Skip to content

Commit

Permalink
make domain strategy in v5 less forgiving to reduce complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokangwang committed Nov 19, 2023
1 parent 1f449e2 commit b583ef4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions infra/conf/v5cfg/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package v5cfg

import (
"context"

Check failure on line 4 in infra/conf/v5cfg/outbound.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)
"strings"

"github.com/golang/protobuf/proto"

core "github.com/v2fly/v2ray-core/v5"
Expand Down Expand Up @@ -42,15 +40,18 @@ func (c OutboundConfig) BuildV5(ctx context.Context) (proto.Message, error) {
if c.MuxSettings != nil {
senderSettings.MultiplexSettings = c.MuxSettings.Build()
}

senderSettings.DomainStrategy = proxyman.SenderConfig_AS_IS
switch strings.ToLower(c.DomainStrategy) {
case "useip", "use_ip", "use-ip":
switch c.DomainStrategy {
case "UseIP":
senderSettings.DomainStrategy = proxyman.SenderConfig_USE_IP
case "useip4", "useipv4", "use_ip4", "use_ipv4", "use_ip_v4", "use-ip4", "use-ipv4", "use-ip-v4":
case "UseIP4":
senderSettings.DomainStrategy = proxyman.SenderConfig_USE_IP4
case "useip6", "useipv6", "use_ip6", "use_ipv6", "use_ip_v6", "use-ip6", "use-ipv6", "use-ip-v6":
case "UseIP6":
senderSettings.DomainStrategy = proxyman.SenderConfig_USE_IP6
case "AsIs", "":
default:
return nil, newError("unknown domain strategy: ", c.DomainStrategy)
}

if c.Settings == nil {
Expand Down

0 comments on commit b583ef4

Please sign in to comment.