Documentation ¶
Overview ¶
import "git.torproject.org/pluggable-transports/snowflake.git/common/messages"
import "git.torproject.org/pluggable-transports/snowflake.git/common/messages"
Index ¶
- Constants
- Variables
- func DecodeAnswerRequest(data []byte) (string, string, error)
- func DecodeAnswerResponse(data []byte) (bool, error)
- func DecodePollRequest(data []byte) (sid string, proxyType string, natType string, clients int, err error)
- func DecodePollResponse(data []byte) (string, string, error)
- func EncodeAnswerRequest(answer string, sid string) ([]byte, error)
- func EncodeAnswerResponse(success bool) ([]byte, error)
- func EncodePollRequest(sid string, proxyType string, natType string, clients int) ([]byte, error)
- func EncodePollResponse(offer string, success bool, natType string) ([]byte, error)
- type Arg
- type ClientPollRequest
- type ClientPollResponse
- type ProxyAnswerRequest
- type ProxyAnswerResponse
- type ProxyPollRequest
- type ProxyPollResponse
Constants ¶
const ClientVersion = "1.0"
Variables ¶
Functions ¶
func DecodeAnswerRequest ¶
Returns the sdp answer and proxy sid
func DecodePollRequest ¶
func DecodePollRequest(data []byte) (sid string, proxyType string, natType string, clients int, err error)
Decodes a poll message from a snowflake proxy and returns the sid, proxy type, nat type and clients of the proxy on success and an error if it failed
func DecodePollResponse ¶
Decodes a poll response from the broker and returns an offer and the client's NAT type If there is a client match, the returned offer string will be non-empty
func EncodePollRequest ¶
Types ¶
type ClientPollRequest ¶
func DecodeClientPollRequest ¶
func DecodeClientPollRequest(data []byte) (*ClientPollRequest, error)
Decodes a poll message from a snowflake client
func (*ClientPollRequest) EncodePollRequest ¶
func (req *ClientPollRequest) EncodePollRequest() ([]byte, error)
Encodes a poll message from a snowflake client
type ClientPollResponse ¶
type ClientPollResponse struct { Answer string `json:"answer,omitempty"` Error string `json:"error,omitempty"` }
func DecodeClientPollResponse ¶
func DecodeClientPollResponse(data []byte) (*ClientPollResponse, error)
Decodes a poll response for a snowflake client If the Error field is empty, the Answer should be non-empty
func (*ClientPollResponse) EncodePollResponse ¶
func (resp *ClientPollResponse) EncodePollResponse() ([]byte, error)
Encodes a poll response for a snowflake client