forked from masterzen/winrm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ntlm.go
33 lines (27 loc) · 815 Bytes
/
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
package winrm
import (
"github.com/Azure/go-ntlmssp"
"github.com/masterzen/winrm/soap"
"net"
)
// ClientNTLM provides a transport via NTLMv2
type ClientNTLM struct {
clientRequest
}
// Transport creates the wrapped NTLM transport
func (c *ClientNTLM) Transport(endpoint *Endpoint) error {
c.clientRequest.Transport(endpoint)
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)
}
func NewClientNTLMWithDial(dial func(network, addr string) (net.Conn, error)) *ClientNTLM {
return &ClientNTLM{
clientRequest{
dial:dial,
},
}
}