Merge branch 'master' into client
This commit is contained in:
commit
dcdc26068b
18
main.go
18
main.go
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/spf13/viper"
|
||||
lumberjack "gopkg.in/natefinch/lumberjack.v2"
|
||||
|
||||
"git.daplie.com/Daplie/go-rvpn-server/rvpn/genericlistener"
|
||||
"git.daplie.com/Daplie/go-rvpn-server/rvpn/server"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -31,7 +31,7 @@ var (
|
|||
argServerAdminBinding string
|
||||
argServerExternalBinding string
|
||||
argDeadTime int
|
||||
connectionTable *genericlistener.Table
|
||||
connectionTable *server.Table
|
||||
secretKey = "abc123"
|
||||
wssHostName = "localhost.daplie.me"
|
||||
adminHostName = "rvpn.daplie.invalid"
|
||||
|
@ -71,7 +71,7 @@ func main() {
|
|||
}
|
||||
|
||||
// send the output io.Writing to the other packages
|
||||
genericlistener.InitLogging(logoutput)
|
||||
server.InitLogging(logoutput)
|
||||
|
||||
loginfo = log.New(logoutput, "INFO: main: ", logFlags)
|
||||
logdebug = log.New(logoutput, "DEBUG: main:", logFlags)
|
||||
|
@ -107,12 +107,12 @@ func main() {
|
|||
ctx, cancelContext := context.WithCancel(context.Background())
|
||||
defer cancelContext()
|
||||
|
||||
serverStatus := genericlistener.NewStatus(ctx)
|
||||
serverStatus := server.NewStatus(ctx)
|
||||
serverStatus.AdminDomain = adminHostName
|
||||
serverStatus.WssDomain = wssHostName
|
||||
serverStatus.Name = serverName
|
||||
serverStatus.StartTime = time.Now()
|
||||
serverStatus.DeadTime = genericlistener.NewStatusDeadTime(dwell, idle, cancelcheck)
|
||||
serverStatus.DeadTime = server.NewStatusDeadTime(dwell, idle, cancelcheck)
|
||||
serverStatus.LoadbalanceDefaultMethod = lbDefaultMethod
|
||||
|
||||
// Setup for GenericListenServe.
|
||||
|
@ -124,16 +124,16 @@ func main() {
|
|||
// - if tls, establish, protocol peek buffer, else decrypted
|
||||
// - match protocol
|
||||
|
||||
connectionTracking := genericlistener.NewTracking()
|
||||
connectionTracking := server.NewTracking()
|
||||
serverStatus.ConnectionTracking = connectionTracking
|
||||
go connectionTracking.Run(ctx)
|
||||
|
||||
connectionTable = genericlistener.NewTable(dwell, idle)
|
||||
connectionTable = server.NewTable(dwell, idle)
|
||||
serverStatus.ConnectionTable = connectionTable
|
||||
go connectionTable.Run(ctx, lbDefaultMethod)
|
||||
|
||||
genericListeners := genericlistener.NewGenerListeners(ctx, secretKey, certbundle, serverStatus)
|
||||
serverStatus.GenericListeners = genericListeners
|
||||
genericListeners := server.NewGenerListeners(ctx, secretKey, certbundle, serverStatus)
|
||||
//serverStatus.GenericListeners = genericListeners
|
||||
|
||||
go genericListeners.Run(ctx, argGenericBinding)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//ConnectionStatsAPI --
|
||||
type ConnectionStatsAPI struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//DomainsAPI -- A collections of all the domains
|
||||
//List of Domains -> DomainAPI
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import "time"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//ServerDomainsAPI -- Structure to support the server API
|
||||
type ServerDomainsAPI struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import "time"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"time"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//StatusDeadTimeAPI -- structure for deadtime configuration
|
||||
type StatusDeadTimeAPI struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//TrafficStats --
|
||||
type TrafficAPI struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"bufio"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"github.com/gorilla/websocket"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//DomainMapping --
|
||||
type DomainMapping struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//DomainTrack -- Tracking specifics for domains
|
||||
type DomainTrack struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"bufio"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -43,8 +43,8 @@ func NewListenerRegistration(port int) (p *ListenerRegistration) {
|
|||
return
|
||||
}
|
||||
|
||||
//GenericListeners -
|
||||
type GenericListeners struct {
|
||||
//servers -
|
||||
type servers struct {
|
||||
listeners map[*net.Listener]int
|
||||
ctx context.Context
|
||||
connnectionTable *Table
|
||||
|
@ -52,7 +52,7 @@ type GenericListeners struct {
|
|||
secretKey string
|
||||
certbundle tls.Certificate
|
||||
register chan *ListenerRegistration
|
||||
genericListeners *GenericListeners
|
||||
servers *servers
|
||||
wssHostName string
|
||||
adminHostName string
|
||||
cancelCheck int
|
||||
|
@ -61,8 +61,8 @@ type GenericListeners struct {
|
|||
}
|
||||
|
||||
//NewGenerListeners --
|
||||
func NewGenerListeners(ctx context.Context, secretKey string, certbundle tls.Certificate, serverStatus *Status) (p *GenericListeners) {
|
||||
p = new(GenericListeners)
|
||||
func NewGenerListeners(ctx context.Context, secretKey string, certbundle tls.Certificate, serverStatus *Status) (p *servers) {
|
||||
p = new(servers)
|
||||
p.listeners = make(map[*net.Listener]int)
|
||||
p.ctx = ctx
|
||||
p.connnectionTable = serverStatus.ConnectionTable
|
||||
|
@ -81,7 +81,7 @@ func NewGenerListeners(ctx context.Context, secretKey string, certbundle tls.Cer
|
|||
//Run -- Execute
|
||||
// - execute the GenericLister
|
||||
// - pass initial port, we'll announce that
|
||||
func (gl *GenericListeners) Run(ctx context.Context, initialPort int) {
|
||||
func (gl *servers) Run(ctx context.Context, initialPort int) {
|
||||
loginfo.Println("ConnectionTable starting")
|
||||
|
||||
config := &tls.Config{Certificates: []tls.Certificate{gl.certbundle}}
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"io"
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//SendTrack -- Used as a channel communication to id domain asssociated to domain for outbound WSS
|
||||
type SendTrack struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
@ -15,8 +15,8 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
loginfo = log.New(os.Stdout, "INFO: genericlistener: ", logFlags)
|
||||
logdebug = log.New(os.Stdout, "DEBUG: genericlistener:", logFlags)
|
||||
loginfo = log.New(os.Stdout, "INFO: server: ", logFlags)
|
||||
logdebug = log.New(os.Stdout, "DEBUG: server:", logFlags)
|
||||
connectionID = 0
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -15,7 +15,7 @@ type Status struct {
|
|||
DeadTime *StatusDeadTime
|
||||
ConnectionTracking *Tracking
|
||||
ConnectionTable *Table
|
||||
GenericListeners *GenericListeners
|
||||
servers *servers
|
||||
LoadbalanceDefaultMethod string
|
||||
AdminStats *TrafficStats
|
||||
AdminReqTyoe *AdminReqType
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//StatusDeadTime -- structure for deadtime configuration
|
||||
type StatusDeadTime struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import "sync"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//ConnectionStats --
|
||||
type ConnectionStats struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
//TrafficStats --
|
||||
type TrafficStats struct {
|
|
@ -1,4 +1,4 @@
|
|||
package genericlistener
|
||||
package server
|
||||
|
||||
import (
|
||||
"errors"
|
Loading…
Reference in New Issue