Documentation ¶
Index ¶
- Constants
- Variables
- func ReadAuthentication(reader io.Reader) (auth Socks5AuthenticationRequest, auth4 Socks4AuthenticationRequest, err error)
- func WriteAuthentication(writer io.Writer, r *Socks5AuthenticationResponse) error
- func WriteUserPassResponse(writer io.Writer, response Socks5UserPassResponse) error
- type Socks4AuthenticationRequest
- type Socks4AuthenticationResponse
- type Socks5AuthenticationRequest
- type Socks5AuthenticationResponse
- type Socks5Request
- type Socks5Response
- type Socks5UDPRequest
- type Socks5UserPassRequest
- type Socks5UserPassResponse
Constants ¶
View Source
const ( AuthNotRequired = byte(0x00) AuthGssApi = byte(0x01) AuthUserPass = byte(0x02) AuthNoMatchingMethod = byte(0xFF) Socks4RequestGranted = byte(90) Socks4RequestRejected = byte(91) )
View Source
const ( AddrTypeIPv4 = byte(0x01) AddrTypeIPv6 = byte(0x04) AddrTypeDomain = byte(0x03) CmdConnect = byte(0x01) CmdBind = byte(0x02) CmdUdpAssociate = byte(0x03) )
View Source
const ( ErrorSuccess = byte(0x00) ErrorGeneralFailure = byte(0x01) ErrorConnectionNotAllowed = byte(0x02) ErrorNetworkUnreachable = byte(0x03) ErrorHostUnUnreachable = byte(0x04) ErrorConnectionRefused = byte(0x05) ErrorTTLExpired = byte(0x06) ErrorCommandNotSupported = byte(0x07) ErrorAddressTypeNotSupported = byte(0x08) )
Variables ¶
View Source
var (
ErrorUnknownAddressType = errors.New("Unknown Address Type.")
)
View Source
var (
Socks4Downgrade = errors.New("Downgraded to Socks 4.")
)
Functions ¶
func ReadAuthentication ¶
func ReadAuthentication(reader io.Reader) (auth Socks5AuthenticationRequest, auth4 Socks4AuthenticationRequest, err error)
func WriteAuthentication ¶
func WriteAuthentication(writer io.Writer, r *Socks5AuthenticationResponse) error
func WriteUserPassResponse ¶
func WriteUserPassResponse(writer io.Writer, response Socks5UserPassResponse) error
Types ¶
type Socks4AuthenticationResponse ¶
type Socks4AuthenticationResponse struct {
// contains filtered or unexported fields
}
func NewSocks4AuthenticationResponse ¶
func NewSocks4AuthenticationResponse(result byte, port uint16, ip []byte) *Socks4AuthenticationResponse
func (*Socks4AuthenticationResponse) Write ¶
func (r *Socks4AuthenticationResponse) Write(buffer *alloc.Buffer)
type Socks5AuthenticationRequest ¶
type Socks5AuthenticationRequest struct {
// contains filtered or unexported fields
}
Authentication request header of Socks5 protocol
func (*Socks5AuthenticationRequest) HasAuthMethod ¶
func (request *Socks5AuthenticationRequest) HasAuthMethod(method byte) bool
type Socks5AuthenticationResponse ¶
type Socks5AuthenticationResponse struct {
// contains filtered or unexported fields
}
func NewAuthenticationResponse ¶
func NewAuthenticationResponse(authMethod byte) *Socks5AuthenticationResponse
type Socks5Request ¶
type Socks5Request struct { Version byte Command byte AddrType byte IPv4 [4]byte Domain string IPv6 [16]byte Port uint16 }
func ReadRequest ¶
func ReadRequest(reader io.Reader) (request *Socks5Request, err error)
func (*Socks5Request) Destination ¶
func (request *Socks5Request) Destination() v2net.Destination
type Socks5Response ¶
type Socks5Response struct { Version byte Error byte AddrType byte IPv4 [4]byte Domain string IPv6 [16]byte Port uint16 }
func NewSocks5Response ¶
func NewSocks5Response() *Socks5Response
func (*Socks5Response) SetDomain ¶
func (r *Socks5Response) SetDomain(domain string)
func (*Socks5Response) SetIPv4 ¶
func (r *Socks5Response) SetIPv4(ipv4 []byte)
func (*Socks5Response) SetIPv6 ¶
func (r *Socks5Response) SetIPv6(ipv6 []byte)
func (*Socks5Response) Write ¶
func (r *Socks5Response) Write(buffer *alloc.Buffer)
type Socks5UDPRequest ¶
func ReadUDPRequest ¶
func ReadUDPRequest(packet []byte) (*Socks5UDPRequest, error)
func (*Socks5UDPRequest) Destination ¶
func (request *Socks5UDPRequest) Destination() v2net.Destination
func (*Socks5UDPRequest) Write ¶
func (request *Socks5UDPRequest) Write(buffer *alloc.Buffer)
type Socks5UserPassRequest ¶
type Socks5UserPassRequest struct {
// contains filtered or unexported fields
}
func ReadUserPassRequest ¶
func ReadUserPassRequest(reader io.Reader) (request Socks5UserPassRequest, err error)
func (Socks5UserPassRequest) AuthDetail ¶
func (request Socks5UserPassRequest) AuthDetail() string
func (Socks5UserPassRequest) Password ¶
func (request Socks5UserPassRequest) Password() string
func (Socks5UserPassRequest) Username ¶
func (request Socks5UserPassRequest) Username() string
type Socks5UserPassResponse ¶
type Socks5UserPassResponse struct {
// contains filtered or unexported fields
}
func NewSocks5UserPassResponse ¶
func NewSocks5UserPassResponse(status byte) Socks5UserPassResponse
Click to show internal directories.
Click to hide internal directories.