Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ProxyPath = "/proxy"
)
Functions ¶
Types ¶
type ProxyParam ¶ added in v0.2.4
type ProxyParam struct { Target string `form:"target" binding:"required"` Path string `form:"path" binding:"required"` }
ProxyParam represents proxy request params.
type ReverseProxy ¶ added in v0.2.4
type ReverseProxy struct { }
ReverseProxy represents the http reverse proxy to target's api.
func NewReverseProxy ¶ added in v0.2.4
func NewReverseProxy() *ReverseProxy
NewReverseProxy creates a ReverseProxy instance.
func (*ReverseProxy) Proxy ¶ added in v0.2.4
func (p *ReverseProxy) Proxy(c *gin.Context)
Proxy forwards to target server api by given target ip and path.
@Summary reverse proxy @Description Forward request to target server by given target ip and path. @Tags State @Accept json @Param param body models.ProxyParam ture "param data" @Produce json @Success 200 {object} object @Failure 404 {string} string "not found" @Failure 500 {string} string "validate failure" @Failure 500 {string} string "internal error" @Router /proxy [get]
func (*ReverseProxy) Register ¶ added in v0.2.4
func (p *ReverseProxy) Register(route gin.IRoutes)
Register adds proxy url route.
type RouteRegister ¶
RouteRegister represents http handle register for spec route path.