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

Method InterfaceNetworks

backend/wireguard/config.go:86–103  ·  view source on GitHub ↗

InterfaceNetworks returns CIDR prefixes parsed from the node's core `address` list. Used to restrict peer AllowedIPs to subnets this interface actually serves.

()

Source from the content-addressed store, hash-verified

84// InterfaceNetworks returns CIDR prefixes parsed from the node's core `address` list.
85// Used to restrict peer AllowedIPs to subnets this interface actually serves.
86func (c *Config) InterfaceNetworks() []*net.IPNet {
87 if c == nil {
88 return nil
89 }
90 var out []*net.IPNet
91 for _, addr := range c.Address {
92 addr = strings.TrimSpace(addr)
93 if addr == "" {
94 continue
95 }
96 _, ipNet, err := net.ParseCIDR(addr)
97 if err != nil {
98 continue
99 }
100 out = append(out, ipNet)
101 }
102 return out
103}
104
105// GetPrivateKey returns the parsed WireGuard private key.
106// The parsed key is stored in memory and reused after first successful parse.

Callers 2

collectDesiredPeersMethod · 0.80

Calls

no outgoing calls

Tested by 1