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