Xgfone Ship Versions Save

A flexible, powerful, high performance and minimalist Go Web HTTP router framework.

v5.0.0

2 years ago
  • Refactor the type Context, Router, Route, RouteBuilder etc.
  • Split the runner from Ship as an independent component to run a standard http.Handler.
  • Split the virtual host manager from Ship as an independent stardard http.Handler.
  • Others. See GoDoc.

v4.3.0

2 years ago
  • Changed:
    • The default error handler no longer logs the error, and please use the logger middleware to do it.

v4.2.0

3 years ago
  • Added:
    • The Logger middleware supports the customized log function.
    • The GZip middleware supports the prefix or suffix domain, such as www.example.* and *.example.com.
  • Fixed:
    • The Logger middleware releases the buffer into the pool after the request ends. As a result, it can be reused by the next request.

v4.1.0

3 years ago
  • Added:
    • Add the convenient function IsInteger to report whether the string is an integer.
    • SetStructFieldToDefault supports the types time.Time, time.Duration and the pointer to these types.
  • Others:
    • The default error handler logs the error instead of ignoring it when the request has been responded.

v4.0.0

3 years ago
  • Added:
    • Add the middleware HandleError to handle the error.
    • Add the convenient functions InStrings and SplitHostPort.
    • Add the method Hosts for the type Ship to get the list of the added hosts.
  • Removed:
    • Remove the function HTTPPprofToRouteInfo.
    • Remove the field RouteCtxData from the type Context.
    • Remove the method RealIP from the type Context.
    • Remove the method URLParamsMaxNum from the type Ship and use the field MaxURLParamNum instead.
    • Remove the method MapType from the type Route, and not support to register the methods of a type as the routes.
    • Remove the global variable DefaultMethodMapping and the fields MethodMapping and MaxBodySize of the type Ship.
    • Remove the implementations JSONRenderer, JSONPrettyRenderer, XMLRenderer and XMLPrettyRenderer of the interface Renderer.
    • Remove the function NewRouterWithConfig and use NewRouter instead.
    • Remove the global variable RemoveTrailingSlash from the sub-package echo.
    • Remove the sub-package general, that's the implementation of the general router.
    • Remove the types TokenFunc and TokenValidator from the sub-package middleware.
    • Remove the errors ErrTokenFromHeader, ErrTokenFromQuery and ErrTokenFromForm from the sub-package middleware.
    • Remove the middleware CSRF, RemoveTrailingSlash, ReqBodyLogger, CleanPath, TokenAuth from the sub-package middleware.
    • Remove the functions FromFunc, IsNoTokenError, GetTokenFromHeader, GetTokenFromQuery and GetTokenFromForm from the sub-package middleware.
  • Changed:
    • Refactor the middleware Gzip.
    • Refactor the functions XxxJSON and use Request instead of RequestJSONWithContext, RequestJSONWithContextAndHeaders.
    • Rename the field CtxDataSize, MaxURLParamNum, RouteExecutor of the type Ship to CtxDataInitCap, URLParamMaxNum, RouterExecutor
    • Rename the method URL of the type Context to URLPath.
    • Rename the method Each to Range of the interface RegexpHostRouter.
    • Rename the function AddContentTypeToSlice to AddContentTypeMapping.
    • Rename the middleware BodyLimit to BodyLenLimit.
    • The middleware MaxRequests only supports one paramenter, that's the maximum number of the requests.
    • The middlewares CORS and Logger use the pointer to the config instead of the rest parameter.
    • The middlewares RequestID use the explicit function as the parameter instead of the rest parameter.
    • Use the interface RWLocker instead of *sync.RWMutex as the field Lock of the type Ship.
    • The route handler MethodNotAllowedHandler supports the allowed methods as the parameter.
    • The method FindRoute of the type Context no longer returns RouteInfo, but only the bool ok.
    • Move the interface Session and the function NewMemorySession from the sub-package session to the root package.
    • Move the interface Binder and some implementation, such as JSONBinder, XMLBinder, FormBinder and QueryBinder, from the sub-package binder to the root package.
    • Remove the sub-package herror and move the errors and types into the root package.
    • Remove the sub-package render and move the interface Renderer, the type MuxRenderer and the function RendererFunc into the root package.
    • Allow that the router implementation returns the type Handler as the handler.
    • Ship.SetDefaultRouter allows that the router parameter is nil to lookup the router by the host.
  • Others:
    • Optimize the codes.

v3.14.0

3 years ago
  • Added:
    • Use Config to configure the echo router in order to add the new features without breaking compatibility.
  • Fixed:
    • echo.Router.Del() supports the RemoveTrailingSlash

v3.13.0

3 years ago
  • Optimize the ship router to serve the http request.
  • The MethodNotAllowed handler of the general and echo router supports the type func(allowedMethods []string) interface{} to returns the handler with the allowed methods.

v3.12.0

3 years ago
  • Added:
    • Add the method ClientIP() for Context instead of the method RealIP().
    • Add the methods SetDefaultRouter and GetDefaultRouter for Ship to reset the default host router.
    • Add the field MaxBodySize for Ship to support the maximum size of the body of all the requests.

v3.11.1

3 years ago
  • Fixed:
    • SetStructFieldToDefault supports the unexported fields

v3.11.0

3 years ago
  • Added:
    • Add the interface RegexpHostRouter to allow the user to customize the virtual host based on the regular expression.
    • Add the field RouteExecutor for Ship to customize the route matching after matching the host and before finding the route.
  • Others:
    • Ship.AddHost(host string, router router.Router) supports the second parameter router to be nil.
    • Set Context.RouteInfo.Host to the virtual host after matching the host router, so you can use it at any time to check which virtual host router is handling the request.