fairway

package module
v0.9.91 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: MIT Imports: 26 Imported by: 0

README

Go Report Card

Fairway

a simple Eureka client for go that will register your service with eureka and send hearbeats as well as deregister on shutdown or panic.

##Spring Boot Admin support

Fairway currently Supports some metrics, logging and environment actuators.

Security

There is currrently no way to secure the actuators so please be aware of that if you are using Fairway.

See example folder for working example of how to use Fairway in your app.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Actuator added in v0.7.0

func Actuator(w http.ResponseWriter, r *http.Request)

Actuator Handler

func BuildRoutes

func BuildRoutes(routes Routes, e *mux.Router) *mux.Router

BuildRoutes - Builds route handlers

func DoHTTPRequest added in v0.9.6

func DoHTTPRequest(httpAction HTTPAction) bool

DoHTTPRequest Accepts a Httpaction and a one-way channel to write the results to.

func Env

func Env(w http.ResponseWriter, r *http.Request)

Env Handler

func Error added in v0.7.0

func Error(w http.ResponseWriter, r *http.Request)

Error Handeler

func GetLocalIP

func GetLocalIP() string

GetLocalIP helper to get the lowest index interface ip address

func Health

func Health(w http.ResponseWriter, r *http.Request)

Health Handler

func Info

func Info(w http.ResponseWriter, r *http.Request)

Info Handler

func Loggers added in v0.7.5

func Loggers(w http.ResponseWriter, r *http.Request)

Loggers Handler

func Mappings added in v0.9.0

func Mappings(w http.ResponseWriter, r *http.Request)

Mappings Handler

func Metrics

func Metrics(w http.ResponseWriter, r *http.Request)

Metrics Handler

func Register

func Register(config EurekaConfig)

Register Rgister application with EurekA

func UpdateLogger added in v0.9.0

func UpdateLogger(w http.ResponseWriter, r *http.Request)

UpdateLogger Handler

Types

type Conf added in v0.9.91

type Conf struct {
	Name       string `yaml:"name" json:"name"`
	Dir        string `yaml:"servedir" json:"servedir"`
	Port       string `yaml:"port" json:"conf"`
	SecurePort string `yaml:"secureport" json:"secureport"`
	Eureka     string `yaml:"eurekahost" json:"eurekahost"`
	PreferIP   bool   `yaml:"preferip" json:"preferip"`
	RestSevice bool   `yaml:"restservice" json:"restservice"`
	Secure     bool   `yaml:"secure" json:"secure"`
}

Conf struct

type Eureka

type Eureka interface {
	Register()
	StartHeartbeat()
}

Eureka Interface

type EurekaClient

type EurekaClient struct {
	Client Eureka
	Routes Routes
}

EurekaClient ...

func Init

func Init(config EurekaConfig) EurekaClient

Init function for setting up Eureka Client

type EurekaConfig

type EurekaConfig struct {
	Name        string
	URL         string
	VipAddress  string
	IPAddress   string
	HostName    string
	Port        string
	SecurePort  string
	RestService bool
	PreferIP    bool
	Username    string
	Password    string
	Secure      bool
	ServeDir    string
}

EurekaConfig ...

func GetFile added in v0.9.91

func GetFile(conf string) EurekaConfig

GetFile - get configuration file for settings

type EurekaRegistration

type EurekaRegistration struct {
	Instance instance `json:"instance"`
}

EurekaRegistration data type

type HTTPAction added in v0.9.6

type HTTPAction struct {
	Method      string `yaml:"method"`
	URL         string `yaml:"url"`
	Body        string `yaml:"body"`
	Template    string `yaml:"template"`
	Accept      string `yaml:"accept"`
	ContentType string `yaml:"contentType"`
	Title       string `yaml:"title"`
	StoreCookie string `yaml:"storeCookie"`
}

HTTPAction data Type

type Route

type Route struct {
	Name     string
	Method   string
	Pattern  string
	Produces string
	Handler  http.Handler
	Static   bool
}

Route data type

type Routes

type Routes []Route

Routes to be combined with main app routes to set up API

func CombineRoutes

func CombineRoutes(routes Routes, eurekaRouts Routes) Routes

CombineRoutes Combines routes from external source with actuator routes

type Settings added in v0.9.91

type Settings struct {
	Conf Conf `yaml:"conf" json:"conf"`
}

Settings stuct

Directories

Path Synopsis
+build ignore
+build ignore

Jump to

Keyboard shortcuts

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