Documentation
¶
Index ¶
- Constants
- func CorsAllowAll(allowedOrigins []string) *cors.Cors
- type ApiFunc
- type Config
- type Package
- type Proxy
- type Resolver
- type Router
- func (r *Router) Connect(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) Delete(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) Get(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) Head(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) Options(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) Patch(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) Post(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) Put(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) ToJson() et.Json
- func (r *Router) Trace(path string, handlerFn http.HandlerFunc, packageName string)
- func (r *Router) With(middlewares ...func(http.Handler) http.Handler) *Router
- type Server
- func (s *Server) Authenticator(middleware func(http.Handler) http.Handler) *Server
- func (s *Server) AuthorizationRoute(method, path string, h http.HandlerFunc, packageName string)
- func (s *Server) Close()
- func (s *Server) Connect(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) Delete(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) DeleteProxyById(id string, save bool) error
- func (s *Server) DeleteProxys(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteRouteById(id string, save bool) error
- func (s *Server) DeleteTokenByKey(key string) error
- func (s *Server) Get(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) GetPackages(name string) et.Items
- func (s *Server) GetProxys(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetProxysById(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetRouteById(id string) *Router
- func (s *Server) GetRouter() et.Items
- func (s *Server) GetTokenByKey(key string) (et.Item, error)
- func (s *Server) HandlerValidToken(key string) (et.Item, error)
- func (s *Server) Head(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) Options(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) Patch(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) Post(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) Private() *Router
- func (s *Server) PrivateRoute(method, path string, h http.HandlerFunc, packageName string)
- func (s *Server) ProtectRoute(method, path string, h http.HandlerFunc, packageName string)
- func (s *Server) PublicRoute(method, path string, h http.HandlerFunc, packageName string)
- func (s *Server) Put(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) Reset() error
- func (s *Server) Save() error
- func (s *Server) SetAddr(port int)
- func (s *Server) SetAuthorizationMiddleware(f func(next http.Handler) http.Handler)
- func (s *Server) SetIdleTimeout(value time.Duration)
- func (s *Server) SetPortForward(id, name, description, remoteHost string, remotePort, localPort int, ...) (*Proxy, error)
- func (s *Server) SetPortForwards(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetProxy(id, path, name, description, solver, packageName string, save bool) (*Proxy, error)
- func (s *Server) SetProxys(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetReadTimeout(value time.Duration)
- func (s *Server) SetRouter(private bool, id, method, path, resolve string, header et.Json, ...) (*Router, error)
- func (s *Server) SetWriteTimeout(value time.Duration)
- func (s *Server) Start() error
- func (s *Server) StartWS() error
- func (s *Server) Trace(path string, handlerFn http.HandlerFunc, packageName string)
- func (s *Server) Use(middlewares ...func(http.Handler) http.Handler)
- func (s *Server) With(middlewares ...func(http.Handler) http.Handler) *Router
- type Storage
- type TpParams
- type TypeApi
Constants ¶
const ( MSG_ROUTE_ADD = "ruta agregada" MSG_ROUTE_UPDATE = "ruta actualizada" MSG_ROUTE_DELETE = "ruta eliminada" MSG_ROUTE_NOT_FOUND = "ruta no encontrada" MSG_ROUTE_NOT_REGISTER = "ruta no registrada" MSG_METRIC_NOT_FOUND = "metrics no definido" MSG_PACKAGE_DELETE = "paquete eliminado" MSG_APIGATEWAY_RESET = "%s reseted" MSG_METHOD_NOT_FOUND = "%s http method is not supported." MSG_TOKEN_VALID = "token valido" MSG_INVALID_KIND = "invalid kind: %s" MSG_PROXY_NOT_FOUND = "proxy no encontrado" MSG_PROXY_DELETE = "proxy eliminado" MSG_IS_PORTFORWARD = "is portforward" )
const ( CONNECT = "CONNECT" DELETE = "DELETE" GET = "GET" HEAD = "HEAD" OPTIONS = "OPTIONS" PATCH = "PATCH" POST = "POST" PUT = "PUT" TRACE = "TRACE" ROUTER_KEY = "apigateway-router" )
const ( MetricKey claim.ContextKey = "metric" ResoluteKey claim.ContextKey = "resolute" )
const QP = "?"
Variables ¶
This section is empty.
Functions ¶
func CorsAllowAll ¶
Types ¶
type ApiFunc ¶ added in v0.1.1
type ApiFunc struct {
Id string
Method string
Path string
HandlerFn http.HandlerFunc
PackageName string
}
func NewApiFunc ¶ added in v0.1.1
func NewApiFunc(id, method, path string, h http.HandlerFunc, packageName string) *ApiFunc
* * NewApiFunc * @param id, method, path string, h http.HandlerFunc, packageName string * @return *ApiFunc *
type Package ¶
type Proxy ¶ added in v0.1.1
type Proxy struct {
Id string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Path string `json:"path"`
Solver string `json:"solver"`
Kind TypeApi `json:"kind"`
PackageName string `json:"package_name"`
RemoteHost string `json:"remote_host"`
RemotePort int `json:"remote_port"`
LocalPort int `json:"local_port"`
// contains filtered or unexported fields
}
func NewProxy ¶ added in v0.1.1
* * NewProxy * @param id, path, name, description, solver, packageName string, s *Server * @return *Proxy *
func (*Proxy) ResetPortForward ¶ added in v0.1.1
* * ResetPortForward * @return error *
func (*Proxy) ServeHTTP ¶ added in v0.1.1
func (s *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
* * ServeHTTP * @param w http.ResponseWriter, r *http.Request *
func (*Proxy) StartPortForward ¶ added in v0.1.1
* * StartPortForward * @return error *
func (*Proxy) StopPortForward ¶ added in v0.1.1
* * StopPortForward * @return error *
type Resolver ¶ added in v0.1.1
type Resolver struct {
Server *Server
Method string
Proto string
Path string
RawQuery string
Query url.Values
RequestURI string
RemoteAddr string
Header http.Header
Body interface{}
Host string
Scheme string
URL string
Router *Router
}
func (*Resolver) GetResolve ¶ added in v0.1.1
* * GetResolve * @return string *
type Router ¶
type Router struct {
Id string `json:"id"`
Tag string `json:"tag"`
TpParams TpParams `json:"tp_params"`
Kind TypeApi `json:"kind"`
Method string `json:"method"`
Resolve string `json:"resolve"`
Path string `json:"path"`
Header et.Json `json:"header"`
TpHeader router.TpHeader `json:"tp_header"`
ExcludeHeader []string `json:"exclude_header"`
Private bool `json:"private"`
PackageName string `json:"package_name"`
Routes []*Router `json:"routes"`
// contains filtered or unexported fields
}
func (*Router) Connect ¶
func (r *Router) Connect(path string, handlerFn http.HandlerFunc, packageName string)
* * Connect * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Router) Delete ¶
func (r *Router) Delete(path string, handlerFn http.HandlerFunc, packageName string)
* * Delete * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Router) Get ¶
func (r *Router) Get(path string, handlerFn http.HandlerFunc, packageName string)
* * Get * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Router) Head ¶
func (r *Router) Head(path string, handlerFn http.HandlerFunc, packageName string)
* * Head * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Router) Options ¶
func (r *Router) Options(path string, handlerFn http.HandlerFunc, packageName string)
* * Options * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Router) Patch ¶
func (r *Router) Patch(path string, handlerFn http.HandlerFunc, packageName string)
* * Patch * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Router) Post ¶
func (r *Router) Post(path string, handlerFn http.HandlerFunc, packageName string)
* * Post * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Router) Put ¶
func (r *Router) Put(path string, handlerFn http.HandlerFunc, packageName string)
* * Put * @param path string, handlerFn http.HandlerFunc, packageName string *
type Server ¶
type Server struct {
CreatedAt time.Time
Id string
Name string
Version string
Company string
Web string
Help string
HostName string
// contains filtered or unexported fields
}
func (*Server) Authenticator ¶
* * Authenticator * @param middleware func(http.HandlerFunc) http.HandlerFunc * @return *Server *
func (*Server) AuthorizationRoute ¶
func (s *Server) AuthorizationRoute(method, path string, h http.HandlerFunc, packageName string)
* * AuthorizationRoute * @param method, path, handlerFn, packageName string *
func (*Server) Connect ¶
func (s *Server) Connect(path string, handlerFn http.HandlerFunc, packageName string)
* * Connect * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Server) Delete ¶
func (s *Server) Delete(path string, handlerFn http.HandlerFunc, packageName string)
* * Delete * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Server) DeleteProxyById ¶ added in v0.1.1
* * DeleteProxyById * @param id string * @return error *
func (*Server) DeleteProxys ¶ added in v0.1.1
func (s *Server) DeleteProxys(w http.ResponseWriter, r *http.Request)
* * DeleteProxys * @params w http.ResponseWriterz * @params r *http.Request *
func (*Server) DeleteRouteById ¶
* * DeleteRouteById * @param id string * @return error *
func (*Server) DeleteTokenByKey ¶
* * DeleteTokenByKey * @param id string * @return error *
func (*Server) Get ¶
func (s *Server) Get(path string, handlerFn http.HandlerFunc, packageName string)
* * Get * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Server) GetPackages ¶
* * GetPackages * @return et.Items *
func (*Server) GetProxys ¶ added in v0.1.1
func (s *Server) GetProxys(w http.ResponseWriter, r *http.Request)
* * GetProxys * @params w http.ResponseWriter * @params r *http.Request *
func (*Server) GetProxysById ¶ added in v0.1.1
func (s *Server) GetProxysById(w http.ResponseWriter, r *http.Request)
* * GetProxysById * @params w http.ResponseWriter * @params r *http.Request *
func (*Server) GetRouteById ¶
* * GetRouteById * @param id string * @return *Router *
func (*Server) GetTokenByKey ¶
* * GetTokenByKey * @param key string * @return error *
func (*Server) HandlerValidToken ¶
* * handlerValidToken * @param key string * @return error *
func (*Server) Head ¶
func (s *Server) Head(path string, handlerFn http.HandlerFunc, packageName string)
* * Head * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Server) Options ¶
func (s *Server) Options(path string, handlerFn http.HandlerFunc, packageName string)
* * Options * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Server) Patch ¶
func (s *Server) Patch(path string, handlerFn http.HandlerFunc, packageName string)
* * Patch * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Server) Post ¶
func (s *Server) Post(path string, handlerFn http.HandlerFunc, packageName string)
* * Post * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Server) PrivateRoute ¶ added in v0.1.1
func (s *Server) PrivateRoute(method, path string, h http.HandlerFunc, packageName string)
* * PrivateRoute * @param method, path, handlerFn, packageName string *
func (*Server) ProtectRoute ¶
func (s *Server) ProtectRoute(method, path string, h http.HandlerFunc, packageName string)
* * ProtectRoute * @param method, path, handlerFn, packageName string *
func (*Server) PublicRoute ¶
func (s *Server) PublicRoute(method, path string, h http.HandlerFunc, packageName string)
* * PublicRoute * @param method, path, handlerFn, packageName string *
func (*Server) Put ¶
func (s *Server) Put(path string, handlerFn http.HandlerFunc, packageName string)
* * Put * @param path string, handlerFn http.HandlerFunc, packageName string *
func (*Server) SetAuthorizationMiddleware ¶ added in v0.1.1
* * SetAuthorizationMiddleware * @param f middleware.AuthorizationMiddleware *
func (*Server) SetIdleTimeout ¶
* * SetIdleTimeout * @param h http.Handler *
func (*Server) SetPortForward ¶ added in v0.1.1
func (s *Server) SetPortForward(id, name, description, remoteHost string, remotePort, localPort int, packageName string, save bool) (*Proxy, error)
* * setPortForward * @param id, path, name, description, remoteHost string, remotePort, localPort int, packageName string, save bool * @return *Proxy, error *
func (*Server) SetPortForwards ¶ added in v0.1.1
func (s *Server) SetPortForwards(w http.ResponseWriter, r *http.Request)
* * SetPortForwards * @params w http.ResponseWriter * @params r *http.Request *
func (*Server) SetProxy ¶ added in v0.1.1
func (s *Server) SetProxy(id, path, name, description, solver, packageName string, save bool) (*Proxy, error)
* * setProxy * @param id, path, name, description, solver, packageName string, save bool * @return *Proxy, error *
func (*Server) SetProxys ¶ added in v0.1.1
func (s *Server) SetProxys(w http.ResponseWriter, r *http.Request)
* * SetProxys * @params w http.ResponseWriter * @params r *http.Request *
func (*Server) SetReadTimeout ¶
* * SetNotFoundHandler * @param h http.Handler *
func (*Server) SetRouter ¶ added in v0.1.1
func (s *Server) SetRouter(private bool, id, method, path, resolve string, header et.Json, tpHeader rt.TpHeader, excludeHeader []string, packageName string, saved bool) (*Router, error)
* * SetRouter * @param private bool, id, method, path, resolve string, header et.Json, tpHeader rt.TpHeader, excludeHeader []string, packageName string, saved bool * @return *Router, error *
func (*Server) SetWriteTimeout ¶
* * SetWriteTimeout * @param h http.Handler *
func (*Server) Trace ¶
func (s *Server) Trace(path string, handlerFn http.HandlerFunc, packageName string)
* * Trace * @param path string, handlerFn http.HandlerFunc, packageName string *
type Storage ¶ added in v0.1.1
func NewStorage ¶ added in v0.1.1
func NewStorage() *Storage