base

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SagooServerTunnelPrefix = "sagoo-server-tunnel"
)

Variables

This section is empty.

Functions

func AddOrEditServerTunnel

func AddOrEditServerTunnel(ctx context.Context, t ServerTunnel) (tunnelId string, err error)

AddOrEditServerTunnel 添加或编辑server通道

func GetTunnelIdByDeviceKey

func GetTunnelIdByDeviceKey(ctx context.Context, deviceKey string) (tunnelId string)

Types

type ServerInstance

type ServerInstance interface {
	Open(ctx context.Context) error
	Close() error
	GetTunnel(id string) base.TunnelInstance
	RemoveTunnel(id string)
	Running() bool
}

Server 通道

type ServerTunnel

type ServerTunnel struct {
	// server的id
	ServerId int
	// server通道id
	TunnelId string
	// 设备key
	DeviceKey string
	// server通道类型,暂时只支持tcp, udp
	Type string
	// server通道状态,0:离线,1:在线
	Status int
	// server通道内地地址
	LocalAddr string
	// server通道远程地址
	RemoteAddr string
	// server通道备注
	Remark string `json:"remark"    description:"备注"`
}

func DeleteServerTunnel

func DeleteServerTunnel(ctx context.Context, deviceKey string) (t ServerTunnel, err error)

DeleteServerTunnel 删除server通道

func GetServerTunnel

func GetServerTunnel(ctx context.Context, deviceKey string) (t ServerTunnel, err error)

GetServerTunnel 获取server通道

func GetServerTunnelList

func GetServerTunnelList(ctx context.Context) (listT []ServerTunnel, err error)

GetServerTunnelList 获取server通道列表

func (ServerTunnel) TunnelOffline

func (t ServerTunnel) TunnelOffline(ctx context.Context) error

TunnelOffline server通道下线

func (ServerTunnel) TunnelOnline

func (t ServerTunnel) TunnelOnline(ctx context.Context) error

TunnelOnline server通道上线

Jump to

Keyboard shortcuts

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