Documentation ¶
Overview ¶
Package dynamux defines a multiplexing helper for url generated at runtime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Link ¶
type Link struct { UID string Path string Destination *url.URL Proxy *httputil.ReverseProxy `json:"-"` Client *http.Client `json:"-"` Active bool // Owner string // whom the link was created on behalf of // RessourceID string // Referer string //ClickerSessionID string //ClickCount int64 CreatedAt time.Time MaxAge time.Duration Handler xhttp.Handler // contains filtered or unexported fields }
Link defines the structure of a url generated at runtime which can collect application stats. This is an indirection url which enables processing to be done before the static resource is fetched or redirected to. Typical use would be url creation for uploaded resources. Persisting(storage, update, deletion) Links and retrieving them from the udatabase are tasks left to the user of this library.
func NewLink ¶
NewLink returns an indirection link pointing to a resource (destination URL). It is used by a Multiplexer which can then insert custom request handling for such dynamically generated links. maxage <0 means the link is expired maxage = 0 means the link doesn not expire
type Multiplexer ¶
Multiplexer is used to handle dynamically generated URLs.
func NewMultiplexer ¶
func NewMultiplexer() *Multiplexer
NewMultiplexer creates a new dynamic link handler for serving requests to these runtime generated links.
func (*Multiplexer) AddLink ¶
func (m *Multiplexer) AddLink(links ...Link)
AddLink inserts a new Link into the Multiplexer.
func (*Multiplexer) ServeHTTP ¶
func (m *Multiplexer) ServeHTTP(w http.ResponseWriter, r *http.Request)