socks

package
v0.0.0-...-3e3e819 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package socks implemented SOCKS protocol version 4, 4a and 5 (RFC1928).

http://www.openssh.com/txt/socks4.protocol

http://www.openssh.com/txt/socks4a.protocol

http://www.rfc-editor.org/rfc/rfc1928.txt

Index

Constants

View Source
const (
	ReplyCode4Granted                     byte = 0x5A
	ReplyCode4RejectedOrFailed            byte = 0x5B
	ReplyCode4CannotConnectToIdentd       byte = 0x5C
	ReplyCode4IdentdReportDifferentUserID byte = 0x5D
)
View Source
const (
	AuthTypeNotRequired       byte = 0x00
	AuthTypeGSSAPI            byte = 0x01
	AuthTypeUsernamePassword  byte = 0x02
	AuthTypeNoAcceptedMethods byte = 0xFF

	UsernamePasswordStatusSuccess byte = 0x00
	UsernamePasswordStatusFailure byte = 0x01

	CommandConnect      byte = 0x01
	CommandBind         byte = 0x02
	CommandUDPAssociate byte = 0x03

	AddressTypeIPv4   byte = 0x01
	AddressTypeDomain byte = 0x03
	AddressTypeIPv6   byte = 0x04

	ReplyCode5Success                byte = 0
	ReplyCode5Failure                byte = 1
	ReplyCode5NotAllowed             byte = 2
	ReplyCode5NetworkUnreachable     byte = 3
	ReplyCode5HostUnreachable        byte = 4
	ReplyCode5ConnectionRefused      byte = 5
	ReplyCode5TTLExpired             byte = 6
	ReplyCode5Unsupported            byte = 7
	ReplyCode5AddressTypeUnsupported byte = 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Version            string
	Network            string
	Address            string
	Username, Password string
	Methods            []byte
}

func NewClientFromURL

func NewClientFromURL(s string) (*Client, error)

NewClientFromURL

socks(5)://username:password@127.0.0.1:1080

socks4(a)://userid@127.0.0.1:1080

func (Client) Dial

func (c Client) Dial(network, address string) (net.Conn, error)

func (Client) DialTCP

func (c Client) DialTCP(network string, laddr, raddr *net.TCPAddr) (*net.TCPConn, error)

func (Client) GetVersion

func (c Client) GetVersion() string

func (Client) Handshake

func (c Client) Handshake(r io.Reader, w io.Writer, network, address string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL