client

package
v0.0.0-...-581961c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAddr

func NewAddr(address, network string) net.Addr

NewAddr returns a net.Addr that holds an address of the form `host:port` with a domain name or IP as host. Used for SOCKS addressing.

func NewPrefixSaltGenerator

func NewPrefixSaltGenerator(prefix []byte) ss.SaltGenerator

NewPrefixSaltGenerator returns a SaltGenerator whose output consists of the provided prefix, followed by random bytes. This is useful to change how shadowsocks traffic is classified by middleboxes.

Note: Prefixes steal entropy from the initialization vector. This weakens security by increasing the likelihood that the same IV is used in two different connections (which becomes likely once 2^(N/2) connections are made, due to the birthday attack). If an IV is reused, the attacker can not only decrypt the ciphertext of those two connections; they can also easily recover the shadowsocks key and decrypt all other connections to this server. Use with care!

Types

type Client

type Client interface {
	// DialTCP connects to `raddr` over TCP though a Shadowsocks proxy.
	// `laddr` is a local bind address, a local address is automatically chosen if nil.
	// `raddr` has the form `host:port`, where `host` can be a domain name or IP address.
	DialTCP(laddr *net.TCPAddr, raddr string) (onet.DuplexConn, error)

	// ListenUDP relays UDP packets though a Shadowsocks proxy.
	// `laddr` is a local bind address, a local address is automatically chosen if nil.
	ListenUDP(laddr *net.UDPAddr) (net.PacketConn, error)

	// SetTCPSaltGenerator controls the SaltGenerator used for TCP upstream.
	// `salter` may be `nil`.
	// This method is not thread-safe.
	SetTCPSaltGenerator(ss.SaltGenerator)

	TCPFd() int
	UDPFd() int
}

Client is a client for Shadowsocks TCP and UDP connections.

func NewClient

func NewClient(host string, port int, password, cipherName string) (Client, error)

NewClient creates a client that routes connections to a Shadowsocks proxy listening at `host:port`, with authentication parameters `cipher` (AEAD) and `password`. TODO: add a dialer argument to support proxy chaining and transport changes.

Jump to

Keyboard shortcuts

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