This page describes how one can use OASIS via either DNS and HTTP. Its HTTP interface also exposes a variety of other functionality; the API is described below. The HTTP interface can respond with either HTML- or XML-formatted output; the latter is especially useful for integration into AJAX-powered web services. DNS interfaceTo access OASIS vis a DNS interface, simply access <service>.nyuld.net. As an example, let's see what gets returned when trying to access service 'coralcdn' via DNS:$ dig coralcdn.nyuld.net ; <<>> DiG 9.3.1 <<>> coralcdn.nyuld.net ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4660 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;coralcdn.nyuld.net. IN A ;; ANSWER SECTION: coralcdn.nyuld.net. 600 IN CNAME coralcdn.ab4203b5.oasis.nyuld.net. coralcdn.ab4203b5.oasis.nyuld.net. 60 IN A 171.66.3.181 coralcdn.ab4203b5.oasis.nyuld.net. 60 IN A 171.66.3.182 ;; AUTHORITY SECTION: coralcdn.ab4203b5.oasis.nyuld.net. 600 IN NS 171.66.3.181.ip4.oasis.nyuld.net. ;; Query time: 367 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; MSG SIZE rcvd: 137 HTTP interfaceLocate a particular IP addresshttp://http.nyuld.net:8096/clnt.html?ip=<ip>HTML response for lookup on an NYU server: $ http://http.nyuld.net:8096/clnt.html?ip=216.165.108.10
HTTP/1.0 200 OK
Server: OasisHttpd/0.1.38 (See http://oasis.coralcdn.org/)
Connection: close
Content-Type: text/html; charset=iso-8859-1
Content-Length: 240
X-OASIS-Target: 216.165.108.10
X-OASIS-Location: 40.729,-73.993,0.270
<table border=0><tr><td><b><font color="blue">IP</font></b>
<br>AS Num<br>Latitude<br>Longitude<br>Error (us)</td>
<td> </td>
<td><b><font color="blue">216.165.108.10</font></b>
<br>12<br>40729<br>-73993<br>270</td></tr>
</table>
XML response:
$ http://http.nyuld.net:8096/clnt.xml?ip=216.165.108.10 HTTP/1.0 200 OK Server: OasisHttpd/0.1.38 (See http://oasis.coralcdn.org/) Connection: close Content-Type: application/xml Content-Length: 113 X-OASIS-Target: 216.165.108.10 X-OASIS-Location: 40.729,-73.993,0.270 <markers> <marker no="1" name="216.165.108.10" asn="12" lat="40.729" lng="-73.993" rtt="0.270"/> </markers> Estimated distance between two IP addresseshttp://http.nyuld.net:8096/dist.html?src=<ip>&dst=<ip>HTML response for distance between MIT and NYU: $ http://http.nyuld.net:8096/dist.html?src=18.0.0.1&dst=216.165.108.10
HTTP/1.0 200 OK
Server: OasisHttpd/0.1.38 (See http://oasis.coralcdn.org/)
Connection: close
Content-Type: text/html; charset=iso-8859-1
Content-Length: 261
X-OASIS-Source: 42.363,-71.092,0.394
X-OASIS-Destination: 40.729,-73.993,0.270
X-OASIS-Kilometers: 370
X-OASIS-Miles: 229
X-OASIS-RTT-Est: 3
<table>
<tr><td>Source:</td><td>42.363,-71.092,0.394</td></tr>
<tr><td>Destination:</td><td>40.729,-73.993,0.270</td></tr>
<tr><td>Kilometers:</td><td>370</td></tr>
<tr><td>Miles:</td><td>229</td></tr>
<tr><td>Estimated RTT:</td><td>3</td></tr>
</table>
XML response for distance between MIT and NYU:
$ http://http.nyuld.net:8096/dist.xml?src=18.0.0.1&dst=216.165.108.10 HTTP/1.0 200 OK Server: OasisHttpd/0.1.38 (See http://oasis.coralcdn.org/) Connection: close Content-Type: text/html; charset=iso-8859-1 Content-Length: 261 X-OASIS-Source: 42.363,-71.092,0.394 X-OASIS-Destination: 40.729,-73.993,0.270 X-OASIS-Kilometers: 370 X-OASIS-Miles: 229 X-OASIS-RTT-Est: 3 <markers> <marker no="1" srclat="42.363" srclng="-71.092" srcerr="0.394" dstlat="40.729" dstlng="-73.993" dsterr="0.270" km="370" miles="229" rttest="3"/> </markers>Note that both kilometers/miles and RTT is just a rough estimate given the estimated geographic distance. They should not be used for predictive accuracy. Anycast functionality for a specified service
http://http.nyuld.net:8096/anycast.html?pol=<service>
[&ip=<ip>][&lat=<latitude>][&lng=<longitude>][&max=<int>][&min=<int>]
This query returns a set of IP addresses at which the specified
service is running. The following precedence of optional arguments is
used: (1) If an <ip> is specified, servers nearby to
<ip> are returned. Next, (2) if a latitude and longitude are
supplied, servers nearby those coordinates are returned. Otherwise,
(3) servers nearby to the requesting client's IP address are returned.
The optional <max> and <min> specify the desired number of values to return; otherwise, values from the service's default policy are used. We recommend a small <max> value (<= 3); otherwise, these requests can cause load balancing problems. HTML response is just a CRLF-separated list of IP addresses: $ http://http.nyuld.net:8096/anycast.html?pol=coralcdn&ip=216.165.108.10&max=3 $ http://http.nyuld.net:8096/anycast.html?pol=coralcdn&lat=40.7&lng=-74&max=3 HTTP/1.0 200 OK Server: OasisHttpd/0.1. (See http://oasis.coralcdn.org/) Connection: close Content-Type: text/html; charset=iso-8859-1 Content-Length: 51 216.165.109.181 216.165.109.182 216.165.109.179XML response: $ http://http.nyuld.net:8096/anycast.xml?pol=coralcdn HTTP/1.0 200 OK Server: OasisHttpd/0.1. (See http://oasis.coralcdn.org/) Connection: close Content-Type: text/html; charset=iso-8859-1 Content-Length: 211 <markers> <marker no="0" serv="coralcdn" addr="216.165.109.181"/> <marker no="1" serv="coralcdn" addr="216.165.109.182"/> <marker no="2" serv="coralcdn" addr="216.165.109.179"/> </markers> Generate an HTTP redirecthttp://http.nyuld.net:8096/redir.html?pol=<service>[&ip=<ip>][&suffix=<sfx>]Here, we just generate an HTTP redirect to a server belonging to the specified service. If an <ip> is specified, a server nearby to <ip> is returned; otherwise, the requesting client's IP address is used. The optional <sfx> is appended to the end of the location. HTML response to a redirect query near to NYU: $ http://http.nyuld.net:8096/redir.html?pol=coralcdn&ip=216.165.108.10&suffix=foo.html
HTTP/1.0 302 Found
Server: OasisHttpd/0.1.38 (See http://oasis.coralcdn.org/)
Connection: close
Content-Type: text/html; charset=iso-8859-1
Location: http://216.165.109.181/foo.html
<html><head><title>302 Found</title></head><body>
<h1>Redirect: 302 Found</h1><br>
<a href="http://216.165.109.181/foo.html">
http://216.165.109.181/foo.html</a>
<br><br><hr>Server OasisHttpd/0.1.38
(See http://oasis.coralcdn.org/)</i>
<br></body></html>
Determine policy information for service running on OASIShttp://http.nyuld.net:8096/pol.html?pol=<service>HTML format: $ http://http.nyuld.net:8096/pol.html?pol=opendht HTTP/1.0 200 OK Server: OasisHttpd/0.1. (See http://oasis.coralcdn.org/) Connection: close Content-Type: text/html; charset=iso-8859-1 <table border=0><tr> <td><b><font color="blue">Service</font></b> <br>Max records<br>Min records<br>Record TTLs</td> <td> </td> <td><b><font color="blue">opendht</font></b><br>2<br>1<br>120 s</td> </tr></table>XML format: $ http://http.nyuld.net:8096/pol.xml?pol=opendht HTTP/1.0 200 OK Server: OasisHttpd/0.1. (See http://oasis.coralcdn.org/) Connection: close Content-Type: text/html; charset=iso-8859-1 <policies> <policy serv="opendht" max="2" min="1" ttl="120"/> </policies> |