delete tunnel headers and add some TODOs
This commit is contained in:
parent
01cb146e0d
commit
c2c8182a5b
@ -133,6 +133,7 @@ func (t *tun) process() {
|
|||||||
}
|
}
|
||||||
for _, link := range t.links {
|
for _, link := range t.links {
|
||||||
log.Debugf("Sending %+v to %s", newMsg, link.Remote())
|
log.Debugf("Sending %+v to %s", newMsg, link.Remote())
|
||||||
|
// TODO: error check and reconnect
|
||||||
link.Send(newMsg)
|
link.Send(newMsg)
|
||||||
}
|
}
|
||||||
t.RUnlock()
|
t.RUnlock()
|
||||||
@ -155,14 +156,19 @@ func (t *tun) listen(link transport.Socket, listener bool) {
|
|||||||
|
|
||||||
switch msg.Header["Micro-Tunnel"] {
|
switch msg.Header["Micro-Tunnel"] {
|
||||||
case "connect", "close":
|
case "connect", "close":
|
||||||
|
// TODO: handle the connect/close message
|
||||||
|
// maybe used to create the dial/listen sockets
|
||||||
|
// or report io.EOF or maybe to kill the link
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// the tunnel id
|
// the tunnel id
|
||||||
id := msg.Header["Micro-Tunnel-Id"]
|
id := msg.Header["Micro-Tunnel-Id"]
|
||||||
|
delete(msg.Header, "Micro-Tunnel-Id")
|
||||||
|
|
||||||
// the session id
|
// the session id
|
||||||
session := msg.Header["Micro-Tunnel-Session"]
|
session := msg.Header["Micro-Tunnel-Session"]
|
||||||
|
delete(msg.Header, "Micro-Tunnel-Session")
|
||||||
|
|
||||||
// if the session id is blank there's nothing we can do
|
// if the session id is blank there's nothing we can do
|
||||||
// TODO: check this is the case, is there any reason
|
// TODO: check this is the case, is there any reason
|
||||||
@ -290,6 +296,7 @@ func (t *tun) connect() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Tunnel dialing %s", node)
|
log.Debugf("Tunnel dialing %s", node)
|
||||||
|
// TODO: reconnection logic is required to keep the tunnel established
|
||||||
c, err := t.options.Transport.Dial(node)
|
c, err := t.options.Transport.Dial(node)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("Tunnel failed to connect to %s: %v", node, err)
|
log.Debugf("Tunnel failed to connect to %s: %v", node, err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user