Documentation ¶
Index ¶
Constants ¶
const ( ProxyFor = "NovaProxy-For" ProxyClient = "NovaProxy-Client" )
NovaProxy:
proxy_set_header NovaProxy-For $proxy_add_x_forwarded_for; proxy_set_header NovaProxy-Host $host; proxy_set_header NovaProxy-Client $remote_addr; proxy_set_header NovaProxy-Proto $scheme; proxy_set_header NovaProxy-Port "30000";
Variables ¶
This section is empty.
Functions ¶
func Bootstrap ¶
func Bootstrap()
Bootstrap will start the application with its very specific configuration, and then begin serving content.
func ClientAddr ¶
ClientAddr is the logic that will respect the NovaProxy headers and pull the true client addr from the proxy (if it exists)
Types ¶
type Analytics ¶
type Analytics struct { anchovies.EmbedRecord // Client hostname total visits ClientVisits map[string]int // PageVisits total visits by page PageVisits map[string]int ThisPageVisits string ThisClientVisits string }
Analytics is a site level analytics structure.
Have fun hacking this shit up!
Everything here is exposed to the website's frontend.
type Client ¶
type Client struct { // Addr is your name Addr string // NMAP is the raw NMAP results PortScan *lib.ScanResults // ClientString is the handy string we can print out // that contains client information ClientString string // GeoString is the handy string we can print out that // contains GeoIP information GeoString string }
Client is you
type ClientHandler ¶
func (*ClientHandler) GetClient ¶
func (v *ClientHandler) GetClient(r *http.Request) Client
GetClient will hit the cache and return a client if it exists Otherwise it will create a new client in memory.
TODO we should cap the buffer and implement a timeout. DoS is real.
func (ClientHandler) ServeHTTP ¶
func (v ClientHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Crypto ¶
type EmptyHandler ¶
type EmptyHandler struct { }
func (*EmptyHandler) ServeHTTP ¶
func (h *EmptyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Nivenly ¶
type Nivenly struct {
// contains filtered or unexported fields
}
Nivenly is a container for the Application as an in-memory state machine.
This is relatively simple and should not change very often.
We get a new instance of this during every bootstrap.
func DefaultValues ¶
func DefaultValues() *Nivenly
DefaultValues is just sample text to interpolate.
It's wise to return sane defaults in the event of an error. so we don't break the underlying website.
func (*Nivenly) GetAPI ¶
func (v *Nivenly) GetAPI(r *http.Request) *NivenlyAPI
GetAPI is the method that is called for every HTTP request to the website.
Break out by client here.
type NivenlyAPI ¶
type NivenlyAPI struct { // Crypto is all crypto (Not ethereum specific, although we start there) Crypto Crypto // Analytics will be page analytics for each page Analytics Analytics // ClientAddr // 1 if by proxy // 2 if by request // // Here is where we define exactly "who" our friendly visitor is. // // This is the most critical string as it also serves as the "key" // in our cache in memory. ClientAddr string // Client is the nested *Client which is the same data structure // that can be found at the /client endpoint. Client Client // R is the *http.Request for EACH request to the server. R *http.Request }
NivenlyAPI is a request specific API for the website.
All user input that comes into the website comes in the form of an HTTP request, therefor regardless of the state of the backend, we can get everything we need via an HTTP request.
Here is the API.
Add fields carefully!
This is concretely what is referenced in the "params" in the config.toml
If you can get data here - you can interpolate into the website.