Versions in this module Expand all Collapse all v0 v0.0.1 Feb 21, 2025 Changes in this version + const CandidateFoundationTCP + const CandidateFoundationUDP + const Host + const RoleControlled + const RoleControlling + const TCP + const UDP + var ErrInvalidState = errors.New("transport state is invalid") + var ErrInvalidStun = errors.New("invalid stun message received") + var ErrNoAvailableIP = errors.New("no available ip") + var ErrNoAvailablePort = errors.New("no available port") + var ErrNoStunMessage = errors.New("no stun message") + var ErrNoTCPAddr = errors.New("not a tcp addr") + var ErrNoUDPAddr = errors.New("not a udp addr") + var ErrServerClosed = errors.New("server has closed") + var ErrStunRoleConflict = errors.New("stun role conflict") + var ErrTCPReadTimeout = errors.New("tcp conn read timeout") + var ErrTransportExist = errors.New("transport already exist") + var ErrTransportNotExist = errors.New("transport not exist") + var ErrUnknownIP = errors.New("unknown ip") + var ErrUnknownProtocol = errors.New("unknown protocol") + var ErrUnsupportedStun = errors.New("unsupported stun type received") + type Candidate struct + Foundation string + IP string + Port uint16 + Priority int + Protocol string + Type string + type Connection interface + Close func() error + Protocol func() string + RemoteAddr func() net.Addr + Write func(data []byte) (int, error) + type ConnectionState int32 + const ConnectionCompleted + const ConnectionConnected + const ConnectionDisconnected + const ConnectionFailed + const ConnectionNew + func (c ConnectionState) String() string + type OnData func(data []byte) + type OnState func(state ConnectionState) + type Option struct + DisableUDP bool + DisconnectTimeout int64 + EnableIPV6 bool + EnableTCP bool + FailTimeout int64 + IPs []string + MaxPort uint16 + MinPort uint16 + TCPPort uint16 + type Parameters struct + Candidates []Candidate + Lite bool + Password string + Role string + UsernameFragment string + type Server struct + func NewServer(option Option) (*Server, error) + func (s *Server) Close() + func (s *Server) NewTransport(ufrag, password string, ips []string, onData OnData, onState OnState) (Transport, error) + type Transport interface + Close func() + Parameters func() Parameters + State func() ConnectionState + Write func(data []byte) (int, error)