-js-proxy-router & -js-access-filter behaviour #240
Replies: 2 comments
-
|
Hello, Indeed, it's actually a very good topic to discuss. README has only brief hint why does that happen: Note
This shouldn't be much of concern, though, if But I see it deserves more explanation. How dumbproxy works with outbound connectionsThe problem is following: sometimes dumbproxy needs to know what will be the destination IP address of outgoing direct connection. It's needed for:
Note that we need to resolve address only for direct connections made by dumbproxy server. But whenever we pass the connection to some upstream proxy it will be a mistake to resolve domain names:
For these reasons domain name resolution normally should happen only for dial outs made directly by dumbproxy instance. How it works internally: dumbproxy builds DAG (basically almost always a chain) of connection wrappers which build outbound connections with the help of each other. Some of them add a proxy into dialing chain, some change dialout settings and so on. But in addition to connection request they also support special protocol to answer simple question: "do you or other dialer in your chain require domain name NOT to be resolved and passed literally to another system?". Every remote proxy dialer answer "yes". Direct dialers answer "no". Now, what happens when upstream proxy is decided with JS script? The dialer executing that JS gets asked before actual connection request: "do you need domain name preservation?". In order to answer that question JS dialer needs to know whether it will be a direct proxy returned by JS script or some upstream proxy. So it gathers all available data for request and calls Tip You can influence that behavior and always resolve names in advance with What happens to connections which have their destination resolvedIf connection request had it destination address resolved (e.g. due to direct connect or forced resolution), the resolver rewrites single connection attempt by domain name into a sequence of attempts to dial each literal IP address, preserving original symbolic destination only in the request context. We make sure that we dial exactly addresses we resolved, not just pass them futher. It has to be like this in order to:
For that reason access filter will be invoked 4 times for Tip It is possible to signal dumbproxy stop asking |
Beta Was this translation helpful? Give feedback.
-
|
Great answer, now it makes a lot of sense! Would be great to include this somewhere in the readme, in case anyone else comes across this. I did update my access script to use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
First of all the scripting in dumbproxy is fantastic, allowing for dynamic advanced configuration scenarios with ease (split routing etc).
However, when using
-js-proxy-router, I found some behaviour that I'd like to understand better.Given the following simple
proxy.jsscript:The output results are:
From this output it seems that getProxy() is called twice? Is there a reason this is happening?
Additionally adding
-js-access-filteradditionally in the mix with a similar script shows additional logs there as well:I'd have expected one JSROUTER and one JSACCESS log entry. Note that only one JSROUTER log is output in this case.
Posting this as a discussion, because it might be by design and not an issue. Just looking to clarify the behaviour.
Beta Was this translation helpful? Give feedback.
All reactions