mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-17 14:57:44 -05:00
clean up code
This commit is contained in:
parent
1432278c2c
commit
bbd3988f3d
@ -16,10 +16,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Test_parseResponse(t *testing.T) {
|
func Test_parseResponse(t *testing.T) {
|
||||||
type args struct {
|
|
||||||
payload []byte
|
|
||||||
}
|
|
||||||
|
|
||||||
var p [][]byte
|
var p [][]byte
|
||||||
|
|
||||||
ans := new(dns.Msg)
|
ans := new(dns.Msg)
|
||||||
|
@ -308,7 +308,7 @@ func (s *Server) lookupIPInternal(domain string, option IPOption) ([]net.IP, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// skip domain without any dot
|
// skip domain without any dot
|
||||||
if strings.Index(domain, ".") == -1 {
|
if !strings.Contains(domain, ".") {
|
||||||
return nil, newError("invalid domain name").AtWarning()
|
return nil, newError("invalid domain name").AtWarning()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,10 +294,7 @@ func NewAttributeMatcher(code string) (*AttributeMatcher, error) {
|
|||||||
return nil, newError("attr rule").Base(err)
|
return nil, newError("attr rule").Base(err)
|
||||||
}
|
}
|
||||||
p, err := starlark.FileProgram(starFile, func(name string) bool {
|
p, err := starlark.FileProgram(starFile, func(name string) bool {
|
||||||
if name == "attrs" {
|
return name == "attrs"
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -126,8 +126,6 @@ type VMessOutboundConfig struct {
|
|||||||
Receivers []*VMessOutboundTarget `json:"vnext"`
|
Receivers []*VMessOutboundTarget `json:"vnext"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var bUser = "a06fe789-5ab1-480b-8124-ae4599801ff3"
|
|
||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
func (c *VMessOutboundConfig) Build() (proto.Message, error) {
|
func (c *VMessOutboundConfig) Build() (proto.Message, error) {
|
||||||
config := new(outbound.Config)
|
config := new(outbound.Config)
|
||||||
|
@ -50,7 +50,6 @@ func ReadTCPSession(user *protocol.MemoryUser, reader io.Reader) (*protocol.Requ
|
|||||||
return nil, nil, newError("failed to initialize decoding stream").Base(err).AtError()
|
return nil, nil, newError("failed to initialize decoding stream").Base(err).AtError()
|
||||||
}
|
}
|
||||||
br := &buf.BufferedReader{Reader: r}
|
br := &buf.BufferedReader{Reader: r}
|
||||||
reader = nil
|
|
||||||
|
|
||||||
authenticator := NewAuthenticator(HeaderKeyGenerator(account.Key, iv))
|
authenticator := NewAuthenticator(HeaderKeyGenerator(account.Key, iv))
|
||||||
request := &protocol.RequestHeader{
|
request := &protocol.RequestHeader{
|
||||||
|
@ -159,8 +159,7 @@ func (v *TimedUserValidator) Get(userHash []byte) (*protocol.MemoryUser, protoco
|
|||||||
copy(fixedSizeHash[:], userHash)
|
copy(fixedSizeHash[:], userHash)
|
||||||
pair, found := v.userHash[fixedSizeHash]
|
pair, found := v.userHash[fixedSizeHash]
|
||||||
if found {
|
if found {
|
||||||
var user protocol.MemoryUser
|
user := pair.user.user
|
||||||
user = pair.user.user
|
|
||||||
if atomic.LoadUint32(pair.taintedFuse) == 0 {
|
if atomic.LoadUint32(pair.taintedFuse) == 0 {
|
||||||
return &user, protocol.Timestamp(pair.timeInc) + v.baseTime, true, nil
|
return &user, protocol.Timestamp(pair.timeInc) + v.baseTime, true, nil
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
type Server struct {
|
type Server struct {
|
||||||
Port net.Port
|
Port net.Port
|
||||||
PathHandler map[string]http.HandlerFunc
|
PathHandler map[string]http.HandlerFunc
|
||||||
accepting bool
|
|
||||||
server *http.Server
|
server *http.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user