portainer/api/http/proxy/factory_local_windows.go

36 lines
960 B
Go
Raw Normal View History

2018-07-20 09:02:06 +00:00
// +build windows
package proxy
import (
"net"
"net/http"
2019-05-24 07:35:15 +00:00
"github.com/Microsoft/go-winio"
portainer "github.com/portainer/portainer/api"
2018-07-20 09:02:06 +00:00
)
func (factory *proxyFactory) newLocalProxy(path string, endpointID portainer.EndpointID) http.Handler {
2018-07-20 09:02:06 +00:00
proxy := &localProxy{}
transport := &proxyTransport{
enableSignature: false,
ResourceControlService: factory.ResourceControlService,
TeamMembershipService: factory.TeamMembershipService,
SettingsService: factory.SettingsService,
RegistryService: factory.RegistryService,
DockerHubService: factory.DockerHubService,
dockerTransport: newNamedPipeTransport(path),
endpointIdentifier: endpointID,
2018-07-20 09:02:06 +00:00
}
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)
},
}
}