models

package
v0.0.73 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 9 Imported by: 9

Documentation

Index

Constants

View Source
const PermissionGatewayLogin = "gateway"
View Source
const PermissionOpenIoTHubLogin = "openiothub"

Variables

Functions

func GetToken

func GetToken(loginWithServer *LoginWithServer, permission []string, expiresecd int64) (token string, err error)

func GetTokenByServerConfig added in v0.0.39

func GetTokenByServerConfig(serverConfig *ServerConfig, expiresecd int64) (gatewayToken, openIoTHubToken string, err error)

func GetUuidToken added in v0.0.66

func GetUuidToken(key, uuid, role string, permission []string, txts map[string]string, expiresecd int64) (token string, err error)

Types

type CheckStatusRequest

type CheckStatusRequest struct {
	Type string
	Addr string
}

type CheckStatusResponse

type CheckStatusResponse struct {
	//Code:0:在线;1:离线
	Code    int
	Message string
}

type ConnectSSH

type ConnectSSH struct {
	TargetIP   string
	TargetPort int
	UserName   string
	PassWord   string
}

type ConnectSTCP

type ConnectSTCP struct {
	TargetIP   string
	TargetPort int
}

type ConnectSerialPort

type ConnectSerialPort serial.OpenOptions

type ConnectTCP

type ConnectTCP struct {
	TargetIP   string
	TargetPort int
}

connect //tcp,stcp,udp,serialport,ws,wss

type ConnectUDP

type ConnectUDP struct {
	TargetIP   string
	TargetPort int
}

type ConnectWs

type ConnectWs struct {
	TargetUrl string
	Protocol  string
	Origin    string
}

type ConnectWss

type ConnectWss struct {
	TargetUrl string
	Protocol  string
	Origin    string
}

type DeleteGatewayJwt added in v0.0.65

type DeleteGatewayJwt struct {
}

type Error

type Error struct {
	Code    int
	Message string
}

type FindmDNS

type FindmDNS struct {
	Service string
	Domain  string
	Second  int
}

type GatewayConfig

type GatewayConfig struct {
	GatewayUUID         string
	LogConfig           *LogConfig
	LoginWithTokenList  []string
	LoginWithServerConf []*LoginWithServer
}

网关的配置文件

type GatewayLogin

type GatewayLogin struct {
	Token   string
	Os      string
	Arch    string
	Version string
	//禁止muxer,用于支持嵌入式等受限设备
	DisableMuxer bool
}

login

type GatewayWorkConn

type GatewayWorkConn struct {
	RunId   string
	Secret  string
	Version string
}

type GetMyUDPPublicAddr

type GetMyUDPPublicAddr struct{}

type InstallPlugin

type InstallPlugin struct {
	TargetUrl string
}

/plugin

type JsonResponse

type JsonResponse struct {
	Code   int
	Msg    string
	Result string
}

type LogConfig added in v0.0.61

type LogConfig struct {
	EnableStdout bool
	LogFilePath  string
}

type LoginWithServer added in v0.0.57

type LoginWithServer struct {
	ConnectionType string `yaml:"connection_type"`
	LastId         string `yaml:"last_id"`
	Server         *Srever
}

type MDNSResult

type MDNSResult struct {
	Instance string   `json:"name"`
	Service  string   `json:"type"`
	Domain   string   `json:"domain"`
	HostName string   `json:"hostname"`
	Port     int      `json:"port"`
	Text     []string `json:"text"`
	TTL      uint32   `json:"ttl"`
	AddrIPv4 []net.IP `json:"addripv4"`
	AddrIPv6 []net.IP `json:"addripv6"`
}

type Message

type Message interface{}

type Msg

type Msg struct {
	MsgType    string
	MsgContent string
}

type NewService

type NewService struct {
	Type   string
	Config string
}

type NewSubSession

type NewSubSession struct{}

type OK

type OK struct{}

type OpenIoTHubLogin

type OpenIoTHubLogin struct {
	Token   string
	Os      string
	Arch    string
	Version string
}

Connect TO

type Ping

type Ping struct{}

/Ping

type Pong

type Pong struct{}

type QueryInstalledPlugin

type QueryInstalledPlugin struct{}

/query installed plugin

type RemoteNetInfo

type RemoteNetInfo struct {
	IntranetIp   string
	IntranetPort int
	ExternalIp   string
	ExternalPort int
}

TODO:NETINFO Model

type RemovePlugin

type RemovePlugin struct {
	TargetUrl string
}

type ReqNewP2PCtrlAsClient

type ReqNewP2PCtrlAsClient struct {
	IntranetIp   string
	IntranetPort int
	ExternalIp   string
	ExternalPort int
}

让内网端以dial的身份连接我

type ReqNewP2PCtrlAsServer added in v0.0.6

type ReqNewP2PCtrlAsServer struct {
	IntranetIp   string
	IntranetPort int
	ExternalIp   string
	ExternalPort int
}

P2P让远端以listener身份运行

type RequestNewWorkConn

type RequestNewWorkConn struct {
	Type   string
	Config string
}

type RespInstalledPlugin

type RespInstalledPlugin struct{}

type RunPlugin

type RunPlugin struct {
	TargetUrl string
}

type ScanPort

type ScanPort struct {
	Host      string
	StartPort int
	EndPort   int
}

type ScanPortResult

type ScanPortResult []int

type ServerConfig

type ServerConfig struct {
	ServerUuid string `yaml:"server_uuid"`
	PublicIp   string `yaml:"my_public_ip_or_domian"`
	LogConfig  *LogConfig
	Common     struct {
		BindAddr   string `yaml:"bind_addr"`
		TcpPort    int    `yaml:"tcp_port"`
		KcpPort    int    `yaml:"kcp_port"`
		UdpApiPort int    `yaml:"udp_p2p_port"`
		KcpApiPort int    `yaml:"kcp_p2p_port"`
		TlsPort    int    `yaml:"tls_port"`
		GrpcPort   int    `yaml:"grpc_port"`
		HttpPort   int    `yaml:"http_port"`
		HttpsPort  int    `yaml:"https_port"`
	}
	Security struct {
		LoginKey          string `yaml:"login_key"`
		TlsCertFilePath   string `yaml:"tls_Cert_file_path"`
		TlsKeyFilePath    string `yaml:"tls_key_file_path"`
		HttpsCertFilePath string `yaml:"https_cert_file_path"`
		HttpsKeyFilePath  string `yaml:"https_key_file_path"`
	}
	RedisConfig struct {
		Enabled  bool   `yaml:"enabled"`
		Network  string `yaml:"network"`
		Address  string `yaml:"address"`
		Database int    `yaml:"database"`
		NeedAuth bool   `yaml:"needAuth"`
		Password string `yaml:"password"`
	}
}

服务器的配置文件模型

type Srever

type Srever struct {
	ServerHost string `yaml:"server_host"`
	TcpPort    int    `yaml:"tcp_port"`
	KcpPort    int    `yaml:"kcp_port"`
	UdpApiPort int    `yaml:"udp_p2p_port"`
	KcpApiPort int    `yaml:"kcp_p2p_port"`
	TlsPort    int    `yaml:"tls_port"`
	GrpcPort   int    `yaml:"grpc_port"`
	LoginKey   string `yaml:"login_key"`
}

type StopPlugin

type StopPlugin struct {
	TargetUrl string
}

type TokenClaims

type TokenClaims struct {
	RunId      string
	Host       string
	TcpPort    int
	KcpPort    int
	TlsPort    int
	GrpcPort   int
	UDPApiPort int
	KCPApiPort int
	Permission []string
	Txts       map[string]string
	jwt.StandardClaims
}

func DecodeToken

func DecodeToken(salt, tokenStr string) (*TokenClaims, error)

func DecodeUnverifiedToken

func DecodeUnverifiedToken(tokenStr string) (*TokenClaims, error)

func (*TokenClaims) IfContainPermission added in v0.0.60

func (t *TokenClaims) IfContainPermission(permission string) bool

func (*TokenClaims) IfContainPermissions added in v0.0.60

func (t *TokenClaims) IfContainPermissions(permissions []string) bool

列表内的权限是否都包括

type UpgradePlugin

type UpgradePlugin struct {
	TargetUrl string
}

type UuidTokenClaims added in v0.0.66

type UuidTokenClaims struct {
	Uuid       string
	Role       string
	Permission []string
	Txts       map[string]string
	jwt.StandardClaims
}

func DecodeUnverifiedUuidToken added in v0.0.66

func DecodeUnverifiedUuidToken(tokenStr string) (*UuidTokenClaims, error)

func DecodeUuidToken added in v0.0.66

func DecodeUuidToken(salt, tokenStr string) (*UuidTokenClaims, error)

func (*UuidTokenClaims) IfContainPermission added in v0.0.66

func (t *UuidTokenClaims) IfContainPermission(permission string) bool

func (*UuidTokenClaims) IfContainPermissions added in v0.0.66

func (t *UuidTokenClaims) IfContainPermissions(permissions []string) bool

列表内的权限是否都包括

Jump to

Keyboard shortcuts

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