diff --git a/Makefile b/Makefile index c613ba6..9cd11a0 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ SRCS=\ client.go \ client-ctl.go \ client-peer.go \ - frame.go \ hodu.go \ hodu.pb.go \ hodu_grpc.pb.go \ diff --git a/frame.go b/frame.go deleted file mode 100644 index 1385093..0000000 --- a/frame.go +++ /dev/null @@ -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 -} diff --git a/server.go b/server.go index 40ae9ec..5ca700e 100644 --- a/server.go +++ b/server.go @@ -888,12 +888,12 @@ func NewServer(ctx context.Context, logger Logger, ctl_addrs []string, rpc_addrs /* create the specified number of listeners */ s.rpc = make([]*net.TCPListener, 0) 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 { goto oops } - l, err = net.ListenTCP(NET_TYPE_TCP, rpcaddr) + l, err = net.ListenTCP("tcp", rpcaddr) if err != nil { goto oops }