Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
agioi authored and kslr committed Jun 26, 2020
1 parent 1432278 commit bbd3988
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 15 deletions.
4 changes: 0 additions & 4 deletions app/dns/dnscommon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ import (
)

func Test_parseResponse(t *testing.T) {
type args struct {
payload []byte
}

var p [][]byte

ans := new(dns.Msg)
Expand Down
2 changes: 1 addition & 1 deletion app/dns/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (s *Server) lookupIPInternal(domain string, option IPOption) ([]net.IP, err
}

// skip domain without any dot
if strings.Index(domain, ".") == -1 {
if !strings.Contains(domain, ".") {
return nil, newError("invalid domain name").AtWarning()
}

Expand Down
5 changes: 1 addition & 4 deletions app/router/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,7 @@ func NewAttributeMatcher(code string) (*AttributeMatcher, error) {
return nil, newError("attr rule").Base(err)
}
p, err := starlark.FileProgram(starFile, func(name string) bool {
if name == "attrs" {
return true
}
return false
return name == "attrs"
})
if err != nil {
return nil, err
Expand Down
2 changes: 0 additions & 2 deletions infra/conf/vmess.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ type VMessOutboundConfig struct {
Receivers []*VMessOutboundTarget `json:"vnext"`
}

var bUser = "a06fe789-5ab1-480b-8124-ae4599801ff3"

// Build implements Buildable
func (c *VMessOutboundConfig) Build() (proto.Message, error) {
config := new(outbound.Config)
Expand Down
1 change: 0 additions & 1 deletion proxy/shadowsocks/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
br := &buf.BufferedReader{Reader: r}
reader = nil

authenticator := NewAuthenticator(HeaderKeyGenerator(account.Key, iv))
request := &protocol.RequestHeader{
Expand Down
3 changes: 1 addition & 2 deletions proxy/vmess/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ func (v *TimedUserValidator) Get(userHash []byte) (*protocol.MemoryUser, protoco
copy(fixedSizeHash[:], userHash)
pair, found := v.userHash[fixedSizeHash]
if found {
var user protocol.MemoryUser
user = pair.user.user
user := pair.user.user
if atomic.LoadUint32(pair.taintedFuse) == 0 {
return &user, protocol.Timestamp(pair.timeInc) + v.baseTime, true, nil
}
Expand Down
1 change: 0 additions & 1 deletion testing/servers/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
type Server struct {
Port net.Port
PathHandler map[string]http.HandlerFunc
accepting bool
server *http.Server
}

Expand Down

0 comments on commit bbd3988

Please sign in to comment.