Esempio n. 1
0
// Run The Server
func NewServer(bind string) *Server {
	server := ophttp.NewServer(bind)
	stats := make(map[string][]string)
	return &Server{
		S: server,
		H: &Handler{Stats: stats},
	}
}
Esempio n. 2
0
func NewTodoService(bind string) (*TodoService, error) {
	server := ophttp.NewServer(bind)

	db, err := vault.NewDbProvider("Todo", "mysql.service.consul")
	if err != nil {
		return nil, err
	}
	return &TodoService{
		Server: server,
		Db:     db,
	}, nil
}
Esempio n. 3
0
func GetClientAndService() (*api.ReportClient, *MetricsService) {
	address := dns.Address{Address: "localhost", Port: uint16(rando.Port())}

	server := ophttp.NewServer(fmt.Sprintf("%s:%d", address.Address, address.Port))
	svc := &MetricsService{
		Server: server,
	}

	client := &api.ReportClient{
		Address: address.String(),
	}
	return client, svc
}
Esempio n. 4
0
func GetClientAndService() (*TodoClient, *TodoService) {
	address := dns.Address{Address: "localhost", Port: uint16(rando.Port())}

	dbStr := "root:@tcp(localhost:3306)/Todo?charset=utf8&parseTime=True"

	db, err := vault.NewStaticDbProvider(dbStr)
	if err != nil {
		panic(err)
	}
	server := ophttp.NewServer(fmt.Sprintf("%s:%d", address.Address, address.Port))
	svc := &TodoService{
		Server: server,
		Db:     db,
	}

	client := &TodoClient{
		Lb:      &StubAddressGetter{Val: address},
		Address: ServiceAddress,
	}
	return client, svc
}
Esempio n. 5
0
func NewMetricsService(bind string) (*MetricsService, error) {
	server := ophttp.NewServer(bind)

	return &MetricsService{Server: server}, nil
}