| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- package vpn
- // OverallVPNStatus provides quick telemetry for the sidebar badges
- type OverallVPNStatus struct {
- TotalPPPoE int `json:"total_pppoe"`
- ActivePPPoE int `json:"active_pppoe"`
- TotalWireGuard int `json:"total_wireguard"`
- ActiveWireGuard int `json:"active_wireguard"`
- TotalWireGuardPeers int `json:"total_wg_peers"`
- TotalPPTP int `json:"total_pptp"`
- ActivePPTP int `json:"active_pptp"`
- TotalL2TP int `json:"total_l2tp"`
- ActiveL2TP int `json:"active_l2tp"`
- TotalIPSec int `json:"total_ipsec"`
- ActiveIPSec int `json:"active_ipsec"`
- TotalEoIP int `json:"total_eoip"`
- ActiveEoIP int `json:"active_eoip"`
- TotalAeroTUN int `json:"total_aerotun"`
- ActiveAeroTUN int `json:"active_aerotun"`
- AeroTUNSavedBytes uint64 `json:"aerotun_saved_bytes"`
- AeroTUNRatio string `json:"aerotun_ratio"`
- TotalPPPSessions int `json:"total_ppp_sessions"`
- PPPoEServerRunning bool `json:"pppoe_server_running"`
- PPTPServerRunning bool `json:"pptp_server_running"`
- L2TPServerRunning bool `json:"l2tp_server_running"`
- IPSecServerRunning bool `json:"ipsec_server_running"`
- TotalActiveTunnels int `json:"total_active_tunnels"`
- }
- // ======================== PPPoE Client (MikroTik style) ========================
- type PPPoEInstance struct {
- Name string `json:"name"` // e.g. "pppoe-out1", "pppoe-wan2"
- Interface string `json:"interface"` // Physical or VLAN interface, e.g. "eth0", "eth0.100"
- Username string `json:"username"`
- Password string `json:"password"`
- Profile string `json:"profile,omitempty"` // PPP Profile from /ppp profile (default "default")
- ServiceName string `json:"service_name,omitempty"`
- MTU int `json:"mtu"` // default 1492
- DefaultRoute bool `json:"default_route"`
- AutoReconnect bool `json:"auto_reconnect"`
- Disabled bool `json:"disabled"`
- Running bool `json:"running"` // MikroTik 'R' flag
- AssignedIP string `json:"assigned_ip,omitempty"`
- PPPDevice string `json:"ppp_device,omitempty"` // e.g. "ppp0"
- Uptime string `json:"uptime,omitempty"`
- LastError string `json:"last_error,omitempty"`
- }
- // ======================== WireGuard (MikroTik style) ========================
- type WireGuardPeer struct {
- Interface string `json:"interface"` // Name of parent WG interface (e.g. "wg0")
- Name string `json:"name"` // Friendly label (e.g. "Peer-Office", "Laptop")
- Comment string `json:"comment,omitempty"`
- PublicKey string `json:"public_key"`
- AllowedIPs []string `json:"allowed_ips"`
- EndpointAddress string `json:"endpoint_address,omitempty"`
- EndpointPort int `json:"endpoint_port,omitempty"`
- PersistentKeepalive int `json:"persistent_keepalive,omitempty"`
- PresharedKey string `json:"preshared_key,omitempty"`
- Disabled bool `json:"disabled"`
- LatestHandshake string `json:"latest_handshake,omitempty"`
- TransferRxBytes uint64 `json:"transfer_rx_bytes,omitempty"`
- TransferTxBytes uint64 `json:"transfer_tx_bytes,omitempty"`
- TransferRxHuman string `json:"transfer_rx_human,omitempty"`
- TransferTxHuman string `json:"transfer_tx_human,omitempty"`
- }
- type WireGuardInterface struct {
- Name string `json:"name"` // e.g. "wg0", "wg-office", "wg-site2site"
- ListenPort int `json:"listen_port"` // UDP port e.g. 51820
- PrivateKey string `json:"private_key"`
- PublicKey string `json:"public_key"`
- Address string `json:"address"` // e.g. "10.10.0.1/24"
- MTU int `json:"mtu"` // default 1420
- Comment string `json:"comment,omitempty"`
- Disabled bool `json:"disabled"`
- Running bool `json:"running"` // MikroTik 'R' flag
- PeersCount int `json:"peers_count"`
- Peers []WireGuardPeer `json:"peers"`
- LastError string `json:"last_error,omitempty"`
- }
- type SaveWireGuardInterfaceRequest struct {
- WireGuardInterface
- OrigName string `json:"orig_name,omitempty"`
- }
- type SaveWireGuardPeerRequest struct {
- WireGuardPeer
- OrigInterface string `json:"orig_interface,omitempty"`
- OrigPublicKey string `json:"orig_public_key,omitempty"`
- }
- // ======================== PPTP Client (MikroTik style) ========================
- type PPTPInstance struct {
- Name string `json:"name"` // e.g. "pptp-out1"
- ConnectTo string `json:"connect_to"` // Server IP / hostname
- Username string `json:"username"`
- Password string `json:"password"`
- Profile string `json:"profile,omitempty"` // PPP Profile from /ppp profile (default "default-encryption")
- RequireMPPE bool `json:"require_mppe"`
- DefaultRoute bool `json:"default_route"`
- AutoReconnect bool `json:"auto_reconnect"`
- Disabled bool `json:"disabled"`
- Running bool `json:"running"`
- AssignedIP string `json:"assigned_ip,omitempty"`
- PPPDevice string `json:"ppp_device,omitempty"`
- LastError string `json:"last_error,omitempty"`
- }
- // ======================== L2TP Client (MikroTik style) ========================
- type L2TPInstance struct {
- Name string `json:"name"` // e.g. "l2tp-out1"
- ConnectTo string `json:"connect_to"` // Server IP / hostname
- Username string `json:"username"`
- Password string `json:"password"`
- Profile string `json:"profile,omitempty"` // PPP Profile from /ppp profile (default "default-encryption")
- IPsecSecret string `json:"ipsec_secret,omitempty"` // For L2TP/IPsec
- DefaultRoute bool `json:"default_route"`
- Disabled bool `json:"disabled"`
- Running bool `json:"running"`
- AssignedIP string `json:"assigned_ip,omitempty"`
- PPPDevice string `json:"ppp_device,omitempty"`
- LastError string `json:"last_error,omitempty"`
- }
- // ======================== IPSec Connection / Policy (FortiGate Phase 1 & 2 Style) ========================
- type IPSecConfig struct {
- Connections []IPSecConnection `json:"connections"`
- }
- type IPSecStatus struct {
- Running bool `json:"running"`
- ActiveSAs int `json:"active_sas"`
- Connections []IPSecConnection `json:"connections"`
- RawStatus string `json:"raw_status"`
- }
- type IPSecConnection struct {
- Name string `json:"name"` // Tunnel name, e.g. "VPN_HQ", "to_branch"
- Comments string `json:"comments"` // FortiGate Comments
-
- // Network & Phase 1 (IKE Gateway)
- Interface string `json:"interface"` // Local interface or %any
- LocalAddrs string `json:"local_addrs"` // "%any" or local IP
- RemoteAddrs string `json:"remote_addrs"` // Remote Gateway IP or FQDN
- IKEVersion string `json:"ike_version"` // "ikev2" (default) or "ikev1"
- AuthMethod string `json:"auth_method"` // "psk"
- PresharedKey string `json:"preshared_key"`
- LocalID string `json:"local_id,omitempty"`
- RemoteID string `json:"remote_id,omitempty"`
- IKEProposals string `json:"ike_proposals"` // default: aes256-sha256-modp2048,default
- IKEKeylife int `json:"ike_keylife"` // seconds, default 86400
- DPD string `json:"dpd"` // "on-demand" (default), "periodic", "disabled"
- NATTraversal bool `json:"nat_traversal"` // default true
- // Phase 2 (IPsec / Selectors)
- Phase2Name string `json:"phase2_name"` // e.g. "VPN_HQ_p2"
- ESPProposals string `json:"esp_proposals"` // default: aes256-sha256-modp2048,default
- PFS bool `json:"pfs"` // Perfect Forward Secrecy, default true
- PFSGroup string `json:"pfs_group"` // e.g. "modp2048" (DH 14), "ecp256" (DH 19)
- ESPKeylife int `json:"esp_keylife"` // seconds, default 28800
- AutoStart bool `json:"auto_start"` // default true
- // Traffic Selectors: Multiple Subnets support!
- LocalSubnets []string `json:"local_subnets"` // e.g. ["192.168.10.0/24", "10.0.1.0/24", "172.16.0.0/16"]
- RemoteSubnets []string `json:"remote_subnets"` // e.g. ["192.168.20.0/24", "10.0.2.0/24", "172.17.0.0/16"]
- LocalSubnet string `json:"local_subnet"` // Backward compatibility
- RemoteSubnet string `json:"remote_subnet"` // Backward compatibility
- Disabled bool `json:"disabled"`
- Running bool `json:"running"` // Active SA installed
- Status string `json:"status"` // "ESTABLISHED", "INSTALLED", "DISCONNECTED"
- }
|