refactor(kcptun): передавать Profile/FEC явно через config вместо process-wide env
This commit is contained in:
1 parent
9459e94066
commit
483e45d68a
6 files changed
+114
-137
No files matched your search
@@ -22,7 +22,7 @@ import (
|
||||
// Handle wraps dtlsConn in KCP+smux and forwards each accepted stream as a TCP
|
||||
// connection to connectAddr. Streams whose first 4 bytes match the bond magic
|
||||
// are handed off to registry.
|
||||
func Handle(ctx context.Context, logger logx.Logger, registry *bondserver.Registry, dtlsConn net.Conn, connectAddr string) {
|
||||
func Handle(ctx context.Context, logger logx.Logger, registry *bondserver.Registry, dtlsConn net.Conn, connectAddr string, kcpProfile kcptun.Profile, kcpFEC kcptun.FEC) {
|
||||
statsCtx, statsCancel := context.WithCancel(ctx)
|
||||
defer statsCancel()
|
||||
st := stats.New(logger.DebugEnabled())
|
||||
@@ -34,7 +34,7 @@ func Handle(ctx context.Context, logger logx.Logger, registry *bondserver.Regist
|
||||
"from-client",
|
||||
)
|
||||
|
||||
kcpSess, err := kcptun.NewKCPOverDTLS(&stats.CountingConn{Conn: dtlsConn, Stats: st}, true)
|
||||
kcpSess, err := kcptun.NewKCPOverDTLS(&stats.CountingConn{Conn: dtlsConn, Stats: st}, true, kcpProfile, kcpFEC)
|
||||
if err != nil {
|
||||
logger.Errorf("tcpfwdserver: KCP session: %s", err)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user