mirror of https://github.com/portainer/portainer
34 lines
840 B
Go
34 lines
840 B
Go
|
// +build windows
|
||
|
|
||
|
package proxy
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/Microsoft/go-winio"
|
||
|
)
|
||
|
|
||
|
func (factory *proxyFactory) newLocalProxy(path string) http.Handler {
|
||
|
proxy := &localProxy{}
|
||
|
transport := &proxyTransport{
|
||
|
enableSignature: false,
|
||
|
ResourceControlService: factory.ResourceControlService,
|
||
|
TeamMembershipService: factory.TeamMembershipService,
|
||
|
SettingsService: factory.SettingsService,
|
||
|
RegistryService: factory.RegistryService,
|
||
|
DockerHubService: factory.DockerHubService,
|
||
|
dockerTransport: newNamedPipeTransport(path),
|
||
|
}
|
||
|
proxy.Transport = transport
|
||
|
return proxy
|
||
|
}
|
||
|
|
||
|
func newNamedPipeTransport(namedPipePath string) *http.Transport {
|
||
|
return &http.Transport{
|
||
|
Dial: func(proto, addr string) (conn net.Conn, err error) {
|
||
|
return winio.DialPipe(namedPipePath, nil)
|
||
|
},
|
||
|
}
|
||
|
}
|