Zvpn

package
v0.0.0-...-b48972f Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPipe

func BuildPipe(src Conn, des Conn) error

func ConnCopy

func ConnCopy(src Conn, des Conn, errCh chan error)

Types

type Conn

type Conn interface {
	//write to the connect
	//l must equal len(buf), otherwise error is not nil
	Write(buf []byte) (l int, err error)
	//read from the connect and return how many byte is read
	//it's that l smaller than len(buf)
	Read(buf []byte) (l int, err error)
	Close() error
}

type ConnWrapper

type ConnWrapper struct {
	// contains filtered or unexported fields
}

func (ConnWrapper) Close

func (c ConnWrapper) Close() error

func (ConnWrapper) Read

func (c ConnWrapper) Read(buf []byte) (retLen int, retErr error)

func (ConnWrapper) Write

func (c ConnWrapper) Write(buf []byte) (retLen int, retErr error)

type Decrypter

type Decrypter interface {
	Read(conn Conn, dst []byte) (int, error)
}

type Encrypter

type Encrypter interface {
	Write(conn Conn, src []byte) (int, error)
}

type Listener

type Listener interface {
	//this is a blocking function
	Accept() (Conn, error)
	Close() error
}

type ListerWrapper

type ListerWrapper struct {
	// contains filtered or unexported fields
}

func (ListerWrapper) Accept

func (l ListerWrapper) Accept() (Conn, error)

func (ListerWrapper) Close

func (l ListerWrapper) Close() error

type NetListenerWrapper

type NetListenerWrapper struct{ L net.Listener }

func (NetListenerWrapper) Accept

func (l NetListenerWrapper) Accept() (Conn, error)

func (NetListenerWrapper) Close

func (l NetListenerWrapper) Close() error

type Obfuscate

type Obfuscate interface {
	// 传入一个已经握手完毕的基于可靠传输协议的连接
	// 你可以在上面利用非对称加密交换密秘钥或者直接
	// 使用本地配置文件中的密钥
	ClientHandShake(Conn) (Encrypter, Decrypter, error)
	ServerHandShake(Conn) (Encrypter, Decrypter, error)
}

type Protocol

type Protocol interface {
	Bind(string) (Listener, error)
	Dial(string) (Conn, error)
}

func NewProtocol

func NewProtocol(pro Protocol, o Obfuscate) Protocol

type ProtocolWrapper

type ProtocolWrapper struct {
	// contains filtered or unexported fields
}

func (ProtocolWrapper) Bind

func (p ProtocolWrapper) Bind(addr string) (listener Listener, err error)

func (ProtocolWrapper) Dial

func (p ProtocolWrapper) Dial(addr string) (conn Conn, err error)

type Proxy

type Proxy interface {
	// return the Conn ready to forward data
	// 本地连接: 浏览器->本地服务器
	// 远程连接: 本地服务器->远程服务器
	// 传入一个本地连接和远程连接,返回一个完成代理握手的远程连接
	// 如果本地和远程的代理协议一样,那么直接return remote即可
	ClientHandshake(local, remote Conn, p Protocol) (Conn, error)
	// take a established Conn between client and server as argument
	// return the established Conn which is the client want to established
	// 传入一个已经完成可靠网络协议握手的conn,在这个conn上进行
	// 代理协议握手,并且返回一个按客户端要求在服务端上建立的连接
	ServerHandshake(Conn, Protocol) (Conn, error)
}

type WallCrosser

type WallCrosser interface {
	StartClient(localAddr, ServerAddr string)
	StartServer(addr string)
}

func NewWallCrosser

func NewWallCrosser(protocol Protocol,
	proxy Proxy, obfuscate Obfuscate) WallCrosser

type WallCrosserImply

type WallCrosserImply struct {
	// contains filtered or unexported fields
}

func (WallCrosserImply) ClientConnHandler

func (w WallCrosserImply) ClientConnHandler(conn Conn)

func (WallCrosserImply) ServerConnHandler

func (w WallCrosserImply) ServerConnHandler(conn Conn)

func (*WallCrosserImply) StartClient

func (w *WallCrosserImply) StartClient(loc, serv string)

func (*WallCrosserImply) StartServer

func (w *WallCrosserImply) StartServer(addr string)

Jump to

Keyboard shortcuts

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