reverseproxy

package
v3.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReverseProxyCmd = &gcli.Command{
	Name: "proxy",
	Func: rp.Run,
	Desc: "start a reverse proxy http server",
	Config: func(c *gcli.Command) {
		c.StrOpt(
			&rp.listen,
			"listen", "s", "127.0.0.1:1180",
			"local proxy server listen address.",
		)
		c.StrOpt(
			&rp.remote,
			"remote", "r", "",
			"the remote reverse proxy server `address`. eg http://site.com:80;true",
		)
		c.StrOpt(
			&rp.remoteIP,
			"remoteIP", "", "",
			"the remote reverse proxy server IP address.",
		)

	},
}

ReverseProxyCmd command

Functions

func ReverseProxy

func ReverseProxy(targets ...*url.URL) *httputil.ReverseProxy

ReverseProxy create a global reverse proxy. Usage:

rp := ReverseProxy(&url.URL{
	Scheme: "http",
	Host:   "localhost:9091",
}, &url.URL{
	Scheme: "http",
	Host:   "localhost:9092",
})
log.Fatal(http.ListenAndServe(":9090", rp))

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL