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) (ok bool, message string, err error)
- func ReadVString(reader io.Reader) (string, error)
- func WriteTCPRequest(addr string, payload []byte) *buf.Buffer
- func WriteTCPResponse(ok bool, msg string, payload []byte) *buf.Buffer
- func WriteUVariant(writer io.Writer, value uint64) error
- func WriteVString(writer io.Writer, value string) error
- type AuthRequest
- type AuthResponse
- type UDPMessage
Constants ¶
View Source
const ( URLHost = "hysteria" URLPath = "/auth" RequestHeaderAuth = "Hysteria-Auth" ResponseHeaderUDPEnabled = "Hysteria-UDP" CommonHeaderCCRX = "Hysteria-CC-RX" CommonHeaderPadding = "Hysteria-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 }
AuthRequest is what client sends to server for authentication.
func AuthRequestFromHeader ¶
func AuthRequestFromHeader(h http.Header) AuthRequest
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.