fix: add yaml tag for forwards

This commit is contained in:
ICKelin
2021-05-12 07:52:03 +08:00
parent ae2ff32867
commit 4a3be942c1
3 changed files with 17 additions and 12 deletions

View File

@@ -1,14 +1,14 @@
serverAddr: "demo.notr.tech:10100"
key: "client server exchange key"
domain: "cloud.dahuizong.com"
domain: "a.dahuizong.com"
forwards:
- protocol: tcp
ports:
2222: 2222
2221: 2222
- protocol: udp
ports:
53: 53
531: 53
- protocol: http
ports:
@@ -21,4 +21,9 @@ forwards:
- protocol: h2c
ports:
0: 50052
- protocol: dummy
ports:
0: 0
rawConfig:
"this is a test config pass to dummy plugin"

View File

@@ -74,7 +74,7 @@ func (s *Server) onConn(conn net.Conn) {
auth := proto.C2SAuth{}
err := proto.ReadJSON(conn, &auth)
if err != nil {
logs.Error("bad request, authorize fail: %v", err)
logs.Error("bad request, authorize fail: %v %v", err, auth)
return
}

View File

@@ -19,27 +19,27 @@ type S2CHeartbeat struct {
type C2SHeartbeat struct{}
type C2SAuth struct {
Key string `json:"key"`
Domain string `json:"domain"`
Forward []ForwardItem `json:"forwards"`
Key string `json:"key" yaml:"key"`
Domain string `json:"domain" yaml:"domain"`
Forward []ForwardItem `json:"forwards" yaml:"forwards"`
}
type ForwardItem struct {
// forward protocol. eg: tcp, udp, https, http
Protocol string `json:"protocol"`
Protocol string `json:"protocol" yaml:"protocol"`
// forward ports
// key is the port opennotrd listen
// value is local port
Ports map[int]string `json:"ports"`
Ports map[int]string `json:"ports" yaml:"ports"`
// local ip, default is 127.0.0.1
// the traffic will be forward to $LocalIP:$LocalPort
// for example: 127.0.0.1:8080. 192.168.31.65:8080
LocalIP string `json:"localIP"`
LocalIP string `json:"localIP" yaml:"localIP"`
// raw config pass to server
RawConfig string `json:"rawConfig"`
RawConfig string `json:"rawConfig" yaml:"rawConfig"`
}
type S2CAuth struct {