Documentation
¶
Index ¶
- Constants
- func AuthRequestToHeader(h http.Header, req AuthRequest)
- func AuthResponseToHeader(h http.Header, resp AuthResponse)
- func ReadTCPRequest(r io.Reader) (string, error)
- func ReadTCPResponse(r io.Reader) (bool, string, error)
- func WriteTCPRequest(w io.Writer, addr string) error
- func WriteTCPResponse(w io.Writer, ok bool, msg string) error
- type AuthRequest
- type AuthResponse
- type UDPMessage
Constants ¶
View Source
const ( URLHost = "xless" // You may ignore this fixed path for auth, since server recognizes dynamic API paths URLPath = "/auth" // ... unchanged ... RequestHeaderAuth = "xless-Auth" ResponseHeaderUDPEnabled = "xless-UDP" CommonHeaderCCRX = "xless-CC-RX" CommonHeaderPadding = "xless-Padding" StatusAuthOK = 233 )
View Source
const ( FrameTypeTCPRequest = 0x401 MaxAddressLength = 2048 MaxMessageLength = 2048 MaxPaddingLength = 4096 MaxUDPSize = 4096 )
Variables ¶
This section is empty.
Functions ¶
func AuthRequestToHeader ¶
func AuthRequestToHeader(h http.Header, req AuthRequest)
func AuthResponseToHeader ¶
func AuthResponseToHeader(h http.Header, resp AuthResponse)
Types ¶
type AuthRequest ¶
type AuthRequest struct { Auth string Rx uint64 // 0 = unknown, client asks server to use bandwidth detection }
func AuthRequestFromHeader ¶
func AuthRequestFromHeader(h http.Header) AuthRequest
func AuthRequestFromObfuscated ¶ added in v0.1.0
func AuthRequestFromObfuscated(r *http.Request) AuthRequest
Parse authentication info from a heavily obfuscated HTTP request according to XLESS SPEC.
type AuthResponse ¶
type AuthResponse struct { UDPEnabled bool Rx uint64 // 0 = unlimited RxAuto bool // true = server asks client to use bandwidth detection }
AuthResponse is what server sends to client when authentication is passed.
func AuthResponseFromHeader ¶
func AuthResponseFromHeader(h http.Header) AuthResponse
type UDPMessage ¶
type UDPMessage struct { SessionID uint32 // 4 PacketID uint16 // 2 FragID uint8 // 1 FragCount uint8 // 1 Addr string // varint + bytes Data []byte }
func ParseUDPMessage ¶
func ParseUDPMessage(msg []byte) (*UDPMessage, error)
func (*UDPMessage) HeaderSize ¶
func (m *UDPMessage) HeaderSize() int
func (*UDPMessage) Serialize ¶
func (m *UDPMessage) Serialize(buf []byte) int
func (*UDPMessage) Size ¶
func (m *UDPMessage) Size() int
Click to show internal directories.
Click to hide internal directories.