User:Chaser Zaks/lsl dns

From Second Life Wiki
Jump to: navigation, search

Yes, I know several already exist. I wanted one with specific features and security, so I made my own. If you have any questions or concerns, or maybe an idea, shoot me a message at http://my.secondlife.com/chaser.zaks (Send me a IM, they do not get capped. I do not read the SL facebook thing.)

You may also want to see the other LSL DNS options. If this doesn't suit your needs, maybe the others will. Or maybe they will just look more appealing to you.

Summary

  • Running on Debian Jessie x64, Written in Python 3, served off Apache, with MySQL as a database.
  • Supports proxying and non-proxying(via 307 Temporary Redirect and Location header).
  • Content type overriding(Proxy mode only, allows to serve HTML from LSL scripts).
  • XHR supported, must be enabled via headers.
  • Made to use as little LSL code size as possible.
  • Domains are accessible through UUID or a custom name(which is optional)

Documentation

PUT http://lsl.softhyena.com/


//Used to register a entry

{
    (OPTIONAL) "domain": string address, //Still accessable from uuid.lsl.softhyena.com
    (OPTIONAL) "title": string title, //Unused, used for indexing later(See flags)
    (OPTIONAL) "auth": [string username, string password], //Unused, HTTP Authentication(See flags)
    (OPTIONAL) "flags": integer mask, //See below
    (OPTIONAL) "ttl": integer minutes, //Minutes for it to stay active, defaults to 24 hours.
    "address": string LSL_Address //Address received from llRequestURL() or llRequestSecureURL()
}

Response:

{
    "ttl": integer UTC_expire, //How long the server will allow
    "address": string address //UUID address, or subdomain if specified.
}


POST http://lsl.softhyena.com/


//To update the TTL without sending extra data(preferred)

{
    (OPTIONAL) "ttl": integer 
}

Response:

{
    "ttl": integer UTC_expire //How long the server will allow
}


DELETE http://lsl.softhyena.com/


//To delete a subdomain(BOTH THE UUID AND CUSTOM):

{}

Response:

{}


GET http://lsl.softhyena.com/


//Return info(THIS IS DIFFERENT THAN GET FROM A BROWSER):

{}

Response:

{
    "ttl": integer UTC_expire,
    "domain": string address,
    "flags": integer flags,
    "address": string assigned_url
}

LSL Functions

Register a domain


key registerDomain(list params){
    /*[
        (OPTIONAL) "domain", string address, //Still accessable from uuid.lsl.softhyena.com
        (OPTIONAL) "flags", integer mask, //See below
        (OPTIONAL) "ttl", integer minutes, //Minutes for it to stay active, defaults to 24 hours.
        "address", string LSL_Address //Address received from llRequestURL() or llRequestSecureURL()
    ]*/
    return llHTTPRequest("http://lsl.softhyena.com",[HTTP_METHOD, "PUT"],llList2Json(JSON_OBJECT, params));
}


Refresh TTL


key refreshDomain(integer ttl){
    list q;
    if(ttl)q=["ttl",llAbs(ttl)];
    return llHTTPRequest("http://lsl.softhyena.com",[HTTP_METHOD, "POST"],llList2Json(JSON_OBJECT,q));
}


Delete a domain


key deleteDomain(){
    return llHTTPRequest("http://lsl.softhyena.com",[HTTP_METHOD, "DELETE"],"");
}

Flags

Domain Flags V Description Notes
DOMAIN_FLAG_HIDDEN 1 Real URL cannot be grabbed from info
DOMAIN_FLAG_LSL_ONLY 2 Only LSL objects can make request to this URL This applies to the "info." prefix as well
DOMAIN_FLAG_NO_PROXY 4 Bypass our proxy and force a redirect May not work with post requests?
DOMAIN_FLAG_INDEX 8 Used to index domains, opt-in for obvious reasons. Not implemented
DOMAIN_FLAG_AUTH 16 Only allow authenticated requests Not implemented
DOMAIN_FLAG_SECURE 32 Force HTTP requests to upgrade to HTTPS requests. No effect on HTTPS LSL URLs.
DOMAIN_FLAG_PRIVACY 64 Server will strip headers sent by LL that may reveal where your server is located in world. Not implemented
DOMAIN_FLAG_DEBUG 128 Enables various debugging headers and system logging. Used internally.

Added headers

Header Description Example value
via Version of the proxy lsl.softhyena.com (<version number>)
x-forwarded-for IP address of the originating request 67.140.140.92

Info prefix

Human readable


   http://info.<subdomain OR uuid>.lsl.softhyena.com/

Json


   http://info.<subdomain OR uuid>.lsl.softhyena.com/json

Key/values


   http://info.<subdomain OR uuid>.lsl.softhyena.com/address
   http://info.<subdomain OR uuid>.lsl.softhyena.com/owner
   http://info.<subdomain OR uuid>.lsl.softhyena.com/owner_name (Does not work yet)
   http://info.<subdomain OR uuid>.lsl.softhyena.com/ttl
   http://info.<subdomain OR uuid>.lsl.softhyena.com/title
   http://info.<subdomain OR uuid>.lsl.softhyena.com/flags

Notes

  • If you give the server a secure LSL URL, you MUST use HTTPS when accessing this proxy, or you will receive an error.
  • This is a free service and will remain free forever.
  • The TTL for all parts of this subdomain are set to 2 minutes, so if a URL isn't working when it should, wait about 2 minutes.
  • Any object you own can request a domain in use by you, but no one can take a domain you requested unless you free it or it expires.
  • Domains are first come first serve, I will not free domains if you fail to keep yours.
  • If an error occurs, the "err" object will be set. An easy way to check for this is: integer errorOccured = (llGetJsonType(res, ["err"]) != JSON_INVALID);
  • Source code will be available eventually, but not right now. Not until I iron out all the bugs and comment it(It's a single wsgi script with 682 lines).
  • A object can only have ONE CUSTOM DOMAIN NAME, and it cannot be a UUID. UUIDs are reserved for object keys.

See also

  • User:Darien_Caldwell/HTTP-DNS A Dynamic DNS service running on Google App Engine, ran by Darien Caldwell.
  • Public_Object_DNS A dynamic DNS service using GAE, ran by Liandra Ceawlin.
  • Silverday_ObjectDNS A easy to use dns-mapping-service with many configurable options (password protection, write protection, etc.) and an optional web-interface, ran by Till Stirling.