From 0572587d7d9d591dc6e8dbc4538224a4b77607ea Mon Sep 17 00:00:00 2001 From: Joe Reid Date: Fri, 19 Jan 2018 11:46:06 +0000 Subject: [PATCH] Remove unused windows code The other platform variants were removed long ago, but this code was missed in that change. --- client_windows.go | 40 --------------------------------------- client_windows_test.go | 43 ------------------------------------------ 2 files changed, 83 deletions(-) delete mode 100644 client_windows.go delete mode 100644 client_windows_test.go diff --git a/client_windows.go b/client_windows.go deleted file mode 100644 index 7951463..0000000 --- a/client_windows.go +++ /dev/null @@ -1,40 +0,0 @@ -// +build windows -// Copyright 2016 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package storageos - -import ( - "net" - "net/http" - "time" - - "github.com/Microsoft/go-winio" -) - -const namedPipeConnectTimeout = 2 * time.Second - -type pipeDialer struct { - dialFunc func(network, addr string) (net.Conn, error) -} - -func (p pipeDialer) Dial(network, address string) (net.Conn, error) { - return p.dialFunc(network, address) -} - -// initializeNativeClient initializes the native Named Pipe client for Windows -func (c *Client) initializeNativeClient() { - if c.endpointURL.Scheme != namedPipeProtocol { - return - } - namedPipePath := c.endpointURL.Path - dialFunc := func(network, addr string) (net.Conn, error) { - timeout := namedPipeConnectTimeout - return winio.DialPipe(namedPipePath, &timeout) - } - tr := defaultTransport() - tr.Dial = dialFunc - c.Dialer = &pipeDialer{dialFunc} - c.nativeHTTPClient = &http.Client{Transport: tr} -} diff --git a/client_windows_test.go b/client_windows_test.go deleted file mode 100644 index fa6a85e..0000000 --- a/client_windows_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// +build windows -// Copyright 2016 go-dockerclient authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package storageos - -import ( - "fmt" - "net/http" - "net/http/httptest" - "sync" - - "github.com/Microsoft/go-winio" -) - -const ( - nativeProtocol = namedPipeProtocol - nativeRealEndpoint = "npipe:////./pipe/docker_engine" - nativeBadEndpoint = "npipe:////./pipe/godockerclient_test_echo" -) - -var ( - // namedPipeCount is used to provide uniqueness in the named pipes generated - // by newNativeServer - namedPipeCount int - // namedPipesAllocateLock protects namedPipeCount - namedPipeAllocateLock sync.Mutex -) - -func newNativeServer(handler http.Handler) (*httptest.Server, func(), error) { - namedPipeAllocateLock.Lock() - defer namedPipeAllocateLock.Unlock() - pipeName := fmt.Sprintf("//./pipe/godockerclient_test_%d", namedPipeCount) - namedPipeCount++ - l, err := winio.ListenPipe(pipeName, &winio.PipeConfig{MessageMode: true}) - if err != nil { - return nil, nil, err - } - srv := httptest.NewUnstartedServer(handler) - srv.Listener = l - return srv, func() {}, nil -}