Skip to content
/ concord Public

agreement or harmony between people or groups.

License

Notifications You must be signed in to change notification settings

bhendo/concord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concord

Go Reference Go Report Card

An HTTP(S) Roundtripper for use with Golang's http.Client with an interfaces that provides a mechanism for responding to proxies that require authentication.

ProxyAuthorizer

A ProxyAuthorizer implements the Handshaker interface which represents a mechanism for handling responses from proxies that require authentication response.StatusCode == 407.

The handshake function receives a *http.Response, a *http.Request, and a net.Conn and returns a *http.Response. The response returned should be a response that is a result of successful or failed authentication. In the cases of successful authentication the response returned is often the desired response for the provided request.

The incoming *http.Response can be used to determine what kind of authentication is provided by the proxy server (e.g. Basic, Negotiate, or NTLM). The body of this response (if there is one) must be closed before writing to the net.Conn.

The Handshaker interface allows concord.Transport to handle simple (e.g. basic authentication) and complicated (e.g. NTLM or Kerberos) proxy authentication.

BasicAuthProxy Handshaker

A sample handshaker is provided that adds a Proxy-Authorization request header for basic authentication

Sample Usage

package main

import (
    "net/http"
    "net/url"

    "github.com/bhendo/concord"
    "github.com/bhendo/concord/handshakers"
)

func main() {
    proxyURL, _ := url.Parse("http://some-basic-auth-proxy:8080")
    t := concord.Transport{
        Proxy: http.ProxyURL(proxyURL),
        ProxyAuthorizer: &handshakers.BasicAuthProxy{
            UserName: "username",
            Password: "password",
        }
    }
    c := http.Client{
        Transport: &t
    }
    c.Get("http://desired-website")
}

TODO

  • DialContext similar to http.Transport
  • DialTLS similar to http.Transport
  • Reuse connections

About

agreement or harmony between people or groups.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages