common

package
v0.0.0-...-b78f4d8 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SchemaProxy SchemaProxy
	SchemaProxy = "proxy"
)

Variables

View Source
var (
	VSecretkey  = flag.String("verifySecretkey", "gxG3Vq9cnB86", "verify secret key")
	ServiceAddr = flag.String("serviceAddr", "", "ip:port")

	EtcdCli *clientv3.Client = nil
)

Functions

func EtcdInit

func EtcdInit()

EtcdInit init etcd

func GetHash

func GetHash(text string) string

GetHash sha256=64len md5=32len sha1=40len

func HandleExit

func HandleExit(exitProc func())

HandleExit handle exit signal

func Reg2etcd

func Reg2etcd(addr, authname string)

Reg2etcd Regregister to gateway: /proxy/authname/

Types

type LoginByLoginOrPlatform

type LoginByLoginOrPlatform struct {

	// Login server
	UID     string `json:"UID"`     // user ID
	DBToken string `json:"DBToken"` // user token

	// Platform server
	PID            string  `json:"PID"`            // Platform ID
	Info           *string `json:"Info"`           // login info
	Token          string  `json:"Token"`          // Token=sha256(TimestampMicro+PID+Platform+Info+verifySecretkey)
	Platform       string  `json:"Platform"`       // Platform name
	TimestampMicro int64   `json:"TimestampMicro"` // timestamp

}

LoginByLoginOrPlatform The user will log in using Login or Platform authentication information, and will return LoginRequ2ws if successful

type LoginRequ2ws

type LoginRequ2ws struct {
	UID     string `json:"UID"`     // user ID, In WATCH mode this is the ID of the watch
	DBToken string `json:"DBToken"` // Login with DBToken

	Info           string   `json:"Info"`           // login info
	Token          string   `json:"Token"`          // Token=sha256(TimestampMicro+UID+DBToken+Info+verifySecretkey)
	TimestampMicro int64    `json:"TimestampMicro"` // timestamp
	Keeps          []string `json:"Keeps"`          // some connects that was kept
}

LoginRequ2ws This json is transparently passed to the gateway. So you can design an authentication server not associated with the gateway.

type Platform

type Platform struct {
	PID            string  `json:"PID"`            // Platform ID
	Info           *string `json:"Info"`           // login info
	Token          string  `json:"Token"`          // Token=sha256(TimestampMicro+PID+Platform+Info+verifySecretkey)
	Platform       string  `json:"Platform"`       // Platform name
	TimestampMicro int64   `json:"TimestampMicro"` // timestamp
}

Platform This json is generated by the platform authentication server and passed to the login server for login

Jump to

Keyboard shortcuts

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