From c1d01c9cdb7f9664a256c7ae3296830ea8a8f4c2 Mon Sep 17 00:00:00 2001 From: Vittorio Parrella Date: Mon, 9 Dec 2024 22:44:52 +0100 Subject: [PATCH] feat: #64 - multipath configuration --- backend/backend_quicgo_mp.go | 7 +++++-- shared/configuration/defaults.go | 1 + shared/configuration/definitions.go | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/backend_quicgo_mp.go b/backend/backend_quicgo_mp.go index 988565a..c5af8bc 100644 --- a/backend/backend_quicgo_mp.go +++ b/backend/backend_quicgo_mp.go @@ -17,7 +17,7 @@ import ( stderr "github.com/Project-Faster/qpep/shared/errors" "github.com/Project-Faster/qpep/shared/logger" "github.com/Project-Faster/qpep/workers/gateway" - "github.com/project-faster/mp-quic-go" + quic "github.com/project-faster/mp-quic-go" "io/ioutil" "net" "strings" @@ -92,6 +92,8 @@ func (q *quicGoMpBackend) Close() error { func quicGoMpGetConfiguration(traceOn bool) *quic.Config { cfg := &quic.Config{ + Versions: []quic.VersionNumber{0}, + MaxReceiveConnectionFlowControlWindow: 10 * 1024 * 1024, MaxReceiveStreamFlowControlWindow: 10 * 1024 * 1024, @@ -99,7 +101,8 @@ func quicGoMpGetConfiguration(traceOn bool) *quic.Config { HandshakeTimeout: gateway.GetScaledTimeout(10, time.Second), KeepAlive: false, - CreatePaths: true, + CacheHandshake: true, + CreatePaths: true, } return cfg diff --git a/shared/configuration/defaults.go b/shared/configuration/defaults.go index 01c65bc..7f28cad 100644 --- a/shared/configuration/defaults.go +++ b/shared/configuration/defaults.go @@ -8,6 +8,7 @@ var DefaultConfig = QPepConfigType{ LocalListenPort: 9443, GatewayHost: "198.18.0.254", GatewayPort: 443, + MultipathAddressList: make([]MultipathPathConfig, 0), }, Server: &ServerDefinition{ LocalListeningAddress: "", diff --git a/shared/configuration/definitions.go b/shared/configuration/definitions.go index 383b899..14837ae 100644 --- a/shared/configuration/definitions.go +++ b/shared/configuration/definitions.go @@ -2,6 +2,12 @@ package configuration import "time" +type MultipathPathConfig struct { + Address string `json:"address"` + Port int `json:"port"` + Weight float64 `json:"weight"` +} + type ClientDefinition struct { // ListenHost (yaml:listenaddress) Address on which the local client listens for incoming connections // if subnet is 0. or 127. it will try to autodetect a good ip available @@ -13,6 +19,8 @@ type ClientDefinition struct { GatewayHost string `yaml:"gateway_address"` // GatewayPort (yaml:gateway_port) Port on which the gateway qpep server listens for quic connections GatewayPort int `yaml:"gateway_port"` + + MultipathAddressList []MultipathPathConfig `yaml:"multipath_address_list"` } type ServerDefinition struct {