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

feat: support grpc tunnel #19

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ require (
github.com/spf13/cobra v1.8.0
github.com/tg123/go-htpasswd v1.2.0
github.com/xtaci/smux v1.5.24
google.golang.org/grpc v1.37.0
google.golang.org/protobuf v1.30.0
)

require (
Expand All @@ -23,6 +25,7 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand All @@ -41,6 +44,6 @@ require (
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions pkg/proto/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: all
all: generate


generate:
protoc --proto_path=./ --go_out=./ \
--go_opt=Mtunnel.proto=./ \
--go-grpc_out=./ \
--go-grpc_opt=Mtunnel.proto=./ \
./*.proto
162 changes: 162 additions & 0 deletions pkg/proto/tunnel.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions pkg/proto/tunnel.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";

package tunnel;
option go_package = "github.com/dvkunion/seamoon/proto";

message Chunk {
bytes body = 1;
int32 size = 2;
}

service Tunnel {
rpc Http (stream Chunk) returns (stream Chunk);
rpc Socks5 (stream Chunk) returns (stream Chunk);
}
Loading
Loading