Hysteria: Fix transport's "udphop without salamander" dialing issue; Require "version": 2 in outbound's settings as well (#5537)

Updated example: https://github.com/XTLS/Xray-core/pull/5508#issue-3795798712
This commit is contained in:
LjhAUMEM
2026-01-14 18:42:07 +08:00
committed by GitHub
parent 0443de7798
commit 649e989fa2
5 changed files with 31 additions and 7 deletions

View File

@@ -1,19 +1,25 @@
package conf
import (
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/proxy/hysteria"
"google.golang.org/protobuf/proto"
)
type HysteriaClientConfig struct {
Version int32 `json:"version"`
Address *Address `json:"address"`
Port uint16 `json:"port"`
}
func (c *HysteriaClientConfig) Build() (proto.Message, error) {
config := new(hysteria.ClientConfig)
if c.Version != 2 {
return nil, errors.New("version != 2")
}
config := &hysteria.ClientConfig{}
config.Version = c.Version
config.Server = &protocol.ServerEndpoint{
Address: c.Address.Build(),
Port: uint32(c.Port),

View File

@@ -453,7 +453,7 @@ func (c *HysteriaConfig) Build() (proto.Message, error) {
}
config := &hysteria.Config{}
config.Version = int32(c.Version)
config.Version = c.Version
config.Auth = c.Auth
config.Up = up
config.Down = down