Add wg port configuration

This commit is contained in:
Viktor Liu
2026-02-10 19:55:28 +08:00
parent 6b00bb0a66
commit 79fed32f01
4 changed files with 30 additions and 8 deletions

View File

@@ -96,6 +96,10 @@ type Server struct {
// When set, forwarding headers from these sources are preserved and
// appended to instead of being stripped.
TrustedProxies []netip.Prefix
// WireguardPort is the port for the WireGuard interface. Use 0 for a
// random OS-assigned port. A fixed port only works with single-account
// deployments; multiple accounts will fail to bind the same port.
WireguardPort int
}
// NotifyStatus sends a status update to management about tunnel connectivity
@@ -188,7 +192,7 @@ func (s *Server) ListenAndServe(ctx context.Context, addr string) (err error) {
// Initialize the netbird client, this is required to build peer connections
// to proxy over.
s.netbird = roundtrip.NewNetBird(s.ManagementAddress, s.ID, s.Logger, s, s.mgmtClient)
s.netbird = roundtrip.NewNetBird(s.ManagementAddress, s.ID, s.WireguardPort, s.Logger, s, s.mgmtClient)
// When generating ACME certificates, start a challenge server.
tlsConfig := &tls.Config{}