From 248578086fc82a86b005f809f29235310a000cc5 Mon Sep 17 00:00:00 2001 From: H1JK Date: Fri, 27 Jan 2023 11:31:58 +0800 Subject: [PATCH] feat: Converter support WS early data parameters --- common/convert/v.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/common/convert/v.go b/common/convert/v.go index 02c7b707..eb2073c3 100644 --- a/common/convert/v.go +++ b/common/convert/v.go @@ -2,7 +2,9 @@ package convert import ( "errors" + "fmt" "net/url" + "strconv" "strings" ) @@ -94,6 +96,17 @@ func handleVShareLink(names map[string]int, url *url.URL, scheme string, proxy m wsOpts["path"] = query.Get("path") wsOpts["headers"] = headers + if earlyData := query.Get("ed"); earlyData != "" { + med, err := strconv.Atoi(earlyData) + if err != nil { + return fmt.Errorf("bad WebSocket max early data size: %v", err) + } + wsOpts["max-early-data"] = med + } + if earlyDataHeader := query.Get("eh"); earlyDataHeader != "" { + wsOpts["early-data-header-name"] = earlyDataHeader + } + proxy["ws-opts"] = wsOpts case "grpc":