Golang reverse proxy / application server
Clone the source code
git clone https://github.com/Wariie/go-woxy.git
cd ./go-woxy
Edit cfg.yml with your config (or try with the default one)
Build go-woxy
go build
Launch go-woxy
go-woxy cfg.yml
Dockerfile
git clone http://github.com/Wariie/go-woxy.git
cd ./go-woxy
docker build -t go-woxy .
docker run -d go-woxy
---
name: easy-go-test
server:
#cert: 'ca-cert.pem'
#cert_key: 'ca-key.pem'
modules:
mod-manager:
version: 1.0
types: 'reverse'
exe:
remote: false
src: 'https://github.com/Wariie/mod-manager.git'
main: 'main.go'
supervised: true
binding:
path:
- from: '/mod-manager'
to: '/'
port: 2001
auth:
enabled: true
type: 'http'
mod.v0:
version: 1.0
types: 'reverse'
exe:
remote: false
src: 'https://github.com/Wariie/mod.v0.git'
main: "testMod.go"
supervised: true
binding:
path:
- from: '/'
port: 2985
favicon:
types: 'bind'
binding:
path:
- from: '/favicon.ico'
root: "./resources/favicon.ico"
- moddir - module source directory
- modules - (Required) list of module config (See Module Configuration below for details)
- motd - motd filepath (default : "motd.txt")
- name - (Required) server config name
- resourcedir - resource directory
- server - (Required) server config (See Server Configuration below for details)
- version - server config version
- address - server address (example : 127.0.0.1, guilhem-mateo.fr)
- path - paths to bind (from: 'path', to: 'customPath') (See example before Example)
- port - server port (example : 2000, 8080)
- protocol - transfer protocol (supported : http, https)
- root - (M) bind to root if no exe
- cert - SSL certificate path
- cert_key - SSL key certificate path
- auth - auth config (See Module Authentication Configuration below for details)
- binding - (Required) server config (See Server Configuration below for details)
- exe - module executable informations (See Module Executable Configuration)
- name - (Required) module name
- types - (Required) module types (supported : reverse, bind)
- version - module version
- bin - source module path
- main - module main filename
- remote - boolean if it's executed on remote server (default : false)
- src - git path of module repository
- supervised - boolean if module need to be supervised
- enabled - boolean for authentication activation
- type - authentication type
Deploy a web-app easily and deploy it through go-woxy
package main
import (
"log"
"net/http"
"github.com/gin-gonic/gin"
"github.com/Wariie/go-woxy/com"
"github.com/Wariie/go-woxy/modbase"
)
func main() {
var m modbase.ModuleImpl
m.Name = "mod.v0"
m.InstanceName = "mod test v0"
//m.SetHubAddress("127.0.0.1")
//m.SetHubPort("2000")
//m.SetProtocol("https")
m.SetPort("2001")
m.SetCommand("msg", msg)
m.Init()
m.Register("GET", "/", index, "WEB")
m.Run()
}
func index(ctx *gin.Context) {
ctx.HTML(http.StatusAccepted, "index.html", gin.H{
"title": "Guilhem MATEO",
"secret": modbase.GetModManager().GetSecret(),
"hash": modbase.GetModManager().GetMod().Hash,
})
log.Println("GET / mod.v0", ctx.Request.RemoteAddr)
}
func msg(r *com.Request, c *gin.Context, mod *modbase.ModuleImpl) (string, error) {
cr := (*r).(*com.CommandRequest)
log.Println("MESSAGE :", cr.Content)
return "OK", nil
}
Much more (mod-manager) here
Want to build your own ?
Check here for the module base code
//TODO
- Custom http router - DONE
- Seperate mod logging ( optionnal with filename in config )
- Config parameter handling ( ex : from: "/{{ NAME }}")
- API Key - DONE (1 per module )
- Role - TBD ( handle api key)
- Metrics : Prometheus ?