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