mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Improve configuration detector (cone or symmetric)
This commit is contained in:
parent
43eb5d1b25
commit
ee15cc253f
9 changed files with 47 additions and 30 deletions
|
@ -24,6 +24,7 @@ type Server struct {
|
|||
config *ServerConfig
|
||||
user *protocol.MemoryUser
|
||||
policyManager policy.Manager
|
||||
cone bool
|
||||
}
|
||||
|
||||
// NewServer create a new Shadowsocks server.
|
||||
|
@ -42,6 +43,7 @@ func NewServer(ctx context.Context, config *ServerConfig) (*Server, error) {
|
|||
config: config,
|
||||
user: mUser,
|
||||
policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),
|
||||
cone: ctx.Value("cone").(bool),
|
||||
}
|
||||
|
||||
return s, nil
|
||||
|
@ -144,7 +146,7 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
|
|||
|
||||
data.UDP = &destination
|
||||
|
||||
if !buf.Cone || dest == nil {
|
||||
if !s.cone || dest == nil {
|
||||
dest = &destination
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue