Coder Social home page Coder Social logo

mutablelogic / go-server Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 1.72 MB

General HTTP Server for golang with a plugin architecture

Home Page: https://pkg.go.dev/github.com/mutablelogic/go-server

License: Apache License 2.0

Makefile 0.68% Go 88.64% Dockerfile 0.42% Shell 0.08% HTML 0.63% JavaScript 8.67% CSS 0.88%
golang http-server plugin-architecture

go-server's People

Contributors

dependabot[bot] avatar djthorpe avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

go-server's Issues

go-server provider cancel order

Fixup provider cancellation of tasks

Should cancel tasks in the reverse order to which they were created
and wait for each task to finish before cancelling the next one.

Provider is generally pretty ugly code so it does need a refactor.

router

  • Add cache
  • Cache expires older entries
  • Add gateway which publishes API's
  • Add some sort of scope support
  • Add static file serving to router
  • Add middleware for gateways
  • Consider renaming gateway to service
  • Configuration should have "self" option to add router as endpoint
  • Delay endpoint registration until "run" so that we can do logging
  • Scopes method (and indeed, all the endpoint reflection) should only output scopes and routes for the requested hostname (or if the hostname is empty) - so that each individual hostname can output a different set of reflections
  • Reflection API should include /scopes (returns all scopes) and /services (returns label and description of each service, and then lists the routes and methods)
  • Should be able to filter services so that we only - for example - return static-handler services and their prefixes
  • Make a client to query the router

certmanager

  • Create a certmanager handler
  • Should be able to create a CA
  • Should be able to import a CA
  • Should be able to query and delete a CA. CA should not be deletable if there are certs which are signed by it
  • Should be able to create a new cert from a CA
  • Should be able to query, renew, export and delete a cert

Integrate certs into nginx
Add Let's Encrypt cert generation
Create an API client for interacting with the cert manager

nginx service

Implement an nginx service tasks:

  • Start, stop, reload and test configuration
  • Create new configurations, update, enable , disable and delete them
  • Command-line client for control of nginx
  • Add a client which can be used for client-side control
  • Permissions on the TEMP directory need to be 755 rather than 700
  • Permissions on any socket directory need to reflect User and Group in httpserver
  • Add scopes for nginx for permissions
  • Add data (for sockets/pid) and log paths
  • Use a mutex lock to guard against concurrency in various places
  • Add "readonly" property to Template so that it cannot be disabled, enabled, changed or deleted
  • Add template variables for rending a configuration from a text/template
  • Allow PATCH method to write body of enabled configuration
  • Log rotation
  • Check remaining TODO's

The repository link is:
https://github.com/mutablelogic/go-server/tree/v4/pkg/handler/nginx

tokenauth

Create middleware to validate API tokens (Bearer) against an interface

  • Middleware gets JWT and a secret from the interface, and scope from the route ("permissable scope")
  • Interface provides a secret to validate the a JWT, or empty string
  • Checks against JWT using secret - if token is valid and route scope is in token scopes, skip the interface, get parameters
  • Otherwise, Interface takes a token and optionally a scope, returns all the parameters and all allowed scopes, or
  • Not Authorized if the scope is not allowed
  • Call the child method
  • After child method, store parameters and scope in JWT with the secret and pass as a cookie back to the client

The interface can store API key against parameters and allowed scopes. Interface should probably update the "last accessed date" against a token

Check for API revoke, secret revoke

provider

The provider (and the command line executable) should:

  • Load all the plugins through a -plugins option
  • List the plugins loaded
  • Reflect on the configuration of the plugins
  • Display the configuration with -help
  • Create a new empty configuation
  • Set and get properties within each configuration
  • Create a graph of dependencies based on setting properties
  • Create tasks in the right graph order
  • Run the tasks, and stop them in the reverse order when signal is received

It will be a further step to express the configuration in HCL or another config language, later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.