Cleanup
This commit is contained in:
		| @@ -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) |  | ||||||
| 	} 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) | 		enc := r.encryptControl(conf, data) | ||||||
| 		r.sendUDP(enc, conf.DirectAddr) | 		r.sendUDP(enc, conf.DirectAddr) | ||||||
| } | 		return | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	// Relayed: | ||||||
|  |  | ||||||
| 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 { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user