Documentation ¶
Index ¶
- Constants
- func ClientAddress(r *http.Request, xRemoteAddress string) string
- func ClientRequestName(r Request) string
- func DumpBody(r *http.Request) (v []byte, err error)
- 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 ProxyRequestNameDefault(r *http.Request) string
- func RequestName(r *http.Request) string
- func RouteName(method, uri string) string
- func Title(name string, statusCode int, status string, tm time.Duration, ...) 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(Response)) *Client
- func (o *Client) WithTransport(transport http.RoundTripper) *Client
- type DomainMux
- 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 Response)
- 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(Response)) *Performer
- type Request
- type Response
- func (o Response) BodyExists() bool
- func (o Response) BodyString() string
- func (o Response) Format(f Format) string
- func (o Response) GetStatus() string
- func (o Response) HeaderExists(key string) bool
- func (o Response) HeaderFloat64(key string) (float64, error)
- func (o Response) HeaderInt64(key string) (int64, error)
- func (o Response) HeaderString() string
- func (o Response) HeaderTo(v any) error
- func (o Response) HeaderValue(key string) string
- func (o Response) Json(v any) error
- func (o Response) NotOkError() error
- func (o Response) Ok() bool
- func (o *Response) RefineError(text string, err error)
- func (o Response) Text() string
- func (o Response) Title() string
- type ReverseProxy
- func (o *ReverseProxy) Init()
- func (o *ReverseProxy) Log() *ulog.Log
- func (o *ReverseProxy) OnRequest(f func(http.ResponseWriter, *http.Request) error) *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) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (o *ReverseProxy) Target() string
- func (o *ReverseProxy) Tracer() *Tracer[ReverseProxyResponse]
- func (o *ReverseProxy) WithLog(log *ulog.Log) *ReverseProxy
- func (o *ReverseProxy) WithTarget(s string) *ReverseProxy
- func (o *ReverseProxy) WithTrace(tracer *Tracer[ReverseProxyResponse]) *ReverseProxy
- type ReverseProxyResponse
- func (o ReverseProxyResponse) Close()
- func (o ReverseProxyResponse) ErrorFree() bool
- func (o ReverseProxyResponse) Format(f Format) string
- func (o *ReverseProxyResponse) Header() http.Header
- func (o ReverseProxyResponse) Ok() bool
- func (o *ReverseProxyResponse) SetError(err error)
- func (o *ReverseProxyResponse) Write(v []byte) (int, error)
- func (o *ReverseProxyResponse) WriteHeader(statusCode int)
- type Router
- func (o Router) Branch(path string) *Router
- func (o *Router) Delete(path string, onRequest OnRequest)
- func (o *Router) Files(f fs.FS)
- func (o *Router) Get(path string, onRequest OnRequest)
- func (o *Router) Handle(method string, path string, onRequest OnRequest) error
- 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(path string, proxy *ReverseProxy)
- func (o *Router) Router() *mux.Router
- func (o *Router) Spa(fs fs.FS)
- func (o *Router) WebSocket(path string, onWebsocket OnWebsocket)
- func (o *Router) WithLog(log *ulog.Log) *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
- func (o *Server) WithTimeouts(timeouts Timeouts) *Server
- type ServerDual
- func (o *ServerDual) Close()
- func (o *ServerDual) Run(addr string, addrTls string, handler http.Handler) error
- func (o *ServerDual) WithAutoSecret(dir string, domains ...string) *ServerDual
- func (o *ServerDual) WithLogErrors(use bool) *ServerDual
- func (o *ServerDual) WithLogErrorsLevel(level ulog.Level) *ServerDual
- func (o *ServerDual) WithRedirectToTls(use string) *ServerDual
- func (o *ServerDual) WithSecret(certFile, keyFile string) *ServerDual
- func (o *ServerDual) WithSecretDir(dir string) *ServerDual
- func (o *ServerDual) WithTimeouts(timeouts Timeouts) *ServerDual
- type SpaHandler
- type Timeouts
- type TraceResponce
- type Tracer
- func (o *Tracer[T]) RequireRequestBody() bool
- func (o *Tracer[T]) RequireResponseBody() bool
- func (o *Tracer[T]) Trace(r T)
- func (o *Tracer[T]) WithFilter(f func(T) bool) *Tracer[T]
- func (o *Tracer[T]) WithFormat(f Format) *Tracer[T]
- func (o *Tracer[T]) WithFormatError(f Format) *Tracer[T]
- func (o *Tracer[T]) WithValidate(f func(T) bool) *Tracer[T]
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 ProxyRequestNameDefault ¶ added in v0.7.13
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 DomainMux ¶ added in v0.7.13
type DomainMux struct {
// contains filtered or unexported fields
}
func NewDomainMux ¶ added in v0.7.13
func NewDomainMux() *DomainMux
func (*DomainMux) DefaultHandler ¶ added in v0.7.13
type FormatProvider ¶ added in v0.5.3
type FormatProvider struct { Title func() string RequestParams func() string RequestHeader func() string RequestBody func() string ResponseHeader func() string ResponseBody 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) BodyLenght ¶ added in v0.7.10
func (*Request) BodyString ¶
func (*Request) HeaderString ¶
func (*Request) ParamsString ¶
type Response ¶ added in v0.7.9
type Response struct { Request Request Time time.Duration Status string StatusCode int Header http.Header Body []byte Error error }
func (Response) BodyExists ¶ added in v0.7.9
func (Response) BodyString ¶ added in v0.7.9
func (Response) HeaderExists ¶ added in v0.7.9
func (Response) HeaderFloat64 ¶ added in v0.7.9
func (Response) HeaderInt64 ¶ added in v0.7.9
func (Response) HeaderString ¶ added in v0.7.9
func (Response) HeaderValue ¶ added in v0.7.9
func (Response) NotOkError ¶ added in v0.7.9
func (*Response) RefineError ¶ added in v0.7.9
type ReverseProxy ¶ added in v0.5.9
type ReverseProxy struct {
// contains filtered or unexported fields
}
func NewReverseProxy ¶ added in v0.5.9
func NewReverseProxy() *ReverseProxy
func (*ReverseProxy) Init ¶ added in v0.7.13
func (o *ReverseProxy) Init()
func (*ReverseProxy) Log ¶ added in v0.7.13
func (o *ReverseProxy) Log() *ulog.Log
func (*ReverseProxy) OnRequest ¶ added in v0.5.9
func (o *ReverseProxy) OnRequest(f func(http.ResponseWriter, *http.Request) error) *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) ServeHTTP ¶ added in v0.7.13
func (o *ReverseProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ReverseProxy) Target ¶ added in v0.5.9
func (o *ReverseProxy) Target() string
func (*ReverseProxy) Tracer ¶ added in v0.7.9
func (o *ReverseProxy) Tracer() *Tracer[ReverseProxyResponse]
func (*ReverseProxy) WithLog ¶ added in v0.7.13
func (o *ReverseProxy) WithLog(log *ulog.Log) *ReverseProxy
func (*ReverseProxy) WithTarget ¶ added in v0.7.13
func (o *ReverseProxy) WithTarget(s string) *ReverseProxy
func (*ReverseProxy) WithTrace ¶ added in v0.7.9
func (o *ReverseProxy) WithTrace(tracer *Tracer[ReverseProxyResponse]) *ReverseProxy
type ReverseProxyResponse ¶ added in v0.7.10
type ReverseProxyResponse struct {
// contains filtered or unexported fields
}
func NewReverseProxyResponse ¶ added in v0.7.10
func NewReverseProxyResponse(r *http.Request, w http.ResponseWriter, tracer *Tracer[ReverseProxyResponse]) *ReverseProxyResponse
func (ReverseProxyResponse) Close ¶ added in v0.7.10
func (o ReverseProxyResponse) Close()
func (ReverseProxyResponse) ErrorFree ¶ added in v0.7.10
func (o ReverseProxyResponse) ErrorFree() bool
func (ReverseProxyResponse) Format ¶ added in v0.7.10
func (o ReverseProxyResponse) Format(f Format) string
func (*ReverseProxyResponse) Header ¶ added in v0.7.10
func (o *ReverseProxyResponse) Header() http.Header
func (ReverseProxyResponse) Ok ¶ added in v0.7.10
func (o ReverseProxyResponse) Ok() bool
func (*ReverseProxyResponse) SetError ¶ added in v0.7.10
func (o *ReverseProxyResponse) SetError(err error)
func (*ReverseProxyResponse) Write ¶ added in v0.7.10
func (o *ReverseProxyResponse) Write(v []byte) (int, error)
func (*ReverseProxyResponse) WriteHeader ¶ added in v0.7.10
func (o *ReverseProxyResponse) WriteHeader(statusCode int)
type Router ¶ added in v0.5.3
type Router struct {
// contains filtered or unexported fields
}
func (*Router) ReverseProxy ¶ added in v0.5.9
func (o *Router) ReverseProxy(path string, proxy *ReverseProxy)
func (*Router) WebSocket ¶ added in v0.5.3
func (o *Router) WebSocket(path string, onWebsocket OnWebsocket)
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
func (*Server) WithTimeouts ¶ added in v0.7.13
type ServerDual ¶ added in v0.7.9
type ServerDual struct {
// contains filtered or unexported fields
}
func ServerNewDual ¶ added in v0.7.9
func ServerNewDual() *ServerDual
func (*ServerDual) Close ¶ added in v0.7.9
func (o *ServerDual) Close()
func (*ServerDual) WithAutoSecret ¶ added in v0.7.9
func (o *ServerDual) WithAutoSecret(dir string, domains ...string) *ServerDual
func (*ServerDual) WithLogErrors ¶ added in v0.7.9
func (o *ServerDual) WithLogErrors(use bool) *ServerDual
func (*ServerDual) WithLogErrorsLevel ¶ added in v0.7.9
func (o *ServerDual) WithLogErrorsLevel(level ulog.Level) *ServerDual
func (*ServerDual) WithRedirectToTls ¶ added in v0.7.9
func (o *ServerDual) WithRedirectToTls(use string) *ServerDual
func (*ServerDual) WithSecret ¶ added in v0.7.9
func (o *ServerDual) WithSecret(certFile, keyFile string) *ServerDual
func (*ServerDual) WithSecretDir ¶ added in v0.7.9
func (o *ServerDual) WithSecretDir(dir string) *ServerDual
func (*ServerDual) WithTimeouts ¶ added in v0.7.13
func (o *ServerDual) WithTimeouts(timeouts Timeouts) *ServerDual
type SpaHandler ¶ added in v0.6.39
type SpaHandler struct {
// contains filtered or unexported fields
}
func NewSpaHandler ¶ added in v0.6.39
func NewSpaHandler(f fs.FS) *SpaHandler
func (*SpaHandler) ServeHTTP ¶ added in v0.6.39
func (o *SpaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*SpaHandler) WithPath ¶ added in v0.6.39
func (o *SpaHandler) WithPath(path string) *SpaHandler
type Timeouts ¶ added in v0.7.13
type TraceResponce ¶ added in v0.7.9
type Tracer ¶
type Tracer[T TraceResponce] struct { // contains filtered or unexported fields }
func (*Tracer[T]) RequireRequestBody ¶ added in v0.7.10
func (*Tracer[T]) RequireResponseBody ¶ added in v0.7.10
func (*Tracer[T]) WithFilter ¶ added in v0.5.29
func (*Tracer[T]) WithFormat ¶ added in v0.2.17
func (*Tracer[T]) WithFormatError ¶ added in v0.2.92
func (*Tracer[T]) WithValidate ¶ added in v0.3.3
Click to show internal directories.
Click to hide internal directories.