Fix windowskext linter errors

This commit is contained in:
Daniel
2020-04-10 13:18:37 +02:00
parent ddc01e648f
commit fd4f059ebb
5 changed files with 29 additions and 29 deletions

View File

@@ -2,10 +2,8 @@ package interception
import "github.com/safing/portmaster/network/packet" import "github.com/safing/portmaster/network/packet"
var ( // Packets channel for feeding the firewall.
// Packets channel for feeding the firewall. var Packets = make(chan packet.Packet, 1000)
Packets = make(chan packet.Packet, 1000)
)
// Start starts the interception. // Start starts the interception.
func Start() error { func Start() error {

View File

@@ -11,12 +11,8 @@ import (
"github.com/safing/portmaster/updates" "github.com/safing/portmaster/updates"
) )
var Packets chan packet.Packet // Packets channel for feeding the firewall.
var Packets = make(chan packet.Packet, 1000)
func init() {
// Packets channel for feeding the firewall.
Packets = make(chan packet.Packet, 1000)
}
// Start starts the interception. // Start starts the interception.
func Start() error { func Start() error {

View File

@@ -1,4 +1,4 @@
// +build windows // +build windows
// Package windowskext provides network interception capabilites on windows via the Portmaster Kernel Extension. // Package windowskext provides network interception capabilities on windows via the Portmaster Kernel Extension.
package windowskext package windowskext

View File

@@ -14,20 +14,20 @@ import (
// VerdictRequest is the request structure from the Kext. // VerdictRequest is the request structure from the Kext.
type VerdictRequest struct { type VerdictRequest struct {
id uint32 /* ID from RegisterPacket */ id uint32 // ID from RegisterPacket
processID uint64 /* Process ID. Nice to have*/ _ uint64 // Process ID - does not yet work
direction uint8 direction uint8
ipV6 uint8 /* True: IPv6, False: IPv4 */ ipV6 uint8 // True: IPv6, False: IPv4
protocol uint8 /* Protocol */ protocol uint8 // Protocol
_ uint8 _ uint8
localIP [4]uint32 /* Source Address */ localIP [4]uint32 // Source Address
remoteIP [4]uint32 /* Destination Address */ remoteIP [4]uint32 // Destination Address
localPort uint16 /* Source Port */ localPort uint16 // Source Port
remotePort uint16 /* Destination port */ remotePort uint16 // Destination port
compartmentID uint32 _ uint32 // compartmentID
interfaceIndex uint32 _ uint32 // interfaceIndex
subInterfaceIndex uint32 _ uint32 // subInterfaceIndex
packetSize uint32 packetSize uint32
} }
// Handler transforms received packets to the Packet interface. // Handler transforms received packets to the Packet interface.

View File

@@ -32,7 +32,7 @@ func main() {
} }
// logging // logging
log.Start() _ = log.Start()
log.Info("starting Portmaster Windows Kext Test Program") log.Info("starting Portmaster Windows Kext Test Program")
// init // init
@@ -52,7 +52,7 @@ func main() {
go handlePackets() go handlePackets()
// catch interrupt for clean shutdown // catch interrupt for clean shutdown
signalCh := make(chan os.Signal) signalCh := make(chan os.Signal, 1)
signal.Notify( signal.Notify(
signalCh, signalCh,
os.Interrupt, os.Interrupt,
@@ -98,13 +98,19 @@ func handlePackets() {
// reroute dns requests to nameserver // reroute dns requests to nameserver
if pkt.IsOutbound() && !pkt.Info().Src.Equal(pkt.Info().Dst) && pkt.Info().DstPort == 53 { if pkt.IsOutbound() && !pkt.Info().Src.Equal(pkt.Info().Dst) && pkt.Info().DstPort == 53 {
log.Infof("rerouting %s", pkt) log.Infof("rerouting %s", pkt)
pkt.RerouteToNameserver() err = pkt.RerouteToNameserver()
if err != nil {
log.Errorf("failed to reroute: %s", err)
}
continue continue
} }
// accept all // accept all
log.Infof("accepting %s", pkt) log.Infof("accepting %s", pkt)
pkt.PermanentAccept() err = pkt.PermanentAccept()
if err != nil {
log.Errorf("failed to accept: %s", err)
}
} }
} }