2020-05-01 05:47:46 +00:00
|
|
|
package api
|
2017-02-19 20:05:06 +00:00
|
|
|
|
2017-03-22 21:43:36 +00:00
|
|
|
import (
|
|
|
|
"github.com/gorilla/websocket"
|
|
|
|
)
|
2017-02-19 20:05:06 +00:00
|
|
|
|
|
|
|
//Registration -- A connection registration structure used to bring up a connection
|
|
|
|
//connection table will then handle additing and sdtarting up the various readers
|
|
|
|
//else error.
|
|
|
|
type Registration struct {
|
|
|
|
// The websocket connection.
|
|
|
|
conn *websocket.Conn
|
|
|
|
|
|
|
|
// Address of the Remote End Point
|
|
|
|
source string
|
|
|
|
|
2017-03-25 22:22:28 +00:00
|
|
|
// serverName
|
|
|
|
serverName string
|
|
|
|
|
2017-02-19 20:05:06 +00:00
|
|
|
// communications channel between go routines
|
|
|
|
commCh chan bool
|
|
|
|
|
|
|
|
//initialDomains - a list of domains from the JWT
|
2020-04-30 11:11:03 +00:00
|
|
|
initialDomains []string
|
2017-03-03 00:47:59 +00:00
|
|
|
|
|
|
|
connectionTrack *Tracking
|
2017-02-19 20:05:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//NewRegistration -- Constructor
|
2020-04-30 11:11:03 +00:00
|
|
|
func NewRegistration(conn *websocket.Conn, remoteAddress string, initialDomains []string, connectionTrack *Tracking, serverName string) (p *Registration) {
|
2017-02-19 20:05:06 +00:00
|
|
|
p = new(Registration)
|
|
|
|
p.conn = conn
|
|
|
|
p.source = remoteAddress
|
2017-03-25 22:22:28 +00:00
|
|
|
p.serverName = serverName
|
2017-02-19 20:05:06 +00:00
|
|
|
p.commCh = make(chan bool)
|
|
|
|
p.initialDomains = initialDomains
|
2017-03-03 00:47:59 +00:00
|
|
|
p.connectionTrack = connectionTrack
|
2017-02-19 20:05:06 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
//CommCh -- Property
|
|
|
|
func (c *Registration) CommCh() chan bool {
|
|
|
|
return c.commCh
|
|
|
|
}
|