-
Notifications
You must be signed in to change notification settings - Fork 129
/
ntlm.go
47 lines (40 loc) · 1.13 KB
/
ntlm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package winrm
import (
"net"
"net/http"
"net/url"
"github.com/Azure/go-ntlmssp"
"github.com/masterzen/winrm/soap"
)
// ClientNTLM provides a transport via NTLMv2
type ClientNTLM struct {
clientRequest
}
// Transport creates the wrapped NTLM transport
func (c *ClientNTLM) Transport(endpoint *Endpoint) error {
if err := c.clientRequest.Transport(endpoint); err != nil {
return err
}
c.clientRequest.transport = &ntlmssp.Negotiator{RoundTripper: c.clientRequest.transport}
return nil
}
// Post make post to the winrm soap service (forwarded to clientRequest implementation)
func (c ClientNTLM) Post(client *Client, request *soap.SoapMessage) (string, error) {
return c.clientRequest.Post(client, request)
}
//NewClientNTLMWithDial NewClientNTLMWithDial
func NewClientNTLMWithDial(dial func(network, addr string) (net.Conn, error)) *ClientNTLM {
return &ClientNTLM{
clientRequest{
dial: dial,
},
}
}
//NewClientNTLMWithProxyFunc NewClientNTLMWithProxyFunc
func NewClientNTLMWithProxyFunc(proxyfunc func(req *http.Request) (*url.URL, error)) *ClientNTLM {
return &ClientNTLM{
clientRequest{
proxyfunc: proxyfunc,
},
}
}