Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) AssignToInitiator()
- func (c *Client) CloseConnection() error
- func (c *Client) DropConnection(code values.CloseCode)
- func (c *Client) Flush()
- func (c *Client) IncomingCombinedSequenceNumber() values.CombinedSequenceNumber
- func (c *Client) IncomingNonceEmpty() bool
- func (c *Client) IncrementIncomingCombinedSequenceNumber() error
- func (c *Client) IncrementOutgoingCombinedSequenceNumber() error
- func (c *Client) IsAuthenticated() bool
- func (c *Client) IsCombinedSequenceNumberValid(combinedSequenceNumber values.CombinedSequenceNumber) bool
- func (c *Client) IsCookieValid(cookie values.Cookie) bool
- func (c *Client) IsInitiator() bool
- func (c *Client) IsP2PAllowed(destinationAddress values.Address) bool
- func (c *Client) IsResponder() bool
- func (c *Client) MarkAsAuthenticated()
- func (c *Client) Nonce() values.Nonce
- func (c *Client) OutgoingCombinedSequenceNumber() values.CombinedSequenceNumber
- func (c *Client) PingTicker(pingPeriod time.Duration, pongWait time.Duration)
- func (c *Client) ReadMessage() (messageType int, p []byte, err error)
- func (c *Client) SendBytes(bytes []byte) error
- func (c *Client) SetAddress(address values.Address)
- func (c *Client) SetIncomingNonce(nonce values.Nonce)
- func (c *Client) SetPermanentPublicKey(permanentPublicKey values.Key)
- func (c *Client) ValidateNonce(nonce values.Nonce) error
- type Room
- func (r *Room) AddClient(client *Client) bool
- func (r *Room) Client(address values.Address) *Client
- func (r *Room) CountResponders() int
- func (r *Room) Initiator() *Client
- func (r *Room) KickCurrentInitiator()
- func (r *Room) NextFreeResponderAddress() (*values.Address, error)
- func (r *Room) ReleaseAddress(address values.Address)
- func (r *Room) RemoveClient(client *Client) bool
- func (r *Room) ReserveAddress(address values.Address)
- func (r *Room) Responders() []*Client
- type Rooms
- type SignalingMessage
Constants ¶
View Source
const SignalingMessageMinByteLength = 25
Variables ¶
View Source
var (
DefaultPongWait, _ = time.ParseDuration("30s")
NotAllowedToRelay = func(destinationAddress values.Address) error {
return errors.New(fmt.Sprintf("not allowed to relay messages to %x", destinationAddress))
}
IdentitiesDoNotMatch = func(clientAddress, sourceAddress values.Address) error {
return errors.New(
fmt.Sprintf("identities do not match, expected %x, got %x", clientAddress, sourceAddress),
)
}
InvalidCookie = errors.New("invalid cookie")
InvalidSequenceNumber = errors.New("invalid sequence number")
)
View Source
var ( RoomFull = errors.New("room full") InitiatiorNotFound = errors.New("initiator not found") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ID string Address values.Address SessionPrivateKey values.Key SessionPublicKey values.Key PermanentPublicKey values.Key OutgoingCookie values.Cookie OutgoingSequenceNumber values.SequenceNumber OutgoingOverflowNumber values.OverflowNumber IncomingCookie values.Cookie IncomingSequenceNumber values.SequenceNumber IncomingOverflowNumber values.OverflowNumber // contains filtered or unexported fields }
func (*Client) AssignToInitiator ¶
func (c *Client) AssignToInitiator()
func (*Client) CloseConnection ¶
func (*Client) DropConnection ¶
func (*Client) IncomingCombinedSequenceNumber ¶
func (c *Client) IncomingCombinedSequenceNumber() values.CombinedSequenceNumber
func (*Client) IncomingNonceEmpty ¶
func (*Client) IncrementIncomingCombinedSequenceNumber ¶
func (*Client) IncrementOutgoingCombinedSequenceNumber ¶
func (*Client) IsAuthenticated ¶
func (*Client) IsCombinedSequenceNumberValid ¶
func (c *Client) IsCombinedSequenceNumberValid(combinedSequenceNumber values.CombinedSequenceNumber, ) bool
func (*Client) IsInitiator ¶
func (*Client) IsResponder ¶
func (*Client) MarkAsAuthenticated ¶
func (c *Client) MarkAsAuthenticated()
func (*Client) OutgoingCombinedSequenceNumber ¶
func (c *Client) OutgoingCombinedSequenceNumber() values.CombinedSequenceNumber
func (*Client) PingTicker ¶
func (*Client) SetAddress ¶
func (*Client) SetIncomingNonce ¶
func (*Client) SetPermanentPublicKey ¶
type Room ¶
func (*Room) AddClient ¶
AddClient returns false if the client was already added, otherwise adds the client and returns true
func (*Room) CountResponders ¶
func (*Room) KickCurrentInitiator ¶
func (r *Room) KickCurrentInitiator()
func (*Room) NextFreeResponderAddress ¶
func (*Room) ReleaseAddress ¶
func (*Room) RemoveClient ¶
RemoveClient returns true if the client with given id was found and removed, otherwise false
func (*Room) ReserveAddress ¶
func (*Room) Responders ¶
type Rooms ¶
type Rooms struct {
// contains filtered or unexported fields
}
func (*Rooms) GetOrCreateRoom ¶
type SignalingMessage ¶
type SignalingMessage struct { Nonce values.Nonce Data values.TypedMessage }
func NewSignalingMessage ¶
func NewSignalingMessage(nonce values.Nonce, data values.TypedMessage) SignalingMessage
func (SignalingMessage) Bytes ¶
func (m SignalingMessage) Bytes() ([]byte, error)
func (SignalingMessage) DataBytes ¶
func (m SignalingMessage) DataBytes() ([]byte, error)
func (SignalingMessage) EncryptBytes ¶
func (m SignalingMessage) EncryptBytes(publicKey, privateKey values.Key) ([]byte, error)
func (SignalingMessage) String ¶
func (m SignalingMessage) String() string
Click to show internal directories.
Click to hide internal directories.