ntlm

package module
v0.0.0-...-93e5be7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2018 License: MIT Imports: 11 Imported by: 0

README

go-ntlm-proxy-auth

GoDoc

With this package, you can connect to http/https servers protected by an NTLM proxy in Golang.

Example

// create a dialer
dialer := &net.Dialer{
    Timeout:   30 * time.Second,
    KeepAlive: 30 * time.Second,
}

// wrap dial context with NTLM
ntlmDialContext := ntlm.WrapDialContext(dialer.DialContext, "proxyAddr", "user", "password", "domain")

// create a http(s) client
client := &http.Client{
    Transport: &http.Transport{
        Proxy: nil, // !!! IMPORTANT, do not set proxy here !!!
        Dial: dialer.Dial,
        DialContext: ntlmDialContext,
        // TLSClientConfig: ...
    },
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDebugf

func SetDebugf(f func(format string, a ...interface{}))

SetDebugf sets a debugf function for debug output

Types

type DialContext

type DialContext func(ctx context.Context, network, addr string) (net.Conn, error)

DialContext is the DialContext function that should be wrapped with a NTLM Authentication.

Example for DialContext:

dialContext := (&net.Dialer{KeepAlive: 30*time.Second, Timeout: 30*time.Second}).DialContext

func WrapDialContext

func WrapDialContext(dialContext DialContext, proxyAddress, proxyUsername, proxyPassword, proxyDomain string) DialContext

WrapDialContext wraps a DialContext with an NTLM Authentication to a proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL