Documentation
¶
Index ¶
- Constants
- func ClientAddress(r *http.Request, xRemoteAddress string) string
- func ClientRequestName(r Request) string
- func HeaderString(h http.Header) string
- func HeaderTo(h http.Header, s any) (err error)
- func IsEmpty(s string) bool
- func Marshal(v any, omitempty bool) (s string, omit bool)
- func OmitEmpty(flags []string) bool
- func ParamsString(params url.Values) string
- func ProxyRequestName(r *http.Request, xRemoteAddress string) string
- func RequestName(r *http.Request) string
- func RouteName(method, uri string) string
- func Title(name string, statusCode int, status string, tm time.Duration, bodyLen int, ...) string
- func UrlJoin(s ...any) string
- func WebSocketName(name string) string
- type Client
- func (o *Client) Base() string
- func (o *Client) Copy() *Client
- func (o *Client) Delete(url string) *Performer
- func (o *Client) Get(url string) *Performer
- func (o *Client) Post(url string) *Performer
- func (o *Client) Put(url string) *Performer
- func (o *Client) Request(method string, url string) *Performer
- func (o *Client) Timeout() time.Duration
- func (o *Client) Transport() http.RoundTripper
- func (o *Client) Url(url string) string
- func (o *Client) WithAppendPath(path string) *Client
- func (o *Client) WithBase(base string) *Client
- func (o *Client) WithOnDoRequestError(f OnError) *Client
- func (o *Client) WithOnInitRequestError(f OnError) *Client
- func (o *Client) WithOnReadBodyError(f OnError) *Client
- func (o *Client) WithPath(path string) *Client
- func (o *Client) WithProxy(proxy string) *Client
- func (o *Client) WithProxyUrl(url *url.URL) *Client
- func (o *Client) WithTimeout(timeout time.Duration) *Client
- func (o *Client) WithTrace(trace func(Responce)) *Client
- func (o *Client) WithTransport(transport http.RoundTripper) *Client
- type DualServer
- func (o *DualServer) Close()
- func (o *DualServer) Run(addr string, addrTls string, handler http.Handler) error
- func (o *DualServer) WithAutoSecret(dir string, domains ...string) *DualServer
- func (o *DualServer) WithLogErrors(use bool) *DualServer
- func (o *DualServer) WithLogErrorsLevel(level ulog.Level) *DualServer
- func (o *DualServer) WithRedirectToTls(use string) *DualServer
- func (o *DualServer) WithSecret(certFile, keyFile string) *DualServer
- func (o *DualServer) WithSecretDir(dir string) *DualServer
- type Format
- type FormatProvider
- type OnError
- type OnErrors
- type OnRequest
- type OnWebsocket
- type Performer
- func (o *Performer) Auth(v string) *Performer
- func (o *Performer) AuthBearer(token string) *Performer
- func (o *Performer) Body(body []byte) *Performer
- func (o *Performer) ContentType(v string) *Performer
- func (o *Performer) ContentTypeJson() *Performer
- func (o *Performer) Do() (r Responce)
- func (o *Performer) Header(name string, value any) *Performer
- func (o *Performer) Headers(s any) *Performer
- func (o *Performer) Json(v any) *Performer
- func (o *Performer) OnDoRequestError(f OnError) *Performer
- func (o *Performer) OnInitRequestError(f OnError) *Performer
- func (o *Performer) OnReadBodyError(f OnError) *Performer
- func (o *Performer) Param(name string, value any) *Performer
- func (o *Performer) Params(s any) *Performer
- func (o *Performer) Trace(trace func(Responce)) *Performer
- type Request
- type Responce
- func (o *Responce) BodyExists() bool
- func (o *Responce) BodyString() string
- func (o *Responce) Format(f Format) string
- func (o *Responce) GetStatus() string
- func (o *Responce) HeaderExists(key string) bool
- func (o *Responce) HeaderFloat64(key string) (float64, error)
- func (o *Responce) HeaderInt64(key string) (int64, error)
- func (o *Responce) HeaderString() string
- func (o *Responce) HeaderTo(v any) error
- func (o *Responce) HeaderValue(key string) string
- func (o *Responce) Json(v any) error
- func (o *Responce) NotOkError() error
- func (o *Responce) Ok() bool
- func (o *Responce) RefineError(text string, err error)
- func (o *Responce) Text() string
- func (o *Responce) Title() string
- type ReverseProxy
- func (o *ReverseProxy) Connect(router *Router)
- func (o *ReverseProxy) OnRequest(f func(http.ResponseWriter, *http.Request) bool) *ReverseProxy
- func (o *ReverseProxy) OnRewrite(f func(*httputil.ProxyRequest)) *ReverseProxy
- func (o *ReverseProxy) OnTarget(f func(*httputil.ProxyRequest) string) *ReverseProxy
- func (o *ReverseProxy) Pure() *ReverseProxy
- func (o *ReverseProxy) Target(s string) *ReverseProxy
- type Router
- func (o Router) Branch(path string) *Router
- func (o *Router) Delete(path string, onRequest OnRequest)
- func (o *Router) Files(files fs.FS)
- func (o *Router) Get(path string, onRequest OnRequest)
- func (o *Router) Handle(method string, path string, onRequest OnRequest)
- func (o *Router) HandleFunc(uri string, onRequest OnRequest) *mux.Route
- func (o *Router) IsRoot() bool
- func (o *Router) Log() *ulog.Log
- func (o *Router) Options(path string, onRequest OnRequest)
- func (o *Router) Post(path string, onRequest OnRequest)
- func (o *Router) Put(path string, onRequest OnRequest)
- func (o *Router) RequestName(r *http.Request) string
- func (o *Router) ReverseProxy(r *ReverseProxy)
- func (o *Router) Router() *mux.Router
- func (o *Router) WebSocket(path string, onWebsocket OnWebsocket)
- func (o *Router) WithId(id any) *Router
- func (o *Router) WithLogRequest(logRequest bool) *Router
- func (o *Router) WithWebSocketErrorLevel(level ulog.Level) *Router
- func (o *Router) WithXRemoteAddress(s string) *Router
- type Server
- func (o *Server) Close()
- func (o *Server) IsTls() bool
- func (o *Server) Run(addr string, handler http.Handler)
- func (o *Server) WithAutoSecret(dir string, domains ...string) *Server
- func (o *Server) WithLogErrors(use bool) *Server
- func (o *Server) WithLogErrorsLevel(level ulog.Level) *Server
- func (o *Server) WithSecret(certFile, keyFile string) *Server
- func (o *Server) WithSecretDir(dir string) *Server
- type Tracer
Constants ¶
View Source
const ( UrlTag string = "url" HeaderTag string = "http" )
View Source
const XForwardedFor = "X-Forwarded-For"
Variables ¶
This section is empty.
Functions ¶
func ClientAddress ¶ added in v0.6.17
func ClientRequestName ¶ added in v0.5.3
func HeaderString ¶ added in v0.2.18
func ParamsString ¶ added in v0.5.3
func ProxyRequestName ¶ added in v0.5.3
func RequestName ¶ added in v0.5.3
func WebSocketName ¶ added in v0.5.3
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Transport ¶ added in v0.3.6
func (o *Client) Transport() http.RoundTripper
func (*Client) WithAppendPath ¶ added in v0.2.26
func (*Client) WithOnDoRequestError ¶ added in v0.3.15
func (*Client) WithOnInitRequestError ¶ added in v0.3.15
func (*Client) WithOnReadBodyError ¶ added in v0.3.15
func (*Client) WithTransport ¶ added in v0.3.6
func (o *Client) WithTransport(transport http.RoundTripper) *Client
type DualServer ¶ added in v0.5.14
type DualServer struct {
// contains filtered or unexported fields
}
func NewDualServer ¶ added in v0.5.14
func NewDualServer() *DualServer
func (*DualServer) Close ¶ added in v0.5.14
func (o *DualServer) Close()
func (*DualServer) WithAutoSecret ¶ added in v0.5.14
func (o *DualServer) WithAutoSecret(dir string, domains ...string) *DualServer
func (*DualServer) WithLogErrors ¶ added in v0.5.14
func (o *DualServer) WithLogErrors(use bool) *DualServer
func (*DualServer) WithLogErrorsLevel ¶ added in v0.5.14
func (o *DualServer) WithLogErrorsLevel(level ulog.Level) *DualServer
func (*DualServer) WithRedirectToTls ¶ added in v0.5.14
func (o *DualServer) WithRedirectToTls(use string) *DualServer
func (*DualServer) WithSecret ¶ added in v0.5.14
func (o *DualServer) WithSecret(certFile, keyFile string) *DualServer
func (*DualServer) WithSecretDir ¶ added in v0.5.14
func (o *DualServer) WithSecretDir(dir string) *DualServer
type FormatProvider ¶ added in v0.5.3
type FormatProvider struct { Title func() string RequestParams func() string RequestHeader func() string RequestBody func() string ResponceHeader func() string ResponceBody func() string }
func (FormatProvider) Format ¶ added in v0.5.3
func (o FormatProvider) Format(f Format) string
type OnWebsocket ¶ added in v0.5.3
type Performer ¶
type Performer struct { Request Request // contains filtered or unexported fields }
func (*Performer) AuthBearer ¶
func (*Performer) ContentType ¶
func (*Performer) ContentTypeJson ¶
func (*Performer) OnDoRequestError ¶ added in v0.3.15
func (*Performer) OnInitRequestError ¶ added in v0.3.15
func (*Performer) OnReadBodyError ¶ added in v0.3.15
type Request ¶
func (*Request) BodyString ¶
func (*Request) HeaderString ¶
func (*Request) ParamsString ¶
type Responce ¶
type Responce struct { Request Request Time time.Duration Status string StatusCode int Header http.Header Body []byte Error error }
func (*Responce) BodyExists ¶ added in v0.2.24
func (*Responce) BodyString ¶ added in v0.5.3
func (*Responce) HeaderExists ¶ added in v0.2.18
func (*Responce) HeaderFloat64 ¶ added in v0.2.18
func (*Responce) HeaderInt64 ¶ added in v0.2.18
func (*Responce) HeaderString ¶ added in v0.2.18
func (*Responce) HeaderValue ¶ added in v0.2.18
func (*Responce) NotOkError ¶ added in v0.5.25
func (*Responce) RefineError ¶
type ReverseProxy ¶ added in v0.5.9
type ReverseProxy struct {
// contains filtered or unexported fields
}
func NewReverseProxy ¶ added in v0.5.9
func NewReverseProxy(s string) *ReverseProxy
func (*ReverseProxy) Connect ¶ added in v0.5.9
func (o *ReverseProxy) Connect(router *Router)
func (*ReverseProxy) OnRequest ¶ added in v0.5.9
func (o *ReverseProxy) OnRequest(f func(http.ResponseWriter, *http.Request) bool) *ReverseProxy
func (*ReverseProxy) OnRewrite ¶ added in v0.5.9
func (o *ReverseProxy) OnRewrite(f func(*httputil.ProxyRequest)) *ReverseProxy
func (*ReverseProxy) OnTarget ¶ added in v0.5.9
func (o *ReverseProxy) OnTarget(f func(*httputil.ProxyRequest) string) *ReverseProxy
func (*ReverseProxy) Pure ¶ added in v0.5.9
func (o *ReverseProxy) Pure() *ReverseProxy
func (*ReverseProxy) Target ¶ added in v0.5.9
func (o *ReverseProxy) Target(s string) *ReverseProxy
type Router ¶ added in v0.5.3
type Router struct {
// contains filtered or unexported fields
}
func (*Router) HandleFunc ¶ added in v0.5.9
func (*Router) ReverseProxy ¶ added in v0.5.9
func (o *Router) ReverseProxy(r *ReverseProxy)
func (*Router) WebSocket ¶ added in v0.5.3
func (o *Router) WebSocket(path string, onWebsocket OnWebsocket)
func (*Router) WithLogRequest ¶ added in v0.5.3
func (*Router) WithWebSocketErrorLevel ¶ added in v0.5.3
func (*Router) WithXRemoteAddress ¶ added in v0.5.3
type Server ¶ added in v0.5.2
type Server struct {
// contains filtered or unexported fields
}
func (*Server) WithAutoSecret ¶ added in v0.5.2
func (*Server) WithLogErrors ¶ added in v0.5.2
func (*Server) WithLogErrorsLevel ¶ added in v0.5.2
func (*Server) WithSecret ¶ added in v0.5.2
func (*Server) WithSecretDir ¶ added in v0.5.2
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
func (*Tracer) WithFilter ¶ added in v0.5.29
func (*Tracer) WithFormat ¶ added in v0.2.17
func (*Tracer) WithFormatError ¶ added in v0.2.92
Click to show internal directories.
Click to hide internal directories.