MCPcopy Create free account
hub / github.com/PasarGuard/node / buildInitialWGConfig

Function buildInitialWGConfig

backend/wireguard/manager.go:113–125  ·  view source on GitHub ↗
(privateKey wgtypes.Key, listenPort int, peers []wgtypes.PeerConfig)

Source from the content-addressed store, hash-verified

111}
112
113func buildInitialWGConfig(privateKey wgtypes.Key, listenPort int, peers []wgtypes.PeerConfig) wgtypes.Config {
114 config := wgtypes.Config{
115 PrivateKey: &privateKey,
116 ListenPort: &listenPort,
117 }
118
119 if len(peers) > 0 {
120 config.Peers = peers
121 config.ReplacePeers = true
122 }
123
124 return config
125}
126
127// InitializeWithPeers sets up the WireGuard interface with initial configuration and optional full peer snapshot.
128func (m *Manager) InitializeWithPeers(privateKey wgtypes.Key, listenPort int, serverIPs []string, peers []wgtypes.PeerConfig) error {

Callers 1

InitializeWithPeersMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected