Version: v1.2.1 Latest Latest

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

Go to latest
Published: May 29, 2022 License: MIT Imports: 29 Imported by: 0




View Source
const IoTManagerAddr = ""


This section is empty.


func InitSessionsCtl added in v1.1.54

func InitSessionsCtl()

func LoadConfigFromIoTManager added in v1.1.75

func LoadConfigFromIoTManager() (err error)


type HttpProxy added in v1.1.30

type HttpProxy struct {
	Domain           string
	RunId            string
	RemoteIP         string
	RemotePort       int
	UserName         string
	Password         string
	IfHttps          bool
	Description      string
	RemotePortStatus bool


func (*HttpProxy) UpdateRemotePortStatus added in v1.1.30

func (hp *HttpProxy) UpdateRemotePortStatus()

type Session

type Session struct {
	Id             string
	OS             string
	ARCH           string
	Version        string
	DisableMuxer   bool
	Conn           *net.Conn
	GatewaySession *yamux.Session
	WorkConn       chan net.Conn

func (*Session) GetNewWorkConn added in v1.1.54

func (sess *Session) GetNewWorkConn() (net.Conn, error)

func (*Session) GetStream added in v1.1.54

func (sess *Session) GetStream() (net.Conn, error)

func (*Session) RequestNewWorkConn added in v1.1.54

func (sess *Session) RequestNewWorkConn() error

func (*Session) Task

func (sess *Session) Task()

:TODO 存活检测

type SessionsManager added in v1.1.30

type SessionsManager struct {
	Session      map[string]*Session
	HttpProxyMap map[string]*HttpProxy
	RedisPool    *redis.Pool
var SessionsCtl SessionsManager

func (*SessionsManager) AddHttpProxy added in v1.1.30

func (sm *SessionsManager) AddHttpProxy(httpProxy *HttpProxy) error

func (*SessionsManager) CheckRedisKeyExit added in v1.1.54

func (sess *SessionsManager) CheckRedisKeyExit(key string) (bool, error)

func (*SessionsManager) CheckRemoteStatus added in v1.1.30

func (sm *SessionsManager) CheckRemoteStatus(targetType, runId, remoteIp string, remotePort int) (bool, error)


func (*SessionsManager) ConnectToSSH added in v1.1.30

func (sm *SessionsManager) ConnectToSSH(runId, remoteIP string, remotePort int, userName, passWord string) (stream net.Conn, err error)

func (*SessionsManager) ConnectToSerialPort added in v1.1.30

func (sm *SessionsManager) ConnectToSerialPort(runId string, msgsd *models.ConnectSerialPort) (net.Conn, error)

Connect to Serial Port

func (*SessionsManager) ConnectToTapTun added in v1.1.30

func (sm *SessionsManager) ConnectToTapTun(runId string) (net.Conn, error)

func (*SessionsManager) ConnectToTcp added in v1.1.30

func (sm *SessionsManager) ConnectToTcp(runId, remoteIp string, remotePort int) (net.Conn, error)

Connect to tcp

func (*SessionsManager) ConnectToTls added in v1.1.30

func (sm *SessionsManager) ConnectToTls(runId, remoteIp string, remotePort int) (net.Conn, error)

func (*SessionsManager) ConnectToUdp added in v1.1.30

func (sm *SessionsManager) ConnectToUdp(runId, remoteIp string, remotePort int) (net.Conn, error)

Connect to udp

func (*SessionsManager) ConnectToWs added in v1.1.30

func (sm *SessionsManager) ConnectToWs(runId, targetUrl, protocol, origin string) (net.Conn, error)

func (*SessionsManager) CreateOneHTTP added in v1.1.30

func (sm *SessionsManager) CreateOneHTTP(ctx context.Context, in *pb.HTTPConfig) (*pb.HTTPConfig, error)


func (*SessionsManager) DelHttpProxy added in v1.1.30

func (sm *SessionsManager) DelHttpProxy(domain string)

func (*SessionsManager) DelRedisByKey added in v1.1.54

func (sess *SessionsManager) DelRedisByKey(key string) error

func (*SessionsManager) DelSession added in v1.1.30

func (sess *SessionsManager) DelSession(id string)

func (*SessionsManager) DeleteOneHTTP added in v1.1.30

func (sm *SessionsManager) DeleteOneHTTP(ctx context.Context, in *pb.HTTPConfig) (*pb.ServerGoEmpty, error)

func (*SessionsManager) GetAllHTTP added in v1.1.30

func (sm *SessionsManager) GetAllHTTP(ctx context.Context, in *pb.Device) (*pb.HTTPList, error)

func (*SessionsManager) GetAllHttpProxy added in v1.1.30

func (sm *SessionsManager) GetAllHttpProxy() map[string]*HttpProxy

func (*SessionsManager) GetAllRedisKey added in v1.1.54

func (sess *SessionsManager) GetAllRedisKey() ([]string, error)

func (*SessionsManager) GetNewWorkConnByID added in v1.1.54

func (sess *SessionsManager) GetNewWorkConnByID(id string) (net.Conn, error)

func (*SessionsManager) GetOneHTTP added in v1.1.30

func (sm *SessionsManager) GetOneHTTP(ctx context.Context, in *pb.HTTPConfig) (*pb.HTTPConfig, error)

func (*SessionsManager) GetOneHttpProxy added in v1.1.30

func (sm *SessionsManager) GetOneHttpProxy(domain string) (*HttpProxy, error)

TODO 根据配置文件确定从内存获取映射表还是redis

func (*SessionsManager) GetRedisConn added in v1.1.54

func (sess *SessionsManager) GetRedisConn() (redis.Conn, error)

Redis Method

func (*SessionsManager) GetRedisValueByKey added in v1.1.54

func (sess *SessionsManager) GetRedisValueByKey(key string) (interface{}, error)

func (*SessionsManager) GetRedisValueByKeyToBool added in v1.1.54

func (sess *SessionsManager) GetRedisValueByKeyToBool(key string) (bool, error)

func (*SessionsManager) GetRedisValueByKeyToBytes added in v1.1.54

func (sess *SessionsManager) GetRedisValueByKeyToBytes(key string) ([]byte, error)

func (*SessionsManager) GetRedisValueByKeyToInt added in v1.1.54

func (sess *SessionsManager) GetRedisValueByKeyToInt(key string) (int, error)

func (*SessionsManager) GetRedisValueByKeyToString added in v1.1.54

func (sess *SessionsManager) GetRedisValueByKeyToString(key string) (string, error)

func (*SessionsManager) GetSessionByID added in v1.1.54

func (sess *SessionsManager) GetSessionByID(id string) (*Session, error)

func (*SessionsManager) GetStreamByID added in v1.1.54

func (sess *SessionsManager) GetStreamByID(id string) (net.Conn, error)

func (*SessionsManager) ListenMulticastUDP added in v1.1.30

func (sm *SessionsManager) ListenMulticastUDP(runId, ip string, port uint) (net.Conn, error)

func (SessionsManager) RunKCP added in v1.1.30

func (sess SessionsManager) RunKCP()

func (SessionsManager) RunTCP added in v1.1.30

func (sess SessionsManager) RunTCP()

func (SessionsManager) RunTLS added in v1.1.30

func (sess SessionsManager) RunTLS()

func (*SessionsManager) ServeHTTP added in v1.1.30

func (sm *SessionsManager) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*SessionsManager) SetRedisKeyValue added in v1.1.54

func (sess *SessionsManager) SetRedisKeyValue(key string, value interface{}) error

func (*SessionsManager) SetSession added in v1.1.30

func (sess *SessionsManager) SetSession(id string, session *Session)

func (SessionsManager) StartHttpListenAndServ added in v1.1.30

func (sess SessionsManager) StartHttpListenAndServ()


func (*SessionsManager) StartgRpcListenAndServ added in v1.1.30

func (sm *SessionsManager) StartgRpcListenAndServ()

func (*SessionsManager) UpdateAllHttpRemotePortStatus added in v1.1.54

func (sm *SessionsManager) UpdateAllHttpRemotePortStatus()

func (*SessionsManager) UpdateHttpProxyByMap added in v1.1.54

func (sm *SessionsManager) UpdateHttpProxyByMap(HttpProxyMap map[string]*HttpProxy)

func (*SessionsManager) UpdateOneHTTP added in v1.1.73

func (sm *SessionsManager) UpdateOneHTTP(ctx context.Context, in *pb.HTTPConfig) (*pb.HTTPConfig, error)

Jump to

Keyboard shortcuts

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