- creating CLI applications,
- testing,
- docummenting,
- using http methods,
- extracting data and etc.
You should enter some data to configuration file like: interface, upstreams with path,method,backends,proxy method.
This is how default configuration file looks like:
{ "config": [
{
"interface": ":8081",
"upstreams": [
{
"path": "/example2",
"method": "GET",
"backends": [
"https://www.apple.com/",
"https://www.microsoft.com/"
],
"proxyMethod": "anycast"
},
{
"path": "/example1",
"method": "GET",
"backends": [
"https://github.com",
"https://netflix.com/"
],
"proxyMethod": "round-robin"
}
]
},
{
"interface": ":8080",
"upstreams": [
{
"path": "/example2",
"method": "GET",
"backends": [
"https://www.yandex.com/",
"https://www.dodopizza.kz/"
],
"proxyMethod": "anycast"
},
{
"path": "/example1",
"method": "GET",
"backends": [
"https://www.google.com/",
"https://www.youtube.com"
],
"proxyMethod": "round-robin"
}
]
},
{
"interface": ":8082",
"upstreams": [
{
"path": "/example2",
"method": "GET",
"backends": [
"https://www.duckduckgo.com/",
"https://en.wikipedia.org/"
],
"proxyMethod": "anycast"
},
{
"path": "/example1",
"method": "GET",
"backends": [
"https://code.visualstudio.com/",
"https://sublimetext.com/"
],
"proxyMethod": "round-robin"
}
]
}
] }
In order to change configuration file, run CLI, then use special flag for "run" or "reload" commands:
- $go run main.go run example.json
- $go run main.go run example.json -d
- $go run main reload