Add support for setting alias when creatign instance. (#140)

* Add support for setting alias when creatign instance.

The POST to create a instance now provides an `alias` field which
then can be used to access the instance services through the following
URL:

`http://<alias>-<short_session>-<port>.<tld>`

When creating a session you can now send an `alias`

* Remove unnecessary function

* Add alias support for DNS resolution
This commit is contained in:
Marcos Nils
2017-05-11 17:39:17 -03:00
committed by GitHub
parent 62c5d3761d
commit 61a0bb4db1
5 changed files with 59 additions and 6 deletions

2
api.go
View File

@@ -65,6 +65,8 @@ func main() {
// Specific routes
r.Host(`{subdomain:.*}{node:pwd[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}}-{port:[0-9]*}.{tld:.*}`).Handler(tcpHandler)
r.Host(`{subdomain:.*}{node:pwd[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}_[0-9]{1,3}}.{tld:.*}`).Handler(tcpHandler)
r.Host(`pwd{alias:.*}-{session:.*}-{port:[0-9]*}.{tld:.*}`).Handler(tcpHandler)
r.Host(`pwd{alias:.*}-{session:.*}.{tld:.*}`).Handler(tcpHandler)
r.HandleFunc("/ping", handlers.Ping).Methods("GET")
corsRouter.HandleFunc("/instances/images", handlers.GetInstanceImages).Methods("GET")
corsRouter.HandleFunc("/sessions/{sessionId}", handlers.GetSession).Methods("GET")