Skip to content

Commit

Permalink
feat: support grpc tunnel (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
DVKunion committed Jan 16, 2024
1 parent ef2bf71 commit 75db770
Show file tree
Hide file tree
Showing 8 changed files with 630 additions and 18 deletions.
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

0 comments on commit 75db770

Please # to comment.