client

package
v0.0.0-...-1a8bae5 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: BSD-2-Clause Imports: 11 Imported by: 2

Documentation

Overview

Package client exposes a socks5 proxy that uses obfs4 to communicate with the server, with an optional kcp wire transport.

Package client exposes a socks5 proxy that uses obfs4 to communicate with the server, with an optional KCP wire transport.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyRunning = errors.New("already initialized")
	ErrNotRunning     = errors.New("server not running")
	ErrBadConfig      = errors.New("configuration error")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	SocksAddr string

	EventLogger EventLogger
	// contains filtered or unexported fields
}

func (*Client) IsStarted

func (c *Client) IsStarted() bool

func (*Client) Start

func (c *Client) Start() (bool, error)

func (*Client) Stop

func (c *Client) Stop() (bool, error)

type Config

type Config struct {
	KCPConfig obfsvpn.KCPConfig
	SocksAddr string
	Obfs4Cert string
}

type EventLogger

type EventLogger interface {
	Log(state string, message string)
	Error(message string)
}

type HopClient

type HopClient struct {
	ProxyAddr string

	EventLogger EventLogger
	// contains filtered or unexported fields
}

func NewFFIHopClient

func NewFFIHopClient(hoppingConfig string) (*HopClient, error)

NewFFIHopClient creates a new Hopping PT client This function is exposed to the JNI and since it's not allowed to pass objects that contain slices (other than byte slices) over the JNI we have to pass a json formatted string and convert it to a HoppingConfig struct for further processing

func (*HopClient) IsStarted

func (c *HopClient) IsStarted() bool

func (*HopClient) Start

func (c *HopClient) Start() (bool, error)

func (*HopClient) Stop

func (c *HopClient) Stop() (bool, error)

type HoppingConfig

type HoppingConfig struct {
	KCPConfig     obfsvpn.KCPConfig
	ProxyAddr     string   `json:"proxy_addr"`
	Remotes       []string `json:"remotes"`
	Certs         []string `json:"certs"`
	PortSeed      int64    `json:"port_seed"`
	PortCount     uint     `json:"port_count"`
	MinHopSeconds uint     `json:"min_hop_seconds"`
	HopJitter     uint     `json:"hop_jitter"`
}

type Obfs4Config

type Obfs4Config struct {
	Remote string
	Cert   string
}

func (*Obfs4Config) String

func (oc *Obfs4Config) String() string

type ObfsClient

type ObfsClient interface {
	Start() (bool, error)
	Stop() (bool, error)
	IsStarted() bool
}

func NewClient

func NewClient(ctx context.Context, config Config) ObfsClient

func NewHopClient

func NewHopClient(ctx context.Context, stop context.CancelFunc, config HoppingConfig) ObfsClient

Jump to

Keyboard shortcuts

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