mirror of https://github.com/cbeuw/Cloak
Remove unnecessary state variable IsAdmin
This commit is contained in:
parent
58cbb73f0f
commit
f65a46f4a9
|
|
@ -23,9 +23,9 @@ import (
|
||||||
|
|
||||||
var version string
|
var version string
|
||||||
|
|
||||||
func makeSession(sta *client.State) *mux.Session {
|
func makeSession(sta *client.State, isAdmin bool) *mux.Session {
|
||||||
log.Info("Attemtping to start a new session")
|
log.Info("Attemtping to start a new session")
|
||||||
if !sta.IsAdmin {
|
if isAdmin {
|
||||||
// sessionID is usergenerated. There shouldn't be a security concern because the scope of
|
// sessionID is usergenerated. There shouldn't be a security concern because the scope of
|
||||||
// sessionID is limited to its UID.
|
// sessionID is limited to its UID.
|
||||||
quad := make([]byte, 4)
|
quad := make([]byte, 4)
|
||||||
|
|
@ -179,7 +179,6 @@ func main() {
|
||||||
|
|
||||||
if adminUID != nil {
|
if adminUID != nil {
|
||||||
log.Infof("API base is %v:%v", listeningIP, sta.LocalPort)
|
log.Infof("API base is %v:%v", listeningIP, sta.LocalPort)
|
||||||
sta.IsAdmin = true
|
|
||||||
sta.SessionID = 0
|
sta.SessionID = 0
|
||||||
sta.UID = adminUID
|
sta.UID = adminUID
|
||||||
sta.NumConn = 1
|
sta.NumConn = 1
|
||||||
|
|
@ -196,7 +195,7 @@ func main() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if sesh == nil || sesh.IsClosed() {
|
if sesh == nil || sesh.IsClosed() {
|
||||||
sesh = makeSession(sta)
|
sesh = makeSession(sta, adminUID != nil)
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
data := make([]byte, 10240)
|
data := make([]byte, 10240)
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ type rawConfig struct {
|
||||||
UID string
|
UID string
|
||||||
PublicKey string
|
PublicKey string
|
||||||
BrowserSig string
|
BrowserSig string
|
||||||
NumConn int
|
Unordered bool
|
||||||
|
|
||||||
|
NumConn int
|
||||||
}
|
}
|
||||||
|
|
||||||
// State stores global variables
|
// State stores global variables
|
||||||
|
|
@ -33,7 +35,6 @@ type State struct {
|
||||||
SessionID uint32
|
SessionID uint32
|
||||||
UID []byte
|
UID []byte
|
||||||
staticPub crypto.PublicKey
|
staticPub crypto.PublicKey
|
||||||
IsAdmin bool
|
|
||||||
|
|
||||||
Browser Browser
|
Browser Browser
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue