Skip to content

Commit

Permalink
Add naive inbound and test
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Aug 10, 2022
1 parent ccdfab3 commit b79b19c
Show file tree
Hide file tree
Showing 23 changed files with 709 additions and 87 deletions.
1 change: 1 addition & 0 deletions constant/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const (
TypeShadowsocks = "shadowsocks"
TypeVMess = "vmess"
TypeTrojan = "trojan"
TypeNaive = "naive"
)

const (
Expand Down
5 changes: 5 additions & 0 deletions constant/quic.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//go:build with_quic

package constant

const QUIC_AVAILABLE = true
5 changes: 5 additions & 0 deletions constant/quic_stub.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//go:build !with_quic

package constant

const QUIC_AVAILABLE = false
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/gorilla/websocket v1.5.0
github.com/hashicorp/yamux v0.1.1
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/lucas-clemente/quic-go v0.28.1
github.com/oschwald/maxminddb-golang v1.10.0
github.com/sagernet/sing v0.0.0-20220808004927-21369d10810d
github.com/sagernet/sing-dns v0.0.0-20220803121532-9e1ffb850d91
Expand All @@ -23,7 +24,7 @@ require (
github.com/xtaci/smux v1.5.16
go.uber.org/atomic v1.9.0
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
golang.org/x/net v0.0.0-20220809012201-f428fae20770
golang.org/x/net v0.0.0-20220809184613-07c6da5e1ced
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664
)

Expand All @@ -36,7 +37,6 @@ require (
github.com/google/btree v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/klauspost/cpuid/v2 v2.0.12 // indirect
github.com/lucas-clemente/quic-go v0.28.1 // indirect
github.com/marten-seemann/qpack v0.2.1 // indirect
github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect
github.com/marten-seemann/qtls-go1-17 v0.1.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220809012201-f428fae20770 h1:dIi4qVdvjZEjiMDv7vhokAZNGnz3kepwuXqFKYDdDMs=
golang.org/x/net v0.0.0-20220809012201-f428fae20770/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.0.0-20220809184613-07c6da5e1ced h1:3dYNDff0VT5xj+mbj2XucFst9WKk6PdGOrb9n+SbIvw=
golang.org/x/net v0.0.0-20220809184613-07c6da5e1ced/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down
2 changes: 2 additions & 0 deletions inbound/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func New(ctx context.Context, router adapter.Router, logger log.ContextLogger, o
return NewVMess(ctx, router, logger, options.Tag, options.VMessOptions)
case C.TypeTrojan:
return NewTrojan(ctx, router, logger, options.Tag, options.TrojanOptions)
case C.TypeNaive:
return NewNaive(ctx, router, logger, options.Tag, options.NaiveOptions)
default:
return nil, E.New("unknown inbound type: ", options.Type)
}
Expand Down
Loading

0 comments on commit b79b19c

Please sign in to comment.