Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect() error
- func (c *Client) ConnectWithContext(ctx context.Context) error
- func (c *Client) Disconnect() error
- func (c *Client) LocalAddr() net.Addr
- func (c *Client) Read(p []byte) (int, error)
- func (c *Client) Reconnect() error
- func (c *Client) ReconnectWithContext(ctx context.Context) error
- func (c *Client) RemoteAddr() net.Addr
- func (c *Client) SetDeadline(t time.Time) error
- func (c *Client) SetReadDeadline(t time.Time) error
- func (c *Client) SetWriteDeadline(t time.Time) error
- func (c *Client) Write(p []byte) (int, error)
- type Options
Constants ¶
View Source
const ( DEFAULT_TIMEOUT = 30 * time.Second DEFAULT_MAX_FRAME_SIZE = 4 << 20 DEFAULT_MAX_PENDING_ICE = 128 DEFAULT_MAX_PENDING_ICE_BYTES = 256 << 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func Dial ¶
func Dial(roomID string, timeout time.Duration, adapter signaling.Adapter, psk peer.PreSharedKey, apiOptions ...peerapi.Option) (*Client, error)
Dial is the compact client entry point: callers provide a room, timeout, signaling adapter, and their pre-shared identity. No server/peer ID is part of the public API.
func (*Client) Disconnect ¶
func (*Client) Read ¶
Read reads received data from the buffer, blocking until data is available or the connection is closed (returns io.EOF).
func (*Client) ReconnectWithContext ¶
func (*Client) RemoteAddr ¶
type Options ¶
type Options struct {
// ICEAgentOptions are passed to the Pion ICE agent created for each connection.
ICEAgentOptions []ice.AgentOption
// TimeFunc returns the current time used to generate handshake timestamps.
TimeFunc func() time.Time
// Timeout is the maximum time to wait for a connection to be established.
Timeout time.Duration
// Transport selects the data transport negotiated after ICE. Nil defaults to
// the raw UDP transport.
Transport transports.ITransport
// UseCompression enables zstd compression before encryption.
UseCompression bool
// MaxFrameSize is the maximum decoded encrypted transport frame size.
MaxFrameSize int
// ReceiveBufferSize is the maximum unread application data retained by Read.
ReceiveBufferSize int
// MaxPendingICE limits the number of ICE candidates buffered per connection.
MaxPendingICE int
// MaxPendingICEBytes limits the bytes used by buffered ICE candidates.
MaxPendingICEBytes int
// EncryptionAAD is additional authenticated data included in each frame.
EncryptionAAD []byte
// EncryptionType selects the frame cipher. Empty uses XChaCha20-Poly1305.
EncryptionType string
// OnClientHello is called after ClientHello is sent.
OnClientHello func(*Client)
// OnServerHello is called after a valid ServerHello is received.
OnServerHello func(*Client)
// OnICECandidate is called for each locally gathered ICE candidate.
OnICECandidate func(*Client, ice.Candidate)
// OnICECandidateGatheringComplete is called after local ICE candidate
// gathering has completed.
OnICECandidateGatheringComplete func(*Client)
// OnICEOffer is called before the local ICE offer is published.
OnICEOffer func(*Client, transports.ICEDescription)
// OnICEAnswer is called after a valid ICE answer is received.
OnICEAnswer func(*Client, transports.ICEDescription)
// OnConnected is called after ICE and the selected transport are connected.
OnConnected func(*Client)
// OnConnectionFailed is called when connection establishment fails.
OnConnectionFailed func(*Client, error)
// OnDisconnected is called after an established connection is lost.
OnDisconnected func(*Client)
}
Click to show internal directories.
Click to hide internal directories.