1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 15:27:43 +00:00

convert serverID

This commit is contained in:
Kane York 2016-06-02 08:30:49 -07:00
parent 80179abc36
commit cd7faaba38
2 changed files with 11 additions and 5 deletions

View file

@ -23,7 +23,7 @@ const bPathAddTopic = "/topics"
const bPathAggStats = "/stats"
const bPathOtherCommand = "/cmd/"
type backend struct {
type backendInfo struct {
HTTPClient http.Client
baseURL string
responseCache *cache.Cache
@ -37,6 +37,9 @@ type backend struct {
lastSuccess map[string]time.Time
}
var Backend *backendInfo
var backendHTTPClient http.Client
var backendURL string
var responseCache *cache.Cache
@ -46,12 +49,13 @@ var addTopicURL string
var announceStartupURL string
var backendSharedKey [32]byte
var serverID int
var lastBackendSuccess map[string]time.Time
func setupBackend(config *ConfigFile) {
serverID = config.ServerID
func setupBackend(config *ConfigFile) *backendInfo {
b := new(backendInfo)
Backend = b
b.serverID = config.ServerID
backendHTTPClient.Timeout = 60 * time.Second
backendURL = config.BackendURL
@ -77,6 +81,8 @@ func setupBackend(config *ConfigFile) {
copy(ourPrivate[:], config.OurPrivateKey)
box.Precompute(&backendSharedKey, &theirPublic, &ourPrivate)
return b
}
func getCacheKey(remoteCommand, data string) string {

View file

@ -58,7 +58,7 @@ func SealRequest(form url.Values) (url.Values, error) {
retval := url.Values{
"nonce": []string{nonceString},
"msg": []string{cipherString},
"id": []string{strconv.Itoa(serverID)},
"id": []string{strconv.Itoa(Backend.serverID)},
}
return retval, nil