Documentation
¶
Index ¶
- type Peer
- type PeerBandwidth
- type PeerReading
- type PortRange
- type Target
- type WgConfig
- type WireGuardService
- func (s *WireGuardService) Close()
- func (s *WireGuardService) GetNetstackNet() *netstack2.Net
- func (s *WireGuardService) GetPublicKey() wgtypes.Key
- func (s *WireGuardService) IsReady() bool
- func (s *WireGuardService) LoadRemoteConfig() error
- func (s *WireGuardService) ReportRTT(seconds float64)
- func (s *WireGuardService) SetBlocked(v bool)
- func (s *WireGuardService) SetCredentialStore(store *nativessh.CredentialStore)
- func (s *WireGuardService) SetOnNetstackClose(callback func())
- func (s *WireGuardService) SetOnNetstackReady(callback func(*netstack2.Net))
- func (s *WireGuardService) SetOthertnet(tnet *netstack.Net)
- func (s *WireGuardService) SetToken(token string)
- func (s *WireGuardService) StartDirectUDPRelay(tunnelIP string) error
- func (s *WireGuardService) StartHolepunch(publicKey string, endpoint string, relayPort uint16)
- func (s *WireGuardService) StopDirectUDPRelay()
- func (s *WireGuardService) Sync(peers []Peer, targets []Target)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerBandwidth ¶
type PeerReading ¶
type Target ¶
type Target struct {
SourcePrefix string `json:"sourcePrefix"`
SourcePrefixes []string `json:"sourcePrefixes"`
DestPrefix string `json:"destPrefix"`
RewriteTo string `json:"rewriteTo,omitempty"`
DisableIcmp bool `json:"disableIcmp,omitempty"`
PortRange []PortRange `json:"portRange,omitempty"`
ResourceId int `json:"resourceId,omitempty"`
Protocol string `json:"protocol,omitempty"` // for now practicably either http or https
HTTPTargets []netstack2.HTTPTarget `json:"httpTargets,omitempty"` // for http protocol, list of downstream services to load balance across
TLSCert string `json:"tlsCert,omitempty"` // PEM-encoded certificate for incoming HTTPS termination
TLSKey string `json:"tlsKey,omitempty"` // PEM-encoded private key for incoming HTTPS termination
}
type WireGuardService ¶
type WireGuardService struct {
Port uint16
// Proxy manager for tunnel
TunnelIP string
// contains filtered or unexported fields
}
func NewWireGuardService ¶
func (*WireGuardService) Close ¶
func (s *WireGuardService) Close()
func (*WireGuardService) GetNetstackNet ¶
func (s *WireGuardService) GetNetstackNet() *netstack2.Net
GetNetstackNet returns the netstack network interface for use by other components
func (*WireGuardService) GetPublicKey ¶
func (s *WireGuardService) GetPublicKey() wgtypes.Key
GetPublicKey returns the public key of this WireGuard service
func (*WireGuardService) IsReady ¶
func (s *WireGuardService) IsReady() bool
IsReady returns true if the WireGuard service is ready to use
func (*WireGuardService) LoadRemoteConfig ¶
func (s *WireGuardService) LoadRemoteConfig() error
func (*WireGuardService) ReportRTT ¶
func (s *WireGuardService) ReportRTT(seconds float64)
ReportRTT allows reporting native RTTs to telemetry, rate-limited externally.
func (*WireGuardService) SetBlocked ¶ added in v1.13.0
func (s *WireGuardService) SetBlocked(v bool)
SetBlocked enables or disables connection blocking for this WireGuard service. The state is persisted and applied immediately to any active proxy handler.
func (*WireGuardService) SetCredentialStore ¶ added in v1.13.0
func (s *WireGuardService) SetCredentialStore(store *nativessh.CredentialStore)
SetCredentialStore sets the in-memory SSH credential store used by the native SSH server. It must be called before the netstack is configured (i.e. before the first newt/wg/receive-config message is processed).
func (*WireGuardService) SetOnNetstackClose ¶
func (s *WireGuardService) SetOnNetstackClose(callback func())
func (*WireGuardService) SetOnNetstackReady ¶
func (s *WireGuardService) SetOnNetstackReady(callback func(*netstack2.Net))
SetOnNetstackReady sets a callback function to be called when the netstack interface is ready
func (*WireGuardService) SetOthertnet ¶
func (s *WireGuardService) SetOthertnet(tnet *netstack.Net)
func (*WireGuardService) SetToken ¶
func (s *WireGuardService) SetToken(token string)
func (*WireGuardService) StartDirectUDPRelay ¶
func (s *WireGuardService) StartDirectUDPRelay(tunnelIP string) error
StartDirectUDPRelay starts a direct UDP relay from the main tunnel netstack to the clients' WireGuard. This bypasses the proxy by listening on the main tunnel's netstack and forwarding packets directly to the SharedBind that feeds the clients' WireGuard device. Responses are automatically routed back through the netstack by the SharedBind. tunnelIP is the IP address to listen on within the main tunnel's netstack.
func (*WireGuardService) StartHolepunch ¶
func (s *WireGuardService) StartHolepunch(publicKey string, endpoint string, relayPort uint16)
StartHolepunch starts hole punching to a specific endpoint
func (*WireGuardService) StopDirectUDPRelay ¶
func (s *WireGuardService) StopDirectUDPRelay()
StopDirectUDPRelay stops the direct UDP relay and closes the netstack listener
func (*WireGuardService) Sync ¶ added in v1.14.0
func (s *WireGuardService) Sync(peers []Peer, targets []Target)
Sync synchronizes the clients WireGuard peers and targets with the desired state received as part of the main newt/sync message.