Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExplicitProxy ¶
type ExplicitProxy struct {
// contains filtered or unexported fields
}
func NewExplicitProxy ¶
func NewExplicitProxy(upstreamBaseURL *url.URL, requestHandler RequestHandlerI) *ExplicitProxy
if upstreamBaseURL is nil, it will be set to defaultUpstreamBaseURL
func (*ExplicitProxy) ServeHTTP ¶
func (p *ExplicitProxy) ServeHTTP(writer http.ResponseWriter, request *http.Request)
type MITMProxy ¶
type MITMProxy struct {
// contains filtered or unexported fields
}
func NewMITMProxy ¶
func NewMITMProxy(requestHandler RequestHandlerI) *MITMProxy
type RequestHandler ¶
type RequestHandler struct { // The transport used to perform proxy requests. // If nil, http.DefaultTransport is used. Transport http.RoundTripper // Github API requests that fail because of an exhausted token will be retried (with different tokens) // up to MaxGithubRetries times - defaults to defaultMaxGithubRetries if <= 0 MaxGithubRetries int // contains filtered or unexported fields }
func NewRequestHandler ¶
func NewRequestHandler(githubURL *url.URL, tokenPool token_pools.TokenPoolStorageBackend) *RequestHandler
func (*RequestHandler) HandleGithubAPIRequest ¶
func (h *RequestHandler) HandleGithubAPIRequest(writer http.ResponseWriter, request *http.Request)
func (*RequestHandler) HandleRequest ¶
func (h *RequestHandler) HandleRequest(writer http.ResponseWriter, request *http.Request)
func (*RequestHandler) ProxyRequest ¶
type RequestHandlerI ¶
type RequestHandlerI interface { // ProxyRequest should take any request, transparently proxy any request that's not made // to Github, and handle auth and throttling for requests made to Github ProxyRequest(request *http.Request) (response *http.Response, err error) // Same idea as ProxyRequest, but meant to be used as a http.Handler HandleRequest(writer http.ResponseWriter, request *http.Request) // Same as HandleRequest, but blindly re-routes all incoming requests to Github's API, regardless // of what host they were originally meant for. HandleGithubAPIRequest(writer http.ResponseWriter, request *http.Request) }
Click to show internal directories.
Click to hide internal directories.