client

package
Version: v0.0.0-...-434f5b0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: BSD-2-Clause Imports: 12 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 NewClient

func NewClient(kcp bool, socksAddr, obfs4Cert string) *Client

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 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 NewHopClient

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

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 {
	KCP           bool     `json:"kcp"`
	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

Jump to

Keyboard shortcuts

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