Documentation
¶
Index ¶
- Constants
- Variables
- func NewConnectionAlreadyClosed(peer string) error
- func NewConnectionClosedError(peer string) error
- func NewConnectionDisconnectedError(peer string) error
- func NewConnectionTimeoutError(peer string, timeout time.Duration) error
- type AsyncOfferListener
- type Conn
- func (conn *Conn) AgentVersionString() string
- func (conn *Conn) AllowedIP() netip.Addr
- func (conn *Conn) Close(signalToRemote bool)
- func (conn *Conn) ConnID() id.ConnID
- func (conn *Conn) GetKey() string
- func (conn *Conn) IsConnected() bool
- func (conn *Conn) OnRemoteAnswer(answer OfferAnswer)
- func (conn *Conn) OnRemoteCandidate(candidate ice.Candidate, haRoutes route.HAMap)
- func (conn *Conn) OnRemoteOffer(offer OfferAnswer)
- func (conn *Conn) Open(engineCtx context.Context) error
- func (conn *Conn) SetOnConnected(...)
- func (conn *Conn) SetOnDisconnected(handler func(remotePeer string))
- func (conn *Conn) WgConfig() WgConfig
- type ConnConfig
- type ConnStatus
- type ConnectionAlreadyClosedError
- type ConnectionClosedError
- type ConnectionDisconnectedError
- type ConnectionTimeoutError
- type EndpointUpdater
- type EventListener
- type EventQueue
- type EventSubscription
- type FullStatus
- type Handshaker
- func (h *Handshaker) AddICEListener(offer func(remoteOfferAnswer *OfferAnswer))
- func (h *Handshaker) AddRelayListener(offer func(remoteOfferAnswer *OfferAnswer))
- func (h *Handshaker) Listen(ctx context.Context)
- func (h *Handshaker) OnRemoteAnswer(answer OfferAnswer)
- func (h *Handshaker) OnRemoteOffer(offer OfferAnswer)
- func (h *Handshaker) SendOffer() error
- type ICEConnInfo
- type ICESessionID
- type IceCredentials
- type Listener
- type LocalPeerState
- type ManagementState
- type NSGroupState
- type OfferAnswer
- type RelayConnInfo
- type ResolvedDomainInfo
- type RosenpassConfig
- type RosenpassState
- type RouterState
- type ServiceDependencies
- type SignalState
- type Signaler
- func (s *Signaler) Ready() bool
- func (s *Signaler) SignalAnswer(offer OfferAnswer, remoteKey string) error
- func (s *Signaler) SignalICECandidate(candidate ice.Candidate, remoteKey string) error
- func (s *Signaler) SignalIdle(remoteKey string) error
- func (s *Signaler) SignalOffer(offer OfferAnswer, remoteKey string) error
- type State
- type Status
- func (d *Status) AddLocalPeerStateRoute(route string, resourceId route.ResID)
- func (d *Status) AddPeer(peerPubKey string, fqdn string, ip string) error
- func (d *Status) AddPeerStateRoute(peer string, route string, resourceId route.ResID) error
- func (d *Status) AddResolvedIPLookupEntry(prefix netip.Prefix, resourceId route.ResID)
- func (d *Status) CheckRoutes(ip netip.Addr) ([]byte, bool)
- func (d *Status) CleanLocalPeerState()
- func (d *Status) CleanLocalPeerStateRoutes()
- func (d *Status) ClientStart()
- func (d *Status) ClientStop()
- func (d *Status) ClientTeardown()
- func (d *Status) DeleteResolvedDomainsStates(domain domain.Domain)
- func (d *Status) FinishPeerListModifications()
- func (d *Status) ForwardingRules() []firewall.ForwardRule
- func (d *Status) GetDNSStates() []NSGroupState
- func (d *Status) GetEventHistory() []*proto.SystemEvent
- func (d *Status) GetFullStatus() FullStatus
- func (d *Status) GetLazyConnection() bool
- func (d *Status) GetLocalPeerState() LocalPeerState
- func (d *Status) GetManagementState() ManagementState
- func (d *Status) GetPeer(peerPubKey string) (State, error)
- func (d *Status) GetRelayStates() []relay.ProbeResult
- func (d *Status) GetResolvedDomainsStates() map[domain.Domain]ResolvedDomainInfo
- func (d *Status) GetRosenpassState() RosenpassState
- func (d *Status) GetSignalState() SignalState
- func (d *Status) IsLoginRequired() bool
- func (d *Status) MarkManagementConnected()
- func (d *Status) MarkManagementDisconnected(err error)
- func (d *Status) MarkSignalConnected()
- func (d *Status) MarkSignalDisconnected(err error)
- func (d *Status) PeerByIP(ip string) (string, bool)
- func (d *Status) PeersStatus() (*configurer.Stats, error)
- func (d *Status) PublishEvent(severity proto.SystemEvent_Severity, category proto.SystemEvent_Category, ...)
- func (d *Status) RemoveConnectionListener()
- func (d *Status) RemoveLocalPeerStateRoute(route string)
- func (d *Status) RemovePeer(peerPubKey string) error
- func (d *Status) RemovePeerStateRoute(peer string, route string) error
- func (d *Status) RemoveResolvedIPLookupEntry(route string)
- func (d *Status) ReplaceOfflinePeers(replacement []State)
- func (d *Status) SetConnectionListener(listener Listener)
- func (d *Status) SetIngressGwMgr(ingressGwMgr *ingressgw.Manager)
- func (d *Status) SetRelayMgr(manager *relayClient.Manager)
- func (d *Status) SetWgIface(wgInterface WGIfaceStatus)
- func (d *Status) SubscribeToEvents() *EventSubscription
- func (d *Status) SubscribeToPeerStateChanges(ctx context.Context, peerID string) *StatusChangeSubscription
- func (d *Status) UnsubscribeFromEvents(sub *EventSubscription)
- func (d *Status) UnsubscribePeerStateChanges(subscription *StatusChangeSubscription)
- func (d *Status) UpdateDNSStates(dnsStates []NSGroupState)
- func (d *Status) UpdateLatency(pubKey string, latency time.Duration) error
- func (d *Status) UpdateLazyConnection(enabled bool)
- func (d *Status) UpdateLocalPeerState(localPeerState LocalPeerState)
- func (d *Status) UpdateManagementAddress(mgmAddress string)
- func (d *Status) UpdatePeerFQDN(peerPubKey, fqdn string) error
- func (d *Status) UpdatePeerICEState(receivedState State) error
- func (d *Status) UpdatePeerICEStateToDisconnected(receivedState State) error
- func (d *Status) UpdatePeerRelayedState(receivedState State) error
- func (d *Status) UpdatePeerRelayedStateToDisconnected(receivedState State) error
- func (d *Status) UpdatePeerSSHHostKey(peerPubKey string, sshHostKey []byte) error
- func (d *Status) UpdatePeerState(receivedState State) error
- func (d *Status) UpdateRelayStates(relayResults []relay.ProbeResult)
- func (d *Status) UpdateResolvedDomainsStates(originalDomain domain.Domain, resolvedDomain domain.Domain, ...)
- func (d *Status) UpdateRosenpass(rosenpassEnabled, rosenpassPermissive bool)
- func (d *Status) UpdateSignalAddress(signalURL string)
- func (d *Status) UpdateWireGuardPeerState(pubKey string, wgStats configurer.WGStats) error
- type StatusChangeSubscription
- type WGIface
- type WGIfaceStatus
- type WGInterfaceStater
- type WGWatcher
- type WgConfig
- type WorkerICE
- func (w *WorkerICE) Close()
- func (w *WorkerICE) GetLocalUserCredentials() (frag string, pwd string)
- func (w *WorkerICE) InProgress() bool
- func (w *WorkerICE) OnNewOffer(remoteOfferAnswer *OfferAnswer)
- func (w *WorkerICE) OnRemoteCandidate(candidate ice.Candidate, haRoutes route.HAMap)
- func (w *WorkerICE) SessionID() ICESessionID
- type WorkerRelay
- func (w *WorkerRelay) CloseConn()
- func (w *WorkerRelay) DisableWgWatcher()
- func (w *WorkerRelay) EnableWgWatcher(ctx context.Context)
- func (w *WorkerRelay) IsRelayConnectionSupportedWithPeer() bool
- func (w *WorkerRelay) OnNewOffer(remoteOfferAnswer *OfferAnswer)
- func (w *WorkerRelay) RelayInstanceAddress() (string, error)
- func (w *WorkerRelay) RelayIsSupportedLocally() bool
Constants ¶
const (
EnvKeyNBForceRelay = "NB_FORCE_RELAY"
)
Variables ¶
var (
ErrSignalIsNotReady = errors.New("signal is not ready")
)
Functions ¶
func NewConnectionAlreadyClosed ¶
NewConnectionAlreadyClosed creates a new ConnectionAlreadyClosedError error
func NewConnectionClosedError ¶
NewConnectionClosedError creates a new ConnectionClosedError error
func NewConnectionDisconnectedError ¶
NewConnectionDisconnectedError creates a new ConnectionDisconnectedError error
Types ¶
type AsyncOfferListener ¶
type AsyncOfferListener struct {
// contains filtered or unexported fields
}
func NewAsyncOfferListener ¶
func NewAsyncOfferListener(fn callbackFunc) *AsyncOfferListener
func (*AsyncOfferListener) Notify ¶
func (o *AsyncOfferListener) Notify(remoteOfferAnswer *OfferAnswer)
type Conn ¶
func NewConn ¶
func NewConn(config ConnConfig, services ServiceDependencies) (*Conn, error)
NewConn creates a new not opened Conn to the remote peer. To establish a connection run Conn.Open
func (*Conn) AgentVersionString ¶
func (*Conn) IsConnected ¶
IsConnected returns true if the peer is connected
func (*Conn) OnRemoteAnswer ¶
func (conn *Conn) OnRemoteAnswer(answer OfferAnswer)
OnRemoteAnswer handles an offer from the remote peer and returns true if the message was accepted, false otherwise doesn't block, discards the message if connection wasn't ready
func (*Conn) OnRemoteCandidate ¶
OnRemoteCandidate Handles ICE connection Candidate provided by the remote peer.
func (*Conn) OnRemoteOffer ¶
func (conn *Conn) OnRemoteOffer(offer OfferAnswer)
func (*Conn) Open ¶
Open opens connection to the remote peer It will try to establish a connection using ICE and in parallel with relay. The higher priority connection type will be used.
func (*Conn) SetOnConnected ¶
func (conn *Conn) SetOnConnected(handler func(remoteWireGuardKey string, remoteRosenpassPubKey []byte, wireGuardIP string, remoteRosenpassAddr string))
SetOnConnected sets a handler function to be triggered by Conn when a new connection to a remote peer established
func (*Conn) SetOnDisconnected ¶
SetOnDisconnected sets a handler function to be triggered by Conn when a connection to a remote disconnected
type ConnConfig ¶
type ConnConfig struct {
// Key is a public key of a remote peer
Key string
// LocalKey is a public key of a local peer
LocalKey string
AgentVersion string
Timeout time.Duration
WgConfig WgConfig
LocalWgPort int
RosenpassConfig RosenpassConfig
// ICEConfig ICE protocol configuration
ICEConfig icemaker.Config
}
ConnConfig is a peer Connection configuration
type ConnStatus ¶
type ConnStatus int32
ConnStatus describe the status of a peer's connection
const ( // StatusIdle indicate the peer is in disconnected state StatusIdle ConnStatus = iota // StatusConnecting indicate the peer is in connecting state StatusConnecting // StatusConnected indicate the peer is in connected state StatusConnected )
func (ConnStatus) String ¶
func (s ConnStatus) String() string
type ConnectionAlreadyClosedError ¶
type ConnectionAlreadyClosedError struct {
// contains filtered or unexported fields
}
ConnectionAlreadyClosedError is an error indicating that a peer Conn has been already closed and the invocation of the Close() method has been performed over a closed connection
func (*ConnectionAlreadyClosedError) Error ¶
func (e *ConnectionAlreadyClosedError) Error() string
type ConnectionClosedError ¶
type ConnectionClosedError struct {
// contains filtered or unexported fields
}
ConnectionClosedError is an error indicating that a peer Conn has been forcefully closed
func (*ConnectionClosedError) Error ¶
func (e *ConnectionClosedError) Error() string
type ConnectionDisconnectedError ¶
type ConnectionDisconnectedError struct {
// contains filtered or unexported fields
}
ConnectionDisconnectedError is an error indicating that a peer Conn has ctx from the remote
func (*ConnectionDisconnectedError) Error ¶
func (e *ConnectionDisconnectedError) Error() string
type ConnectionTimeoutError ¶
type ConnectionTimeoutError struct {
// contains filtered or unexported fields
}
ConnectionTimeoutError is an error indicating that a peer Conn has been timed out
func (*ConnectionTimeoutError) Error ¶
func (e *ConnectionTimeoutError) Error() string
type EndpointUpdater ¶
type EndpointUpdater struct {
// contains filtered or unexported fields
}
func NewEndpointUpdater ¶
func NewEndpointUpdater(log *logrus.Entry, wgConfig WgConfig, initiator bool) *EndpointUpdater
func (*EndpointUpdater) ConfigureWGEndpoint ¶
ConfigureWGEndpoint sets up the WireGuard endpoint configuration. The initiator immediately configures the endpoint, while the non-initiator waits for a fallback period before configuring to avoid handshake congestion.
func (*EndpointUpdater) RemoveWgPeer ¶
func (e *EndpointUpdater) RemoveWgPeer() error
type EventListener ¶
type EventListener interface {
OnEvent(event *proto.SystemEvent)
}
type EventQueue ¶
type EventQueue struct {
// contains filtered or unexported fields
}
func NewEventQueue ¶
func NewEventQueue(size int) *EventQueue
func (*EventQueue) Add ¶
func (q *EventQueue) Add(event *proto.SystemEvent)
func (*EventQueue) GetAll ¶
func (q *EventQueue) GetAll() []*proto.SystemEvent
type EventSubscription ¶
type EventSubscription struct {
// contains filtered or unexported fields
}
func (*EventSubscription) Events ¶
func (s *EventSubscription) Events() <-chan *proto.SystemEvent
type FullStatus ¶
type FullStatus struct {
Peers []State
ManagementState ManagementState
SignalState SignalState
LocalPeerState LocalPeerState
RosenpassState RosenpassState
Relays []relay.ProbeResult
NSGroupStates []NSGroupState
NumOfForwardingRules int
LazyConnectionEnabled bool
}
FullStatus contains the full state held by the Status instance
type Handshaker ¶
type Handshaker struct {
// contains filtered or unexported fields
}
func NewHandshaker ¶
func NewHandshaker(log *log.Entry, config ConnConfig, signaler *Signaler, ice *WorkerICE, relay *WorkerRelay) *Handshaker
func (*Handshaker) AddICEListener ¶
func (h *Handshaker) AddICEListener(offer func(remoteOfferAnswer *OfferAnswer))
func (*Handshaker) AddRelayListener ¶
func (h *Handshaker) AddRelayListener(offer func(remoteOfferAnswer *OfferAnswer))
func (*Handshaker) Listen ¶
func (h *Handshaker) Listen(ctx context.Context)
func (*Handshaker) OnRemoteAnswer ¶
func (h *Handshaker) OnRemoteAnswer(answer OfferAnswer)
OnRemoteAnswer handles an offer from the remote peer and returns true if the message was accepted, false otherwise doesn't block, discards the message if connection wasn't ready
func (*Handshaker) OnRemoteOffer ¶
func (h *Handshaker) OnRemoteOffer(offer OfferAnswer)
OnRemoteOffer handles an offer from the remote peer and returns true if the message was accepted, false otherwise doesn't block, discards the message if connection wasn't ready
func (*Handshaker) SendOffer ¶
func (h *Handshaker) SendOffer() error
type ICEConnInfo ¶
type ICESessionID ¶
type ICESessionID string
func ICESessionIDFromBytes ¶
func ICESessionIDFromBytes(b []byte) (ICESessionID, error)
func NewICESessionID ¶
func NewICESessionID() (ICESessionID, error)
NewICESessionID generates a new session ID for distinguishing sessions
func (ICESessionID) Bytes ¶
func (id ICESessionID) Bytes() ([]byte, error)
Bytes returns the raw bytes of the session ID for protobuf serialization
func (ICESessionID) String ¶
func (id ICESessionID) String() string
type IceCredentials ¶
IceCredentials ICE protocol credentials struct
type Listener ¶
type Listener interface {
OnConnected()
OnDisconnected()
OnConnecting()
OnDisconnecting()
OnAddressChanged(string, string)
OnPeersListChanged(int)
}
Listener is a callback type about the Nirvati Connect network connection state
type LocalPeerState ¶
type LocalPeerState struct {
IP string
PubKey string
KernelInterface bool
FQDN string
Routes map[string]struct{}
}
LocalPeerState contains the latest state of the local peer
func (LocalPeerState) Clone ¶
func (l LocalPeerState) Clone() LocalPeerState
Clone returns a copy of the LocalPeerState
type ManagementState ¶
ManagementState contains the latest state of a management connection
type NSGroupState ¶
type NSGroupState struct {
ID string
Servers []netip.AddrPort
Domains []string
Enabled bool
Error error
}
NSGroupState represents the status of a DNS server group, including associated domains, whether it's enabled, and the last error message encountered during probing.
type OfferAnswer ¶
type OfferAnswer struct {
IceCredentials IceCredentials
// WgListenPort is a remote WireGuard listen port.
// This field is used when establishing a direct WireGuard connection without any proxy.
// We can set the remote peer's endpoint with this port.
WgListenPort int
// Version of Nirvati Connect Agent
Version string
// RosenpassPubKey is the Rosenpass public key of the remote peer when receiving this message
// This value is the local Rosenpass server public key when sending the message
RosenpassPubKey []byte
// RosenpassAddr is the Rosenpass server address (IP:port) of the remote peer when receiving this message
// This value is the local Rosenpass server address when sending the message
RosenpassAddr string
// relay server address
RelaySrvAddress string
// SessionID is the unique identifier of the session, used to discard old messages
SessionID *ICESessionID
}
OfferAnswer represents a session establishment offer or answer
func (*OfferAnswer) SessionIDString ¶
func (oa *OfferAnswer) SessionIDString() string
type RelayConnInfo ¶
type RelayConnInfo struct {
// contains filtered or unexported fields
}
type ResolvedDomainInfo ¶
type RosenpassConfig ¶
type RosenpassState ¶
RosenpassState contains the latest state of the Rosenpass configuration
type RouterState ¶
type RouterState struct {
Status ConnStatus
Relayed bool
Latency time.Duration
}
RouterState status for router peers. This contains relevant fields for route manager
type ServiceDependencies ¶
type ServiceDependencies struct {
StatusRecorder *Status
Signaler *Signaler
IFaceDiscover stdnet.ExternalIFaceDiscover
RelayManager *relayClient.Manager
SrWatcher *guard.SRWatcher
Semaphore *semaphoregroup.SemaphoreGroup
PeerConnDispatcher *dispatcher.ConnectionDispatcher
}
type SignalState ¶
SignalState contains the latest state of a signal connection
type Signaler ¶
type Signaler struct {
// contains filtered or unexported fields
}
func (*Signaler) SignalAnswer ¶
func (s *Signaler) SignalAnswer(offer OfferAnswer, remoteKey string) error
func (*Signaler) SignalICECandidate ¶
func (*Signaler) SignalIdle ¶
func (*Signaler) SignalOffer ¶
func (s *Signaler) SignalOffer(offer OfferAnswer, remoteKey string) error
type State ¶
type State struct {
Mux *sync.RWMutex
IP string
PubKey string
FQDN string
ConnStatus ConnStatus
ConnStatusUpdate time.Time
Relayed bool
LocalIceCandidateType string
RemoteIceCandidateType string
LocalIceCandidateEndpoint string
RemoteIceCandidateEndpoint string
RelayServerAddress string
LastWireguardHandshake time.Time
BytesTx int64
BytesRx int64
Latency time.Duration
RosenpassEnabled bool
SSHHostKey []byte
// contains filtered or unexported fields
}
State contains the latest state of a peer
func (*State) DeleteRoute ¶
DeleteRoute removes a route from the network amp
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status holds a state of peers, signal, management connections and relays
func NewRecorder ¶
NewRecorder returns a new Status instance
func (*Status) AddLocalPeerStateRoute ¶
AddLocalPeerStateRoute adds a route to the local peer state
func (*Status) AddPeerStateRoute ¶
func (*Status) AddResolvedIPLookupEntry ¶
AddResolvedIPLookupEntry adds a resolved IP lookup entry
func (*Status) CheckRoutes ¶
CheckRoutes checks if the source and destination addresses are within the same route and returns the resource ID of the route that contains the addresses
func (*Status) CleanLocalPeerState ¶
func (d *Status) CleanLocalPeerState()
CleanLocalPeerState cleans local peer status
func (*Status) CleanLocalPeerStateRoutes ¶
func (d *Status) CleanLocalPeerStateRoutes()
CleanLocalPeerStateRoutes cleans all routes from the local peer state
func (*Status) ClientStart ¶
func (d *Status) ClientStart()
ClientStart will notify all listeners about the new service state
func (*Status) ClientStop ¶
func (d *Status) ClientStop()
ClientStop will notify all listeners about the new service state
func (*Status) ClientTeardown ¶
func (d *Status) ClientTeardown()
ClientTeardown will notify all listeners about the service is under teardown
func (*Status) DeleteResolvedDomainsStates ¶
func (*Status) FinishPeerListModifications ¶
func (d *Status) FinishPeerListModifications()
FinishPeerListModifications this event invoke the notification
func (*Status) ForwardingRules ¶
func (d *Status) ForwardingRules() []firewall.ForwardRule
func (*Status) GetDNSStates ¶
func (d *Status) GetDNSStates() []NSGroupState
func (*Status) GetEventHistory ¶
func (d *Status) GetEventHistory() []*proto.SystemEvent
GetEventHistory returns all events in the queue
func (*Status) GetFullStatus ¶
func (d *Status) GetFullStatus() FullStatus
GetFullStatus gets full status
func (*Status) GetLazyConnection ¶
func (*Status) GetLocalPeerState ¶
func (d *Status) GetLocalPeerState() LocalPeerState
GetLocalPeerState returns the local peer state
func (*Status) GetManagementState ¶
func (d *Status) GetManagementState() ManagementState
func (*Status) GetRelayStates ¶
func (d *Status) GetRelayStates() []relay.ProbeResult
GetRelayStates returns the stun/turn/permanent relay states
func (*Status) GetResolvedDomainsStates ¶
func (d *Status) GetResolvedDomainsStates() map[domain.Domain]ResolvedDomainInfo
func (*Status) GetRosenpassState ¶
func (d *Status) GetRosenpassState() RosenpassState
func (*Status) GetSignalState ¶
func (d *Status) GetSignalState() SignalState
func (*Status) IsLoginRequired ¶
IsLoginRequired determines if a peer's login has expired.
func (*Status) MarkManagementConnected ¶
func (d *Status) MarkManagementConnected()
MarkManagementConnected sets ManagementState to connected
func (*Status) MarkManagementDisconnected ¶
MarkManagementDisconnected sets ManagementState to disconnected
func (*Status) MarkSignalConnected ¶
func (d *Status) MarkSignalConnected()
MarkSignalConnected sets SignalState to connected
func (*Status) MarkSignalDisconnected ¶
MarkSignalDisconnected sets SignalState to disconnected
func (*Status) PeersStatus ¶
func (d *Status) PeersStatus() (*configurer.Stats, error)
func (*Status) PublishEvent ¶
func (d *Status) PublishEvent( severity proto.SystemEvent_Severity, category proto.SystemEvent_Category, msg string, userMsg string, metadata map[string]string, )
PublishEvent adds an event to the queue and distributes it to all subscribers
func (*Status) RemoveConnectionListener ¶
func (d *Status) RemoveConnectionListener()
RemoveConnectionListener remove the listener from the notifier
func (*Status) RemoveLocalPeerStateRoute ¶
RemoveLocalPeerStateRoute removes a route from the local peer state
func (*Status) RemovePeer ¶
RemovePeer removes peer from Daemon status map
func (*Status) RemovePeerStateRoute ¶
func (*Status) RemoveResolvedIPLookupEntry ¶
RemoveResolvedIPLookupEntry removes a resolved IP lookup entry
func (*Status) ReplaceOfflinePeers ¶
ReplaceOfflinePeers replaces
func (*Status) SetConnectionListener ¶
SetConnectionListener set a listener to the notifier
func (*Status) SetIngressGwMgr ¶
func (*Status) SetRelayMgr ¶
func (d *Status) SetRelayMgr(manager *relayClient.Manager)
func (*Status) SetWgIface ¶
func (d *Status) SetWgIface(wgInterface WGIfaceStatus)
func (*Status) SubscribeToEvents ¶
func (d *Status) SubscribeToEvents() *EventSubscription
SubscribeToEvents returns a new event subscription
func (*Status) SubscribeToPeerStateChanges ¶
func (d *Status) SubscribeToPeerStateChanges(ctx context.Context, peerID string) *StatusChangeSubscription
func (*Status) UnsubscribeFromEvents ¶
func (d *Status) UnsubscribeFromEvents(sub *EventSubscription)
UnsubscribeFromEvents removes an event subscription
func (*Status) UnsubscribePeerStateChanges ¶
func (d *Status) UnsubscribePeerStateChanges(subscription *StatusChangeSubscription)
func (*Status) UpdateDNSStates ¶
func (d *Status) UpdateDNSStates(dnsStates []NSGroupState)
func (*Status) UpdateLatency ¶
func (*Status) UpdateLazyConnection ¶
func (*Status) UpdateLocalPeerState ¶
func (d *Status) UpdateLocalPeerState(localPeerState LocalPeerState)
UpdateLocalPeerState updates local peer status
func (*Status) UpdateManagementAddress ¶
UpdateManagementAddress update the address of the management server
func (*Status) UpdatePeerFQDN ¶
UpdatePeerFQDN update peer's state fqdn only
func (*Status) UpdatePeerICEState ¶
func (*Status) UpdatePeerICEStateToDisconnected ¶
func (*Status) UpdatePeerRelayedState ¶
func (*Status) UpdatePeerRelayedStateToDisconnected ¶
func (*Status) UpdatePeerSSHHostKey ¶
UpdatePeerSSHHostKey updates peer's SSH host key
func (*Status) UpdatePeerState ¶
UpdatePeerState updates peer status
func (*Status) UpdateRelayStates ¶
func (d *Status) UpdateRelayStates(relayResults []relay.ProbeResult)
func (*Status) UpdateResolvedDomainsStates ¶
func (*Status) UpdateRosenpass ¶
UpdateRosenpass update the Rosenpass configuration
func (*Status) UpdateSignalAddress ¶
UpdateSignalAddress update the address of the signal server
func (*Status) UpdateWireGuardPeerState ¶
func (d *Status) UpdateWireGuardPeerState(pubKey string, wgStats configurer.WGStats) error
UpdateWireGuardPeerState updates the WireGuard bits of the peer state
type StatusChangeSubscription ¶
type StatusChangeSubscription struct {
// contains filtered or unexported fields
}
func (*StatusChangeSubscription) Events ¶
func (s *StatusChangeSubscription) Events() chan map[string]RouterState
type WGIface ¶
type WGIface interface {
UpdatePeer(peerKey string, allowedIps []netip.Prefix, keepAlive time.Duration, endpoint *net.UDPAddr, preSharedKey *wgtypes.Key) error
RemovePeer(peerKey string) error
GetStats() (map[string]configurer.WGStats, error)
GetProxy() wgproxy.Proxy
Address() wgaddr.Address
RemoveEndpointAddress(key string) error
}
type WGIfaceStatus ¶
type WGIfaceStatus interface {
FullStats() (*configurer.Stats, error)
}
type WGInterfaceStater ¶
type WGInterfaceStater interface {
GetStats() (map[string]configurer.WGStats, error)
}
type WGWatcher ¶
type WGWatcher struct {
// contains filtered or unexported fields
}
func NewWGWatcher ¶
func NewWGWatcher(log *log.Entry, wgIfaceStater WGInterfaceStater, peerKey string, stateDump *stateDump) *WGWatcher
func (*WGWatcher) DisableWgWatcher ¶
func (w *WGWatcher) DisableWgWatcher()
DisableWgWatcher stops the WireGuard watcher and wait for the watcher to exit
func (*WGWatcher) EnableWgWatcher ¶
EnableWgWatcher starts the WireGuard watcher. If it is already enabled, it will return immediately and do nothing.
type WorkerICE ¶
type WorkerICE struct {
// contains filtered or unexported fields
}
func NewWorkerICE ¶
func (*WorkerICE) GetLocalUserCredentials ¶
func (*WorkerICE) InProgress ¶
func (*WorkerICE) OnNewOffer ¶
func (w *WorkerICE) OnNewOffer(remoteOfferAnswer *OfferAnswer)
func (*WorkerICE) OnRemoteCandidate ¶
OnRemoteCandidate Handles ICE connection Candidate provided by the remote peer.
func (*WorkerICE) SessionID ¶
func (w *WorkerICE) SessionID() ICESessionID
type WorkerRelay ¶
type WorkerRelay struct {
// contains filtered or unexported fields
}
func NewWorkerRelay ¶
func NewWorkerRelay(ctx context.Context, log *log.Entry, ctrl bool, config ConnConfig, conn *Conn, relayManager *relayClient.Manager, stateDump *stateDump) *WorkerRelay
func (*WorkerRelay) CloseConn ¶
func (w *WorkerRelay) CloseConn()
func (*WorkerRelay) DisableWgWatcher ¶
func (w *WorkerRelay) DisableWgWatcher()
func (*WorkerRelay) EnableWgWatcher ¶
func (w *WorkerRelay) EnableWgWatcher(ctx context.Context)
func (*WorkerRelay) IsRelayConnectionSupportedWithPeer ¶
func (w *WorkerRelay) IsRelayConnectionSupportedWithPeer() bool
func (*WorkerRelay) OnNewOffer ¶
func (w *WorkerRelay) OnNewOffer(remoteOfferAnswer *OfferAnswer)
func (*WorkerRelay) RelayInstanceAddress ¶
func (w *WorkerRelay) RelayInstanceAddress() (string, error)
func (*WorkerRelay) RelayIsSupportedLocally ¶
func (w *WorkerRelay) RelayIsSupportedLocally() bool