Documentation ¶
Index ¶
- Constants
- Variables
- func GetToken(loginWithServer *LoginWithServer, permission []string, expiresecd int64) (token string, err error)
- func GetTokenByServerConfig(serverConfig *ServerConfig, expiresecd int64) (gatewayToken, openIoTHubToken string, err error)
- func GetUuidToken(key, uuid, role string, permission []string, txts map[string]string, ...) (token string, err error)
- type CheckStatusRequest
- type CheckStatusResponse
- type ConnectSSH
- type ConnectSTCP
- type ConnectSerialPort
- type ConnectTCP
- type ConnectUDP
- type ConnectWs
- type ConnectWss
- type DeleteGatewayJwt
- type Error
- type FindmDNS
- type GatewayConfig
- type GatewayLogin
- type GatewayWorkConn
- type GetMyUDPPublicAddr
- type InstallPlugin
- type JsonResponse
- type LogConfig
- type LoginWithServer
- type MDNSResult
- type Message
- type Msg
- type NewService
- type NewSubSession
- type OK
- type OpenIoTHubLogin
- type Ping
- type Pong
- type QueryInstalledPlugin
- type RemoteNetInfo
- type RemovePlugin
- type ReqNewP2PCtrlAsClient
- type ReqNewP2PCtrlAsServer
- type RequestNewWorkConn
- type RespInstalledPlugin
- type RunPlugin
- type ScanPort
- type ScanPortResult
- type ServerConfig
- type Srever
- type StopPlugin
- type TokenClaims
- type UpgradePlugin
- type UuidTokenClaims
Constants ¶
View Source
const PermissionGatewayLogin = "gateway"
View Source
const PermissionOpenIoTHubLogin = "openiothub"
Variables ¶
View Source
var ( TypeMap = make(map[string]reflect.Type) TypeStringMap = make(map[reflect.Type]string) Types = []interface{}{ GatewayLogin{}, GatewayWorkConn{}, OpenIoTHubLogin{}, ConnectTCP{}, ConnectSTCP{}, ConnectUDP{}, ConnectWs{}, ConnectWss{}, ConnectSerialPort{}, ConnectSSH{}, NewSubSession{}, RemoteNetInfo{}, ReqNewP2PCtrlAsServer{}, ReqNewP2PCtrlAsClient{}, CheckStatusRequest{}, CheckStatusResponse{}, NewService{}, RequestNewWorkConn{}, GetMyUDPPublicAddr{}, net.UDPAddr{}, Ping{}, Pong{}, OK{}, Error{}, JsonResponse{}, DeleteGatewayJwt{}, } )
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)
Types ¶
type CheckStatusRequest ¶
type CheckStatusResponse ¶
type ConnectSSH ¶
type ConnectSTCP ¶
type ConnectSerialPort ¶
type ConnectSerialPort serial.OpenOptions
type ConnectTCP ¶
connect //tcp,stcp,udp,serialport,ws,wss
type ConnectUDP ¶
type ConnectWss ¶
type DeleteGatewayJwt ¶ added in v0.0.65
type DeleteGatewayJwt struct { }
type GatewayConfig ¶
type GatewayConfig struct { GatewayUUID string LogConfig *LogConfig LoginWithTokenList []string LoginWithServerConf []*LoginWithServer }
网关的配置文件
type GatewayLogin ¶
login
type GatewayWorkConn ¶
type GetMyUDPPublicAddr ¶
type GetMyUDPPublicAddr struct{}
type JsonResponse ¶
type LoginWithServer ¶ added in v0.0.57
type MDNSResult ¶
type NewService ¶
type NewSubSession ¶
type NewSubSession struct{}
type OpenIoTHubLogin ¶
Connect TO
type RemoteNetInfo ¶
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 RespInstalledPlugin ¶
type RespInstalledPlugin struct{}
type ScanPortResult ¶
type ScanPortResult []int
type ServerConfig ¶
type ServerConfig struct { 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 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
列表内的权限是否都包括
Click to show internal directories.
Click to hide internal directories.