New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to bind littleproxy to a specific interface? #135
Comments
Yes, just use |
@oxtoacart The documentation says that this method binds for incoming connections, but i want to bind for outgoing connections. I have two modems connection with pppd to the internet. My ifconfig says that i have two network interfaces then: ppp0 and ppp1. I would like to setup or decide within the proxy wich connection should be used for outgoing access (to the internet). Is this possible? For example like in tinyproxy:
If it's possible or a feature you plan, it would be fine to also bind by network interface name and not only by ip-address. |
Ahh, sorry, I misunderstood. We already have a facility for doing this when using a chained proxy. It should be possible to add some configurability (perhaps through the HttpFilters abstraction) to support your use case. Do you have any interest in giving it a shot? |
I'm not so familiar with LittleProxy yet. So i have to create a chained proxy and configure it via HttpFilters abstraction? Or do i have to change littleproxy project code? |
If i understand right: I have to change the return type of the resolve method to return two objects (local and remote)
and then use the connect() method with both parameters to connect with the given interface? |
Yes, you've got it! Alternately, you could provide an additional method on Cheers, "I love people who harness themselves, an ox to a heavy cart,
On Sat, Feb 22, 2014 at 10:56 AM, Patrick Hütter
|
@oxtoacart Why do i have to use ProxyToServerConnection.java ? I already created the getLocalAddress method. Is this correct? PatrickHuetter@e0416a5 My further temptations failed because of Gateway errors (Bad Gateway). This is my code: https://github.com/PatrickHuetter/LittleProxy |
Yes, you've added the getLocalAddress() method to HostResolver, but now LittleProxy needs to actually use that method to get the local address. The current localAddress in ProxyToServerConnection is only populated if you're using a ChainedProxy. You need to populate it from your HostResolver. See here Regarding the bad gateway problem - if you create a unit test reproducing the issue, I'd be happy to take a look. |
@oxtoacart I did this without using ChainedProxy (i think). I added it to the else-part: Using your ChainedProxyWithoutFallbackTest seems to work partly until getting Bad Gateway as response for some requests of the unit test. I hardcoded the interface name and port here (for first tests): For your interest: I have to choose the second element of the inetAddress collection in DefaultHostResolver.getLocalAddress(), because the first one is IPv6 on Mac OS X. |
@PatrickHuetter - seems like a good approach. If you pull request this (preferably with a unit test), I'd love to get it merged into LittleProxy. |
@oxtoacart Unfortunately I couldn't get it working. So there is nothing to merge this time. |
oxtocart. Any progress on this? I badly need this. Is there any other software that supports this? |
@jibijose You could try looking at @PatrickHuetter's attempt and see if you can get it to work. |
http://docs.oracle.com/javase/tutorial/networking/nifs/definition.html |
@oxtoacart Maybe we could donate to you, if you would take some time to build this feature :-) |
I succeeded :-) If I let you know changes, can you check it in? |
@jibijose You can create a pull-request to this repository, so @oxtoacart can merge it into the main branch. I'm very happy that you succeeded and i'll test it as soon as i can! :-) Could you push it into a repository on github? |
That's great news! I'm looking forward to integrating a pull request for Cheers, "I love people who harness themselves, an ox to a heavy cart,
On Fri, May 9, 2014 at 6:11 AM, Patrick Hütter notifications@github.comwrote:
|
@jibijose Could you please create a pull request for this ? :-) |
@jibijose Are you going to create a pull request for this? |
Back after long vacation. Tied up with few stuff. Will surely get this done. Please give me some time. |
Hi @jibijose, this sounds great! I hope to hear from you soon :-) |
@jibijose Are there some news on this? |
@jibijose Please create a pull request for this feature...you would help me a lot! |
New to GIT. Tried few softwares with help of my team mate. Could you summarize steps involved in pull and checkin? |
@jibijose You have to "fork" this project with the fork button at the top right at this page. After that you've to clone your forked repository. Than you make your changes in your cloned project. When you're ready you do a git commit. Example in terminal: It's also possible using the terminal but using the webinterface is more easy. If you've problems i'll help you, just send me a message. You could also send me your project as zip archive and i'll create a pull request for you. |
Done. Please check. Read comments properly. |
@jibijose I'll check it out. Could you please send me your e-mail address or contact me by email? I would like to stay in contact with you. I think i have the same setup like you. |
Since this feature was implemented by PR #172, I'll go ahead and close it. I've been successfully using this feature for some time. Thanks for reporting it, and thanks to everyone who implemented it! |
I have two or more physical network interfaces, connected to the internet and i would like to create a proxy for each of them. Is this possible with littleproxy? (using linux)
The text was updated successfully, but these errors were encountered: