guard

package
v0.70.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetICEMonitorPeriod added in v0.59.4

func GetICEMonitorPeriod() time.Duration

Types

type ConnStatus added in v0.70.0

type ConnStatus int

ConnStatus represents the connection state as seen by the guard.

const (
	// ConnStatusDisconnected means neither ICE nor Relay is connected.
	ConnStatusDisconnected ConnStatus = iota
	// ConnStatusPartiallyConnected means Relay is connected but ICE is not.
	ConnStatusPartiallyConnected
	// ConnStatusConnected means all required connections are established.
	ConnStatusConnected
)

type Guard

type Guard struct {
	// contains filtered or unexported fields
}

Guard is responsible for the reconnection logic. It will trigger to send an offer to the peer then has connection issues. Watch these events: - Relay client reconnected to home server - Signal server connection state changed - ICE connection disconnected - Relayed connection disconnected - ICE candidate changes

func NewGuard

func NewGuard(log *log.Entry, isConnectedFn connStatusFunc, timeout time.Duration, srWatcher *SRWatcher) *Guard

func (*Guard) SetICEConnDisconnected

func (g *Guard) SetICEConnDisconnected()

func (*Guard) SetRelayedConnDisconnected

func (g *Guard) SetRelayedConnDisconnected()

func (*Guard) Start

func (g *Guard) Start(ctx context.Context, eventCallback func())

type ICEMonitor

type ICEMonitor struct {
	ReconnectCh chan struct{}
	// contains filtered or unexported fields
}

func NewICEMonitor

func NewICEMonitor(iFaceDiscover stdnet.ExternalIFaceDiscover, config icemaker.Config, period time.Duration) *ICEMonitor

func (*ICEMonitor) Start

func (cm *ICEMonitor) Start(ctx context.Context, onChanged func())

type SRWatcher

type SRWatcher struct {
	// contains filtered or unexported fields
}

func NewSRWatcher

func NewSRWatcher(signalClient chNotifier, relayManager chNotifier, iFaceDiscover stdnet.ExternalIFaceDiscover, iceConfig ice.Config) *SRWatcher

NewSRWatcher creates a new SRWatcher. This watcher will notify the listeners when the ICE candidates change or the Relay connection is reconnected or the Signal client reconnected.

func (*SRWatcher) Close

func (w *SRWatcher) Close()

func (*SRWatcher) NewListener

func (w *SRWatcher) NewListener() chan struct{}

func (*SRWatcher) RemoveListener

func (w *SRWatcher) RemoveListener(listenerChan chan struct{})

func (*SRWatcher) Start

func (w *SRWatcher) Start(disableICEMonitor bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL