utils

package module
v0.0.0-...-b58e9f1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const IpEnvVarName = "GEN2MODULEIP"
View Source
const IpModel = 0 // IpModel = [0,1,2] = [localhost,extIP,envVarIP]

Variables

View Source
var (
	//    Trace   *log.Logger
	Info    *logrus.Logger
	Warning *logrus.Logger
	Error   *logrus.Logger
)
View Source
var AppClientChan = []chan string{
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
	make(chan string),
}

the number of channel array elements sets the limit for max number of parallel WS app clients

View Source
var HostIP string
View Source
var Logfile *os.File

const LOG_FILE = "servercore-log.txt"

View Source
var MuxServer = []*http.ServeMux{
	http.NewServeMux(),
	http.NewServeMux(),
}
View Source
var TransportErrorMessage string
View Source
var Upgrader = websocket.Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
}

Functions

func BackendWSdataSession

func BackendWSdataSession(conn *websocket.Conn, backendChannel chan string)

func CloseLogFile

func CloseLogFile()

func ExtractFromToken

func ExtractFromToken(token string, claim string) string

func ExtractPayload

func ExtractPayload(request string, rMap *map[string]interface{})

func FinalizeMessage

func FinalizeMessage(responseMap map[string]interface{}) string

func FrontendWSdataSession

func FrontendWSdataSession(conn *websocket.Conn, clientChannel chan string, backendChannel chan string)

func GenerateHmac

func GenerateHmac(input string, key string) string

func GetModelIP

func GetModelIP(ipModel int) string

func GetRfcTime

func GetRfcTime() string

func GetServerIP

func GetServerIP() string

func InitDataSession

func InitDataSession(muxServer *http.ServeMux, regData RegData) (dataConn *websocket.Conn)

func InitLog

func InitLog(filename string, logdir string)

func PathToUrl

func PathToUrl(path string) string

func RegisterAsTransportMgr

func RegisterAsTransportMgr(regData *RegData, protocol string)

* * registerAsTransportMgr: * Registers with servercore as WebSocket protocol manager, and stores response in regData *

func SetErrorResponse

func SetErrorResponse(reqMap map[string]interface{}, errRespMap map[string]interface{}, number string, reason string, message string)

func TrimLogFile

func TrimLogFile(logFile *os.File)

* * The log file is trimmed to 20% of its size when exceeding 10MB. *

func UrlToPath

func UrlToPath(url string) string

func VerifyTokenSignature

func VerifyTokenSignature(token string, key string) bool

Types

type ClientHandler

type ClientHandler interface {
	// contains filtered or unexported methods
}

********************************************************************* Client response handlers *********************

type ClientServer

type ClientServer interface {
	InitClientServer(muxServer *http.ServeMux)
}

type HttpChannel

type HttpChannel struct {
}

type HttpServer

type HttpServer struct {
}

func (HttpServer) InitClientServer

func (server HttpServer) InitClientServer(muxServer *http.ServeMux)

type HttpWSsession

type HttpWSsession struct {
}

func (HttpWSsession) TransportHubFrontendWSsession

func (httpCoreSocketSession HttpWSsession) TransportHubFrontendWSsession(dataConn *websocket.Conn, appClientChannel []chan string)

type RegData

type RegData struct {
	Portnum int
	Urlpath string
	Mgrid   int
}

type TransportHubFrontendWSSession

type TransportHubFrontendWSSession interface {
	// contains filtered or unexported methods
}

**********Server Core Communications *******************************************************************************

type WsChannel

type WsChannel struct {
	// contains filtered or unexported fields
}

type WsServer

type WsServer struct {
	ClientBackendChannel []chan string
}

func (WsServer) InitClientServer

func (server WsServer) InitClientServer(muxServer *http.ServeMux, serverIndex *int)

type WsWSsession

type WsWSsession struct {
	ClientBackendChannel []chan string
}

func (WsWSsession) TransportHubFrontendWSsession

func (wsCoreSocketSession WsWSsession) TransportHubFrontendWSsession(dataConn *websocket.Conn, appClientChannel []chan string)

Jump to

Keyboard shortcuts

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