Post

Replies

Boosts

Views

Activity

Best API to intercept and modify network packets?
In some countries, the government deploys DPI (deep packet inspection) systems for censorship. These systems usually don't implement TCP completely and thus can be tricked pretty easily into allowing a connection to a blocked resource to go through, e.g. by fragmenting a ClientHello and optionally shuffling the fragments around. There exists this app for Windows: https://github.com/ValdikSS/GoodbyeDPI It uses WinDivert to intercept the network traffic and modify it as needed. I'd like to build a similar tool for macOS but I struggle to understand which of the many APIs I should use. I need two main features from the API in question: The ability to drop a packet sent by an application and send something else, e.g. several TCP fragments with the same data, instead. The ability to drop incoming packets because some DPI equipment works by sending RST before the origin server has time to respond. Ideally, I'd filter the connections by destination IP address and only work on those that deal with blocked resources, leaving the other ones to be dealt with completely by to system so that there's no needless performance regression caused by all traffic passing through my code. So which API do I use for this? NetworkExtension — which kind? BPF? Some other unix API? Or I'll have to resort to making it a kernel extension?
1
1
831
Jul ’23
AudioComponentInstanceNew takes several seconds to complete
I'm using a VoiceProcessingIO audio unit in my VoIP application on Mac. The problem is, at least since Mojave, AudioComponentInstanceNew blocks for at least 2 seconds. Profiling shows that internally it's waiting on some mutex and then on some message queue. My code to initialize the audio unit is as follows: OSStatus status; AudioComponentDescription desc; AudioComponent inputComponent; desc.componentType = kAudioUnitType_Output; desc.componentSubType = kAudioUnitSubType_VoiceProcessingIO; desc.componentFlags = 0; desc.componentFlagsMask = 0; desc.componentManufacturer = kAudioUnitManufacturer_Apple; inputComponent = AudioComponentFindNext(NULL, &desc); status = AudioComponentInstanceNew(inputComponent, &unit);Here's a profiler screenshot showing the two system calls in question.So, is this a bug or an intended behavior?
4
0
2.4k
Oct ’18
VoiceProcessingIO lowers the volume of all other audio apps on OS X, any way to disable this?
I'm using a VoiceProcessingIO (kAudioUnitSubType_VoiceProcessingIO) audio unit in my VoIP application to record and play audio while also making use of system-provided signal processing. Everything works fine except when the unit is initialized, if anything else is playing audio, that audio becomes significantly quieter whereas whatever I output is heard at full volume. When the unit is uninitialized, the volume of the other audio changes back to what it was.Some users apparently don't like this behavior so I'm looking for a way to control this, if at all possible, but I can't seem to find anything related to this; the information related to the VoiceProcessingIO unit on OS X is generally extremely scarce as opposed to iOS.The only thing I've found that comes close is the kAUVoiceIOProperty_DuckNonVoiceAudio property which seems to be exactly what I need but it's only available on iOS and is also marked deprecated.
1
0
1.5k
Dec ’17