hipache

package
v0.0.0-...-df9d84e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2014 License: BSD-3-Clause Imports: 7 Imported by: 0

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:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL