fix doc and lint warns for connection package

This commit is contained in:
mlsmaycon
2021-05-15 15:23:56 +05:00
parent e6358e7bb2
commit f1cff0e13a
3 changed files with 30 additions and 10 deletions
+6 -2
View File
@@ -7,6 +7,7 @@ import (
"net"
)
// WgProxy an instance of an instance of the Connection Wireguard Proxy
type WgProxy struct {
iface string
remoteKey string
@@ -16,6 +17,7 @@ type WgProxy struct {
wgConn net.Conn
}
// NewWgProxy creates a new Connection Wireguard Proxy
func NewWgProxy(iface string, remoteKey string, allowedIps string, wgAddr string) *WgProxy {
return &WgProxy{
iface: iface,
@@ -26,6 +28,7 @@ func NewWgProxy(iface string, remoteKey string, allowedIps string, wgAddr string
}
}
// Close closes the proxy
func (p *WgProxy) Close() error {
close(p.close)
@@ -39,6 +42,7 @@ func (p *WgProxy) Close() error {
return nil
}
// Start starts a new proxy using the ICE connection
func (p *WgProxy) Start(remoteConn *ice.Conn) error {
wgConn, err := net.Dial("udp", p.wgAddr)
@@ -78,7 +82,7 @@ func (p *WgProxy) proxyToRemotePeer(remoteConn *ice.Conn) {
continue
}
n, err = remoteConn.Write(buf[:n])
_, err = remoteConn.Write(buf[:n])
if err != nil {
//log.Warnln("failed writing to remote peer: ", err.Error())
}
@@ -102,7 +106,7 @@ func (p *WgProxy) proxyToLocalWireguard(remoteConn *ice.Conn) {
//log.Errorf("failed reading from remote connection %s", err)
}
n, err = p.wgConn.Write(buf[:n])
_, err = p.wgConn.Write(buf[:n])
if err != nil {
//log.Errorf("failed writing to local Wireguard instance %s", err)
}