Fix Codacy

This commit is contained in:
braginini
2023-04-05 16:54:50 +02:00
parent 005c4dd44a
commit 0e8a552334
7 changed files with 12 additions and 4 deletions
-3
View File
@@ -118,9 +118,6 @@ type Engine struct {
routeManager routemanager.Manager
dnsServer dns.Server
// userspaceBind indicates whether a
userspaceBind bool
}
// Peer is an instance of the Connection Peer
+3
View File
@@ -214,6 +214,9 @@ func TestEngine_UpdateNetworkMap(t *testing.T) {
t.Fatal(err)
}
engine.wgInterface, err = iface.NewWGIFace("utun102", "100.64.0.1/24", iface.DefaultMTU, nil, newNet)
if err != nil {
t.Fatal(err)
}
engine.routeManager = routemanager.NewManager(ctx, key.PublicKey().String(), engine.wgInterface, engine.statusRecorder)
engine.dnsServer = &dns.MockServer{
UpdateDNSServerFunc: func(serial uint64, update nbdns.Config) error { return nil },
+2
View File
@@ -23,6 +23,7 @@ func NewDirectNoProxy(config Config, remoteWgPort int) *DirectNoProxy {
return &DirectNoProxy{config: config, RemoteWgListenPort: remoteWgPort}
}
// Close removes peer from the WireGuard interface
func (p *DirectNoProxy) Close() error {
err := p.config.WgInterface.RemovePeer(p.config.RemoteKey)
if err != nil {
@@ -50,6 +51,7 @@ func (p *DirectNoProxy) Start(remoteConn net.Conn) error {
return nil
}
// Type returns the type of this proxy
func (p *DirectNoProxy) Type() Type {
return TypeDirectNoProxy
}
+1 -1
View File
@@ -49,7 +49,7 @@ func (n *Net) filterInterfaces(interfaces []*transport.Interface) []*transport.I
// The interfaces are discovered by an external iFaceDiscover function or by a default discoverer if the external one
// wasn't specified.
func (n *Net) UpdateInterfaces(iFaceDiscover IFaceDiscover) error {
discoveredInterfaces := []*transport.Interface{}
discoveredInterfaces := []*transport.Interface{} //nolint
var err error
if iFaceDiscover != nil {
interfacesString := ""