Added .gitignore

This commit is contained in:
garo
2026-03-16 22:16:47 +01:00
parent ab3fc72496
commit 36b4ffe469
3 changed files with 85 additions and 32 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
"gitea_token.txt"

View File

@@ -1,7 +1,7 @@
#!/bin/ucode #!/bin/ucode
import * as uloop from 'uloop'; import * as uloop from 'uloop';
import { readfile, popen, pipe } from 'fs'; import { readfile, popen, pipe } from 'fs';
//import { event_fns } from './set_endpoint_events.uc' import { cursor } from 'uci';
// Aggregate all Endpoints // Aggregate all Endpoints
// Start pipe and loop and listen for set_endpoint commands // Start pipe and loop and listen for set_endpoint commands
// set_endpoint command structure: userId,endpoint // set_endpoint command structure: userId,endpoint
@@ -22,55 +22,105 @@ function log(msg,code) {
print(prefix + msg + "\n"); print(prefix + msg + "\n");
} }
function endpoint_format(ip,port) { function tunserverobj(ip_addr, endpoint_addr, endpoint_port) {
is_ipv6 = len(iptoarr(ip_addr)) == 16;
const endpoint = {
ip: endpoint_addr,
port: endpoint_addr
};
if(is_ipv6) {
return {
endpoint: endpoint,
tunip_v6: ip_addr
};
}
is_ipv4 = len(iptoarr(ip_addr)) == 4
if(!is_ipv4) {
log("ip is neither v6 or v4, Ignoring",1);
}
return {
endpoint: endpoint,
tunip_v4: ip_addr
};
}
function tuntypeobj_wireguard(if_name, pubkey, private_key_path, tunnel_props) {
return { return {
endpoint: { type: wireguard
ip: ip, if_name: if_name,
port: port public_key: pubkey,
} private_key: private_key
tunnel: tunserverobj(),
}; };
} }
function tunnel_ip_format(v4_addr, v6_addr, v4_endpoint, v6_endpoint) {
return { function tuntypeobj_socks5() {
tunnel: { return {
ipv4: { type: socks5,
if_addr: v4_addr, if_name: "",
endpoint: v4_endpoint username: "",
password: "",
tunnel: tunserverobj
};
}
function tuntypeobj_socks4() {
return {
type: socks4,
if_name: "",
username: "",
password: "",
tunnel: ""
};
}
function tuntypeobj_http() {
return {
type: http,
if_name: "",
username: "",
password: "",
cert: "",
tunnel: "" // Should be tunserverobj
};
}
function basic_nm_provider(name, base_api_url, requires_basic_auth, credentials) {
return {
name: name,
api_urls: {
default: base_api_url
}, },
ipv6: { auth: {
if_addr: v6_addr, basic_auth: requires_basic_auth,
endpoint: v6_endpoint credentials: credentials
} }
} }
};
} }
function wireguard_format(name, pubkey, private_key_path, tunnel_props) {
return {
wireguard: {
name: name,
tunnel: tunnel_props,
public_key: pubkey,
private_key: private_key_path
}
};
}
function socks5_format() {}
function nm_unified_format(provider, data) { function nm_unified_format(provider, data) {
return { return {
nm_unified: { nm_unified: {
provider: provider, provider: provider, // Ein Objekt mit dem namen vom anbieter wovon die vpn tunnel stammen. Ein anbieter kann mehrere Tunnel Protokole verwenden
data: data // Should be array of wireguard or openvpn or socks format data: data // Should be array of wireguard or openvpn or socks format
} }
}; };
} }
// UCI Configuration
function wireguard_connect(ctx,args) { function wireguard_create_if() {
let ctx = uci.cursor();
}
function nm_setup(nm_unified) {
log("nm_setup called for " + nm_unified.provider.name);
} }

View File

@@ -1,8 +1,10 @@
// Set endpoint options, takes a user object wich contains the userId wich is a hash formed from tunnel ip and public key // Set endpoint options, takes a user object wich contains the userId wich is a hash formed from tunnel ip and public key
function set_endpoint() { function set_endpoint() {
} }
return { return {
event_fns: [set_endpoint] event_fns: [set_endpoint]
} }