datatunnel

package
v1.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AuthAction   = "Auth"   // 认证,由SA发起
	CreateAction = "Create" // 认证通过, 创建数据通道客户端,由SC发起
	NewAction    = "New"    // 新建一个TCP连接,由SC发起
	ErrorAction  = "Error"  // 错误事件
)
View Source
const (
	DefaultTCPKeepAlivePeriod = (5 * time.Minute)
	DefaultLingerSecond       = 30
)

Variables

This section is empty.

Functions

func GetActionData

func GetActionData(value string, data interface{}) (err error)

获取事件数据

func Proxy

func Proxy(from, to net.Conn)

Types

type AuthActionData

type AuthActionData struct {
	SAID        string `json:"sa_id"`
	Key         string `json:"key"`
	ServiceName string `json:"service_name"`
}

AuthActionData 认证事件数据格式

type CreateActionData

type CreateActionData struct {
	Port        int    `json:"port"`
	ServiceName string `json:"service_name"`
}

CreateActionData 新建时间数据格式

type NewActionData

type NewActionData struct {
	ServiceName   string `json:"service_name"`
	ConnectionKey string `json:"key"`
}

NewActionData 新建TCP连接数据格式

type TunnelClient

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

func NewTunnelClient

func NewTunnelClient(option *TunnelClientOption) *TunnelClient

func (*TunnelClient) NewProxy

func (c *TunnelClient) NewProxy(sendKey func(net.Conn) error)

type TunnelClientOption

type TunnelClientOption struct {
	// 服务端和需要代理的地址
	ServerAddr *net.TCPAddr
	ProxyAddr  *net.TCPAddr

	// 重试次数
	Retry int

	LogLevel string

	LingerSecond int // tcp参数SO_LINGER,单位秒
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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