Skip to content

Commit

Permalink
add --client-facing-pto option, which is used instead of default PTO …
Browse files Browse the repository at this point in the history
…behavior
  • Loading branch information
birneee committed Jan 19, 2023
1 parent 25f5048 commit 58c7216
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/birneee/hquic-proxy-go
go 1.19

replace (
github.com/lucas-clemente/quic-go => github.com/birneee/quic-go v0.32.1-0.20230117144234-e74c4c6edb8d
github.com/lucas-clemente/quic-go => github.com/birneee/quic-go v0.32.1-0.20230119083324-1897b9d18542
github.com/marten-seemann/qtls-go1-19 => github.com/birneee/qtls-go1-19 v0.1.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/birneee/qtls-go1-19 v0.1.0 h1:6Uq+3e1RgZH0olDHU2rNK+JB7D7IUVr0KBBrsZoxQRI=
github.com/birneee/qtls-go1-19 v0.1.0/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI=
github.com/birneee/quic-go v0.32.1-0.20230117144234-e74c4c6edb8d h1:jD7OvyFoNV/5f0dGt9XfrQmgNg9m9C+7bvOMQAueZzk=
github.com/birneee/quic-go v0.32.1-0.20230117144234-e74c4c6edb8d/go.mod h1:Rivb+tPQjcX5cxHyVy5eDiAOBxhS1OWYUlAjHJbaLR0=
github.com/birneee/quic-go v0.32.1-0.20230119083324-1897b9d18542 h1:Qfr4FkEWhqC+RXvIIh+DHJuIxiq7q2hRdHcfwd9OwS8=
github.com/birneee/quic-go v0.32.1-0.20230119083324-1897b9d18542/go.mod h1:Rivb+tPQjcX5cxHyVy5eDiAOBxhS1OWYUlAjHJbaLR0=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
Expand Down
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ func main() {
Usage: "use the hybla-westwood congestion control algorithms on the client facing proxy connection",
Value: false,
},
&cli.IntFlag{
Name: "client-facing-pto",
Usage: "if not zero, use this fixed PTO in milliseconds instead of the default PTO behavior",
Value: 0,
},
&cli.StringFlag{
Name: "server-facing-initial-receive-window",
Usage: "the initial receive window on the server facing proxy connection, in bytes, overwrites the value from the handover state",
Expand Down Expand Up @@ -214,6 +219,7 @@ func main() {
OverwriteInitialReceiveWindow: clientSideInitialReceiveWindow,
HyblaWestwoodCongestionControl: c.Bool("client-facing-hybla-westwood"),
Tracer: clientFacingTracer,
FixedPTO: time.Duration(c.Int("client-facing-pto")) * time.Millisecond,
},
})
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/lucas-clemente/quic-go/logging"
"net"
"os"
"time"
)

type proxy struct {
Expand All @@ -34,6 +35,7 @@ type RestoreConfig struct {
// add a proxy on this connection after restore
ProxyConf *quic.ProxyConfig
HyblaWestwoodCongestionControl bool
FixedPTO time.Duration
}

func populateRestoreConfig(config *RestoreConfig) *RestoreConfig {
Expand Down Expand Up @@ -243,6 +245,7 @@ func applyConfig(originalHandoverState *handover.State, pcc *RestoreConfig, trac
}

conf.HyblaWestwoodCongestionControl = pcc.HyblaWestwoodCongestionControl
conf.FixedPTO = pcc.FixedPTO

if pcc.Tracer != nil {
conf.Tracer = logging.NewMultiplexedTracer(tracer, pcc.Tracer)
Expand Down

0 comments on commit 58c7216

Please sign in to comment.