Skip to content
Matthew Faltys edited this page Aug 5, 2016 · 8 revisions

Nsproxy exposes an api for easy access to data and creating DNS records. The following is the specification for endpoints and their protocols.

  • /<registered_id> : GET : endpoint for getting a registered id's content.
    • example: curl localhost:8080/unixvoid
  • / : POST : endpoint for registering hosts to the dns loadbalancer.
    • hostname : hostname of the box
    • cluster : cluster the host is associated with
    • port : port to health check on
    • ip : (optional) the ip the box is on, you only need to set this if the client is behind a firewall
    • weight : (optional) the weight of the box (for load balancing). This field defaults to '1'. This is how many load balance hits the box will receive in a row before continuing to the next live host proxy/loadbalancer
    • example: curl -d hostname=$1 -d cluster=smartos -d port=7700 192.168.2.201:8080
  • /dns : POST: endpoint for adding a DNS entry to the db
    • dnstype : the type of request being made: supported {a, aaaa, cname}
    • domain : domain name, this will be fully qualified by nsproxy if it is not already
    • value : the entry value {ip4 address for 'a', ipv6 address for 'aaaa', aname for 'aname'}
    • example: curl -d dnstype=CNAME -d domain=bitnuke.io -d value=turbo.lb.bitnuke.io localhost:8080/dns
  • /dns/rm : POST : endpoint to remove a DNS entry from the db
    • dnstype : (optional) dns request to remove {a, aaaa, cname}. If not set, will remove all three from the db for the domain
    • domain : the domain to remove entry for
    • example: curl -d dnstype=a -d domain=bitnuke.io localhost:8080/dns/rm
  • /custerspec : POST : get hosts for a specific cluster
    • cluster : cluster name to get hosts for
    • example: curl -d cluster=smartos localhost:8080/clusterspec
  • /hostspec : POST : get the ip of a specific host
    • cluster : cluster name that the host belongs to
    • host : hostname to get the ip of
    • example: curl -d cluster=smartos -d host=test1 localhost:8080/hostspec
  • /dnsspec : POST : get the ip of a specific custom DNS entry
    • dnstype : the dnstype of the entry, default is 'A' if not set
    • domain : domain name of the entry to return
    • example: curl -d dnstype=cname -d domain=google.com localhost:8080/dnsspec
  • /hosts : GET : get a list of all live hosts (in the format :)
    • example: curl localhost:8080/hosts
  • /clusters : GET : get a list of all live clusters
    • example: curl localhost:8080/clusters
  • /dns : GET: endpoint for retrieving all custom dns entries in the db
    • example: curl localhost:8080/dns

Clone this wiki locally