Documentation ¶
Index ¶
- Constants
- func BackendFetch(req *http.Request, config *Config) (*http.Response, error)
- func GetFCGIEnvVars(req *http.Request, config *Config) map[string]string
- func GetListener(config *Config) (net.Listener, error)
- func HTTPResponseFromBytes(b []byte) (*http.Response, error)
- func HTTPResponseToBytes(r *http.Response) ([]byte, error)
- func HandleRequest(req *http.Request, config *Config, exts *[]Extension) (*http.Response, error)
- func RenderErrorPage(w http.ResponseWriter, r *http.Request, err error)
- func UnloadExtensions(exts *[]Extension)
- type Config
- type Extension
Constants ¶
const AppName = "CProxy"
AppName - name of this application
const DefaultConfigFilePath = "cproxy.json"
DefaultConfigFilePath - default path to config file
const ProxyTypeDummy = "dummy"
ProxyTypeDummy - denotes dummy test proxy
const ProxyTypeFCGI = "fcgi"
ProxyTypeFCGI - denotes FastCGI proxy
const ProxyTypeHTTP = "http"
ProxyTypeHTTP - denotes HTTP proxy
const VersionNo = 1
VersionNo - current version of this application
Variables ¶
This section is empty.
Functions ¶
func BackendFetch ¶
BackendFetch - fetch content from backend
func GetFCGIEnvVars ¶
GetFCGIEnvVars - retrieve FCGI env vars
func GetListener ¶
GetListener - get listener for incomming requests
func HTTPResponseFromBytes ¶
HTTPResponseFromBytes - convert bytes to http response
func HTTPResponseToBytes ¶
HTTPResponseToBytes - convert http response to bytes
func HandleRequest ¶
HandleRequest - handle a request
func RenderErrorPage ¶
func RenderErrorPage(w http.ResponseWriter, r *http.Request, err error)
RenderErrorPage - render an error page
func UnloadExtensions ¶
func UnloadExtensions(exts *[]Extension)
UnloadExtensions - unload all extensions
Types ¶
type Config ¶
type Config struct { ProxyType string `json:"proxy_type"` Listen string `json:"listen"` // 8081, /app/listen.sock Backend string `json:"backend"` // 127.0.0.1:9000, /app/run.sock, https://www.example.com Extensions struct { Path string `json:"path"` Enabled []string `json:"enabled"` Config map[string]json.RawMessage `json:"config"` } `json:"extensions"` }
Config - app configuration struct
func GetDefaultConfig ¶
func GetDefaultConfig() Config
GetDefaultConfig - get default configuration values
func LoadConfigFile ¶
LoadConfigFile - load configuration from file