mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-12 17:10:54 +00:00
start converting to backend as a struct
This commit is contained in:
parent
d49c88a222
commit
80179abc36
1 changed files with 14 additions and 5 deletions
|
@ -12,7 +12,6 @@ import (
|
|||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pmylund/go-cache"
|
||||
|
@ -24,6 +23,20 @@ const bPathAddTopic = "/topics"
|
|||
const bPathAggStats = "/stats"
|
||||
const bPathOtherCommand = "/cmd/"
|
||||
|
||||
type backend struct {
|
||||
HTTPClient http.Client
|
||||
baseURL string
|
||||
responseCache *cache.Cache
|
||||
|
||||
postStatsURL string
|
||||
addTopicURL string
|
||||
announceStartupURL string
|
||||
|
||||
sharedKey [32]byte
|
||||
serverID int
|
||||
|
||||
lastSuccess map[string]time.Time
|
||||
}
|
||||
var backendHTTPClient http.Client
|
||||
var backendURL string
|
||||
var responseCache *cache.Cache
|
||||
|
@ -35,8 +48,6 @@ var announceStartupURL string
|
|||
var backendSharedKey [32]byte
|
||||
var serverID int
|
||||
|
||||
var messageBufferPool sync.Pool
|
||||
|
||||
var lastBackendSuccess map[string]time.Time
|
||||
|
||||
func setupBackend(config *ConfigFile) {
|
||||
|
@ -61,8 +72,6 @@ func setupBackend(config *ConfigFile) {
|
|||
}
|
||||
Statistics.Health.Backend = lastBackendSuccess
|
||||
|
||||
messageBufferPool.New = New4KByteBuffer
|
||||
|
||||
var theirPublic, ourPrivate [32]byte
|
||||
copy(theirPublic[:], config.BackendPublicKey)
|
||||
copy(ourPrivate[:], config.OurPrivateKey)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue