Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: fix lint according to golangci-lint errors #781

Merged
merged 2 commits into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Chore: fix lint according to golangci-lint errors
  • Loading branch information
Loyalsoldier committed Mar 13, 2021
commit 54d39c7b84da88f4c99dba02da53c60d7dd28596
20 changes: 9 additions & 11 deletions app/dispatcher/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,17 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
common.Interrupt(link.Reader)
return
}
} else {
if d.router != nil {
if route, err := d.router.PickRoute(routing_session.AsRoutingContext(ctx)); err == nil {
tag := route.GetOutboundTag()
if h := d.ohm.GetHandler(tag); h != nil {
newError("taking detour [", tag, "] for [", destination, "]").WriteToLog(session.ExportIDToError(ctx))
handler = h
} else {
newError("non existing tag: ", tag).AtWarning().WriteToLog(session.ExportIDToError(ctx))
}
} else if d.router != nil {
if route, err := d.router.PickRoute(routing_session.AsRoutingContext(ctx)); err == nil {
tag := route.GetOutboundTag()
if h := d.ohm.GetHandler(tag); h != nil {
newError("taking detour [", tag, "] for [", destination, "]").WriteToLog(session.ExportIDToError(ctx))
handler = h
} else {
newError("default route for ", destination).WriteToLog(session.ExportIDToError(ctx))
newError("non existing tag: ", tag).AtWarning().WriteToLog(session.ExportIDToError(ctx))
}
} else {
newError("default route for ", destination).WriteToLog(session.ExportIDToError(ctx))
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/reverse/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"context"
"time"

"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/proto"

"github.com/v2fly/v2ray-core/v4/common/mux"
"github.com/v2fly/v2ray-core/v4/common/net"
Expand Down
1 change: 0 additions & 1 deletion app/router/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
}
conds.Add(matcher)
}

}

if len(rr.UserEmail) > 0 {
Expand Down
8 changes: 4 additions & 4 deletions common/mux/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ type DialingWorkerFactory struct {
ctx context.Context
}

func NewDialingWorkerFactory(ctx context.Context, Proxy proxy.Outbound, Dialer internet.Dialer, Strategy ClientStrategy) *DialingWorkerFactory {
func NewDialingWorkerFactory(ctx context.Context, proxy proxy.Outbound, dialer internet.Dialer, strategy ClientStrategy) *DialingWorkerFactory {
return &DialingWorkerFactory{
Proxy: Proxy,
Dialer: Dialer,
Strategy: Strategy,
Proxy: proxy,
Dialer: dialer,
Strategy: strategy,
ctx: ctx,
}
}
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"
"strings"

"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/proto"

"github.com/v2fly/v2ray-core/v4/common"
"github.com/v2fly/v2ray-core/v4/common/buf"
Expand Down
2 changes: 1 addition & 1 deletion functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"testing"
"time"

"github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp"
"google.golang.org/protobuf/proto"

core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/app/dispatcher"
Expand Down
1 change: 1 addition & 0 deletions main/distro/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
_ "github.com/v2fly/v2ray-core/v4/app/router"
_ "github.com/v2fly/v2ray-core/v4/app/stats"

// Fix dependency cycle caused by core import in internet package
_ "github.com/v2fly/v2ray-core/v4/transport/internet/tagged/taggedimpl"

// Inbound and outbound proxies.
Expand Down
3 changes: 1 addition & 2 deletions proxy/vmess/encoding/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request
}
if s.isAEADForced {
return nil, drainConnection(newError("invalid user: VMessAEAD is enforced and a non VMessAEAD connection is received. You can still disable this security feature with environment variable v2ray.vmess.aead.forced = false . You will not be able to enable legacy header workaround in the future."))
} else {
newError("Critical Warning: potentially invalid user: a non VMessAEAD connection is received. From 2022 Jan 1st, this kind of connection will be rejected by default. You should update or replace your client software now. ").AtWarning().WriteToLog()
}
newError("Critical Warning: potentially invalid user: a non VMessAEAD connection is received. From 2022 Jan 1st, this kind of connection will be rejected by default. You should update or replace your client software now. ").AtWarning().WriteToLog()
user = userLegacy
iv := hashTimestamp(md5.New(), timestamp)
vmessAccount = userLegacy.Account.(*vmess.MemoryAccount)
Expand Down