mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
Chore: Run gofmt (#3990)
This commit is contained in:
parent
bc4bf3d38f
commit
83bab5dd90
50 changed files with 272 additions and 273 deletions
|
@ -30,9 +30,9 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
|
|||
// Process implements OutboundHandler.Dispatch().
|
||||
func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer internet.Dialer) error {
|
||||
outbounds := session.OutboundsFromContext(ctx)
|
||||
ob := outbounds[len(outbounds) - 1]
|
||||
ob := outbounds[len(outbounds)-1]
|
||||
ob.Name = "blackhole"
|
||||
|
||||
|
||||
nBytes := h.response.WriteTo(link.Writer)
|
||||
if nBytes > 0 {
|
||||
// Sleep a little here to make sure the response is sent to client.
|
||||
|
|
|
@ -49,7 +49,7 @@ type Handler struct {
|
|||
server net.Destination
|
||||
timeout time.Duration
|
||||
nonIPQuery string
|
||||
blockTypes []int32
|
||||
blockTypes []int32
|
||||
}
|
||||
|
||||
func (h *Handler) Init(config *Config, dnsClient dns.Client, policyManager policy.Manager) error {
|
||||
|
|
|
@ -78,7 +78,7 @@ type UserManager interface {
|
|||
|
||||
// RemoveUser removes a user by email.
|
||||
RemoveUser(context.Context, string) error
|
||||
|
||||
|
||||
// Get user by email.
|
||||
GetUser(context.Context, string) *protocol.MemoryUser
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
// MemoryAccount is an account type converted from Account.
|
||||
type MemoryAccount struct {
|
||||
Cipher Cipher
|
||||
CipherType CipherType
|
||||
CipherType CipherType
|
||||
Key []byte
|
||||
Password string
|
||||
|
||||
|
@ -42,8 +42,8 @@ func (a *MemoryAccount) Equals(another protocol.Account) bool {
|
|||
func (a *MemoryAccount) ToProto() proto.Message {
|
||||
return &Account{
|
||||
CipherType: a.CipherType,
|
||||
Password: a.Password,
|
||||
IvCheck: a.replayFilter != nil,
|
||||
Password: a.Password,
|
||||
IvCheck: a.replayFilter != nil,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,10 +117,10 @@ func (a *Account) AsAccount() (protocol.Account, error) {
|
|||
return nil, errors.New("failed to get cipher").Base(err)
|
||||
}
|
||||
return &MemoryAccount{
|
||||
Cipher: Cipher,
|
||||
Cipher: Cipher,
|
||||
CipherType: a.CipherType,
|
||||
Key: passwordToCipherKey([]byte(a.Password), Cipher.KeySize()),
|
||||
Password: a.Password,
|
||||
Key: passwordToCipherKey([]byte(a.Password), Cipher.KeySize()),
|
||||
Password: a.Password,
|
||||
replayFilter: func() antireplay.GeneralizedReplayFilter {
|
||||
if a.IvCheck {
|
||||
return antireplay.NewBloomRing()
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/crypto"
|
||||
"github.com/xtls/xray-core/common/drain"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
)
|
||||
|
|
|
@ -8,13 +8,13 @@ import (
|
|||
|
||||
// MemoryAccount is an account type converted from Account.
|
||||
type MemoryAccount struct {
|
||||
Key string
|
||||
Key string
|
||||
}
|
||||
|
||||
// AsAccount implements protocol.AsAccount.
|
||||
func (u *Account) AsAccount() (protocol.Account, error) {
|
||||
return &MemoryAccount{
|
||||
Key: u.GetKey(),
|
||||
Key: u.GetKey(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ func (i *MultiUserInbound) GetUser(ctx context.Context, email string) *protocol.
|
|||
if email == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
i.Lock()
|
||||
defer i.Unlock()
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Client, error) {
|
|||
serverPicker: protocol.NewRoundRobinServerPicker(serverList),
|
||||
policyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),
|
||||
}
|
||||
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -361,14 +361,14 @@ func (s *Server) fallback(ctx context.Context, err error, sessionPolicy policy.S
|
|||
cs := tlsConn.ConnectionState()
|
||||
name = cs.ServerName
|
||||
alpn = cs.NegotiatedProtocol
|
||||
errors.LogInfo(ctx, "realName = " + name)
|
||||
errors.LogInfo(ctx, "realAlpn = " + alpn)
|
||||
errors.LogInfo(ctx, "realName = "+name)
|
||||
errors.LogInfo(ctx, "realAlpn = "+alpn)
|
||||
} else if realityConn, ok := iConn.(*reality.Conn); ok {
|
||||
cs := realityConn.ConnectionState()
|
||||
name = cs.ServerName
|
||||
alpn = cs.NegotiatedProtocol
|
||||
errors.LogInfo(ctx, "realName = " + name)
|
||||
errors.LogInfo(ctx, "realAlpn = " + alpn)
|
||||
errors.LogInfo(ctx, "realName = "+name)
|
||||
errors.LogInfo(ctx, "realAlpn = "+alpn)
|
||||
}
|
||||
name = strings.ToLower(name)
|
||||
alpn = strings.ToLower(alpn)
|
||||
|
@ -418,7 +418,7 @@ func (s *Server) fallback(ctx context.Context, err error, sessionPolicy policy.S
|
|||
}
|
||||
if k == '?' || k == ' ' {
|
||||
path = string(firstBytes[i:j])
|
||||
errors.LogInfo(ctx, "realPath = " + path)
|
||||
errors.LogInfo(ctx, "realPath = "+path)
|
||||
if pfb[path] == nil {
|
||||
path = ""
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ func (v *Validator) Get(hash string) *protocol.MemoryUser {
|
|||
return nil
|
||||
}
|
||||
|
||||
|
||||
// Get a trojan user with hashed key, nil if user doesn't exist.
|
||||
func (v *Validator) GetByEmail(email string) *protocol.MemoryUser {
|
||||
u, _ := v.email.Load(email)
|
||||
|
|
|
@ -42,8 +42,8 @@ func (a *MemoryAccount) Equals(account protocol.Account) bool {
|
|||
|
||||
func (a *MemoryAccount) ToProto() proto.Message {
|
||||
return &Account{
|
||||
Id: a.ID.String(),
|
||||
Flow: a.Flow,
|
||||
Id: a.ID.String(),
|
||||
Flow: a.Flow,
|
||||
Encryption: a.Encryption,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ func (a *MemoryAccount) ToProto() proto.Message {
|
|||
test = test + "NoTerminationSignal"
|
||||
}
|
||||
return &Account{
|
||||
Id: a.ID.String(),
|
||||
TestsEnabled: test,
|
||||
Id: a.ID.String(),
|
||||
TestsEnabled: test,
|
||||
SecuritySettings: &protocol.SecurityConfig{Type: a.Security},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ import (
|
|||
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/dice"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/log"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue