Documentation ¶
Index ¶
- func RespondWithError(w http.ResponseWriter, s int, j JSONError)
- type Config
- type JSONError
- type Route
- type RouteModify
- type RouteWithProxy
- type ShrikeServer
- func (s *ShrikeServer) AddProxy(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) CreateToxic(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) DeleteRoute(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) DeleteToxic(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) GetProxies(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) GetRoute(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) GetToxic(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) GetToxics(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) Listen()
- func (s *ShrikeServer) Proxy(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) RemoveAllRoutes(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) ResetToxics(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) UpdateRoute(w http.ResponseWriter, req *http.Request)
- func (s *ShrikeServer) UpdateToxic(w http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, s int, j JSONError)
RespondWithError writes the error to the response writer
Types ¶
type Config ¶
type Config struct { Host string Port int APIPort int ToxyAddress string ToxyAPIPort int ToxyPathSeparator string UpstreamURL string }
Config for ShrikeServer
type Route ¶
type Route struct {
Prefix string `json:"prefix"`
}
Route holds information about the routing of a request
type RouteModify ¶
type RouteModify struct {
Enabled bool `json:"enabled"`
}
RouteModify holds information for updating a proxy on a route
type RouteWithProxy ¶
RouteWithProxy has the proxy and path information to show clients
type ShrikeServer ¶
type ShrikeServer struct { ProxyStore *store.ProxyStore // contains filtered or unexported fields }
ShrikeServer is the main Shrike server. Usage: server := api.New(..args) server.Listen()
func (*ShrikeServer) AddProxy ¶
func (s *ShrikeServer) AddProxy(w http.ResponseWriter, req *http.Request)
AddProxy cfg to Toxiproxy.
func (*ShrikeServer) CreateToxic ¶
func (s *ShrikeServer) CreateToxic(w http.ResponseWriter, req *http.Request)
CreateToxic on the given route
func (*ShrikeServer) DeleteRoute ¶
func (s *ShrikeServer) DeleteRoute(w http.ResponseWriter, req *http.Request)
DeleteRoute removes a route from the proxy
func (*ShrikeServer) DeleteToxic ¶
func (s *ShrikeServer) DeleteToxic(w http.ResponseWriter, req *http.Request)
DeleteToxic from the proxy
func (*ShrikeServer) GetProxies ¶
func (s *ShrikeServer) GetProxies(w http.ResponseWriter, req *http.Request)
GetProxies gets proxies from Toxiproxy and maps with the routes we match from.
func (*ShrikeServer) GetRoute ¶
func (s *ShrikeServer) GetRoute(w http.ResponseWriter, req *http.Request)
GetRoute gets proxies from Toxiproxy and maps with the routes we match from.
func (*ShrikeServer) GetToxic ¶
func (s *ShrikeServer) GetToxic(w http.ResponseWriter, req *http.Request)
GetToxic from the proxy
func (*ShrikeServer) GetToxics ¶
func (s *ShrikeServer) GetToxics(w http.ResponseWriter, req *http.Request)
GetToxics for the given route.
func (*ShrikeServer) Proxy ¶
func (s *ShrikeServer) Proxy(w http.ResponseWriter, req *http.Request)
Proxy requests via Toxiproxy proxies or the upstream server if no match.
func (*ShrikeServer) RemoveAllRoutes ¶
func (s *ShrikeServer) RemoveAllRoutes(w http.ResponseWriter, req *http.Request)
RemoveAllRoutes removes all routes. A hard reset on everything.
func (*ShrikeServer) ResetToxics ¶
func (s *ShrikeServer) ResetToxics(w http.ResponseWriter, req *http.Request)
ResetToxics removes toxics from all Routes and reenables all Route proxies
func (*ShrikeServer) UpdateRoute ¶
func (s *ShrikeServer) UpdateRoute(w http.ResponseWriter, req *http.Request)
UpdateRoute in the proxy
func (*ShrikeServer) UpdateToxic ¶
func (s *ShrikeServer) UpdateToxic(w http.ResponseWriter, req *http.Request)
UpdateToxic in the proxy