Documentation ¶
Overview ¶
import "git.torproject.org/pluggable-transports/snowflake.git/v2/common/messages"
import "git.torproject.org/pluggable-transports/snowflake.git/v2/common/messages"
Index ¶
- Constants
- Variables
- func DecodeAnswerRequest(data []byte) (string, string, error)
- func DecodeAnswerResponse(data []byte) (bool, error)
- func DecodePollResponse(data []byte) (string, string, error)
- func DecodePollResponseWithRelayURL(data []byte) (string, string, string, error)
- func DecodeProxyPollRequest(data []byte) (sid string, proxyType string, natType string, clients int, err error)
- func DecodeProxyPollRequestWithRelayPrefix(data []byte) (sid string, proxyType string, natType string, clients int, relayPrefix string, ...)
- func EncodeAnswerRequest(answer string, sid string) ([]byte, error)
- func EncodeAnswerResponse(success bool) ([]byte, error)
- func EncodePollResponse(offer string, success bool, natType string) ([]byte, error)
- func EncodePollResponseWithRelayURL(offer string, success bool, natType, relayURL, failReason string) ([]byte, error)
- func EncodeProxyPollRequest(sid string, proxyType string, natType string, clients int) ([]byte, error)
- func EncodeProxyPollRequestWithRelayPrefix(sid string, proxyType string, natType string, clients int, relayPattern string) ([]byte, error)
- type Arg
- type ClientPollRequest
- type ClientPollResponse
- type ProxyAnswerRequest
- type ProxyAnswerResponse
- type ProxyPollRequest
- type ProxyPollResponse
Constants ¶
const ClientVersion = "1.0"
const (
ProxyUnknown = "unknown"
)
Variables ¶
Functions ¶
func DecodeAnswerRequest ¶
Returns the sdp answer and proxy sid
func DecodePollResponseWithRelayURL ¶ added in v2.3.0
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 DecodeProxyPollRequest ¶ added in v2.2.0
func DecodeProxyPollRequestWithRelayPrefix ¶ added in v2.3.0
func DecodeProxyPollRequestWithRelayPrefix(data []byte) ( sid string, proxyType string, natType string, clients int, relayPrefix string, relayPrefixAware bool, 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 EncodePollResponse ¶
func EncodePollResponseWithRelayURL ¶ added in v2.3.0
func EncodeProxyPollRequest ¶ added in v2.2.0
Types ¶
type ClientPollRequest ¶
type ClientPollRequest struct { Offer string `json:"offer"` NAT string `json:"nat"` Fingerprint string `json:"fingerprint"` }
func DecodeClientPollRequest ¶
func DecodeClientPollRequest(data []byte) (*ClientPollRequest, error)
Decodes a poll message from a snowflake client
func (*ClientPollRequest) EncodeClientPollRequest ¶ added in v2.2.0
func (req *ClientPollRequest) EncodeClientPollRequest() ([]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