WIP
This commit is contained in:
@@ -9,11 +9,14 @@ import (
|
||||
|
||||
type stateFunc func(msg any) stateFunc
|
||||
|
||||
<<<<<<< HEAD
|
||||
type sentProbe struct {
|
||||
SentAt time.Time
|
||||
Addr netip.AddrPort
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
type remoteFSM struct {
|
||||
*Remote
|
||||
|
||||
@@ -161,13 +164,23 @@ func (r *remoteFSM) stateServer_onInit(msg controlMsg[packetInit]) {
|
||||
}
|
||||
|
||||
func (r *remoteFSM) stateServer_onSyn(msg controlMsg[packetSyn]) {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
r.logf("Got SYN: %v", msg.Packet)
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
r.lastSeen = time.Now()
|
||||
p := msg.Packet
|
||||
|
||||
// Before we can respond to this packet, we need to make sure the
|
||||
// route is setup properly.
|
||||
conf := r.conf()
|
||||
<<<<<<< HEAD
|
||||
logSyn := !conf.Up || conf.Direct != p.Direct
|
||||
=======
|
||||
if !conf.Up || conf.Direct != p.Direct {
|
||||
r.logf("Got SYN.")
|
||||
}
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
|
||||
conf.Up = true
|
||||
conf.Direct = p.Direct
|
||||
@@ -181,10 +194,13 @@ func (r *remoteFSM) stateServer_onSyn(msg controlMsg[packetSyn]) {
|
||||
|
||||
r.updateConf(conf)
|
||||
|
||||
<<<<<<< HEAD
|
||||
if logSyn {
|
||||
r.logf("Got SYN.")
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
r.sendControl(conf, packetAck{
|
||||
TraceID: p.TraceID,
|
||||
ToAddr: conf.DirectAddr,
|
||||
@@ -201,7 +217,11 @@ func (r *remoteFSM) stateServer_onSyn(msg controlMsg[packetSyn]) {
|
||||
break
|
||||
}
|
||||
r.logf("Probing %v...", addr)
|
||||
<<<<<<< HEAD
|
||||
r.sendControlToAddr(packetProbe{TraceID: r.NewTraceID()}.Marshal(r.buf), addr)
|
||||
=======
|
||||
r.sendControlToAddr(packetProbe{TraceID: newTraceID()}.Marshal(r.buf), addr)
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +289,11 @@ func (r *remoteFSM) stateClientInit(iMsg any) stateFunc {
|
||||
|
||||
func (r *remoteFSM) stateClientInit_sendInit() {
|
||||
conf := r.conf()
|
||||
<<<<<<< HEAD
|
||||
r.traceID = r.NewTraceID()
|
||||
=======
|
||||
r.traceID = newTraceID()
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
init := packetInit{
|
||||
TraceID: r.traceID,
|
||||
Direct: conf.Direct,
|
||||
@@ -316,7 +340,11 @@ func (r *remoteFSM) enterClient() stateFunc {
|
||||
conf := r.conf()
|
||||
r.probes = make(map[uint64]sentProbe, 8)
|
||||
|
||||
<<<<<<< HEAD
|
||||
r.traceID = r.NewTraceID()
|
||||
=======
|
||||
r.traceID = newTraceID()
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
r.stateClient_sendSyn(conf)
|
||||
|
||||
r.pingTimer.Reset(pingInterval)
|
||||
@@ -382,7 +410,11 @@ func (r *remoteFSM) stateClient_cleanProbes() {
|
||||
}
|
||||
|
||||
func (r *remoteFSM) stateClient_sendProbeTo(addr netip.AddrPort) {
|
||||
<<<<<<< HEAD
|
||||
probe := packetProbe{TraceID: r.NewTraceID()}
|
||||
=======
|
||||
probe := packetProbe{TraceID: newTraceID()}
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
r.probes[probe.TraceID] = sentProbe{
|
||||
SentAt: time.Now(),
|
||||
Addr: addr,
|
||||
@@ -408,7 +440,11 @@ func (r *remoteFSM) stateClient_onProbe(msg controlMsg[packetProbe]) {
|
||||
conf.DirectAddr = sent.Addr
|
||||
r.updateConf(conf)
|
||||
|
||||
<<<<<<< HEAD
|
||||
r.traceID = r.NewTraceID()
|
||||
=======
|
||||
r.traceID = newTraceID()
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
r.stateClient_sendSyn(conf)
|
||||
r.logf("Successful probe to %v.", sent.Addr)
|
||||
}
|
||||
@@ -435,6 +471,10 @@ func (r *remoteFSM) stateClient_onPingTimer() stateFunc {
|
||||
return r.enterClientInit()
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
r.traceID = newTraceID()
|
||||
>>>>>>> 69f2536 (WIP)
|
||||
r.stateClient_sendSyn(conf)
|
||||
return r.stateClient
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user