removed frame.go
This commit is contained in:
parent
7cea612ae5
commit
692fc352b1
1
Makefile
1
Makefile
@ -5,7 +5,6 @@ SRCS=\
|
|||||||
client.go \
|
client.go \
|
||||||
client-ctl.go \
|
client-ctl.go \
|
||||||
client-peer.go \
|
client-peer.go \
|
||||||
frame.go \
|
|
||||||
hodu.go \
|
hodu.go \
|
||||||
hodu.pb.go \
|
hodu.pb.go \
|
||||||
hodu_grpc.pb.go \
|
hodu_grpc.pb.go \
|
||||||
|
70
frame.go
70
frame.go
@ -1,70 +0,0 @@
|
|||||||
package hodu
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
const NET_TYPE_TCP string = "tcp"
|
|
||||||
|
|
||||||
const FRAME_CODE_CLIENT_HELLO uint8 = 1
|
|
||||||
const FRAME_CODE_SERVER_HELLO uint8 = 2
|
|
||||||
const FRAME_CODE_SERVER_PEER_OPEN uint8 = 3
|
|
||||||
const FRAME_CODE_SERVER_PEER_DATA uint8 = 4
|
|
||||||
const FRAME_CODE_SERVER_PEER_CLOSE uint8 = 5
|
|
||||||
const FRAME_CODE_SERVER_PEER_ERROR uint8 = 6
|
|
||||||
const FRAME_CODE_CLIENT_PEER_OPENED uint8 = 7
|
|
||||||
const FRAME_CODE_CLIENT_PEER_DATA uint8 = 8
|
|
||||||
const FRAME_CODE_CLIENT_PEER_CLOSED uint8 = 9
|
|
||||||
const FRAME_CODE_CLIENT_PEER_ERROR uint8 = 10
|
|
||||||
|
|
||||||
const FRAME_OPTION_PORT uint8 = 1
|
|
||||||
const FRAME_OPTION_REQNET4 uint8 = 2
|
|
||||||
const FRAME_OPTION_REQNET6 uint8 = 3
|
|
||||||
|
|
||||||
type FrameHeader struct {
|
|
||||||
Len uint16 // length of whole packet including the header
|
|
||||||
Code uint8
|
|
||||||
ChanId uint8
|
|
||||||
ConnId uint16
|
|
||||||
}
|
|
||||||
|
|
||||||
type FrameOptionHeader struct {
|
|
||||||
Len uint8
|
|
||||||
Code uint8
|
|
||||||
}
|
|
||||||
|
|
||||||
type FreameOptionRetnet4Data struct {
|
|
||||||
addr [4]byte
|
|
||||||
pfxlen uint8
|
|
||||||
}
|
|
||||||
|
|
||||||
type FreameOptionRetnet6Data struct {
|
|
||||||
addr [16]byte
|
|
||||||
pfxlen uint8
|
|
||||||
}
|
|
||||||
|
|
||||||
type FrameClientHelloData struct {
|
|
||||||
AuthKey [64]byte // TODO: How to send this securely???
|
|
||||||
ReqChan uint8
|
|
||||||
/* this can be followed by variable options */
|
|
||||||
}
|
|
||||||
|
|
||||||
type FrameServerHelloData struct {
|
|
||||||
AuthCode uint8
|
|
||||||
}
|
|
||||||
|
|
||||||
func read_chan_with_tmout(chan_bool chan bool, tmout time.Duration) (bool, bool) {
|
|
||||||
var tmr *time.Timer
|
|
||||||
var b bool
|
|
||||||
var timed bool
|
|
||||||
|
|
||||||
tmr = time.NewTimer(tmout)
|
|
||||||
|
|
||||||
select {
|
|
||||||
case <-tmr.C:
|
|
||||||
timed = true
|
|
||||||
b = false
|
|
||||||
case b = <-chan_bool:
|
|
||||||
tmr.Stop()
|
|
||||||
timed = false
|
|
||||||
}
|
|
||||||
return timed, b
|
|
||||||
}
|
|
@ -888,12 +888,12 @@ func NewServer(ctx context.Context, logger Logger, ctl_addrs []string, rpc_addrs
|
|||||||
/* create the specified number of listeners */
|
/* create the specified number of listeners */
|
||||||
s.rpc = make([]*net.TCPListener, 0)
|
s.rpc = make([]*net.TCPListener, 0)
|
||||||
for _, addr = range rpc_addrs {
|
for _, addr = range rpc_addrs {
|
||||||
rpcaddr, err = net.ResolveTCPAddr(NET_TYPE_TCP, addr) // Make this interruptable???
|
rpcaddr, err = net.ResolveTCPAddr("tcp", addr) // Make this interruptable???
|
||||||
if err != nil {
|
if err != nil {
|
||||||
goto oops
|
goto oops
|
||||||
}
|
}
|
||||||
|
|
||||||
l, err = net.ListenTCP(NET_TYPE_TCP, rpcaddr)
|
l, err = net.ListenTCP("tcp", rpcaddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
goto oops
|
goto oops
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user