Bindsame feature?

Tinyproxy has a feature called “bindsame” if enabled, it binds the connecting ip to the outgoing ip

Would this be possible by making small modifications to the mitmproxy’s source code?

Not sure if I understand you correctly, but are you looking for our spoof_source_address option?