Documentation ¶
Overview ¶
Package hipache provides a router implementation that store routes in Redis, as specified by Hipache (https://github.com/dotcloud/hipache).
It does not provided any exported type, in order to use the router, you must import this package and get the router intance using the function router.Get.
In order to use this router, you need to define the "hipache:domain" setting.
Example ¶
package main import ( "fmt" "github.com/tsuru/tsuru/router" _ "github.com/tsuru/tsuru/router/hipache" ) func main() { router, err := router.Get("hipache") if err != nil { panic(err) } err = router.AddBackend("myapp") if err != nil { panic(err) } err = router.AddRoute("myapp", "http://10.10.10.10:8080") if err != nil { panic(err) } addr, _ := router.Addr("myapp") fmt.Println("Please access:", addr) err = router.RemoveRoute("myapp", "http://10.10.10.10:8080") if err != nil { panic(err) } err = router.RemoveBackend("myapp") if err != nil { panic(err) } }
Output:
Click to show internal directories.
Click to hide internal directories.