socks

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SOCKS4  = 0x04
	SOCKS4A = 0x04 // Same version byte, distinguished by null IP
	SOCKS5  = 0x05
)

SOCKS versions

View Source
const (
	CmdConnect      = 0x01
	CmdBind         = 0x02
	CmdUDPAssociate = 0x03
)

SOCKS5 commands

View Source
const (
	AddrTypeIPv4   = 0x01
	AddrTypeDomain = 0x03
	AddrTypeIPv6   = 0x04
)

SOCKS5 address types

View Source
const (
	AuthNone         = 0x00
	AuthGSSAPI       = 0x01
	AuthUsernamePass = 0x02
	AuthNoAcceptable = 0xFF
)

SOCKS5 authentication methods

Variables

View Source
var Decoder = &decoder.StreamDecoder{
	Type:        types.Type_NC_SOCKS,
	Name:        serviceSOCKS,
	Description: "SOCKS is a proxy protocol for routing packets between client and server through a proxy",
	PostInit: func(d *decoder.StreamDecoder) error {
		var err error
		socksLog, _, err = logging.InitZapLogger(
			decoderconfig.Instance.Out,
			"socks",
			decoderconfig.Instance.Debug,
		)
		return err
	},
	CanDecode: func(client, server []byte) bool {

		if len(client) >= 3 && client[0] == 0x05 && int(client[1])+2 <= len(client) {
			return true
		}

		if len(client) >= 9 && client[0] == 0x04 && (client[1] == 0x01 || client[1] == 0x02) {
			return true
		}
		return false
	},
	DeInit: func(sd *decoder.StreamDecoder) error {
		return socksLog.Sync()
	},
	Factory: &socksReader{},
	Typ:     core.TCP,
}

Decoder for protocol analysis and writing audit records to disk.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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