- Add secubox-p2p backend package: - UCI configuration for P2P settings, DNS federation, WireGuard mesh, HAProxy - RPCD handler for peer management, service discovery, mesh configuration - Init script and main P2P manager daemon - Add luci-app-secubox-p2p frontend package: - Main hub view with master control, network matrix visualization - Peers management with discovery and manual add - Services view showing local and shared services - Mesh network configuration (DNS, WireGuard, HAProxy) - Settings for P2P and registry configuration - Add Services Registry view to luci-app-secubox - Add listProfiles/applyProfile to secubox-admin API - Fix P2P ACL permissions - Remove old hub.js from luci-app-secubox (moved to dedicated package) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
173 lines
4.0 KiB
JavaScript
173 lines
4.0 KiB
JavaScript
'use strict';
|
|
'require baseclass';
|
|
'require rpc';
|
|
|
|
// P2P Peer Management
|
|
var callGetPeers = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'get_peers',
|
|
expect: { peers: [] }
|
|
});
|
|
|
|
var callGetSettings = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'get_settings',
|
|
expect: {}
|
|
});
|
|
|
|
var callGetServices = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'get_services',
|
|
expect: { services: [] }
|
|
});
|
|
|
|
var callGetSharedServices = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'get_shared_services',
|
|
expect: { shared_services: [] }
|
|
});
|
|
|
|
var callDiscover = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'discover',
|
|
params: ['timeout'],
|
|
expect: [],
|
|
timeout: 15000
|
|
});
|
|
|
|
var callAddPeer = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'add_peer',
|
|
params: ['address', 'name'],
|
|
expect: { success: false }
|
|
});
|
|
|
|
var callRemovePeer = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'remove_peer',
|
|
params: ['peer_id'],
|
|
expect: { success: false }
|
|
});
|
|
|
|
var callSetSettings = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'set_settings',
|
|
params: ['settings'],
|
|
expect: { success: false }
|
|
});
|
|
|
|
var callSyncCatalog = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'sync_catalog',
|
|
expect: { success: false }
|
|
});
|
|
|
|
var callBroadcastCommand = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'broadcast_command',
|
|
params: ['command'],
|
|
expect: { success: false }
|
|
});
|
|
|
|
// DNS Federation
|
|
var callGetDNSConfig = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'get_dns_config',
|
|
expect: {}
|
|
});
|
|
|
|
var callSetDNSConfig = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'set_dns_config',
|
|
params: ['config'],
|
|
expect: { success: false }
|
|
});
|
|
|
|
// WireGuard Mesh
|
|
var callGetWireGuardConfig = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'get_wireguard_config',
|
|
expect: {}
|
|
});
|
|
|
|
var callSetWireGuardConfig = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'set_wireguard_config',
|
|
params: ['config'],
|
|
expect: { success: false }
|
|
});
|
|
|
|
// HAProxy
|
|
var callGetHAProxyConfig = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'get_haproxy_config',
|
|
expect: {}
|
|
});
|
|
|
|
var callSetHAProxyConfig = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'set_haproxy_config',
|
|
params: ['config'],
|
|
expect: { success: false }
|
|
});
|
|
|
|
// Registry
|
|
var callGetRegistry = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'get_registry',
|
|
expect: {}
|
|
});
|
|
|
|
var callRegisterURL = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'register_url',
|
|
params: ['short_url', 'target_url'],
|
|
expect: { success: false }
|
|
});
|
|
|
|
// Health Check
|
|
var callHealthCheck = rpc.declare({
|
|
object: 'luci.secubox-p2p',
|
|
method: 'health_check',
|
|
expect: {}
|
|
});
|
|
|
|
return baseclass.extend({
|
|
// Peers
|
|
getPeers: function() { return callGetPeers(); },
|
|
addPeer: function(address, name) { return callAddPeer(address, name); },
|
|
removePeer: function(peer_id) { return callRemovePeer(peer_id); },
|
|
discover: function(timeout) { return callDiscover(timeout || 5); },
|
|
|
|
// Settings
|
|
getSettings: function() { return callGetSettings(); },
|
|
setSettings: function(settings) { return callSetSettings(settings); },
|
|
|
|
// Services
|
|
getServices: function() { return callGetServices(); },
|
|
getSharedServices: function() { return callGetSharedServices(); },
|
|
|
|
// Sync & Broadcast
|
|
syncCatalog: function() { return callSyncCatalog(); },
|
|
broadcastCommand: function(cmd) { return callBroadcastCommand(cmd); },
|
|
|
|
// DNS Federation
|
|
getDNSConfig: function() { return callGetDNSConfig(); },
|
|
setDNSConfig: function(config) { return callSetDNSConfig(config); },
|
|
|
|
// WireGuard Mesh
|
|
getWireGuardConfig: function() { return callGetWireGuardConfig(); },
|
|
setWireGuardConfig: function(config) { return callSetWireGuardConfig(config); },
|
|
|
|
// HAProxy
|
|
getHAProxyConfig: function() { return callGetHAProxyConfig(); },
|
|
setHAProxyConfig: function(config) { return callSetHAProxyConfig(config); },
|
|
|
|
// Registry
|
|
getRegistry: function() { return callGetRegistry(); },
|
|
registerURL: function(shortUrl, targetUrl) { return callRegisterURL(shortUrl, targetUrl); },
|
|
|
|
// Health
|
|
healthCheck: function() { return callHealthCheck(); }
|
|
});
|