Documentation ¶
Index ¶
- Constants
- func IsPublicIP(ip net.IP) bool
- func NewConnectionAlreadyClosed(peer string) error
- func NewConnectionClosedError(peer string) error
- func NewConnectionDisconnectedError(peer string) error
- func NewConnectionTimeoutError(peer string, timeout time.Duration) error
- type Conn
- func (conn *Conn) Close() error
- func (conn *Conn) GetConf() ConnConfig
- func (conn *Conn) GetKey() string
- func (conn *Conn) OnRemoteAnswer(remoteAuth IceCredentials) bool
- func (conn *Conn) OnRemoteCandidate(candidate ice.Candidate)
- func (conn *Conn) OnRemoteOffer(remoteAuth IceCredentials) bool
- func (conn *Conn) Open() error
- func (conn *Conn) SetSignalAnswer(handler func(uFrag string, pwd string) error)
- func (conn *Conn) SetSignalCandidate(handler func(candidate ice.Candidate) error)
- func (conn *Conn) SetSignalOffer(handler func(uFrag string, pwd string) error)
- func (conn *Conn) Status() ConnStatus
- type ConnConfig
- type ConnStatus
- type ConnectionAlreadyClosedError
- type ConnectionClosedError
- type ConnectionDisconnectedError
- type ConnectionTimeoutError
- type IceCredentials
Constants ¶
const ( StatusConnected = iota StatusConnecting StatusDisconnected )
Variables ¶
This section is empty.
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 Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func NewConn ¶
func NewConn(config ConnConfig) (*Conn, error)
NewConn creates a new not opened Conn to the remote peer. To establish a connection run Conn.Open
func (*Conn) GetConf ¶ added in v0.6.3
func (conn *Conn) GetConf() ConnConfig
GetConf returns the connection config
func (*Conn) OnRemoteAnswer ¶
func (conn *Conn) OnRemoteAnswer(remoteAuth IceCredentials) bool
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 ¶
func (conn *Conn) OnRemoteCandidate(candidate ice.Candidate)
OnRemoteCandidate Handles ICE connection Candidate provided by the remote peer.
func (*Conn) OnRemoteOffer ¶
func (conn *Conn) OnRemoteOffer(remoteAuth IceCredentials) bool
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 (*Conn) Open ¶
Open opens connection to the remote peer starting ICE candidate gathering process. Blocks until connection has been closed or connection timeout. ConnStatus will be set accordingly
func (*Conn) SetSignalAnswer ¶
SetSignalAnswer sets a handler function to be triggered by Conn when a new connection answer has to be signalled to the remote peer
func (*Conn) SetSignalCandidate ¶
SetSignalCandidate sets a handler function to be triggered by Conn when a new ICE local connection candidate has to be signalled to the remote peer
func (*Conn) SetSignalOffer ¶
SetSignalOffer sets a handler function to be triggered by Conn when a new connection offer has to be signalled to the remote peer
func (*Conn) Status ¶
func (conn *Conn) Status() ConnStatus
Status returns current status of the Conn
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 // StunTurn is a list of STUN and TURN URLs StunTurn []*ice.URL // InterfaceBlackList is a list of machine interfaces that should be filtered out by ICE Candidate gathering // (e.g. if eth0 is in the list, host candidate of this interface won't be used) InterfaceBlackList []string Timeout time.Duration ProxyConfig proxy.Config UDPMux ice.UDPMux UDPMuxSrflx ice.UniversalUDPMux }
ConnConfig is a peer Connection configuration
type ConnStatus ¶
type ConnStatus int
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 IceCredentials ¶
IceCredentials ICE protocol credentials struct