Compare commits

..

No commits in common. "e488f9d1d6a01a9e668e3af6abc45500f7ae839c" and "ee3f4f3fe58dadaf45118149274c210f4ed7525a" have entirely different histories.

224 changed files with 67 additions and 24375 deletions

3
.gitignore vendored
View File

@ -46,6 +46,3 @@ ovpn-connector.json
app/src/main/resources/htdocs/ app/src/main/resources/htdocs/
*.pfapp *.pfapp
cache/ cache/
/data/
test/
pfsdn.mv.db

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html lang="en" class="dark-theme">
<head>
<meta charset="UTF-8">
<link rel="icon" type="image/png" href="/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pfSDN</title>
<script type="module" crossorigin src="/assets/index-DH1TgtxD.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BOvamk01.css">
</head>
<body>
<div id="app">
<div id="loader" style="height: 100vh; display: flex; justify-content: center; align-items: center; color: #fff;">
Загрузка...
</div>
</div>
</body>
</html>

View File

@ -1,69 +0,0 @@
{
"subscribedResources": ["local:111"],
"subscriptions": [
{
"name": "updates",
"source": "https://git.kirillius.ru/kirillius/protected-resources-list.git",
"type": "ru.kirillius.pf.sdn.External.API.GitSubscription",
"script": ""
},
{
"name": "local",
"source": "./.cache/res",
"type": "ru.kirillius.pf.sdn.External.API.LocalFilesystemSubscription",
"script": ""
}
],
"enabledComponents": [],
"httpPort": 8881,
"filteredResources": {
"description": "",
"domains": [],
"subnets": [],
"resolveDomains": false,
"ASN": []
},
"mergeSubnets": true,
"updateSubscriptionsInterval": 6,
"mergeSubnetsWithUsage": 51,
"componentsConfig": {
"ru.kirillius.pf.sdn.External.API.Components.OVPN": {
"shellConfig": {
"password": "securepassword",
"port": 22,
"host": "127.0.0.1",
"useSSH": false,
"username": "root"
},
"restartOnUpdate": true,
"restartCommand": "rc-service openvpn restart"
},
"ru.kirillius.pf.sdn.External.API.Components.FRR": {"instances": []},
"ru.kirillius.pf.sdn.External.API.Components.TDNS": {"instances": [{
"server": "http://1.1.1.1",
"forwarder": "8.8.4.4",
"token": "3213213123"
}]}
},
"customResources": {
"description": "",
"domains": [],
"subnets": [],
"resolveDomains": false,
"ASN": []
},
"domainLookupInterval": 5,
"passwordHash": "08b36623926454ff6f98d1af119a818b3f7ba8f5c489ba885b63422b906294ddf6de0efb752551a47dffcfb96304919cc2fbc742e6d12892725f4f5afe859d3e",
"displayDebuggingInfo": true,
"cachingAS": true,
"cachingDomains": true,
"domainsTimeToLive": 48,
"host": "0.0.0.0",
"updateASInterval": 12,
"cacheDirectory": "./cache",
"passwordSalt": "d56607e8-94b2-4754-95c1-3ef08cd0cde4",
"domainResolvers": [
"8.8.8.8",
"77.88.8.8"
]
}

View File

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.kirillius</groupId>
<artifactId>pf-sdn</artifactId>
<version>2.0.0.0</version>
<packaging>pom</packaging>
<modules>
</modules>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lombok.version>1.18.40</lombok.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
<!-- <repositories>-->
<!-- <repository>-->
<!-- <id>kirillius</id>-->
<!-- <name>kirillius</name>-->
<!-- <url>https://repo.kirillius.ru/maven</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- <checksumPolicy>fail</checksumPolicy>-->
<!-- </releases>-->
<!-- <layout>default</layout>-->
<!-- </repository>-->
<!-- </repositories>-->
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.13.0-M2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>4.0.0-M1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,4 +0,0 @@
{
"port" : 8080,
"jwtSecret" : "xM8Og2TQ3QT7I2BlBgJtlahwDwXOn+8sAWvVy/qwi7/uVsn/BTEKdFSqdIUOCV/Xe+G5jjOOZe3H+gVHMHH9Hg=="
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,227 +0,0 @@
export const JSONRPC = {
url: "/jsonrpc/rpc",
__id: 1,
/**
*
* @param method
* @param params
* @returns Object
* @private
*/
__invoke: async function (method, params) {
const request = await JSONRPC.__performRequest(method, params);
if (!request.success) {
console.error(request.result);
throw new Error("Failed to invoke method " + method + " with params " + JSON.stringify(params));
}
return request.result;
},
__performRequest: async function (method, params) {
const __this = this;
const resp = await fetch(
__this.url,
{
method: "POST",
mode: "cors",
cache: "no-cache",
credentials: "include",
headers: {
"Content-Type": "application/json"
},
redirect: "follow",
referrerPolicy: "no-referrer",
body: JSON.stringify({
jsonrpc: '2.0',
method: method,
params: params,
id: __this.__id++
})
}
);
const success = resp.status === 200;
const result = (success ? (await resp.json()).result : {
"error": true,
"code": resp.status,
"status": resp.statusText,
"body": await resp.text()
});
return {
"result": result,
"success": success
};
}
};
export const TYPES = {};
JSONRPC.OVPN = {};
JSONRPC.OVPN.restartSystemService=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.External.API.Components.OVPN::restartSystemService", {});
};
JSONRPC.OVPN.getManagedRoutes=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.External.API.Components.OVPN::getManagedRoutes", {});
};
JSONRPC.SubscriptionManager = {};
JSONRPC.SubscriptionManager.isUpdating=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.SubscriptionManager::isUpdating", {});
};
JSONRPC.SubscriptionManager.triggerUpdate=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.SubscriptionManager::triggerUpdate", {});
};
JSONRPC.SubscriptionManager.writeLocalResourceFile=async function(name, description, domains, ASN, subnets, addresses, autoResolve, storage, subscribe){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.SubscriptionManager::writeLocalResourceFile", {"name":name, "description":description, "domains":domains, "ASN":ASN, "subnets":subnets, "addresses":addresses, "autoResolve":autoResolve, "storage":storage, "subscribe":subscribe});
};
JSONRPC.SubscriptionManager.removeLocalResourceFile=async function(name, storage){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.SubscriptionManager::removeLocalResourceFile", {"name":name, "storage":storage});
};
JSONRPC.SubscriptionManager.getLocalRepositories=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.SubscriptionManager::getLocalRepositories", {});
};
JSONRPC.SubscriptionManager.getSubscribedResources=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.SubscriptionManager::getSubscribedResources", {});
};
JSONRPC.SubscriptionManager.getAvailableResources=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.SubscriptionManager::getAvailableResources", {});
};
JSONRPC.SubscriptionManager.setSubscribedResources=async function(resources){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.SubscriptionManager::setSubscribedResources", {"resources":resources});
};
JSONRPC.Auth = {};
JSONRPC.Auth.listTokens=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::listTokens", {});
};
JSONRPC.Auth.changePassword=async function(password){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::changePassword", {"password":password});
};
JSONRPC.Auth.removeToken=async function(token){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::removeToken", {"token":token});
};
JSONRPC.Auth.createAPIToken=async function(description){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::createAPIToken", {"description":description});
};
JSONRPC.Auth.startSessionByPassword=async function(password){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::startSessionByPassword", {"password":password});
};
JSONRPC.Auth.startSessionByToken=async function(token){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::startSessionByToken", {"token":token});
};
JSONRPC.Auth.isAuthenticated=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::isAuthenticated", {});
};
JSONRPC.Auth.logout=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::logout", {});
};
JSONRPC.Auth.createToken=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.Auth::createToken", {});
};
JSONRPC.System = {};
JSONRPC.System.shutdown=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::shutdown", {});
};
JSONRPC.System.getAppVersion=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getAppVersion", {});
};
JSONRPC.System.getEnabledComponents=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getEnabledComponents", {});
};
JSONRPC.System.setEnabledComponents=async function(components){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::setEnabledComponents", {"components":components});
};
JSONRPC.System.isConfigChanged=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::isConfigChanged", {});
};
JSONRPC.System.saveConfig=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::saveConfig", {});
};
JSONRPC.System.getVersionForUpdate=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getVersionForUpdate", {});
};
JSONRPC.System.getRepositoryTypes=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getRepositoryTypes", {});
};
JSONRPC.System.getAvailableComponents=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getAvailableComponents", {});
};
JSONRPC.System.getComponentConfig=async function(component){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getComponentConfig", {"component":component});
};
JSONRPC.System.setComponentConfig=async function(component, config){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::setComponentConfig", {"component":component, "config":config});
};
JSONRPC.System.getLogs=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getLogs", {});
};
JSONRPC.System.clearLogs=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::clearLogs", {});
};
JSONRPC.System.getVersionInfo=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getVersionInfo", {});
};
JSONRPC.System.setConfig=async function(config){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::setConfig", {"config":config});
};
JSONRPC.System.getConfig=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::getConfig", {});
};
JSONRPC.System.restart=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::restart", {});
};
JSONRPC.System.doUpdate=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.System::doUpdate", {});
};
JSONRPC.NetworkManager = {};
JSONRPC.NetworkManager.isUpdating=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.NetworkManager::isUpdating", {});
};
JSONRPC.NetworkManager.discoverBlockedDomainResources=async function(domain, server){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.NetworkManager::discoverBlockedDomainResources", {"domain":domain, "server":server});
};
JSONRPC.NetworkManager.triggerUpdate=async function(ignoreCache){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.NetworkManager::triggerUpdate", {"ignoreCache":ignoreCache});
};
JSONRPC.NetworkManager.getOutputResources=async function(){
return await JSONRPC.__invoke("ru.kirillius.pf.sdn.web.RPC.NetworkManager::getOutputResources", {});
};

View File

@ -1,40 +0,0 @@
```text
//Содержит непосредственно инфу о ресурсе
Subscription {
String name; //telegram
NetworkScope scope;
}
SubscriptionQueryResult{
bool isUpdated()
NetworkScope get()
}
//Протокол, по которому загружаются подписки (git, rest, local, etc)
SubscriptionProviderProtocol {
//impl
string protocolId;
bool get(config) //true if updated
}
SubscriptionProvider{
private SubscriptionProviderConfig config;
private SubscriptionProviderProtocol protocol;
List<Subscription> get();
void update();
event updated();
}
//Конфиг Провайдера подписок
SubscriptionProviderConfig {
string protocolId;
Properties properties;
}
//репозиторий конфигов
SubscriptionProviderConfigRepository{
}
```

Some files were not shown because too many files have changed in this diff Show More