Function
buildInitialWGConfig
(privateKey wgtypes.Key, listenPort int, peers []wgtypes.PeerConfig)
Source from the content-addressed store, hash-verified
| 111 | } |
| 112 | |
| 113 | func 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. |
| 128 | func (m *Manager) InitializeWithPeers(privateKey wgtypes.Key, listenPort int, serverIPs []string, peers []wgtypes.PeerConfig) error { |
Tested by
no test coverage detected