Cleanup
This commit is contained in:
parent
3c4534f620
commit
31c48fbafd
@ -163,24 +163,16 @@ func (r *Remote) sendControl(conf remoteConfig, data []byte) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Direct:
|
||||||
|
|
||||||
if conf.Direct {
|
if conf.Direct {
|
||||||
r.sendControlDirect(conf, data)
|
enc := r.encryptControl(conf, data)
|
||||||
} else {
|
r.sendUDP(enc, conf.DirectAddr)
|
||||||
r.sendControlRelayed(conf, data)
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Remote) sendControlToAddr(buf []byte, addr netip.AddrPort) {
|
// Relayed:
|
||||||
enc := r.encryptControl(r.conf(), buf)
|
|
||||||
r.sendUDP(enc, addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Remote) sendControlDirect(conf remoteConfig, data []byte) {
|
|
||||||
enc := r.encryptControl(conf, data)
|
|
||||||
r.sendUDP(enc, conf.DirectAddr)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Remote) sendControlRelayed(conf remoteConfig, data []byte) {
|
|
||||||
relay := r.RelayHandler.Load()
|
relay := r.RelayHandler.Load()
|
||||||
|
|
||||||
if relay == nil {
|
if relay == nil {
|
||||||
@ -191,6 +183,11 @@ func (r *Remote) sendControlRelayed(conf remoteConfig, data []byte) {
|
|||||||
relay.relayData(conf.Peer.PeerIP, r.encryptControl(conf, data))
|
relay.relayData(conf.Peer.PeerIP, r.encryptControl(conf, data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Remote) sendControlToAddr(buf []byte, addr netip.AddrPort) {
|
||||||
|
enc := r.encryptControl(r.conf(), buf)
|
||||||
|
r.sendUDP(enc, addr)
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Remote) forwardPacket(data []byte) {
|
func (r *Remote) forwardPacket(data []byte) {
|
||||||
conf := r.conf()
|
conf := r.conf()
|
||||||
if !conf.Up || !conf.Direct {
|
if !conf.Up || !conf.Direct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user