minihyperproxy

package module
v0.0.0-...-adfb97e Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BodyUnmarshallError = &HttpError{ErrString: "Error unmarshalling body", code: 422}
View Source
var EmptyFieldError = &HttpError{ErrString: "Required field is empty", code: 422}
View Source
var InvalidBodyError = &HttpError{ErrString: "Invalid body structure", code: 422}
View Source
var NoServerFoundError = &HttpError{ErrString: "Server not Found", code: 500}
View Source
var RequestUnmarshallError = &HttpError{ErrString: "Error unmarshalling request", code: 422}
View Source
var ServerHostnamePortTakenError = &HttpError{ErrString: "Server with provided hostname and port already exists", code: 500}
View Source
var ServerNameAlreadyExistsError = &HttpError{ErrString: "Server with provided name already exists", code: 500}
View Source
var URLParsingError = &HttpError{ErrString: "Can't parse given URL", code: 500}
View Source
var WrongServerTypeError = &HttpError{ErrString: "Wrong server Type", code: 500}

Functions

func BuildAPI

func BuildAPI(m *MinihyperProxy) *mux.Router

Types

type CreateHopperRequest

type CreateHopperRequest struct {
	Name     string `json:"Name"`
	Hostname string `json:"Hostname"`
}

type CreateHopperResponse

type CreateHopperResponse struct {
	Name         string `json:"Name"`
	Hostname     string `json:"Hostname"`
	IncomingPort string `json:"IncomingPort"`
	OutgoingPort string `json:"OutgoingPort"`
}

type CreateIncomingHopRequest

type CreateIncomingHopRequest struct {
	Name   string `json:"Name"`
	Route  string `json:"Route"`
	Target string `json:"Target"`
}

type CreateOutgoingHopRequest

type CreateOutgoingHopRequest struct {
	Name   string `json:"Name"`
	Route  string `json:"Route"`
	Target string `json:"Target"`
}

type CreateProxyRequest

type CreateProxyRequest struct {
	Name     string `json:"Name"`
	Hostname string `json:"Hostname"`
}

type CreateProxyResponse

type CreateProxyResponse struct {
	Name     string `json:"Name"`
	Hostname string `json:"Hostname"`
	Port     string `json:"Port"`
}

type CreateRouteRequest

type CreateRouteRequest struct {
	Name   string `json:"Name"`
	Route  string `json:"Route"`
	Target string `json:"Target"`
}

type CreateRouteResponse

type CreateRouteResponse CreateRouteRequest

type EmptyRequest

type EmptyRequest struct {
}

type GetHopsRequest

type GetHopsRequest struct {
	Name string `json:"Name"`
}

type GetHopsResponse

type GetHopsResponse struct {
	IncomingHops map[string]*url.URL `json:"IncomingHops"`
	OutgoingHops map[string]*url.URL `json:"OutgoingHops"`
}

type GetIncomingHopsResponse

type GetIncomingHopsResponse struct {
	IncomingHops map[string]*url.URL `json:"IncomingHops"`
}

type GetOutgoingHopsResponse

type GetOutgoingHopsResponse struct {
	OutgoingHops map[string]*url.URL `json:"OutgoingHops"`
}

type GetServerRequest

type GetServerRequest struct {
	Name string `json:"Name"`
}

type HopInfo

type HopInfo struct {
}

type HopperServer

type HopperServer struct {
	ServerName string
	Hostname   string

	IncomingHopsReference map[string]*url.URL
	OutgoingHopsReference map[string]*url.URL
	IncomingHopProxy      *ProxyServer
	OutgoingHopProxy      *ProxyServer
	Status                string
	// contains filtered or unexported fields
}

func NewHopperServer

func NewHopperServer(serverName string, hostname string, incomingHopPort string, outgoingHopPort string) *HopperServer

func (*HopperServer) BuildNewIncomingHop

func (h *HopperServer) BuildNewIncomingHop(target *url.URL, hop *url.URL)

func (*HopperServer) BuildNewOutgoingHop

func (h *HopperServer) BuildNewOutgoingHop(target *url.URL, hop *url.URL)

func (*HopperServer) Info

func (s *HopperServer) Info() *map[string]interface{}

func (*HopperServer) Name

func (h *HopperServer) Name() string

func (*HopperServer) Serve

func (h *HopperServer) Serve()

func (*HopperServer) Stop

func (h *HopperServer) Stop()

func (*HopperServer) Type

func (h *HopperServer) Type() string

type HttpError

type HttpError struct {
	ErrString string `json:"Error"`
	// contains filtered or unexported fields
}

func (*HttpError) Error

func (h *HttpError) Error() string

type ListServersResponse

type ListServersResponse struct {
	Info []ServerInfo `json:"Info"`
}

type MinihyperProxy

type MinihyperProxy struct {
	ErrorLog *log.Logger
	WarnLog  *log.Logger
	InfoLog  *log.Logger

	Servers              map[string]*Server
	ServersNameReference map[string]bool
	// contains filtered or unexported fields
}

func NewMinihyperProxy

func NewMinihyperProxy() (m *MinihyperProxy)

func (*MinihyperProxy) AddHop

func (m *MinihyperProxy) AddHop(serverName string, target *url.URL, hop *url.URL) (httpErr *HttpError)

func (*MinihyperProxy) GetHopperInfo

func (m *MinihyperProxy) GetHopperInfo(Name string) (serverInfo ServerInfo, httpErr *HttpError)

func (*MinihyperProxy) GetHoppersInfo

func (m *MinihyperProxy) GetHoppersInfo() (serversInfo []ServerInfo)

func (*MinihyperProxy) GetIncomingHops

func (m *MinihyperProxy) GetIncomingHops(serverName string) (hops map[string]*url.URL, httpErr *HttpError)

func (*MinihyperProxy) GetOutgoingHops

func (m *MinihyperProxy) GetOutgoingHops(serverName string) (hops map[string]*url.URL, httpErr *HttpError)

func (*MinihyperProxy) GetProxiesInfo

func (m *MinihyperProxy) GetProxiesInfo() (serversInfo []ServerInfo)

func (*MinihyperProxy) GetProxyInfo

func (m *MinihyperProxy) GetProxyInfo(Name string) (serverInfo ServerInfo, httpErr *HttpError)

func (*MinihyperProxy) GetProxyMap

func (m *MinihyperProxy) GetProxyMap(serverName string) (proxyMap map[string]string, httpErr *HttpError)

func (*MinihyperProxy) GetServerInfo

func (m *MinihyperProxy) GetServerInfo(Name string) (serverInfo ServerInfo, httpErr *HttpError)

func (*MinihyperProxy) GetServersInfo

func (m *MinihyperProxy) GetServersInfo() (serversInfo []ServerInfo)

func (*MinihyperProxy) ReceiveHop

func (m *MinihyperProxy) ReceiveHop(serverName string, target *url.URL, hop *url.URL) (httpErr *HttpError)

type ProxyInfo

type ProxyInfo struct {
}

type ProxyMapResponse

type ProxyMapResponse struct {
	ProxyMap map[string]string `json:"ProxyMap"`
}

type ProxyServer

type ProxyServer struct {
	ServerName string
	Hostname   string
	ServerPort string
	Status     string

	ProxyReference map[string]string
	ProxyMap       map[string]func(w http.ResponseWriter, r *http.Request)
	// contains filtered or unexported fields
}

func NewProxyServer

func NewProxyServer(serverName string, hostname string, port string) *ProxyServer

func (*ProxyServer) DeleteProxy

func (s *ProxyServer) DeleteProxy(route *url.URL)

func (*ProxyServer) Info

func (s *ProxyServer) Info() *map[string]interface{}

func (*ProxyServer) NewProxy

func (s *ProxyServer) NewProxy(route *url.URL, target *url.URL)

func (*ProxyServer) Serve

func (s *ProxyServer) Serve()

func (*ProxyServer) StartIncomingHopProxy

func (s *ProxyServer) StartIncomingHopProxy(director func(*http.Request), serveFunc func(*httputil.ReverseProxy, http.ResponseWriter, *http.Request))

func (*ProxyServer) StartOutgoingHopProxy

func (s *ProxyServer) StartOutgoingHopProxy(director func(*http.Request), serveFunc func(*httputil.ReverseProxy, http.ResponseWriter, *http.Request))

func (*ProxyServer) Stop

func (s *ProxyServer) Stop()

func (*ProxyServer) Type

func (s *ProxyServer) Type() string

type RouteFunction

type RouteFunction func(interface{}, *MinihyperProxy) (reponse interface{}, httpErr *HttpError)

type Server

type Server interface {
	Serve()
	Stop()
	Info() *map[string]interface{}
}

type ServerInfo

type ServerInfo *map[string]interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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