Skip to content

Commit

Permalink
fix: adding fields to apipib legacy and update water impl connect opt…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
WendelHime committed Dec 3, 2024
1 parent 337278f commit 3866761
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions apipb/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"net"
"strconv"
"strings"
"time"

commonconfig "github.com/getlantern/common/config"
)
Expand Down Expand Up @@ -177,9 +178,15 @@ func ProxyToLegacyConfig(cfg *ProxyConnectConfig) (*commonconfig.ProxyConfig, er
}
case *ProxyConnectConfig_ConnectCfgWater:
legacy.PluggableTransport = "water"
duration, err := time.ParseDuration(pCfg.ConnectCfgWater.DownloadTimeout.String())
if err != nil {
duration = 5 * time.Minute
}
legacy.PluggableTransportSettings = map[string]string{
"water_wasm": base64.StdEncoding.EncodeToString(pCfg.ConnectCfgWater.Wasm),
"water_transport": pCfg.ConnectCfgWater.Transport,
"water_wasm": base64.StdEncoding.EncodeToString(pCfg.ConnectCfgWater.Wasm),
"water_transport": pCfg.ConnectCfgWater.Transport,
"wasm_available_at": strings.Join(pCfg.ConnectCfgWater.WasmAvailableAt, ","),
"download_timeout": duration.String(),
}

default:
Expand Down
2 changes: 1 addition & 1 deletion chained/water_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (

func newWaterImpl(dir, addr string, pc *config.ProxyConfig, reportDialCore reportDialCoreFn) (*waterImpl, error) {
ctx := context.Background()
wasmAvailableAt := ptSetting(pc, "water_available_at")
wasmAvailableAt := ptSetting(pc, "wasm_available_at")
transport := ptSetting(pc, "water_transport")
d := &waterImpl{
raddr: addr,
Expand Down

0 comments on commit 3866761

Please sign in to comment.