mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 12:49:20 +02:00
Run "go fmt ./..."
This commit is contained in:
parent
667279af57
commit
ee21763928
|
@ -307,8 +307,8 @@ func TestRoutingRule(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
rule: &RoutingRule{
|
rule: &RoutingRule{
|
||||||
Protocol: []string{"http"},
|
Protocol: []string{"http"},
|
||||||
Attributes: map[string]string {
|
Attributes: map[string]string{
|
||||||
":path": "/test",
|
":path": "/test",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (a *VMessAccount) Build() *vmess.Account {
|
||||||
st = protocol.SecurityType_AUTO
|
st = protocol.SecurityType_AUTO
|
||||||
}
|
}
|
||||||
return &vmess.Account{
|
return &vmess.Account{
|
||||||
Id: a.ID,
|
Id: a.ID,
|
||||||
SecuritySettings: &protocol.SecurityConfig{
|
SecuritySettings: &protocol.SecurityConfig{
|
||||||
Type: st,
|
Type: st,
|
||||||
},
|
},
|
||||||
|
@ -61,7 +61,7 @@ type FeaturesConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type VMessDefaultConfig struct {
|
type VMessDefaultConfig struct {
|
||||||
Level byte `json:"level"`
|
Level byte `json:"level"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
|
|
|
@ -17,7 +17,7 @@ func Authenticate(b []byte) uint32 {
|
||||||
return fnv1hash.Sum32()
|
return fnv1hash.Sum32()
|
||||||
}
|
}
|
||||||
|
|
||||||
// [DEPRECATED 2023-06]
|
// [DEPRECATED 2023-06]
|
||||||
type NoOpAuthenticator struct{}
|
type NoOpAuthenticator struct{}
|
||||||
|
|
||||||
func (NoOpAuthenticator) NonceSize() int {
|
func (NoOpAuthenticator) NonceSize() int {
|
||||||
|
|
|
@ -30,14 +30,14 @@ import (
|
||||||
|
|
||||||
type userByEmail struct {
|
type userByEmail struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
cache map[string]*protocol.MemoryUser
|
cache map[string]*protocol.MemoryUser
|
||||||
defaultLevel uint32
|
defaultLevel uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func newUserByEmail(config *DefaultConfig) *userByEmail {
|
func newUserByEmail(config *DefaultConfig) *userByEmail {
|
||||||
return &userByEmail{
|
return &userByEmail{
|
||||||
cache: make(map[string]*protocol.MemoryUser),
|
cache: make(map[string]*protocol.MemoryUser),
|
||||||
defaultLevel: config.Level,
|
defaultLevel: config.Level,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ func (v *userByEmail) Get(email string) (*protocol.MemoryUser, bool) {
|
||||||
if !found {
|
if !found {
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
rawAccount := &vmess.Account{
|
rawAccount := &vmess.Account{
|
||||||
Id: id.String(),
|
Id: id.String(),
|
||||||
}
|
}
|
||||||
account, err := rawAccount.AsAccount()
|
account, err := rawAccount.AsAccount()
|
||||||
common.Must(err)
|
common.Must(err)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func (h *Handler) handleSwitchAccount(cmd *protocol.CommandSwitchAccount) {
|
func (h *Handler) handleSwitchAccount(cmd *protocol.CommandSwitchAccount) {
|
||||||
rawAccount := &vmess.Account{
|
rawAccount := &vmess.Account{
|
||||||
Id: cmd.ID.String(),
|
Id: cmd.ID.String(),
|
||||||
SecuritySettings: &protocol.SecurityConfig{
|
SecuritySettings: &protocol.SecurityConfig{
|
||||||
Type: protocol.SecurityType_AUTO,
|
Type: protocol.SecurityType_AUTO,
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
// TimedUserValidator is a user Validator based on time.
|
// TimedUserValidator is a user Validator based on time.
|
||||||
type TimedUserValidator struct {
|
type TimedUserValidator struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
users []*protocol.MemoryUser
|
users []*protocol.MemoryUser
|
||||||
|
|
||||||
behaviorSeed uint64
|
behaviorSeed uint64
|
||||||
behaviorFused bool
|
behaviorFused bool
|
||||||
|
|
|
@ -36,7 +36,7 @@ func NewDNS(ctx context.Context, config interface{}) (interface{}, error) {
|
||||||
|
|
||||||
buf := make([]byte, 0x100)
|
buf := make([]byte, 0x100)
|
||||||
|
|
||||||
off1, err := packDomainName(config.(*Config).Domain + ".", buf)
|
off1, err := packDomainName(config.(*Config).Domain+".", buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,8 @@ func packDomainName(s string, msg []byte) (off1 int, err error) {
|
||||||
|
|
||||||
// Emit sequence of counted strings, chopping at dots.
|
// Emit sequence of counted strings, chopping at dots.
|
||||||
var (
|
var (
|
||||||
begin int
|
begin int
|
||||||
bs []byte
|
bs []byte
|
||||||
)
|
)
|
||||||
for i := 0; i < ls; i++ {
|
for i := 0; i < ls; i++ {
|
||||||
var c byte
|
var c byte
|
||||||
|
|
|
@ -143,7 +143,7 @@ func (s *clientConnections) openConnection(ctx context.Context, destAddr net.Add
|
||||||
HandshakeIdleTimeout: time.Second * 8,
|
HandshakeIdleTimeout: time.Second * 8,
|
||||||
MaxIdleTimeout: time.Second * 300,
|
MaxIdleTimeout: time.Second * 300,
|
||||||
Tracer: func(ctx context.Context, p logging.Perspective, ci quic.ConnectionID) logging.ConnectionTracer {
|
Tracer: func(ctx context.Context, p logging.Perspective, ci quic.ConnectionID) logging.ConnectionTracer {
|
||||||
return qlog.NewConnectionTracer( &QlogWriter{connID: ci}, p, ci);
|
return qlog.NewConnectionTracer(&QlogWriter{connID: ci}, p, ci)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
udpConn, _ := rawConn.(*net.UDPConn)
|
udpConn, _ := rawConn.(*net.UDPConn)
|
||||||
|
|
|
@ -109,7 +109,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
||||||
MaxIncomingStreams: 32,
|
MaxIncomingStreams: 32,
|
||||||
MaxIncomingUniStreams: -1,
|
MaxIncomingUniStreams: -1,
|
||||||
Tracer: func(ctx context.Context, p logging.Perspective, ci quic.ConnectionID) logging.ConnectionTracer {
|
Tracer: func(ctx context.Context, p logging.Perspective, ci quic.ConnectionID) logging.ConnectionTracer {
|
||||||
return qlog.NewConnectionTracer( &QlogWriter{connID: ci}, p, ci);
|
return qlog.NewConnectionTracer(&QlogWriter{connID: ci}, p, ci)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue