mirror of
https://github.com/safing/portmaster
synced 2025-04-12 23:19:10 +00:00
[service] Minor windows kext improvments
This commit is contained in:
parent
5459c1ccb2
commit
6f9b0a8249
2 changed files with 23 additions and 33 deletions
service/firewall/interception
|
@ -66,19 +66,16 @@ func startInterception(packets chan packet.Packet) error {
|
|||
// Start bandwidth stats monitor.
|
||||
module.StartServiceWorker("kext bandwidth request worker", 0, func(ctx context.Context) error {
|
||||
timer := time.NewTicker(1 * time.Second)
|
||||
defer timer.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-timer.C:
|
||||
{
|
||||
err := kext2.SendBandwidthStatsRequest()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err := kext2.SendBandwidthStatsRequest()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case <-ctx.Done():
|
||||
{
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,19 +84,16 @@ func startInterception(packets chan packet.Packet) error {
|
|||
// Start kext logging. The worker will periodically send request to the kext to send logs.
|
||||
module.StartServiceWorker("kext log request worker", 0, func(ctx context.Context) error {
|
||||
timer := time.NewTicker(1 * time.Second)
|
||||
defer timer.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-timer.C:
|
||||
{
|
||||
err := kext2.SendLogRequest()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err := kext2.SendLogRequest()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case <-ctx.Done():
|
||||
{
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -107,19 +101,16 @@ func startInterception(packets chan packet.Packet) error {
|
|||
|
||||
module.StartServiceWorker("kext clean ended connection worker", 0, func(ctx context.Context) error {
|
||||
timer := time.NewTicker(30 * time.Second)
|
||||
defer timer.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-timer.C:
|
||||
{
|
||||
err := kext2.SendCleanEndedConnection()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err := kext2.SendCleanEndedConnection()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case <-ctx.Done():
|
||||
{
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,16 +40,15 @@ func Handler(ctx context.Context, packets chan packet.Packet, bandwidthUpdate ch
|
|||
switch {
|
||||
case packetInfo.ConnectionV4 != nil:
|
||||
{
|
||||
log.Tracef("packet: %+v", packetInfo.ConnectionV4)
|
||||
// log.Tracef("packet: %+v", packetInfo.ConnectionV4)
|
||||
conn := packetInfo.ConnectionV4
|
||||
// New Packet
|
||||
new := &Packet{
|
||||
newPacket := &Packet{
|
||||
verdictRequest: conn.Id,
|
||||
payload: conn.Payload,
|
||||
verdictSet: abool.NewBool(false),
|
||||
}
|
||||
new.Base.Payload()
|
||||
info := new.Info()
|
||||
info := newPacket.Info()
|
||||
info.Inbound = conn.Direction > 0
|
||||
info.InTunnel = false
|
||||
info.Protocol = packet.IPProtocol(conn.Protocol)
|
||||
|
@ -88,19 +87,19 @@ func Handler(ctx context.Context, packets chan packet.Packet, bandwidthUpdate ch
|
|||
info.DstPort = conn.RemotePort
|
||||
}
|
||||
|
||||
packets <- new
|
||||
packets <- newPacket
|
||||
}
|
||||
case packetInfo.ConnectionV6 != nil:
|
||||
{
|
||||
log.Tracef("packet: %+v", packetInfo.ConnectionV6)
|
||||
// log.Tracef("packet: %+v", packetInfo.ConnectionV6)
|
||||
conn := packetInfo.ConnectionV6
|
||||
// New Packet
|
||||
new := &Packet{
|
||||
newPacket := &Packet{
|
||||
verdictRequest: conn.Id,
|
||||
payload: conn.Payload,
|
||||
verdictSet: abool.NewBool(false),
|
||||
}
|
||||
info := new.Info()
|
||||
info := newPacket.Info()
|
||||
info.Inbound = conn.Direction > 0
|
||||
info.InTunnel = false
|
||||
info.Protocol = packet.IPProtocol(conn.Protocol)
|
||||
|
@ -139,7 +138,7 @@ func Handler(ctx context.Context, packets chan packet.Packet, bandwidthUpdate ch
|
|||
info.DstPort = conn.RemotePort
|
||||
}
|
||||
|
||||
packets <- new
|
||||
packets <- newPacket
|
||||
}
|
||||
case packetInfo.LogLine != nil:
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue