go-woxy

command module
v0.0.0-...-56e812d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 2 Imported by: 0

README

go-woxy

Go Report Card Build Status FOSSA Status

Golang reverse proxy / application server

Installation

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

Configuration

Example
---
  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"
General configuration
  • 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
Server Configuration
  • 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
Module Configuration
Module Executable Configuration
  • 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
Module Authentication Configuration
  • enabled - boolean for authentication activation
  • type - authentication type

go-woxy Module

Deploy a web-app easily and deploy it through go-woxy

Simple example

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

go-woxy API

//TODO

License

FOSSA Status

TODO LIST

  • 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 ?

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
com module
modbase module
tools module

Jump to

Keyboard shortcuts

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