Documentation ¶
Overview ¶
Package mulery provides an application wrapper around the mulery/server module. This is full of assumptions, but very configurable. Use it as-is, or use it as an example for your own server package.
Index ¶
- Variables
- type AllowedIPs
- type Config
- func (c *Config) ApacheLogFormat() string
- func (c *Config) Debugf(msg string, v ...interface{})
- func (c *Config) Errorf(msg string, v ...interface{})
- func (c *Config) HandleAll(resp http.ResponseWriter, _ *http.Request)
- func (c *Config) HandleOK(resp http.ResponseWriter, _ *http.Request)
- func (c *Config) KeyValidator(ctx context.Context, header http.Header) (string, error)
- func (c *Config) PrintConfig()
- func (c *Config) Printf(msg string, v ...interface{})
- func (c *Config) SetupLogs()
- func (c *Config) Shutdown()
- func (c *Config) Start()
- func (c *Config) ValidateUpstream(next http.Handler) http.Handler
- type StringSlice
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidKey = errors.New("provided key is not authorized")
Functions ¶
This section is empty.
Types ¶
type AllowedIPs ¶
type AllowedIPs struct {
// contains filtered or unexported fields
}
AllowedIPs determines who make can requests.
func MakeIPs ¶
func MakeIPs(upstreams []string) *AllowedIPs
MakeIPs turns a list of CIDR strings, IPs or dns hostnames into a list of net.IPNet. This "allowed" list is later used to check incoming IPs from web requests. Starts a go routine that does periodic dns lookups for hostnames in the upstreams list.
func (*AllowedIPs) Contains ¶
func (n *AllowedIPs) Contains(ip string) bool
Contains returns true if an IP is allowed.
func (*AllowedIPs) Start ¶ added in v0.0.4
func (n *AllowedIPs) Start()
func (*AllowedIPs) Stop ¶ added in v0.0.4
func (n *AllowedIPs) Stop()
Stop the running allow IP routine.
func (*AllowedIPs) String ¶
func (n *AllowedIPs) String() string
String turns a list of allowedIPs into a printable masterpiece.
type Config ¶
type Config struct { ListenAddr string `json:"listenAddr" toml:"listen_addr" yaml:"listenAddr" xml:"listen_addr"` AuthURL string `json:"authUrl" toml:"auth_url" yaml:"authUrl" xml:"auth_url"` AuthHeader string `json:"authHeader" toml:"auth_header" yaml:"authHeader" xml:"auth_header"` // Providing a header=>name map here will put these request headers into the apache log output. LogHeaders map[string]string `json:"logHeaders" toml:"log_headers" yaml:"logHeaders" xml:"log_headers"` // List of IPs or CIDRs that are allowed to make requests to clients. Upstreams []string `json:"upstreams" toml:"upstreams" yaml:"upstreams" xml:"upstreams"` // Optional directory where SSL certificates are stored. CacheDir string `json:"cacheDir" toml:"cache_dir" yaml:"cacheDir" xml:"cache_dir"` // CFToken is used to create DNS entries to validate SSL certs for acme. CFToken string `json:"cfToken" toml:"cf_token" yaml:"cfToken" xml:"cf_token"` // Email is used for acme certificate registration. Email string `json:"email" toml:"email" yaml:"email" xml:"email"` // DNS Names that we are allowed to create SSL certificates for. SSLNames StringSlice `json:"sslNames" toml:"ssl_names" yaml:"sslNames" xml:"ssl_names"` // Path to app log file. LogFile string `json:"logFile" toml:"log_file" yaml:"logFile" xml:"log_file"` // Number of log files to keep when rotating. LogFiles int `json:"logFiles" toml:"log_files" yaml:"logFiles" xml:"log_files"` // Rotate the log file when it reaches this many megabytes. LogFileMB int64 `json:"logFileMb" toml:"log_file_mb" yaml:"logFileMb" xml:"log_file_mb"` // Path for http log. HTTPLog string `json:"httpLog" toml:"http_log" yaml:"httpLog" xml:"http_log"` // Number of http log files to keep when rotating. HTTPLogs int `json:"httpLogs" toml:"http_logs" yaml:"httpLogs" xml:"http_logs"` // Rotate the http log file when it reaches this many megabytes. HTTPLogMB int64 `json:"httpLogMb" toml:"http_log_mb" yaml:"httpLogMb" xml:"http_log_mb"` // RedirectURL is where to send a request to any unknown path. Unauthorized is returned otherwise. RedirectURL string `json:"redirectUrl" toml:"redirect_url" yaml:"redirectUrl" xml:"redirect_url"` *server.Config // contains filtered or unexported fields }
Config is the input data to run this app. Read from a config file.
func LoadConfigFile ¶
LoadConfigFile does what its name implies.
func (*Config) ApacheLogFormat ¶
func (*Config) HandleOK ¶ added in v0.0.4
func (c *Config) HandleOK(resp http.ResponseWriter, _ *http.Request)
func (*Config) KeyValidator ¶
KeyValidator validates client secret keys against an nginx auth proxy. The actual auth proxy is: http://github.com/Notifiarr/mysql-auth-proxy
func (*Config) PrintConfig ¶
func (c *Config) PrintConfig()
PrintConfig logs the current configuration information.
type StringSlice ¶
type StringSlice []string
func (StringSlice) Contains ¶
func (s StringSlice) Contains(str string) bool
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package mulch provides shared methods, structures and variables used by mulery client library, server library and server application.
|
Package mulch provides shared methods, structures and variables used by mulery client library, server library and server application. |