Update On Sun Dec 21 19:39:14 CET 2025

This commit is contained in:
github-action[bot]
2025-12-21 19:39:15 +01:00
parent b4025330d8
commit 5dff9b4adf
228 changed files with 11822 additions and 4873 deletions

View File

@@ -12,6 +12,7 @@ import (
"io"
"net"
"net/url"
"strings"
"sync"
"time"
@@ -331,11 +332,19 @@ func NewHTTP2Client(dialFn DialFn, tlsConfig *tls.Config, clientFingerprint stri
return wrap
}
func ServiceNameToPath(serviceName string) string {
if strings.HasPrefix(serviceName, "/") { // custom paths
return serviceName
}
return "/" + serviceName + "/Tun"
}
func StreamGunWithTransport(transport *TransportWrap, cfg *Config) (net.Conn, error) {
serviceName := "GunService"
if cfg.ServiceName != "" {
serviceName = cfg.ServiceName
}
path := ServiceNameToPath(serviceName)
reader, writer := io.Pipe()
request := &http.Request{
@@ -344,9 +353,9 @@ func StreamGunWithTransport(transport *TransportWrap, cfg *Config) (net.Conn, er
URL: &url.URL{
Scheme: "https",
Host: cfg.Host,
Path: fmt.Sprintf("/%s/Tun", serviceName),
Path: path,
// for unescape path
Opaque: fmt.Sprintf("//%s/%s/Tun", cfg.Host, serviceName),
Opaque: "//" + cfg.Host + path,
},
Proto: "HTTP/2",
ProtoMajor: 2,

View File

@@ -24,7 +24,7 @@ type ServerOption struct {
}
func NewServerHandler(options ServerOption) http.Handler {
path := "/" + options.ServiceName + "/Tun"
path := ServiceNameToPath(options.ServiceName)
connHandler := options.ConnHandler
httpHandler := options.HttpHandler
if httpHandler == nil {