From 74563c6e3a658a4a6462aae8f6757cb6355fa916 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 20 Jan 2015 20:44:35 +0000 Subject: [PATCH] cosmetic: move connection types from types.go to connection.go --- router/connection.go | 46 +++++++++++++++++++++++++++++++++++++++++++ router/types.go | 47 -------------------------------------------- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/router/connection.go b/router/connection.go index a5bebef7..e2c77bd1 100644 --- a/router/connection.go +++ b/router/connection.go @@ -8,9 +8,55 @@ import ( "log" "net" "strconv" + "sync" "time" ) +type Connection interface { + Local() *Peer + Remote() *Peer + RemoteTCPAddr() string + Established() bool + Shutdown(error) +} + +type RemoteConnection struct { + local *Peer + remote *Peer + remoteTCPAddr string +} + +type LocalConnection struct { + sync.RWMutex + RemoteConnection + TCPConn *net.TCPConn + tcpSender TCPSender + remoteUDPAddr *net.UDPAddr + established bool + receivedHeartbeat bool + stackFrag bool + effectivePMTU int + SessionKey *[32]byte + heartbeatFrame *ForwardedFrame + heartbeat *time.Ticker + fetchAll *time.Ticker + fragTest *time.Ticker + forwardChan chan<- *ForwardedFrame + forwardChanDF chan<- *ForwardedFrame + stopForward chan<- interface{} + stopForwardDF chan<- interface{} + verifyPMTU chan<- int + Decryptor Decryptor + Router *Router + UID uint64 + queryChan chan<- *ConnectionInteraction +} + +type ConnectionInteraction struct { + Interaction + payload interface{} +} + func NewRemoteConnection(from, to *Peer, tcpAddr string) *RemoteConnection { return &RemoteConnection{ local: from, diff --git a/router/types.go b/router/types.go index 78c1972f..9bd04c56 100644 --- a/router/types.go +++ b/router/types.go @@ -3,8 +3,6 @@ package router import ( "code.google.com/p/gopacket/layers" "net" - "sync" - "time" ) type Router struct { @@ -21,51 +19,6 @@ type Router struct { LogFrame func(string, []byte, *layers.Ethernet) } -type Connection interface { - Local() *Peer - Remote() *Peer - RemoteTCPAddr() string - Established() bool - Shutdown(error) -} - -type RemoteConnection struct { - local *Peer - remote *Peer - remoteTCPAddr string -} - -type LocalConnection struct { - sync.RWMutex - RemoteConnection - TCPConn *net.TCPConn - tcpSender TCPSender - remoteUDPAddr *net.UDPAddr - established bool - receivedHeartbeat bool - stackFrag bool - effectivePMTU int - SessionKey *[32]byte - heartbeatFrame *ForwardedFrame - heartbeat *time.Ticker - fetchAll *time.Ticker - fragTest *time.Ticker - forwardChan chan<- *ForwardedFrame - forwardChanDF chan<- *ForwardedFrame - stopForward chan<- interface{} - stopForwardDF chan<- interface{} - verifyPMTU chan<- int - Decryptor Decryptor - Router *Router - UID uint64 - queryChan chan<- *ConnectionInteraction -} - -type ConnectionInteraction struct { - Interaction - payload interface{} -} - type UDPPacket struct { Name PeerName Packet []byte