client-interface-cleanup (#6)
Refactoring and code cleanup. Improved client command interface.
This commit is contained in:
@@ -106,6 +106,25 @@ func (r *Remote) encryptControl(conf remoteConfig, packet []byte) []byte {
|
||||
return conf.ControlCipher.Encrypt(h, packet, packet[len(packet):cap(packet)])
|
||||
}
|
||||
|
||||
func (r *Remote) Status() (RemoteStatus, bool) {
|
||||
conf := r.conf()
|
||||
if conf.Peer == nil {
|
||||
return RemoteStatus{}, false
|
||||
}
|
||||
|
||||
return RemoteStatus{
|
||||
PeerIP: conf.Peer.PeerIP,
|
||||
Up: conf.Up,
|
||||
Name: conf.Peer.Name,
|
||||
PublicIP: conf.Peer.PublicIP,
|
||||
Port: conf.Peer.Port,
|
||||
Relay: conf.Peer.Relay,
|
||||
Server: conf.Server,
|
||||
Direct: conf.Direct,
|
||||
DirectAddr: conf.DirectAddr,
|
||||
}, true
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// SendDataTo sends a data packet to the remote, called by the IFReader.
|
||||
|
||||
Reference in New Issue
Block a user