client

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SINGLE_MODE = 0
	AUTO_MODE   = 1
	FLOW_MODE   = 20
	SOCKS5TYPE  = 0
	HTTPTYPE    = 1
)
View Source
const (
	STAGE_INIT     = 0
	STAGE_CONNECT  = 1
	STAGE_DONE     = 2
	STAGE_UNEXISTS = -1
)
View Source
const (
	DEFAULT_TIMEOUT = 5 * time.Second
)

Variables

View Source
var (
	UDPSTACK = &UDpSocks5Conn{
		StackSrc: make(map[string]int),
	}
	Locker = sync.RWMutex{}
)
View Source
var (
	GlobalStatus = false
)
View Source
var (
	IsStartHttpProxy = false
)
View Source
var RAW_PROFILE = ""
View Source
var (
	TO_STOP = false
)
View Source
var UseGBK = false
View Source
var WaitClose = make(chan int, 5)

Functions

func Auth

func Auth(name, host, port, passwd string, callbcak func(sess *ssh.Session))

func Build

func Build(name, host, port, pwd string, config utils.Config)

func GetStage

func GetStage(src *net.UDPAddr) int

func GetUDPCon

func GetUDPCon(host string) (con *net.UDPConn, err error)

func HandleBySrc

func HandleBySrc(src *net.UDPAddr, data []byte) (out []byte, err error)

func IfProxyStart

func IfProxyStart() bool

func InitDesktop

func InitDesktop()

func KillKcpee

func KillKcpee()

func NewCmdRunner

func NewCmdRunner(remoteConn net.Conn) error

func NewForwardingHTTPProxy

func NewForwardingHTTPProxy(logger *log.Logger) *httputil.ReverseProxy

NewForwardingHTTPProxy retuns a new reverse proxy that takes an incoming request and sends it to another server, proxying the response back to the client.

See: https://golang.org/pkg/net/http/httputil/#ReverseProxy

func ProxySet

func ProxySet(localAddr string)

func Stop

func Stop(name, host, port, pwd string)

func UpdateStage

func UpdateStage(src *net.UDPAddr, stage int)

Types

type CmdStruct

type CmdStruct struct {
	UseGbk bool
	// contains filtered or unexported fields
}

CmdStruct for cmd byte

func NewCmdStruct

func NewCmdStruct(cmd string) (c *CmdStruct)

NewCmdStruct construct NewCmd with string

func (*CmdStruct) ToData

func (cmd *CmdStruct) ToData() *bytes.Buffer

ToData from instance to bytes

type KcpClient

type KcpClient struct {
	utils.KcpBase

	RRR     uint16
	ShowLog int
	CmdChan chan string
	// contains filtered or unexported fields
}

KcpClient for client and cmd

func NewKcpClient

func NewKcpClient(config *utils.Config, kconfig *utils.KcpConfig) (kclient *KcpClient)

NewKcpClient init KcpClient

func (*KcpClient) CmdString

func (conn *KcpClient) CmdString(cmd string)

CmdString run cmd like redirect://ss://xxxxxxxx | redirect://ls | redirect://stop

func (*KcpClient) Listen

func (conn *KcpClient) Listen(listenAddr string, ifStartUdpListener ...bool) (err error)

Listen for socks5

func (*KcpClient) ListenHttpProxy

func (kclient *KcpClient) ListenHttpProxy(listenAddr string) (err error)

func (*KcpClient) ListenUDP

func (conn *KcpClient) ListenUDP(listenAddr string) (err error)

func (*KcpClient) SetMode

func (kclient *KcpClient) SetMode(mode int)

func (*KcpClient) SetProxyType

func (conn *KcpClient) SetProxyType(tp int)

Set client Proxy type as http/socks5

type KcpTunnel

type KcpTunnel struct {
	utils.KcpBase
	// contains filtered or unexported fields
}

func NewKcpTunnel

func NewKcpTunnel(config *utils.Config, kconfig *utils.KcpConfig) (kclient *KcpTunnel)

func (*KcpTunnel) Connect

func (tun *KcpTunnel) Connect(listenAddr, host string)

func (*KcpTunnel) ConnectCmd

func (tun *KcpTunnel) ConnectCmd(host string) error

func (*KcpTunnel) ConnectCmdInit

func (tun *KcpTunnel) ConnectCmdInit(host string) (p1 Stdio, p2 net.Conn, err error)

func (*KcpTunnel) HeartBeatC

func (kcpBase *KcpTunnel) HeartBeatC(stream net.Conn)

func (*KcpTunnel) SetRedirectHost

func (tun *KcpTunnel) SetRedirectHost(host string)

func (*KcpTunnel) SetTunMode

func (tun *KcpTunnel) SetTunMode(mode string)

func (*KcpTunnel) TryPadding

func (tun *KcpTunnel) TryPadding(host string)

func (*KcpTunnel) Tunnel

func (tun *KcpTunnel) Tunnel(host string)

func (*KcpTunnel) TunnelOne

func (tun *KcpTunnel) TunnelOne(host string)

type Proxy

type Proxy struct {
	Logger              *zap.Logger
	AuthUser            string
	AuthPass            string
	Avoid               string
	HandleBody          func(p1 net.Conn, host string, afterConnected func(p1, p2 net.Conn))
	ForwardingHTTPProxy *httputil.ReverseProxy
	DestDialTimeout     time.Duration
	DestReadTimeout     time.Duration
	DestWriteTimeout    time.Duration
	ClientReadTimeout   time.Duration
	ClientWriteTimeout  time.Duration
	// contains filtered or unexported fields
}

Proxy is a HTTPS forward proxy.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Stdio

type Stdio struct {
	UseGbk bool
	// contains filtered or unexported fields
}

func NewStdio

func NewStdio(remoteHost string) Stdio

func (*Stdio) Close

func (std *Stdio) Close() error

func (*Stdio) LocalAddr

func (std *Stdio) LocalAddr() net.Addr

func (*Stdio) Read

func (std *Stdio) Read(buf []byte) (n int, err error)

func (*Stdio) RemoteAddr

func (std *Stdio) RemoteAddr() net.Addr

func (*Stdio) SetDeadline

func (std *Stdio) SetDeadline(t time.Time) error

func (*Stdio) SetReadDeadline

func (std *Stdio) SetReadDeadline(t time.Time) error

func (*Stdio) SetTimeout

func (std *Stdio) SetTimeout(t time.Duration)

func (*Stdio) SetWriteDeadline

func (std *Stdio) SetWriteDeadline(t time.Time) error

func (*Stdio) Write

func (std *Stdio) Write(buf []byte) (n int, err error)

type UDpSocks5Conn

type UDpSocks5Conn struct {
	StackSrc map[string]int

	Dst   *net.UDPAddr
	Stage int
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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