I implemented a per-app vpn with packetTunnelProvider on MacOS, fully functional. I would like to get the PID from sourceAppAuditToken but it is always nil. This is the code:
self.packetFlow.readPacketObjects { packets in
for packet in packets {
if let auditToken = packet.metadata!.sourceAppAuditToken {
log.debug("ok")
} else {
log.debug("No audit Token")
}
}
}
I read a lot of answer about this problem but all solved on NEFilterFlow and they don't actually work on PacketTunnelFlow