Documentation
¶
Overview ¶
Package gateway implements bounded, egress-bound gateway control protocols.
Index ¶
- Constants
- func DatagramExchange(ctx context.Context, local netip.Addr, server netip.AddrPort, request []byte) ([]byte, error)
- func Defaults(snapshot networkstate.Snapshot) []r.Gateway
- func EgressID(index int) string
- type AutoUPnP
- type DHCPOptions
- type DHCPSource
- type Discovery
- type Exchange
- type HTTPDo
- type NATPMP
- type PCP
- type PCPDiscovery
- type PCPServer
- type Service
- type SystemDHCPSource
- type UPnP
Constants ¶
const ( WANIPv1 = "urn:schemas-upnp-org:service:WANIPConnection:1" WANIPv2 = "urn:schemas-upnp-org:service:WANIPConnection:2" WANPPP = "urn:schemas-upnp-org:service:WANPPPConnection:1" WANIPv6Firewall = "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1" )
const MaxDHCPWorkers = 2
const MaxDiscoveryEntries = 16
const MaxPCPServerAddresses = 8
const MaxPCPServers = 8
Variables ¶
This section is empty.
Functions ¶
func DatagramExchange ¶
func DatagramExchange(ctx context.Context, local netip.Addr, server netip.AddrPort, request []byte) ([]byte, error)
DatagramExchange uses a connected UDP socket so replies from a different gateway/source port cannot be mistaken for a control response.
Types ¶
type AutoUPnP ¶
type AutoUPnP struct {
Gateway netip.Addr
Egress string
ControlLocal netip.Addr
Discover func(context.Context, netip.Addr, netip.Addr, string) ([]Service, error)
HTTP HTTPDo
}
type DHCPOptions ¶
type DHCPSource ¶
type DHCPSource interface {
Acquire(context.Context, networkstate.Address) (DHCPOptions, error)
}
type Discovery ¶
type Discovery struct {
// contains filtered or unexported fields
}
Discovery belongs to the process, not an attempt. A blocking OS DHCP call retains its capacity slot until the call really returns, even after retirement.
func NewDiscovery ¶
func NewDiscovery(source DHCPSource) *Discovery
type PCP ¶
type PCP struct {
Server netip.AddrPort
Egress string
Exchange Exchange
Nonce func([]byte) (int, error)
}
type PCPDiscovery ¶
type PCPServer ¶
Each group is one logical PCP server; addresses inside it are alternatives. Multiple groups are independent servers and must never be flattened together.
func DiscoverPCP ¶
func DiscoverPCP(input PCPDiscovery) ([]PCPServer, error)
type Service ¶
type Service struct {
URL string
Type string
Gateway netip.Addr
Egress string
ControlLocal netip.Addr
}
func DiscoverUPnP ¶
type SystemDHCPSource ¶
type SystemDHCPSource struct{}
func (SystemDHCPSource) Acquire ¶
func (SystemDHCPSource) Acquire(context.Context, networkstate.Address) (DHCPOptions, error)
No portable OS DHCP cache API exposes repeated RFC7291 options. Unsupported platforms retain the standard default-router fallback and configured sources.