added theConnDesc message to the grpc protocol
This commit is contained in:
parent
1c49023c37
commit
c7b7bfd25f
12
client.go
12
client.go
@ -64,6 +64,8 @@ type ClientConfig struct {
|
|||||||
RpcConnMax int
|
RpcConnMax int
|
||||||
PeerConnMax int
|
PeerConnMax int
|
||||||
PeerConnTmout time.Duration
|
PeerConnTmout time.Duration
|
||||||
|
|
||||||
|
Token string // to send to the server for identification
|
||||||
}
|
}
|
||||||
|
|
||||||
type ClientConnNoticeHandler interface {
|
type ClientConnNoticeHandler interface {
|
||||||
@ -98,6 +100,7 @@ type Client struct {
|
|||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
stop_req atomic.Bool
|
stop_req atomic.Bool
|
||||||
stop_chan chan bool
|
stop_chan chan bool
|
||||||
|
token string
|
||||||
|
|
||||||
log Logger
|
log Logger
|
||||||
conn_notice ClientConnNoticeHandler
|
conn_notice ClientConnNoticeHandler
|
||||||
@ -1007,6 +1010,14 @@ start_over:
|
|||||||
|
|
||||||
cts.psc = &GuardedPacketStreamClient{Hodu_PacketStreamClient: psc}
|
cts.psc = &GuardedPacketStreamClient{Hodu_PacketStreamClient: psc}
|
||||||
|
|
||||||
|
if cts.C.token != "" {
|
||||||
|
err = cts.psc.Send(MakeConnDescPacket(cts.C.token))
|
||||||
|
if err != nil {
|
||||||
|
cts.C.log.Write(cts.Sid, LOG_ERROR, "Failed to send conn-desc to server[%d] %s - %s", cts.cfg.Index, cts.cfg.ServerAddrs[cts.cfg.Index], err.Error())
|
||||||
|
goto reconnect_to_server
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(cts.cfg.Routes) > 0 {
|
if len(cts.cfg.Routes) > 0 {
|
||||||
// the connection structure to a server is ready.
|
// the connection structure to a server is ready.
|
||||||
// let's add statically configured routes to the client-side peers
|
// let's add statically configured routes to the client-side peers
|
||||||
@ -1344,6 +1355,7 @@ func NewClient(ctx context.Context, name string, logger Logger, cfg *ClientConfi
|
|||||||
c.stop_req.Store(false)
|
c.stop_req.Store(false)
|
||||||
c.stop_chan = make(chan bool, 8)
|
c.stop_chan = make(chan bool, 8)
|
||||||
c.log = logger
|
c.log = logger
|
||||||
|
c.token = cfg.Token
|
||||||
|
|
||||||
c.rpc_tls = cfg.RpcTls
|
c.rpc_tls = cfg.RpcTls
|
||||||
c.ctl_auth = cfg.CtlAuth
|
c.ctl_auth = cfg.CtlAuth
|
||||||
|
3
go.mod
3
go.mod
@ -3,6 +3,7 @@ module hodu
|
|||||||
go 1.22.0
|
go 1.22.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/prometheus/client_golang v1.20.5
|
||||||
golang.org/x/crypto v0.26.0
|
golang.org/x/crypto v0.26.0
|
||||||
golang.org/x/net v0.28.0
|
golang.org/x/net v0.28.0
|
||||||
golang.org/x/sys v0.24.0
|
golang.org/x/sys v0.24.0
|
||||||
@ -16,8 +17,8 @@ require (
|
|||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/klauspost/compress v1.17.9 // indirect
|
github.com/klauspost/compress v1.17.9 // indirect
|
||||||
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/prometheus/client_golang v1.20.5 // indirect
|
|
||||||
github.com/prometheus/client_model v0.6.1 // indirect
|
github.com/prometheus/client_model v0.6.1 // indirect
|
||||||
github.com/prometheus/common v0.55.0 // indirect
|
github.com/prometheus/common v0.55.0 // indirect
|
||||||
github.com/prometheus/procfs v0.15.1 // indirect
|
github.com/prometheus/procfs v0.15.1 // indirect
|
||||||
|
12
go.sum
12
go.sum
@ -2,10 +2,17 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
|||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||||
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||||
|
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
||||||
@ -16,6 +23,8 @@ github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G
|
|||||||
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
|
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
|
||||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||||
|
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||||
|
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||||
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
|
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
|
||||||
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
|
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
|
||||||
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
||||||
@ -32,7 +41,8 @@ google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
|
|||||||
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
|
||||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
305
hodu.pb.go
305
hodu.pb.go
@ -1,6 +1,6 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.35.1
|
// protoc-gen-go v1.36.5
|
||||||
// protoc v3.19.6
|
// protoc v3.19.6
|
||||||
// source: hodu.proto
|
// source: hodu.proto
|
||||||
|
|
||||||
@ -11,6 +11,7 @@ import (
|
|||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
sync "sync"
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -97,7 +98,8 @@ const (
|
|||||||
PACKET_KIND_PEER_ABORTED PACKET_KIND = 7
|
PACKET_KIND_PEER_ABORTED PACKET_KIND = 7
|
||||||
PACKET_KIND_PEER_EOF PACKET_KIND = 8
|
PACKET_KIND_PEER_EOF PACKET_KIND = 8
|
||||||
PACKET_KIND_PEER_DATA PACKET_KIND = 9
|
PACKET_KIND_PEER_DATA PACKET_KIND = 9
|
||||||
PACKET_KIND_CONN_NOTICE PACKET_KIND = 10
|
PACKET_KIND_CONN_DESC PACKET_KIND = 11
|
||||||
|
PACKET_KIND_CONN_NOTICE PACKET_KIND = 12
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for PACKET_KIND.
|
// Enum value maps for PACKET_KIND.
|
||||||
@ -113,7 +115,8 @@ var (
|
|||||||
7: "PEER_ABORTED",
|
7: "PEER_ABORTED",
|
||||||
8: "PEER_EOF",
|
8: "PEER_EOF",
|
||||||
9: "PEER_DATA",
|
9: "PEER_DATA",
|
||||||
10: "CONN_NOTICE",
|
11: "CONN_DESC",
|
||||||
|
12: "CONN_NOTICE",
|
||||||
}
|
}
|
||||||
PACKET_KIND_value = map[string]int32{
|
PACKET_KIND_value = map[string]int32{
|
||||||
"RESERVED": 0,
|
"RESERVED": 0,
|
||||||
@ -126,7 +129,8 @@ var (
|
|||||||
"PEER_ABORTED": 7,
|
"PEER_ABORTED": 7,
|
||||||
"PEER_EOF": 8,
|
"PEER_EOF": 8,
|
||||||
"PEER_DATA": 9,
|
"PEER_DATA": 9,
|
||||||
"CONN_NOTICE": 10,
|
"CONN_DESC": 11,
|
||||||
|
"CONN_NOTICE": 12,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -158,12 +162,11 @@ func (PACKET_KIND) EnumDescriptor() ([]byte, []int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Seed struct {
|
type Seed struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Version uint32 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"`
|
||||||
|
Flags uint64 `protobuf:"varint,2,opt,name=Flags,proto3" json:"Flags,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
Version uint32 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"`
|
|
||||||
Flags uint64 `protobuf:"varint,2,opt,name=Flags,proto3" json:"Flags,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Seed) Reset() {
|
func (x *Seed) Reset() {
|
||||||
@ -211,11 +214,8 @@ func (x *Seed) GetFlags() uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RouteDesc struct {
|
type RouteDesc struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
RouteId uint32 `protobuf:"varint,1,opt,name=RouteId,proto3" json:"RouteId,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
RouteId uint32 `protobuf:"varint,1,opt,name=RouteId,proto3" json:"RouteId,omitempty"`
|
|
||||||
// C->S(ROUTE_START): client-side peer address
|
// C->S(ROUTE_START): client-side peer address
|
||||||
// S->C(ROUTE_STARTED): server-side listening address
|
// S->C(ROUTE_STARTED): server-side listening address
|
||||||
TargetAddrStr string `protobuf:"bytes,2,opt,name=TargetAddrStr,proto3" json:"TargetAddrStr,omitempty"`
|
TargetAddrStr string `protobuf:"bytes,2,opt,name=TargetAddrStr,proto3" json:"TargetAddrStr,omitempty"`
|
||||||
@ -235,6 +235,8 @@ type RouteDesc struct {
|
|||||||
// C->S(ROUTE_START): permitted network of server-side peers.
|
// C->S(ROUTE_START): permitted network of server-side peers.
|
||||||
// S->C(ROUTE_STARTED): cloned as sent by C.
|
// S->C(ROUTE_STARTED): cloned as sent by C.
|
||||||
ServiceNetStr string `protobuf:"bytes,6,opt,name=ServiceNetStr,proto3" json:"ServiceNetStr,omitempty"`
|
ServiceNetStr string `protobuf:"bytes,6,opt,name=ServiceNetStr,proto3" json:"ServiceNetStr,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RouteDesc) Reset() {
|
func (x *RouteDesc) Reset() {
|
||||||
@ -310,14 +312,13 @@ func (x *RouteDesc) GetServiceNetStr() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PeerDesc struct {
|
type PeerDesc struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
RouteId uint32 `protobuf:"varint,1,opt,name=RouteId,proto3" json:"RouteId,omitempty"`
|
||||||
|
PeerId uint32 `protobuf:"varint,2,opt,name=PeerId,proto3" json:"PeerId,omitempty"`
|
||||||
|
RemoteAddrStr string `protobuf:"bytes,3,opt,name=RemoteAddrStr,proto3" json:"RemoteAddrStr,omitempty"`
|
||||||
|
LocalAddrStr string `protobuf:"bytes,4,opt,name=LocalAddrStr,proto3" json:"LocalAddrStr,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
RouteId uint32 `protobuf:"varint,1,opt,name=RouteId,proto3" json:"RouteId,omitempty"`
|
|
||||||
PeerId uint32 `protobuf:"varint,2,opt,name=PeerId,proto3" json:"PeerId,omitempty"`
|
|
||||||
RemoteAddrStr string `protobuf:"bytes,3,opt,name=RemoteAddrStr,proto3" json:"RemoteAddrStr,omitempty"`
|
|
||||||
LocalAddrStr string `protobuf:"bytes,4,opt,name=LocalAddrStr,proto3" json:"LocalAddrStr,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PeerDesc) Reset() {
|
func (x *PeerDesc) Reset() {
|
||||||
@ -379,13 +380,12 @@ func (x *PeerDesc) GetLocalAddrStr() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PeerData struct {
|
type PeerData struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
RouteId uint32 `protobuf:"varint,1,opt,name=RouteId,proto3" json:"RouteId,omitempty"`
|
||||||
|
PeerId uint32 `protobuf:"varint,2,opt,name=PeerId,proto3" json:"PeerId,omitempty"`
|
||||||
|
Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
RouteId uint32 `protobuf:"varint,1,opt,name=RouteId,proto3" json:"RouteId,omitempty"`
|
|
||||||
PeerId uint32 `protobuf:"varint,2,opt,name=PeerId,proto3" json:"PeerId,omitempty"`
|
|
||||||
Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PeerData) Reset() {
|
func (x *PeerData) Reset() {
|
||||||
@ -439,17 +439,60 @@ func (x *PeerData) GetData() []byte {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConnNotice struct {
|
type ConnDesc struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Token string `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"`
|
func (x *ConnDesc) Reset() {
|
||||||
|
*x = ConnDesc{}
|
||||||
|
mi := &file_hodu_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ConnDesc) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ConnDesc) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ConnDesc) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_hodu_proto_msgTypes[4]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ConnDesc.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ConnDesc) Descriptor() ([]byte, []int) {
|
||||||
|
return file_hodu_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ConnDesc) GetToken() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Token
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConnNotice struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConnNotice) Reset() {
|
func (x *ConnNotice) Reset() {
|
||||||
*x = ConnNotice{}
|
*x = ConnNotice{}
|
||||||
mi := &file_hodu_proto_msgTypes[4]
|
mi := &file_hodu_proto_msgTypes[5]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -461,7 +504,7 @@ func (x *ConnNotice) String() string {
|
|||||||
func (*ConnNotice) ProtoMessage() {}
|
func (*ConnNotice) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *ConnNotice) ProtoReflect() protoreflect.Message {
|
func (x *ConnNotice) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_hodu_proto_msgTypes[4]
|
mi := &file_hodu_proto_msgTypes[5]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -474,7 +517,7 @@ func (x *ConnNotice) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use ConnNotice.ProtoReflect.Descriptor instead.
|
// Deprecated: Use ConnNotice.ProtoReflect.Descriptor instead.
|
||||||
func (*ConnNotice) Descriptor() ([]byte, []int) {
|
func (*ConnNotice) Descriptor() ([]byte, []int) {
|
||||||
return file_hodu_proto_rawDescGZIP(), []int{4}
|
return file_hodu_proto_rawDescGZIP(), []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ConnNotice) GetText() string {
|
func (x *ConnNotice) GetText() string {
|
||||||
@ -485,23 +528,23 @@ func (x *ConnNotice) GetText() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Packet struct {
|
type Packet struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
sizeCache protoimpl.SizeCache
|
Kind PACKET_KIND `protobuf:"varint,1,opt,name=Kind,proto3,enum=PACKET_KIND" json:"Kind,omitempty"`
|
||||||
unknownFields protoimpl.UnknownFields
|
// Types that are valid to be assigned to U:
|
||||||
|
|
||||||
Kind PACKET_KIND `protobuf:"varint,1,opt,name=Kind,proto3,enum=PACKET_KIND" json:"Kind,omitempty"`
|
|
||||||
// Types that are assignable to U:
|
|
||||||
//
|
//
|
||||||
// *Packet_Route
|
// *Packet_Route
|
||||||
// *Packet_Peer
|
// *Packet_Peer
|
||||||
// *Packet_Data
|
// *Packet_Data
|
||||||
|
// *Packet_Conn
|
||||||
// *Packet_Notice
|
// *Packet_Notice
|
||||||
U isPacket_U `protobuf_oneof:"U"`
|
U isPacket_U `protobuf_oneof:"U"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Packet) Reset() {
|
func (x *Packet) Reset() {
|
||||||
*x = Packet{}
|
*x = Packet{}
|
||||||
mi := &file_hodu_proto_msgTypes[5]
|
mi := &file_hodu_proto_msgTypes[6]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -513,7 +556,7 @@ func (x *Packet) String() string {
|
|||||||
func (*Packet) ProtoMessage() {}
|
func (*Packet) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *Packet) ProtoReflect() protoreflect.Message {
|
func (x *Packet) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_hodu_proto_msgTypes[5]
|
mi := &file_hodu_proto_msgTypes[6]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -526,7 +569,7 @@ func (x *Packet) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use Packet.ProtoReflect.Descriptor instead.
|
// Deprecated: Use Packet.ProtoReflect.Descriptor instead.
|
||||||
func (*Packet) Descriptor() ([]byte, []int) {
|
func (*Packet) Descriptor() ([]byte, []int) {
|
||||||
return file_hodu_proto_rawDescGZIP(), []int{5}
|
return file_hodu_proto_rawDescGZIP(), []int{6}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Packet) GetKind() PACKET_KIND {
|
func (x *Packet) GetKind() PACKET_KIND {
|
||||||
@ -536,37 +579,54 @@ func (x *Packet) GetKind() PACKET_KIND {
|
|||||||
return PACKET_KIND_RESERVED
|
return PACKET_KIND_RESERVED
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Packet) GetU() isPacket_U {
|
func (x *Packet) GetU() isPacket_U {
|
||||||
if m != nil {
|
if x != nil {
|
||||||
return m.U
|
return x.U
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Packet) GetRoute() *RouteDesc {
|
func (x *Packet) GetRoute() *RouteDesc {
|
||||||
if x, ok := x.GetU().(*Packet_Route); ok {
|
if x != nil {
|
||||||
return x.Route
|
if x, ok := x.U.(*Packet_Route); ok {
|
||||||
|
return x.Route
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Packet) GetPeer() *PeerDesc {
|
func (x *Packet) GetPeer() *PeerDesc {
|
||||||
if x, ok := x.GetU().(*Packet_Peer); ok {
|
if x != nil {
|
||||||
return x.Peer
|
if x, ok := x.U.(*Packet_Peer); ok {
|
||||||
|
return x.Peer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Packet) GetData() *PeerData {
|
func (x *Packet) GetData() *PeerData {
|
||||||
if x, ok := x.GetU().(*Packet_Data); ok {
|
if x != nil {
|
||||||
return x.Data
|
if x, ok := x.U.(*Packet_Data); ok {
|
||||||
|
return x.Data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Packet) GetConn() *ConnDesc {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.U.(*Packet_Conn); ok {
|
||||||
|
return x.Conn
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Packet) GetNotice() *ConnNotice {
|
func (x *Packet) GetNotice() *ConnNotice {
|
||||||
if x, ok := x.GetU().(*Packet_Notice); ok {
|
if x != nil {
|
||||||
return x.Notice
|
if x, ok := x.U.(*Packet_Notice); ok {
|
||||||
|
return x.Notice
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -587,8 +647,12 @@ type Packet_Data struct {
|
|||||||
Data *PeerData `protobuf:"bytes,4,opt,name=Data,proto3,oneof"`
|
Data *PeerData `protobuf:"bytes,4,opt,name=Data,proto3,oneof"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Packet_Conn struct {
|
||||||
|
Conn *ConnDesc `protobuf:"bytes,5,opt,name=Conn,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
type Packet_Notice struct {
|
type Packet_Notice struct {
|
||||||
Notice *ConnNotice `protobuf:"bytes,5,opt,name=Notice,proto3,oneof"`
|
Notice *ConnNotice `protobuf:"bytes,6,opt,name=Notice,proto3,oneof"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Packet_Route) isPacket_U() {}
|
func (*Packet_Route) isPacket_U() {}
|
||||||
@ -597,11 +661,13 @@ func (*Packet_Peer) isPacket_U() {}
|
|||||||
|
|
||||||
func (*Packet_Data) isPacket_U() {}
|
func (*Packet_Data) isPacket_U() {}
|
||||||
|
|
||||||
|
func (*Packet_Conn) isPacket_U() {}
|
||||||
|
|
||||||
func (*Packet_Notice) isPacket_U() {}
|
func (*Packet_Notice) isPacket_U() {}
|
||||||
|
|
||||||
var File_hodu_proto protoreflect.FileDescriptor
|
var File_hodu_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_hodu_proto_rawDesc = []byte{
|
var file_hodu_proto_rawDesc = string([]byte{
|
||||||
0x0a, 0x0a, 0x68, 0x6f, 0x64, 0x75, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x04,
|
0x0a, 0x0a, 0x68, 0x6f, 0x64, 0x75, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x04,
|
||||||
0x53, 0x65, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18,
|
0x53, 0x65, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14,
|
0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14,
|
||||||
@ -634,61 +700,66 @@ var file_hodu_proto_rawDesc = []byte{
|
|||||||
0x75, 0x74, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x18,
|
0x75, 0x74, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x18,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a,
|
0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a,
|
||||||
0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74,
|
0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74,
|
||||||
0x61, 0x22, 0x20, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x12,
|
0x61, 0x22, 0x20, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x12, 0x14, 0x0a,
|
||||||
0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54,
|
0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f,
|
||||||
0x65, 0x78, 0x74, 0x22, 0xbc, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x20,
|
0x6b, 0x65, 0x6e, 0x22, 0x20, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x4e, 0x6f, 0x74, 0x69, 0x63,
|
||||||
0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x50,
|
0x65, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x52, 0x04, 0x4b, 0x69, 0x6e, 0x64,
|
0x04, 0x54, 0x65, 0x78, 0x74, 0x22, 0xdd, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74,
|
||||||
0x12, 0x22, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
0x12, 0x20, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c,
|
||||||
0x0a, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x44, 0x65, 0x73, 0x63, 0x48, 0x00, 0x52, 0x05, 0x52,
|
0x2e, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x52, 0x04, 0x4b, 0x69,
|
||||||
0x6f, 0x75, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01,
|
0x6e, 0x64, 0x12, 0x22, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x44, 0x65, 0x73, 0x63, 0x48, 0x00, 0x52,
|
0x0b, 0x32, 0x0a, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x44, 0x65, 0x73, 0x63, 0x48, 0x00, 0x52,
|
||||||
0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20,
|
0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x03,
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x48, 0x00,
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x44, 0x65, 0x73, 0x63, 0x48,
|
||||||
0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x25, 0x0a, 0x06, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65,
|
0x00, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18,
|
||||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x4e, 0x6f, 0x74,
|
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61,
|
||||||
0x69, 0x63, 0x65, 0x48, 0x00, 0x52, 0x06, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x42, 0x03, 0x0a,
|
0x48, 0x00, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x04, 0x43, 0x6f, 0x6e, 0x6e,
|
||||||
0x01, 0x55, 0x2a, 0x5e, 0x0a, 0x0c, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x4f, 0x50, 0x54, 0x49,
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x44, 0x65, 0x73,
|
||||||
0x4f, 0x4e, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x10, 0x00, 0x12, 0x07,
|
0x63, 0x48, 0x00, 0x52, 0x04, 0x43, 0x6f, 0x6e, 0x6e, 0x12, 0x25, 0x0a, 0x06, 0x4e, 0x6f, 0x74,
|
||||||
0x0a, 0x03, 0x54, 0x43, 0x50, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x43, 0x50, 0x34, 0x10,
|
0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x43, 0x6f, 0x6e, 0x6e,
|
||||||
0x02, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x43, 0x50, 0x36, 0x10, 0x04, 0x12, 0x07, 0x0a, 0x03, 0x54,
|
0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x48, 0x00, 0x52, 0x06, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65,
|
||||||
0x54, 0x59, 0x10, 0x08, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x10, 0x12, 0x09,
|
0x42, 0x03, 0x0a, 0x01, 0x55, 0x2a, 0x5e, 0x0a, 0x0c, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x4f,
|
||||||
0x0a, 0x05, 0x48, 0x54, 0x54, 0x50, 0x53, 0x10, 0x20, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x53, 0x48,
|
0x50, 0x54, 0x49, 0x4f, 0x4e, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x10,
|
||||||
0x10, 0x40, 0x2a, 0xc6, 0x01, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4b, 0x49,
|
0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x43, 0x50, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x43,
|
||||||
0x4e, 0x44, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x53, 0x45, 0x52, 0x56, 0x45, 0x44, 0x10, 0x00,
|
0x50, 0x34, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x43, 0x50, 0x36, 0x10, 0x04, 0x12, 0x07,
|
||||||
0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10,
|
0x0a, 0x03, 0x54, 0x54, 0x59, 0x10, 0x08, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10,
|
||||||
0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x4f, 0x50, 0x10,
|
0x10, 0x12, 0x09, 0x0a, 0x05, 0x48, 0x54, 0x54, 0x50, 0x53, 0x10, 0x20, 0x12, 0x07, 0x0a, 0x03,
|
||||||
0x02, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54,
|
0x53, 0x53, 0x48, 0x10, 0x40, 0x2a, 0xd5, 0x01, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
||||||
0x45, 0x44, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54,
|
0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x53, 0x45, 0x52, 0x56, 0x45,
|
||||||
0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x45, 0x45, 0x52, 0x5f,
|
0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41,
|
||||||
0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x45, 0x45,
|
0x52, 0x54, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54,
|
||||||
0x52, 0x5f, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x50,
|
0x4f, 0x50, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54,
|
||||||
0x45, 0x45, 0x52, 0x5f, 0x41, 0x42, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x10, 0x07, 0x12, 0x0c, 0x0a,
|
0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x4f, 0x55, 0x54, 0x45,
|
||||||
0x08, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x45, 0x4f, 0x46, 0x10, 0x08, 0x12, 0x0d, 0x0a, 0x09, 0x50,
|
0x5f, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x45,
|
||||||
0x45, 0x45, 0x52, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x09, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x4f,
|
0x45, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c,
|
||||||
0x4e, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x49, 0x43, 0x45, 0x10, 0x0a, 0x32, 0x49, 0x0a, 0x04, 0x48,
|
0x50, 0x45, 0x45, 0x52, 0x5f, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x06, 0x12, 0x10,
|
||||||
0x6f, 0x64, 0x75, 0x12, 0x19, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x53, 0x65, 0x65, 0x64, 0x12, 0x05,
|
0x0a, 0x0c, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x41, 0x42, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x10, 0x07,
|
||||||
0x2e, 0x53, 0x65, 0x65, 0x64, 0x1a, 0x05, 0x2e, 0x53, 0x65, 0x65, 0x64, 0x22, 0x00, 0x12, 0x26,
|
0x12, 0x0c, 0x0a, 0x08, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x45, 0x4f, 0x46, 0x10, 0x08, 0x12, 0x0d,
|
||||||
0x0a, 0x0c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x07,
|
0x0a, 0x09, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x09, 0x12, 0x0d, 0x0a,
|
||||||
0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x07, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74,
|
0x09, 0x43, 0x4f, 0x4e, 0x4e, 0x5f, 0x44, 0x45, 0x53, 0x43, 0x10, 0x0b, 0x12, 0x0f, 0x0a, 0x0b,
|
||||||
0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x68, 0x6f, 0x64, 0x75,
|
0x43, 0x4f, 0x4e, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x49, 0x43, 0x45, 0x10, 0x0c, 0x32, 0x49, 0x0a,
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x04, 0x48, 0x6f, 0x64, 0x75, 0x12, 0x19, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x53, 0x65, 0x65, 0x64,
|
||||||
}
|
0x12, 0x05, 0x2e, 0x53, 0x65, 0x65, 0x64, 0x1a, 0x05, 0x2e, 0x53, 0x65, 0x65, 0x64, 0x22, 0x00,
|
||||||
|
0x12, 0x26, 0x0a, 0x0c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
|
||||||
|
0x12, 0x07, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x07, 0x2e, 0x50, 0x61, 0x63, 0x6b,
|
||||||
|
0x65, 0x74, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x68, 0x6f,
|
||||||
|
0x64, 0x75, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
})
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_hodu_proto_rawDescOnce sync.Once
|
file_hodu_proto_rawDescOnce sync.Once
|
||||||
file_hodu_proto_rawDescData = file_hodu_proto_rawDesc
|
file_hodu_proto_rawDescData []byte
|
||||||
)
|
)
|
||||||
|
|
||||||
func file_hodu_proto_rawDescGZIP() []byte {
|
func file_hodu_proto_rawDescGZIP() []byte {
|
||||||
file_hodu_proto_rawDescOnce.Do(func() {
|
file_hodu_proto_rawDescOnce.Do(func() {
|
||||||
file_hodu_proto_rawDescData = protoimpl.X.CompressGZIP(file_hodu_proto_rawDescData)
|
file_hodu_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_hodu_proto_rawDesc), len(file_hodu_proto_rawDesc)))
|
||||||
})
|
})
|
||||||
return file_hodu_proto_rawDescData
|
return file_hodu_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_hodu_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
var file_hodu_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||||
var file_hodu_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
var file_hodu_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||||
var file_hodu_proto_goTypes = []any{
|
var file_hodu_proto_goTypes = []any{
|
||||||
(ROUTE_OPTION)(0), // 0: ROUTE_OPTION
|
(ROUTE_OPTION)(0), // 0: ROUTE_OPTION
|
||||||
(PACKET_KIND)(0), // 1: PACKET_KIND
|
(PACKET_KIND)(0), // 1: PACKET_KIND
|
||||||
@ -696,24 +767,26 @@ var file_hodu_proto_goTypes = []any{
|
|||||||
(*RouteDesc)(nil), // 3: RouteDesc
|
(*RouteDesc)(nil), // 3: RouteDesc
|
||||||
(*PeerDesc)(nil), // 4: PeerDesc
|
(*PeerDesc)(nil), // 4: PeerDesc
|
||||||
(*PeerData)(nil), // 5: PeerData
|
(*PeerData)(nil), // 5: PeerData
|
||||||
(*ConnNotice)(nil), // 6: ConnNotice
|
(*ConnDesc)(nil), // 6: ConnDesc
|
||||||
(*Packet)(nil), // 7: Packet
|
(*ConnNotice)(nil), // 7: ConnNotice
|
||||||
|
(*Packet)(nil), // 8: Packet
|
||||||
}
|
}
|
||||||
var file_hodu_proto_depIdxs = []int32{
|
var file_hodu_proto_depIdxs = []int32{
|
||||||
1, // 0: Packet.Kind:type_name -> PACKET_KIND
|
1, // 0: Packet.Kind:type_name -> PACKET_KIND
|
||||||
3, // 1: Packet.Route:type_name -> RouteDesc
|
3, // 1: Packet.Route:type_name -> RouteDesc
|
||||||
4, // 2: Packet.Peer:type_name -> PeerDesc
|
4, // 2: Packet.Peer:type_name -> PeerDesc
|
||||||
5, // 3: Packet.Data:type_name -> PeerData
|
5, // 3: Packet.Data:type_name -> PeerData
|
||||||
6, // 4: Packet.Notice:type_name -> ConnNotice
|
6, // 4: Packet.Conn:type_name -> ConnDesc
|
||||||
2, // 5: Hodu.GetSeed:input_type -> Seed
|
7, // 5: Packet.Notice:type_name -> ConnNotice
|
||||||
7, // 6: Hodu.PacketStream:input_type -> Packet
|
2, // 6: Hodu.GetSeed:input_type -> Seed
|
||||||
2, // 7: Hodu.GetSeed:output_type -> Seed
|
8, // 7: Hodu.PacketStream:input_type -> Packet
|
||||||
7, // 8: Hodu.PacketStream:output_type -> Packet
|
2, // 8: Hodu.GetSeed:output_type -> Seed
|
||||||
7, // [7:9] is the sub-list for method output_type
|
8, // 9: Hodu.PacketStream:output_type -> Packet
|
||||||
5, // [5:7] is the sub-list for method input_type
|
8, // [8:10] is the sub-list for method output_type
|
||||||
5, // [5:5] is the sub-list for extension type_name
|
6, // [6:8] is the sub-list for method input_type
|
||||||
5, // [5:5] is the sub-list for extension extendee
|
6, // [6:6] is the sub-list for extension type_name
|
||||||
0, // [0:5] is the sub-list for field type_name
|
6, // [6:6] is the sub-list for extension extendee
|
||||||
|
0, // [0:6] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_hodu_proto_init() }
|
func init() { file_hodu_proto_init() }
|
||||||
@ -721,19 +794,20 @@ func file_hodu_proto_init() {
|
|||||||
if File_hodu_proto != nil {
|
if File_hodu_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
file_hodu_proto_msgTypes[5].OneofWrappers = []any{
|
file_hodu_proto_msgTypes[6].OneofWrappers = []any{
|
||||||
(*Packet_Route)(nil),
|
(*Packet_Route)(nil),
|
||||||
(*Packet_Peer)(nil),
|
(*Packet_Peer)(nil),
|
||||||
(*Packet_Data)(nil),
|
(*Packet_Data)(nil),
|
||||||
|
(*Packet_Conn)(nil),
|
||||||
(*Packet_Notice)(nil),
|
(*Packet_Notice)(nil),
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_hodu_proto_rawDesc,
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_hodu_proto_rawDesc), len(file_hodu_proto_rawDesc)),
|
||||||
NumEnums: 2,
|
NumEnums: 2,
|
||||||
NumMessages: 6,
|
NumMessages: 7,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
@ -743,7 +817,6 @@ func file_hodu_proto_init() {
|
|||||||
MessageInfos: file_hodu_proto_msgTypes,
|
MessageInfos: file_hodu_proto_msgTypes,
|
||||||
}.Build()
|
}.Build()
|
||||||
File_hodu_proto = out.File
|
File_hodu_proto = out.File
|
||||||
file_hodu_proto_rawDesc = nil
|
|
||||||
file_hodu_proto_goTypes = nil
|
file_hodu_proto_goTypes = nil
|
||||||
file_hodu_proto_depIdxs = nil
|
file_hodu_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
10
hodu.proto
10
hodu.proto
@ -68,6 +68,10 @@ message PeerData {
|
|||||||
bytes Data = 3;
|
bytes Data = 3;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
message ConnDesc {
|
||||||
|
string Token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message ConnNotice {
|
message ConnNotice {
|
||||||
string Text = 1;
|
string Text = 1;
|
||||||
}
|
}
|
||||||
@ -83,7 +87,8 @@ enum PACKET_KIND {
|
|||||||
PEER_ABORTED = 7;
|
PEER_ABORTED = 7;
|
||||||
PEER_EOF = 8;
|
PEER_EOF = 8;
|
||||||
PEER_DATA = 9;
|
PEER_DATA = 9;
|
||||||
CONN_NOTICE = 10;
|
CONN_DESC = 11;
|
||||||
|
CONN_NOTICE = 12;
|
||||||
};
|
};
|
||||||
|
|
||||||
message Packet {
|
message Packet {
|
||||||
@ -93,6 +98,7 @@ message Packet {
|
|||||||
RouteDesc Route = 2;
|
RouteDesc Route = 2;
|
||||||
PeerDesc Peer = 3;
|
PeerDesc Peer = 3;
|
||||||
PeerData Data = 4;
|
PeerData Data = 4;
|
||||||
ConnNotice Notice = 5;
|
ConnDesc Conn = 5;
|
||||||
|
ConnNotice Notice = 6;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,10 @@ func MakePeerDataPacket(route_id RouteId, peer_id PeerId, data []byte) *Packet {
|
|||||||
U: &Packet_Data{Data: &PeerData{RouteId: uint32(route_id), PeerId: uint32(peer_id), Data: data}}}
|
U: &Packet_Data{Data: &PeerData{RouteId: uint32(route_id), PeerId: uint32(peer_id), Data: data}}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MakeConnDescPacket(token string) *Packet {
|
||||||
|
return &Packet{Kind: PACKET_KIND_CONN_DESC,U: &Packet_Conn{Conn: &ConnDesc{Token: token}}}
|
||||||
|
}
|
||||||
|
|
||||||
func MakeConnNoticePacket(msg string) *Packet {
|
func MakeConnNoticePacket(msg string) *Packet {
|
||||||
return &Packet{Kind: PACKET_KIND_CONN_NOTICE, U: &Packet_Notice{Notice: &ConnNotice{Text: msg}}}
|
return &Packet{Kind: PACKET_KIND_CONN_NOTICE, U: &Packet_Notice{Notice: &ConnNotice{Text: msg}}}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ type json_out_server_conn struct {
|
|||||||
Id ConnId `json:"id"`
|
Id ConnId `json:"id"`
|
||||||
ServerAddr string `json:"server-addr"`
|
ServerAddr string `json:"server-addr"`
|
||||||
ClientAddr string `json:"client-addr"`
|
ClientAddr string `json:"client-addr"`
|
||||||
|
ClientToken string `json:"client-token"`
|
||||||
Routes []json_out_server_route `json:"routes"`
|
Routes []json_out_server_route `json:"routes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +202,7 @@ func (ctl *server_ctl_server_conns) ServeHTTP(w http.ResponseWriter, req *http.R
|
|||||||
Id: cts.Id,
|
Id: cts.Id,
|
||||||
ClientAddr: cts.RemoteAddr.String(),
|
ClientAddr: cts.RemoteAddr.String(),
|
||||||
ServerAddr: cts.LocalAddr.String(),
|
ServerAddr: cts.LocalAddr.String(),
|
||||||
|
ClientToken: cts.Token,
|
||||||
Routes: jsp,
|
Routes: jsp,
|
||||||
})
|
})
|
||||||
cts.route_mtx.Unlock()
|
cts.route_mtx.Unlock()
|
||||||
@ -268,6 +270,7 @@ func (ctl *server_ctl_server_conns_id) ServeHTTP(w http.ResponseWriter, req *htt
|
|||||||
Id: cts.Id,
|
Id: cts.Id,
|
||||||
ClientAddr: cts.RemoteAddr.String(),
|
ClientAddr: cts.RemoteAddr.String(),
|
||||||
ServerAddr: cts.LocalAddr.String(),
|
ServerAddr: cts.LocalAddr.String(),
|
||||||
|
ClientToken: cts.Token,
|
||||||
Routes: jsp,
|
Routes: jsp,
|
||||||
}
|
}
|
||||||
cts.route_mtx.Unlock()
|
cts.route_mtx.Unlock()
|
||||||
|
11
server.go
11
server.go
@ -128,6 +128,7 @@ type ServerConn struct {
|
|||||||
S *Server
|
S *Server
|
||||||
Id ConnId
|
Id ConnId
|
||||||
Sid string // for logging
|
Sid string // for logging
|
||||||
|
Token string // provided by client
|
||||||
|
|
||||||
RemoteAddr net.Addr // client address that created this structure
|
RemoteAddr net.Addr // client address that created this structure
|
||||||
LocalAddr net.Addr // local address that the client is connected to
|
LocalAddr net.Addr // local address that the client is connected to
|
||||||
@ -744,6 +745,16 @@ func (cts *ServerConn) receive_from_stream(wg *sync.WaitGroup) {
|
|||||||
cts.S.log.Write(cts.Sid, LOG_ERROR, "Invalid peer_data event from %s", cts.RemoteAddr)
|
cts.S.log.Write(cts.Sid, LOG_ERROR, "Invalid peer_data event from %s", cts.RemoteAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case PACKET_KIND_CONN_DESC:
|
||||||
|
var x *Packet_Conn
|
||||||
|
var ok bool
|
||||||
|
x, ok = pkt.U.(*Packet_Conn)
|
||||||
|
if ok {
|
||||||
|
cts.Token = x.Conn.Token
|
||||||
|
} else {
|
||||||
|
cts.S.log.Write(cts.Sid, LOG_ERROR, "Invalid conn_desc event from %s", cts.RemoteAddr)
|
||||||
|
}
|
||||||
|
|
||||||
case PACKET_KIND_CONN_NOTICE:
|
case PACKET_KIND_CONN_NOTICE:
|
||||||
// the connection from the client to a peer has been established
|
// the connection from the client to a peer has been established
|
||||||
var x *Packet_Notice
|
var x *Packet_Notice
|
||||||
|
Loading…
x
Reference in New Issue
Block a user