DNS Request Routing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

DNS Request Routing

Mina Nagy Zaki
Hello,
I'd like to create a Firefox extension that 'routes' specific DNS requests to a different set of nameservers. Is such a thing possible? If yes, then how would I go about this (are there already APIs I could hook into, etc)?

Thanks!
_______________________________________________
dev-tech-network mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-network
Reply | Threaded
Open this post in threaded view
|

Re: DNS Request Routing

Patrick McManus
firefox uses the OS resolver - so if you wanted to use the existing DNS
code you would need to change the nameserver at the OS level.

I'm guessing you want per name granularity though instead of something
based on time. For that about all you can do is implement your own DNS code
with nsIDNSService.


On Wed, Feb 19, 2014 at 9:41 AM, Mina Nagy Zaki <[hidden email]> wrote:

> Hello,
> I'd like to create a Firefox extension that 'routes' specific DNS requests
> to a different set of nameservers. Is such a thing possible? If yes, then
> how would I go about this (are there already APIs I could hook into, etc)?
>
> Thanks!
> _______________________________________________
> dev-tech-network mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-network
>
_______________________________________________
dev-tech-network mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-network
Reply | Threaded
Open this post in threaded view
|

Re: DNS Request Routing

Patrick McManus
On Wed, Feb 19, 2014 at 10:13 AM, Mina Nagy Zaki <[hidden email]> wrote:

> So would it be possible to write an extension with a custom DNS
> service component and register it to override the builtin
> nsIDNSService?
>

should be. never seen it done.


> Can this be done in JS or should it be done in C++? Would it be
> advisable to do it in C++?
>
>
the idl will let you do either. I'm not really certain whether or not you
will find the other JS libraries sufficient to the implementation in JS or
not. Make sure not to block the main thread.


>
_______________________________________________
dev-tech-network mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-network
Reply | Threaded
Open this post in threaded view
|

Re: DNS Request Routing

Honza Bambas-4
On 2/19/2014 4:31 PM, Patrick McManus wrote:
>> Can this be done in JS or should it be done in C++? Would it be
>> advisable to do it in C++?
>>
>>
> the idl will let you do either. I'm not really certain whether or not you
> will find the other JS libraries sufficient to the implementation in JS or
> not. Make sure not to block the main thread.
>

I *think* nsIDNSService is called from non-main threads too.  Hence, you
may be forced to have a C++ thread-safe implementation (JS is limited to
main thread only).  Good to check before you decide.

-hb-

_______________________________________________
dev-tech-network mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-network
Reply | Threaded
Open this post in threaded view
|

Re: DNS Request Routing

Patrick McManus
I looked a little closer, and there definitely are paths that are focused
on being able to be called off main thread. That's actually a property I
wish more of our code had - so you should support that (which means at a
minimum you need a c++ bit to shuffle stuff onto the main thread where you
can deal with it in JS.. but that will hurt your latency because the main
thread gets backed up from time to time.)


On Wed, Feb 19, 2014 at 11:29 AM, Honza Bambas <[hidden email]> wrote:

> On 2/19/2014 4:31 PM, Patrick McManus wrote:
>
>> Can this be done in JS or should it be done in C++? Would it be
>>> advisable to do it in C++?
>>>
>>>
>>>  the idl will let you do either. I'm not really certain whether or not
>> you
>> will find the other JS libraries sufficient to the implementation in JS or
>> not. Make sure not to block the main thread.
>>
>>
> I *think* nsIDNSService is called from non-main threads too.  Hence, you
> may be forced to have a C++ thread-safe implementation (JS is limited to
> main thread only).  Good to check before you decide.
>
> -hb-
>
>
> _______________________________________________
> dev-tech-network mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-network
>
_______________________________________________
dev-tech-network mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-network