socks

package
v0.16.6 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	},

	Specificity: core.SpecificityWeak,
	Confidence:  socksConfidence,
	CanDecode: func(client, server []byte) bool {

		if len(client) >= 3 && client[0] == 0x05 {
			methods := int(client[1])
			if methods >= 1 && methods <= maxSocks5Methods && len(client) >= 2+methods {
				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