Documentation
¶
Index ¶
Constants ¶
View Source
const (
// DefaultSTUNServer is the default STUN server used when none are configured.
DefaultSTUNServer = "stun:stun.l.google.com:19302"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
AgentID string
Signaling signaling.SignalingClient
PeerManager *peer.Manager
MsgHandler func(ctx context.Context, env *envelope.Envelope)
X25519PubKey string
OnSession func(peerID, x25519 string) error
ConnectionGate func(peerID string) bool // returns true to allow connection
DefaultSTUNURL string // STUN server URL used when no ICE servers are configured
Logger *slog.Logger
}
Config holds configuration for the connection manager.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates P2P connections between agents. It consumes signaling messages, initiates and responds to WebRTC connections, and registers established connections with the PeerManager.
func (*Manager) Connect ¶
Connect initiates a P2P connection to a peer. It blocks until the connection is established or the context is cancelled/times out.
Click to show internal directories.
Click to hide internal directories.