Closed GoogleCodeExporter closed 9 years ago
To clarify further, my bluetooth service does not have the ability to set a
proxy.
Original comment by KannedF...@gmail.com
on 9 Aug 2013 at 7:22
Please see https://code.google.com/p/proxy-vole/issues/detail?id=42
I'm also looking for a solution.
Original comment by hansberg...@gmail.com
on 14 Nov 2013 at 8:05
After a ton of Google searching I came across this:
route get 0.0.0.0 2>/dev/null | awk '/interface: / {print $2}'
This is a terminal call that will return the name of the currently active
network interface (eg. en0)
This should be baked into proxy-vole and used to map against the service orders
rather than assuming the first service order is the active interface.
Original comment by KannedF...@gmail.com
on 14 Nov 2013 at 8:12
This modified OsxProxySearchStrategy#getProxySelector() method should also
solve the problem:
public ProxySelector getProxySelector() throws ProxyException {
Logger.log(getClass(), LogLevel.TRACE, "Detecting OSX proxy settings");
// First create a list of Ethernet interfaces that are connected
List<String> acceptedInterfaces = new ArrayList<String>();
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
for (Iterator<NetworkInterface> it = Collections.list(interfaces).iterator(); it.hasNext();) {
NetworkInterface ni = it.next();
if (ni.isLoopback() || ni.isPointToPoint() || ni.isVirtual() || !ni.isUp()) {
// Ignore
continue;
}
acceptedInterfaces.add(ni.getName());
}
} catch (SocketException ex) {
throw new ProxyException("Error getting the Network Interfaces");
}
if (acceptedInterfaces.isEmpty()) {
throw new ProxyException("No acceptable Network Interfaces found");
}
// Now look at the Network Settings
try {
Dict settings = PListParser.load(getSettingsFile());
Object currentSet = settings.getAtPath("/CurrentSet");
if (currentSet == null) {
throw new ProxyException("CurrentSet not defined");
}
Dict networkSet = (Dict) settings.getAtPath(String.valueOf(currentSet));
List<?> serviceOrder = (List<?>) networkSet.getAtPath("/Network/Global/IPv4/ServiceOrder");
if (serviceOrder == null || serviceOrder.size() == 0) {
throw new ProxyException("ServiceOrder not defined");
}
// Look at the Services in priority order and pick the first one that was
// also accepted above
Dict proxySettings = null;
for (int i = 0; i < serviceOrder.size(); i++) {
Object candidateService = serviceOrder.get(i);
Object networkService = networkSet.getAtPath("/Network/Service/"+candidateService+"/__LINK__");
if (networkService == null ) {
throw new ProxyException("NetworkService not defined.");
}
Dict selectedServiceSettings = (Dict) settings.getAtPath(""+networkService);
String interfaceName = (String) selectedServiceSettings.getAtPath("/Interface/DeviceName");
if (acceptedInterfaces.contains(interfaceName)) {
Logger.log(getClass(), LogLevel.TRACE, "Looking up proxies for device " + interfaceName);
proxySettings = (Dict) selectedServiceSettings.getAtPath("/Proxies");
break;
}
}
if (proxySettings == null) {
throw new ProxyException("No Ethernet service found");
}
ProtocolDispatchSelector ps = new ProtocolDispatchSelector();
installSelectorForProtocol(proxySettings, ps, "HTTP");
installSelectorForProtocol(proxySettings, ps, "HTTPS");
installSelectorForProtocol(proxySettings, ps, "FTP");
installSelectorForProtocol(proxySettings, ps, "Gopher");
installSelectorForProtocol(proxySettings, ps, "RTSP");
installSocksProxy(proxySettings, ps);
ProxySelector result = ps;
result = installPacProxyIfAvailable(proxySettings, result);
result = autodetectProxyIfAvailable(proxySettings, result);
result = installExceptionList(proxySettings, result);
result = installSimpleHostFilter(proxySettings, result);
return result;
} catch (XmlParseException e) {
throw new ProxyException(e);
} catch (IOException e) {
throw new ProxyException(e);
}
}
Original comment by hansberg...@gmail.com
on 14 Nov 2013 at 11:07
Hi all,
Finally I found the time (and an OSX laptop) to fix this issue. I integrated a
solution based on the fix of "hansbergstengtalk". Thanks for submitting this.
The fix is in the repository checked in with revision 117.
I will release it with a new version of proxy vole within this week.
Please note that in the OSX Network Settings there is a little known feature to
change the order of the interfaces. So you might want to sort your WLAN
interface to the top. This could also help for other applications that fetch
the wrong interface.
But with the new release this should be no longer necessary.
Have fun,
- Rossi
Original comment by rosstaus...@googlemail.com
on 4 Dec 2013 at 12:27
Original issue reported on code.google.com by
KannedF...@gmail.com
on 9 Aug 2013 at 7:17