|
@@ -3,7 +3,6 @@ package loadbalance
|
|
|
import (
|
|
|
"strings"
|
|
|
"sync"
|
|
|
- "sync/atomic"
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
"github.com/gorilla/sessions"
|
|
@@ -43,10 +42,10 @@ type Upstream struct {
|
|
|
|
|
|
//Load balancing configs
|
|
|
Weight int //Random weight for round robin, 0 for fallback only
|
|
|
- MaxConn int //Maxmium connection to this server, 0 for unlimited
|
|
|
+ MaxConn int //TODO: Maxmium connection to this server, 0 for unlimited
|
|
|
|
|
|
- currentConnectionCounts atomic.Uint64 //Counter for number of client currently connected
|
|
|
- proxy *dpcore.ReverseProxy
|
|
|
+ //currentConnectionCounts atomic.Uint64 //Counter for number of client currently connected
|
|
|
+ proxy *dpcore.ReverseProxy
|
|
|
}
|
|
|
|
|
|
// Create a new load balancer
|
|
@@ -57,7 +56,7 @@ func NewLoadBalancer(options *Options) *RouteManager {
|
|
|
}
|
|
|
|
|
|
//Generate a session store for stickySession
|
|
|
- store := sessions.NewCookieStore([]byte("something-very-secret"))
|
|
|
+ store := sessions.NewCookieStore([]byte(options.SystemUUID))
|
|
|
return &RouteManager{
|
|
|
SessionStore: store,
|
|
|
LoadBalanceMap: sync.Map{},
|