Im having trouble understanding how this transparent proxy would work.
Given that i only want to modify the headers of this requests flowing through my proxy and not re-route them i should return false in handleNewFlow ?
Im trying to follow the link you provided but i can't seem to grasp how this works.
let flow: NEAppProxyTCPFlow
let connection: NWConnection
// Reads from the flow and writes to the remote connection.
func outboundCopier() {
flow.readData { (data, error) in
if error == nil, let readData = data, !readData.isEmpty {
connection.send(content: readData,
completion: .contentProcessed( { connectionError in
// Handle completion success or error.
// Set up another read if there is no error.
if connectionError == nil {
self.outboundCopier()
}
}))
} else {
// Handle error case or the read that contains empty data.
}
}
}
Where should i create that NWConnection? Should i initialize one with the endpoint data contained in the flow i receive? Also I asume the headers i want are contained in the data from readData but how can interpret this data and modify it?
Post
Replies
Boosts
Views
Activity
There is nothing technically stopping you from doing this
Great! Given that i don't want to redirect the flow and only modify the headers i think NETransparentProxyProvider might be the better option for me.
however this will be something that you need to research on your own
I didn't find any information on how to do this. Do you know if there is a function from the NETransparentProxyProvider that can give me access to the headers?
Thanks for the help btw :)