Skip to content

Commit

Permalink
Do not convert @ to \x00
Browse files Browse the repository at this point in the history
  • Loading branch information
RPRX authored Sep 7, 2020
1 parent f10f5b4 commit 16fe0b0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
5 changes: 1 addition & 4 deletions infra/conf/vless.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
fb.Type = "serve"
} else {
switch fb.Dest[0] {
case '@':
fb.Dest = "\x00" + fb.Dest[1:]
fallthrough
case '/':
case '@', '/':
fb.Type = "unix"
default:
if _, err := strconv.Atoi(fb.Dest); err == nil {
Expand Down
2 changes: 1 addition & 1 deletion infra/conf/vless_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestVLessInbound(t *testing.T) {
Alpn: "h2",
Path: "",
Type: "unix",
Dest: "\x00/dev/shm/domain.socket",
Dest: "@/dev/shm/domain.socket",
Xver: 2,
},
{
Expand Down
6 changes: 1 addition & 5 deletions proxy/vless/inbound/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i
}
return nil
}); err != nil {
dest := fb.Dest
if dest[0] == '\x00' {
dest = "@" + dest[1:]
}
return newError("failed to dial to " + dest).Base(err).AtWarning()
return newError("failed to dial to " + fb.Dest).Base(err).AtWarning()
}
defer conn.Close() // nolint: errcheck

Expand Down

0 comments on commit 16fe0b0

Please sign in to comment.