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
import * as uloop from 'uloop';
import { readfile, popen, pipe } from 'fs';
//import { event_fns } from './set_endpoint_events.uc'
import { cursor } from 'uci';
// Aggregate all Endpoints
// Start pipe and loop and listen for set_endpoint commands
// set_endpoint command structure: userId,endpoint
@@ -22,54 +22,104 @@ function log(msg,code) {
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: {
ip: ip,
port: port
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 tunnel_ip_format(v4_addr, v6_addr, v4_endpoint, v6_endpoint) {
function tuntypeobj_wireguard(if_name, pubkey, private_key_path, tunnel_props) {
return {
tunnel: {
ipv4: {
if_addr: v4_addr,
endpoint: v4_endpoint
},
ipv6: {
if_addr: v6_addr,
endpoint: v6_endpoint
}
}
};
}
function wireguard_format(name, pubkey, private_key_path, tunnel_props) {
return {
wireguard: {
name: name,
tunnel: tunnel_props,
type: wireguard
if_name: if_name,
public_key: pubkey,
private_key: private_key_path
}
private_key: private_key
tunnel: tunserverobj(),
};
}
function socks5_format() {}
function tuntypeobj_socks5() {
return {
type: socks5,
if_name: "",
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
},
auth: {
basic_auth: requires_basic_auth,
credentials: credentials
}
}
}
function nm_unified_format(provider, data) {
return {
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
}
};
}
// 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,4 +1,6 @@
// 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() {
}