Hysteria inbound: Use transport's authentication when there are no clients (#5942)

This commit is contained in:
LjhAUMEM
2026-04-15 20:13:15 +08:00
committed by GitHub
parent 5c3d639c09
commit ff6126463b
3 changed files with 9 additions and 19 deletions

View File

@@ -450,6 +450,7 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
}
requireDatagram := hyCtx.RequireDatagramFromContext(ctx)
dest.Network = net.Network_UDP
config := streamSettings.ProtocolSettings.(*Config)
initmanager.Do(func() {
@@ -464,8 +465,8 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
},
}).Start()
})
manager.mutex.Lock()
dest.Network = net.Network_UDP
c, ok := manager.m[dialerConf{Destination: dest, MemoryStreamConfig: streamSettings}]
if !ok {
c = &client{

View File

@@ -175,10 +175,10 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var user *protocol.MemoryUser
var ok bool
if h.validator != nil {
if h.validator != nil && h.validator.GetCount() > 0 {
user = h.validator.Get(auth)
} else if auth == h.config.Auth {
ok = true
} else if h.config.Auth != "" {
ok = auth == h.config.Auth
}
if user != nil || ok {