Removed metadata code that only worked in kubelet
diff --git a/cloudstack.go b/cloudstack.go
index 736d4b9..e331185 100644
--- a/cloudstack.go
+++ b/cloudstack.go
@@ -22,9 +22,7 @@
"fmt"
"io"
"os"
- "path/filepath"
- "github.com/kardianos/osext"
"github.com/xanzy/go-cloudstack/cloudstack"
"gopkg.in/gcfg.v1"
"k8s.io/apimachinery/pkg/types"
@@ -50,7 +48,6 @@
// CSCloud is an implementation of Interface for CloudStack.
type CSCloud struct {
client *cloudstack.CloudStackClient
- metadata *metadata
projectID string // If non-"", all resources will be created within this project
zone string
}
@@ -87,34 +84,12 @@
zone: cfg.Global.Zone,
}
- exe, err := osext.Executable()
- if err != nil {
- return nil, fmt.Errorf("cloud not find the service executable: %v", err)
- }
-
- // When running the kubelet service it's fine to not specify a config file (or only a
- // partial config file) as all needed info can be retrieved anonymously using metadata.
- if filepath.Base(exe) == "kubelet" || filepath.Base(exe) == "kubelet.exe" {
- // In CloudStack your metadata is always served by the DHCP server.
- dhcpServer, err := findDHCPServer()
- if err == nil {
- klog.V(4).Infof("Found metadata server: %v", dhcpServer)
- cs.metadata = &metadata{dhcpServer: dhcpServer, zone: cs.zone}
- } else {
- klog.Errorf("Error searching metadata server: %v", err)
- }
- }
-
if cfg.Global.APIURL != "" && cfg.Global.APIKey != "" && cfg.Global.SecretKey != "" {
cs.client = cloudstack.NewAsyncClient(cfg.Global.APIURL, cfg.Global.APIKey, cfg.Global.SecretKey, !cfg.Global.SSLNoVerify)
}
if cs.client == nil {
- if cs.metadata != nil {
- klog.V(2).Infof("No API URL, key and secret are provided, so only using metadata!")
- } else {
- return nil, errors.New("no cloud provider config given")
- }
+ return nil, errors.New("no cloud provider config given")
}
return cs, nil
@@ -135,10 +110,6 @@
// Instances returns an implementation of Instances for CloudStack.
func (cs *CSCloud) Instances() (cloudprovider.Instances, bool) {
- if cs.metadata != nil {
- return cs.metadata, true
- }
-
if cs.client == nil {
return nil, false
}
@@ -148,10 +119,6 @@
// Zones returns an implementation of Zones for CloudStack.
func (cs *CSCloud) Zones() (cloudprovider.Zones, bool) {
- if cs.metadata != nil {
- return cs.metadata, true
- }
-
if cs.client == nil {
return nil, false
}
@@ -165,6 +132,7 @@
return nil, false
}
+ klog.Warning("This cloud provider doesn't support clusters")
return nil, false
}
@@ -174,6 +142,7 @@
return nil, false
}
+ klog.Warning("This cloud provider doesn't support routes")
return nil, false
}
diff --git a/go.mod b/go.mod
index 69568a5..5b099b8 100644
--- a/go.mod
+++ b/go.mod
@@ -15,8 +15,6 @@
github.com/coreos/go-semver v0.2.0 // indirect
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
- github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c
- github.com/d2g/dhcp4client v1.0.0
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/dnaeon/go-vcr v1.0.1 // indirect
github.com/docker/distribution v0.0.0-20181024170156-93e082742a00 // indirect
@@ -43,7 +41,6 @@
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jonboulle/clockwork v0.1.0 // indirect
github.com/json-iterator/go v1.1.5 // indirect
- github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1
github.com/marstr/guid v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
diff --git a/go.sum b/go.sum
index 0f7d902..e772890 100644
--- a/go.sum
+++ b/go.sum
@@ -38,10 +38,6 @@
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
-github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c h1:Xo2rK1pzOm0jO6abTPIQwbAmqBIOj132otexc1mmzFc=
-github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ=
-github.com/d2g/dhcp4client v1.0.0 h1:suYBsYZIkSlUMEz4TAYCczKf62IA2UWC+O8+KtdOhCo=
-github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
@@ -118,8 +114,6 @@
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
-github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro=
-github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
diff --git a/metadata.go b/metadata.go
deleted file mode 100644
index 5854a4c..0000000
--- a/metadata.go
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cloudstack
-
-import (
- "context"
- "errors"
- "fmt"
- "io/ioutil"
- "net"
- "net/http"
- "regexp"
-
- "github.com/d2g/dhcp4"
- "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/types"
- cloudprovider "k8s.io/cloud-provider"
- "k8s.io/klog"
-)
-
-type metadata struct {
- dhcpServer string
- zone string
-}
-
-type metadataType string
-
-const (
- metadataTypeHostname metadataType = "local-hostname"
- metadataTypeExternalIP metadataType = "public-ipv4"
- metadataTypeInternalIP metadataType = "local-ipv4"
- metadataTypeInstanceID metadataType = "instance-id"
- metadataTypeInstanceType metadataType = "service-offering"
- metadataTypeZone metadataType = "availability-zone"
-)
-
-var labelInvalidCharsRegex *regexp.Regexp = regexp.MustCompile(`([^A-Za-z0-9][^-A-Za-z0-9_.]*)?[^A-Za-z0-9]`)
-
-// NodeAddresses returns the addresses of the specified instance.
-func (m *metadata) NodeAddresses(ctx context.Context, name types.NodeName) ([]v1.NodeAddress, error) {
- externalIP, err := m.get(metadataTypeExternalIP)
- if err != nil {
- return nil, fmt.Errorf("could not get external IP: %v", err)
- }
-
- internalIP, err := m.get(metadataTypeInternalIP)
- if err != nil {
- return nil, fmt.Errorf("could not get internal IP: %v", err)
- }
-
- addresses := []v1.NodeAddress{
- {Type: v1.NodeExternalIP, Address: externalIP},
- {Type: v1.NodeInternalIP, Address: internalIP},
- }
-
- hostname, err := m.get(metadataTypeHostname)
- if err != nil {
- return nil, fmt.Errorf("could not get hostname: %v", err)
- }
- if hostname != "" {
- addresses = append(addresses, v1.NodeAddress{Type: v1.NodeHostName, Address: hostname})
- }
-
- return addresses, nil
-}
-
-// NodeAddressesByProviderID returns the addresses of the specified instance.
-func (m *metadata) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) {
- return nil, errors.New("NodeAddressesByProviderID not implemented")
-}
-
-// InstanceID returns the cloud provider ID of the specified instance.
-func (m *metadata) InstanceID(ctx context.Context, name types.NodeName) (string, error) {
- instanceID, err := m.get(metadataTypeInstanceID)
- if err != nil {
- return "", fmt.Errorf("could not get instance ID: %v", err)
- }
-
- zone, err := m.get(metadataTypeZone)
- if err != nil {
- return "", fmt.Errorf("could not get zone: %v", err)
- }
-
- return "/" + zone + "/" + instanceID, nil
-}
-
-// InstanceType returns the type of the specified instance.
-func (m *metadata) InstanceType(ctx context.Context, name types.NodeName) (string, error) {
- instanceTypeCS, err := m.get(metadataTypeInstanceType)
-
- // Replace everything that doesn't match the metadata.labels regex
- instanceType := labelInvalidCharsRegex.ReplaceAllString(instanceTypeCS, ``)
-
- if err != nil {
- return "", fmt.Errorf("could not get instance type: %v", err)
- }
-
- return instanceType, nil
-}
-
-// InstanceTypeByProviderID returns the type of the specified instance.
-func (m *metadata) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error) {
- return "", errors.New("InstanceTypeByProviderID not implemented")
-}
-
-// AddSSHKeyToAllInstances is currently not implemented.
-func (m *metadata) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error {
- return cloudprovider.NotImplemented
-}
-
-// CurrentNodeName returns the name of the node we are currently running on.
-func (m *metadata) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error) {
- return types.NodeName(hostname), nil
-}
-
-// InstanceExistsByProviderID returns if the instance still exists.
-func (m *metadata) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) {
- return false, errors.New("InstanceExistsByProviderID not implemented")
-}
-
-// InstanceShutdownByProviderID returns if the instance is shutdown.
-func (m *metadata) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error) {
- return false, cloudprovider.NotImplemented
-}
-
-// GetZone returns the Zone containing the region that the program is running in.
-func (m *metadata) GetZone(ctx context.Context) (cloudprovider.Zone, error) {
- zone := cloudprovider.Zone{}
-
- if m.zone == "" {
- zoneName, err := m.get(metadataTypeZone)
- if err != nil {
- return zone, fmt.Errorf("could not get zone: %v", err)
- }
-
- m.zone = zoneName
- }
-
- klog.V(2).Infof("Current zone is %v", zone)
- zone.FailureDomain = m.zone
- zone.Region = m.zone
-
- return zone, nil
-}
-
-// GetZoneByProviderID returns the Zone, found by using the provider ID.
-func (m *metadata) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error) {
- return cloudprovider.Zone{}, errors.New("GetZoneByProviderID not implemented")
-}
-
-// GetZoneByNodeName returns the Zone, found by using the node name.
-func (m *metadata) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error) {
- return cloudprovider.Zone{}, errors.New("GetZoneByNodeName not implemented")
-}
-
-func (m *metadata) get(mdType metadataType) (string, error) {
- url := fmt.Sprintf("http://%s/latest/meta-data/%s", m.dhcpServer, mdType)
-
- resp, err := http.Get(url)
- if err != nil {
- return "", fmt.Errorf("error reading metadata: %v", err)
- }
- defer resp.Body.Close()
-
- if resp.StatusCode != http.StatusOK {
- return "", fmt.Errorf("unexpected HTTP status: %d", resp.StatusCode)
- }
-
- data, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return "", fmt.Errorf("error reading response body: %d", resp.StatusCode)
- }
-
- return string(data), nil
-}
-
-func findDHCPServer() (string, error) {
- nics, err := net.Interfaces()
- if err != nil {
- return "", fmt.Errorf("could not get interfaces: %v", err)
- }
-
- for _, nic := range nics {
- if nic.Flags&net.FlagUp == 1 && nic.Flags&net.FlagLoopback == 0 && nic.Flags&net.FlagPointToPoint == 0 {
- addrs, err := nic.Addrs()
- if err != nil {
- return "", fmt.Errorf("error reading IP addresses from interface %v: %v", nic.Name, err)
- }
-
- if addrs != nil {
- client, err := newDHCPClient(&nic)
- if err != nil {
- return "", fmt.Errorf("error creating new DHCP client: %v", err)
- }
-
- discoverPacket, err := client.SendDiscoverPacket()
- if err != nil {
- return "", fmt.Errorf("error sending DHCP discover package: %v", err)
- }
-
- offerPacket, err := client.GetOffer(&discoverPacket)
- if err != nil {
- return "", fmt.Errorf("error receiving DHCP offer package: %v", err)
- }
-
- offerPacketOptions := offerPacket.ParseOptions()
-
- if ipaddr, ok := offerPacketOptions[dhcp4.OptionServerIdentifier]; ok {
- return net.IP(ipaddr).String(), nil
- }
- }
- }
- }
-
- return "", errors.New("no server found")
-}
diff --git a/metadata_linux.go b/metadata_linux.go
deleted file mode 100644
index 02603bf..0000000
--- a/metadata_linux.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build linux
-
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cloudstack
-
-import (
- "net"
- "time"
-
- "github.com/d2g/dhcp4client"
-)
-
-func newDHCPClient(nic *net.Interface) (*dhcp4client.Client, error) {
- pktsock, err := dhcp4client.NewPacketSock(nic.Index)
- if err != nil {
- return nil, err
- }
-
- return dhcp4client.New(
- dhcp4client.HardwareAddr(nic.HardwareAddr),
- dhcp4client.Timeout(2*time.Second),
- dhcp4client.Broadcast(false),
- dhcp4client.Connection(pktsock),
- )
-}
diff --git a/metadata_other.go b/metadata_other.go
deleted file mode 100644
index 74a7fe2..0000000
--- a/metadata_other.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build !linux
-
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cloudstack
-
-import (
- "net"
- "time"
-
- "github.com/d2g/dhcp4client"
-)
-
-func newDHCPClient(nic *net.Interface) (*dhcp4client.Client, error) {
- inetsock, err := dhcp4client.NewInetSock()
- if err != nil {
- return nil, err
- }
-
- return dhcp4client.New(
- dhcp4client.HardwareAddr(nic.HardwareAddr),
- dhcp4client.Timeout(2*time.Second),
- dhcp4client.Broadcast(false),
- dhcp4client.Connection(inetsock),
- )
-}
diff --git a/vendor/github.com/d2g/dhcp4/LICENSE b/vendor/github.com/d2g/dhcp4/LICENSE
deleted file mode 100644
index f7d058a..0000000
--- a/vendor/github.com/d2g/dhcp4/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2013 Skagerrak Software Limited. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Skagerrak Software Limited nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/vendor/github.com/d2g/dhcp4/README.md b/vendor/github.com/d2g/dhcp4/README.md
deleted file mode 100644
index 6752dc7..0000000
--- a/vendor/github.com/d2g/dhcp4/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# DHCP4 - A DHCP library written in Go.
-
-Warning: This library is still being developed. Function calls will change.
-
-I've removed Server Functionality, for me this project supports the underlying DHCP format not the implementation.
diff --git a/vendor/github.com/d2g/dhcp4/constants.go b/vendor/github.com/d2g/dhcp4/constants.go
deleted file mode 100644
index 183a778..0000000
--- a/vendor/github.com/d2g/dhcp4/constants.go
+++ /dev/null
@@ -1,121 +0,0 @@
-package dhcp4
-
-// OpCodes
-const (
- BootRequest OpCode = 1 // From Client
- BootReply OpCode = 2 // From Server
-)
-
-// DHCP Message Type 53
-const (
- Discover MessageType = 1 // Broadcast Packet From Client - Can I have an IP?
- Offer MessageType = 2 // Broadcast From Server - Here's an IP
- Request MessageType = 3 // Broadcast From Client - I'll take that IP (Also start for renewals)
- Decline MessageType = 4 // Broadcast From Client - Sorry I can't use that IP
- ACK MessageType = 5 // From Server, Yes you can have that IP
- NAK MessageType = 6 // From Server, No you cannot have that IP
- Release MessageType = 7 // From Client, I don't need that IP anymore
- Inform MessageType = 8 // From Client, I have this IP and there's nothing you can do about it
-)
-
-// DHCP Options
-const (
- End OptionCode = 255
- Pad OptionCode = 0
- OptionSubnetMask OptionCode = 1
- OptionTimeOffset OptionCode = 2
- OptionRouter OptionCode = 3
- OptionTimeServer OptionCode = 4
- OptionNameServer OptionCode = 5
- OptionDomainNameServer OptionCode = 6
- OptionLogServer OptionCode = 7
- OptionCookieServer OptionCode = 8
- OptionLPRServer OptionCode = 9
- OptionImpressServer OptionCode = 10
- OptionResourceLocationServer OptionCode = 11
- OptionHostName OptionCode = 12
- OptionBootFileSize OptionCode = 13
- OptionMeritDumpFile OptionCode = 14
- OptionDomainName OptionCode = 15
- OptionSwapServer OptionCode = 16
- OptionRootPath OptionCode = 17
- OptionExtensionsPath OptionCode = 18
-
- // IP Layer Parameters per Host
- OptionIPForwardingEnableDisable OptionCode = 19
- OptionNonLocalSourceRoutingEnableDisable OptionCode = 20
- OptionPolicyFilter OptionCode = 21
- OptionMaximumDatagramReassemblySize OptionCode = 22
- OptionDefaultIPTimeToLive OptionCode = 23
- OptionPathMTUAgingTimeout OptionCode = 24
- OptionPathMTUPlateauTable OptionCode = 25
-
- // IP Layer Parameters per Interface
- OptionInterfaceMTU OptionCode = 26
- OptionAllSubnetsAreLocal OptionCode = 27
- OptionBroadcastAddress OptionCode = 28
- OptionPerformMaskDiscovery OptionCode = 29
- OptionMaskSupplier OptionCode = 30
- OptionPerformRouterDiscovery OptionCode = 31
- OptionRouterSolicitationAddress OptionCode = 32
- OptionStaticRoute OptionCode = 33
-
- // Link Layer Parameters per Interface
- OptionTrailerEncapsulation OptionCode = 34
- OptionARPCacheTimeout OptionCode = 35
- OptionEthernetEncapsulation OptionCode = 36
-
- // TCP Parameters
- OptionTCPDefaultTTL OptionCode = 37
- OptionTCPKeepaliveInterval OptionCode = 38
- OptionTCPKeepaliveGarbage OptionCode = 39
-
- // Application and Service Parameters
- OptionNetworkInformationServiceDomain OptionCode = 40
- OptionNetworkInformationServers OptionCode = 41
- OptionNetworkTimeProtocolServers OptionCode = 42
- OptionVendorSpecificInformation OptionCode = 43
- OptionNetBIOSOverTCPIPNameServer OptionCode = 44
- OptionNetBIOSOverTCPIPDatagramDistributionServer OptionCode = 45
- OptionNetBIOSOverTCPIPNodeType OptionCode = 46
- OptionNetBIOSOverTCPIPScope OptionCode = 47
- OptionXWindowSystemFontServer OptionCode = 48
- OptionXWindowSystemDisplayManager OptionCode = 49
- OptionNetworkInformationServicePlusDomain OptionCode = 64
- OptionNetworkInformationServicePlusServers OptionCode = 65
- OptionMobileIPHomeAgent OptionCode = 68
- OptionSimpleMailTransportProtocol OptionCode = 69
- OptionPostOfficeProtocolServer OptionCode = 70
- OptionNetworkNewsTransportProtocol OptionCode = 71
- OptionDefaultWorldWideWebServer OptionCode = 72
- OptionDefaultFingerServer OptionCode = 73
- OptionDefaultInternetRelayChatServer OptionCode = 74
- OptionStreetTalkServer OptionCode = 75
- OptionStreetTalkDirectoryAssistance OptionCode = 76
-
- // DHCP Extensions
- OptionRequestedIPAddress OptionCode = 50
- OptionIPAddressLeaseTime OptionCode = 51
- OptionOverload OptionCode = 52
- OptionDHCPMessageType OptionCode = 53
- OptionServerIdentifier OptionCode = 54
- OptionParameterRequestList OptionCode = 55
- OptionMessage OptionCode = 56
- OptionMaximumDHCPMessageSize OptionCode = 57
- OptionRenewalTimeValue OptionCode = 58
- OptionRebindingTimeValue OptionCode = 59
- OptionVendorClassIdentifier OptionCode = 60
- OptionClientIdentifier OptionCode = 61
-
- OptionTFTPServerName OptionCode = 66
- OptionBootFileName OptionCode = 67
-
- OptionUserClass OptionCode = 77
-
- OptionClientArchitecture OptionCode = 93
-
- OptionTZPOSIXString OptionCode = 100
- OptionTZDatabaseString OptionCode = 101
-
- OptionClasslessRouteFormat OptionCode = 121
-)
diff --git a/vendor/github.com/d2g/dhcp4/helpers.go b/vendor/github.com/d2g/dhcp4/helpers.go
deleted file mode 100644
index 4b14638..0000000
--- a/vendor/github.com/d2g/dhcp4/helpers.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package dhcp4
-
-import (
- "encoding/binary"
- "net"
- "time"
-)
-
-// IPRange returns how many ips in the ip range from start to stop (inclusive)
-func IPRange(start, stop net.IP) int {
- //return int(Uint([]byte(stop))-Uint([]byte(start))) + 1
- return int(binary.BigEndian.Uint32(stop.To4())) - int(binary.BigEndian.Uint32(start.To4())) + 1
-}
-
-// IPAdd returns a copy of start + add.
-// IPAdd(net.IP{192,168,1,1},30) returns net.IP{192.168.1.31}
-func IPAdd(start net.IP, add int) net.IP { // IPv4 only
- start = start.To4()
- //v := Uvarint([]byte(start))
- result := make(net.IP, 4)
- binary.BigEndian.PutUint32(result, binary.BigEndian.Uint32(start)+uint32(add))
- //PutUint([]byte(result), v+uint64(add))
- return result
-}
-
-// IPLess returns where IP a is less than IP b.
-func IPLess(a, b net.IP) bool {
- b = b.To4()
- for i, ai := range a.To4() {
- if ai != b[i] {
- return ai < b[i]
- }
- }
- return false
-}
-
-// IPInRange returns true if ip is between (inclusive) start and stop.
-func IPInRange(start, stop, ip net.IP) bool {
- return !(IPLess(ip, start) || IPLess(stop, ip))
-}
-
-// OptionsLeaseTime - converts a time.Duration to a 4 byte slice, compatible
-// with OptionIPAddressLeaseTime.
-func OptionsLeaseTime(d time.Duration) []byte {
- leaseBytes := make([]byte, 4)
- binary.BigEndian.PutUint32(leaseBytes, uint32(d/time.Second))
- //PutUvarint(leaseBytes, uint64(d/time.Second))
- return leaseBytes
-}
-
-// JoinIPs returns a byte slice of IP addresses, one immediately after the other
-// This may be useful for creating multiple IP options such as OptionRouter.
-func JoinIPs(ips []net.IP) (b []byte) {
- for _, v := range ips {
- b = append(b, v.To4()...)
- }
- return
-}
diff --git a/vendor/github.com/d2g/dhcp4/option.go b/vendor/github.com/d2g/dhcp4/option.go
deleted file mode 100644
index fbf86e6..0000000
--- a/vendor/github.com/d2g/dhcp4/option.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package dhcp4
-
-type OptionCode byte
-
-type Option struct {
- Code OptionCode
- Value []byte
-}
-
-// Map of DHCP options
-type Options map[OptionCode][]byte
-
-// SelectOrderOrAll has same functionality as SelectOrder, except if the order
-// param is nil, whereby all options are added (in arbitrary order).
-func (o Options) SelectOrderOrAll(order []byte) []Option {
- if order == nil {
- opts := make([]Option, 0, len(o))
- for i, v := range o {
- opts = append(opts, Option{Code: i, Value: v})
- }
- return opts
- }
- return o.SelectOrder(order)
-}
-
-// SelectOrder returns a slice of options ordered and selected by a byte array
-// usually defined by OptionParameterRequestList. This result is expected to be
-// used in ReplyPacket()'s []Option parameter.
-func (o Options) SelectOrder(order []byte) []Option {
- opts := make([]Option, 0, len(order))
- for _, v := range order {
- if data, ok := o[OptionCode(v)]; ok {
- opts = append(opts, Option{Code: OptionCode(v), Value: data})
- }
- }
- return opts
-}
-
-type OpCode byte
-type MessageType byte // Option 53
diff --git a/vendor/github.com/d2g/dhcp4/packet.go b/vendor/github.com/d2g/dhcp4/packet.go
deleted file mode 100644
index 25d69fb..0000000
--- a/vendor/github.com/d2g/dhcp4/packet.go
+++ /dev/null
@@ -1,150 +0,0 @@
-package dhcp4
-
-import (
- "net"
- "time"
-)
-
-// A DHCP packet
-type Packet []byte
-
-func (p Packet) OpCode() OpCode { return OpCode(p[0]) }
-func (p Packet) HType() byte { return p[1] }
-func (p Packet) HLen() byte { return p[2] }
-func (p Packet) Hops() byte { return p[3] }
-func (p Packet) XId() []byte { return p[4:8] }
-func (p Packet) Secs() []byte { return p[8:10] } // Never Used?
-func (p Packet) Flags() []byte { return p[10:12] }
-func (p Packet) CIAddr() net.IP { return net.IP(p[12:16]) }
-func (p Packet) YIAddr() net.IP { return net.IP(p[16:20]) }
-func (p Packet) SIAddr() net.IP { return net.IP(p[20:24]) }
-func (p Packet) GIAddr() net.IP { return net.IP(p[24:28]) }
-func (p Packet) CHAddr() net.HardwareAddr {
- hLen := p.HLen()
- if hLen > 16 { // Prevent chaddr exceeding p boundary
- hLen = 16
- }
- return net.HardwareAddr(p[28 : 28+hLen]) // max endPos 44
-}
-
-// 192 bytes of zeros BOOTP legacy
-func (p Packet) Cookie() []byte { return p[236:240] }
-func (p Packet) Options() []byte {
- if len(p) > 240 {
- return p[240:]
- }
- return nil
-}
-
-func (p Packet) Broadcast() bool { return p.Flags()[0] > 127 }
-
-func (p Packet) SetBroadcast(broadcast bool) {
- if p.Broadcast() != broadcast {
- p.Flags()[0] ^= 128
- }
-}
-
-func (p Packet) SetOpCode(c OpCode) { p[0] = byte(c) }
-func (p Packet) SetCHAddr(a net.HardwareAddr) {
- copy(p[28:44], a)
- p[2] = byte(len(a))
-}
-func (p Packet) SetHType(hType byte) { p[1] = hType }
-func (p Packet) SetCookie(cookie []byte) { copy(p.Cookie(), cookie) }
-func (p Packet) SetHops(hops byte) { p[3] = hops }
-func (p Packet) SetXId(xId []byte) { copy(p.XId(), xId) }
-func (p Packet) SetSecs(secs []byte) { copy(p.Secs(), secs) }
-func (p Packet) SetFlags(flags []byte) { copy(p.Flags(), flags) }
-func (p Packet) SetCIAddr(ip net.IP) { copy(p.CIAddr(), ip.To4()) }
-func (p Packet) SetYIAddr(ip net.IP) { copy(p.YIAddr(), ip.To4()) }
-func (p Packet) SetSIAddr(ip net.IP) { copy(p.SIAddr(), ip.To4()) }
-func (p Packet) SetGIAddr(ip net.IP) { copy(p.GIAddr(), ip.To4()) }
-
-// Parses the packet's options into an Options map
-func (p Packet) ParseOptions() Options {
- opts := p.Options()
- options := make(Options, 10)
- for len(opts) >= 2 && OptionCode(opts[0]) != End {
- if OptionCode(opts[0]) == Pad {
- opts = opts[1:]
- continue
- }
- size := int(opts[1])
- if len(opts) < 2+size {
- break
- }
- options[OptionCode(opts[0])] = opts[2 : 2+size]
- opts = opts[2+size:]
- }
- return options
-}
-
-func NewPacket(opCode OpCode) Packet {
- p := make(Packet, 241)
- p.SetOpCode(opCode)
- p.SetHType(1) // Ethernet
- p.SetCookie([]byte{99, 130, 83, 99})
- p[240] = byte(End)
- return p
-}
-
-// Appends a DHCP option to the end of a packet
-func (p *Packet) AddOption(o OptionCode, value []byte) {
- *p = append((*p)[:len(*p)-1], []byte{byte(o), byte(len(value))}...) // Strip off End, Add OptionCode and Length
- *p = append(*p, value...) // Add Option Value
- *p = append(*p, byte(End)) // Add on new End
-}
-
-// Removes all options from packet.
-func (p *Packet) StripOptions() {
- *p = append((*p)[:240], byte(End))
-}
-
-// Creates a request packet that a Client would send to a server.
-func RequestPacket(mt MessageType, chAddr net.HardwareAddr, cIAddr net.IP, xId []byte, broadcast bool, options []Option) Packet {
- p := NewPacket(BootRequest)
- p.SetCHAddr(chAddr)
- p.SetXId(xId)
- if cIAddr != nil {
- p.SetCIAddr(cIAddr)
- }
- p.SetBroadcast(broadcast)
- p.AddOption(OptionDHCPMessageType, []byte{byte(mt)})
- for _, o := range options {
- p.AddOption(o.Code, o.Value)
- }
- p.PadToMinSize()
- return p
-}
-
-// ReplyPacket creates a reply packet that a Server would send to a client.
-// It uses the req Packet param to copy across common/necessary fields to
-// associate the reply the request.
-func ReplyPacket(req Packet, mt MessageType, serverId, yIAddr net.IP, leaseDuration time.Duration, options []Option) Packet {
- p := NewPacket(BootReply)
- p.SetXId(req.XId())
- p.SetFlags(req.Flags())
- p.SetYIAddr(yIAddr)
- p.SetGIAddr(req.GIAddr())
- p.SetCHAddr(req.CHAddr())
- p.AddOption(OptionDHCPMessageType, []byte{byte(mt)})
- p.AddOption(OptionServerIdentifier, []byte(serverId))
- if leaseDuration > 0 {
- p.AddOption(OptionIPAddressLeaseTime, OptionsLeaseTime(leaseDuration))
- }
- for _, o := range options {
- p.AddOption(o.Code, o.Value)
- }
- p.PadToMinSize()
- return p
-}
-
-// PadToMinSize pads a packet so that when sent over UDP, the entire packet,
-// is 300 bytes (BOOTP min), to be compatible with really old devices.
-var padder [272]byte
-
-func (p *Packet) PadToMinSize() {
- if n := len(*p); n < 272 {
- *p = append(*p, padder[:272-n]...)
- }
-}
diff --git a/vendor/github.com/d2g/dhcp4client/LICENSE b/vendor/github.com/d2g/dhcp4client/LICENSE
deleted file mode 100644
index c33dcc7..0000000
--- a/vendor/github.com/d2g/dhcp4client/LICENSE
+++ /dev/null
@@ -1,354 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. “Contributor”
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. “Contributor Version”
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor’s Contribution.
-
-1.3. “Contribution”
-
- means Covered Software of a particular Contributor.
-
-1.4. “Covered Software”
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. “Incompatible With Secondary Licenses”
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of version
- 1.1 or earlier of the License, but not also under the terms of a
- Secondary License.
-
-1.6. “Executable Form”
-
- means any form of the work other than Source Code Form.
-
-1.7. “Larger Work”
-
- means a work that combines Covered Software with other material, in a separate
- file or files, that is not Covered Software.
-
-1.8. “License”
-
- means this document.
-
-1.9. “Licensable”
-
- means having the right to grant, to the maximum extent possible, whether at the
- time of the initial grant or subsequently, any and all of the rights conveyed by
- this License.
-
-1.10. “Modifications”
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to, deletion
- from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. “Patent Claims” of a Contributor
-
- means any patent claim(s), including without limitation, method, process,
- and apparatus claims, in any patent Licensable by such Contributor that
- would be infringed, but for the grant of the License, by the making,
- using, selling, offering for sale, having made, import, or transfer of
- either its Contributions or its Contributor Version.
-
-1.12. “Secondary License”
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. “Source Code Form”
-
- means the form of the work preferred for making modifications.
-
-1.14. “You” (or “Your”)
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, “You” includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, “control” means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or as
- part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its Contributions
- or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution become
- effective for each Contribution on the date the Contributor first distributes
- such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under this
- License. No additional rights or licenses will be implied from the distribution
- or licensing of Covered Software under this License. Notwithstanding Section
- 2.1(b) above, no patent license is granted by a Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party’s
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of its
- Contributions.
-
- This License does not grant any rights in the trademarks, service marks, or
- logos of any Contributor (except as may be necessary to comply with the
- notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this License
- (see Section 10.2) or under the terms of a Secondary License (if permitted
- under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its Contributions
- are its original creation(s) or it has sufficient rights to grant the
- rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under applicable
- copyright doctrines of fair use, fair dealing, or other equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under the
- terms of this License. You must inform recipients that the Source Code Form
- of the Covered Software is governed by the terms of this License, and how
- they can obtain a copy of this License. You may not attempt to alter or
- restrict the recipients’ rights in the Source Code Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this License,
- or sublicense it under different terms, provided that the license for
- the Executable Form does not attempt to limit or alter the recipients’
- rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for the
- Covered Software. If the Larger Work is a combination of Covered Software
- with a work governed by one or more Secondary Licenses, and the Covered
- Software is not Incompatible With Secondary Licenses, this License permits
- You to additionally distribute such Covered Software under the terms of
- such Secondary License(s), so that the recipient of the Larger Work may, at
- their option, further distribute the Covered Software under the terms of
- either this License or such Secondary License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices (including
- copyright notices, patent notices, disclaimers of warranty, or limitations
- of liability) contained within the Source Code Form of the Covered
- Software, except that You may alter any license notices to the extent
- required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on behalf
- of any Contributor. You must make it absolutely clear that any such
- warranty, support, indemnity, or liability obligation is offered by You
- alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute, judicial
- order, or regulation then You must: (a) comply with the terms of this License
- to the maximum extent possible; and (b) describe the limitations and the code
- they affect. Such description must be placed in a text file included with all
- distributions of the Covered Software under this License. Except to the
- extent prohibited by statute or regulation, such description must be
- sufficiently detailed for a recipient of ordinary skill to be able to
- understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing basis,
- if such Contributor fails to notify You of the non-compliance by some
- reasonable means prior to 60 days after You have come back into compliance.
- Moreover, Your grants from a particular Contributor are reinstated on an
- ongoing basis if such Contributor notifies You of the non-compliance by
- some reasonable means, this is the first time You have received notice of
- non-compliance with this License from such Contributor, and You become
- compliant prior to 30 days after Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions, counter-claims,
- and cross-claims) alleging that a Contributor Version directly or
- indirectly infringes any patent, then the rights granted to You by any and
- all Contributors for the Covered Software under Section 2.1 of this License
- shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an “as is” basis, without
- warranty of any kind, either expressed, implied, or statutory, including,
- without limitation, warranties that the Covered Software is free of defects,
- merchantable, fit for a particular purpose or non-infringing. The entire
- risk as to the quality and performance of the Covered Software is with You.
- Should any Covered Software prove defective in any respect, You (not any
- Contributor) assume the cost of any necessary servicing, repair, or
- correction. This disclaimer of warranty constitutes an essential part of this
- License. No use of any Covered Software is authorized under this License
- except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from such
- party’s negligence to the extent applicable law prohibits such limitation.
- Some jurisdictions do not allow the exclusion or limitation of incidental or
- consequential damages, so this exclusion and limitation may not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts of
- a jurisdiction where the defendant maintains its principal place of business
- and such litigation shall be governed by laws of that jurisdiction, without
- reference to its conflict-of-law provisions. Nothing in this Section shall
- prevent a party’s ability to bring cross-claims or counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject matter
- hereof. If any provision of this License is held to be unenforceable, such
- provision shall be reformed only to the extent necessary to make it
- enforceable. Any law or regulation which provides that the language of a
- contract shall be construed against the drafter shall not be used to construe
- this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version of
- the License under which You originally received the Covered Software, or
- under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a modified
- version of this License if you rename the license and remove any
- references to the name of the license steward (except to note that such
- modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
- If You choose to distribute Source Code Form that is Incompatible With
- Secondary Licenses under the terms of this version of the License, the
- notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file, then
-You may include the notice in a location (such as a LICENSE file in a relevant
-directory) where a recipient would be likely to look for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - “Incompatible With Secondary Licenses” Notice
-
- This Source Code Form is “Incompatible
- With Secondary Licenses”, as defined by
- the Mozilla Public License, v. 2.0.
-
diff --git a/vendor/github.com/d2g/dhcp4client/README.md b/vendor/github.com/d2g/dhcp4client/README.md
deleted file mode 100644
index 785ac2c..0000000
--- a/vendor/github.com/d2g/dhcp4client/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-dhcp4client [![GoDoc](https://godoc.org/github.com/d2g/dhcp4client?status.svg)](http://godoc.org/github.com/d2g/dhcp4client) [![Coverage Status](https://coveralls.io/repos/d2g/dhcp4client/badge.svg?branch=HEAD)](https://coveralls.io/r/d2g/dhcp4client?branch=HEAD) [![Codeship Status for d2g/dhcp4client](https://codeship.com/projects/d75d9860-b364-0132-bc79-7e1d8cf367b9/status?branch=master)](https://codeship.com/projects/70187)
-===========
-
-DHCP Client
-
-
-###### Thanks to:
-@eyakubovich For AF_PACKET support.
diff --git a/vendor/github.com/d2g/dhcp4client/client.go b/vendor/github.com/d2g/dhcp4client/client.go
deleted file mode 100644
index 1d43e30..0000000
--- a/vendor/github.com/d2g/dhcp4client/client.go
+++ /dev/null
@@ -1,416 +0,0 @@
-package dhcp4client
-
-import (
- "bytes"
- "fmt"
- "hash/fnv"
- "math/rand"
- "net"
- "sync"
- "syscall"
- "time"
-
- "github.com/d2g/dhcp4"
-)
-
-const (
- MaxDHCPLen = 576
-)
-
-type Client struct {
- hardwareAddr net.HardwareAddr //The HardwareAddr to send in the request.
- ignoreServers []net.IP //List of Servers to Ignore requests from.
- timeout time.Duration //Time before we timeout.
- broadcast bool //Set the Bcast flag in BOOTP Flags
- connection ConnectionInt //The Connection Method to use
- generateXID func([]byte) //Function Used to Generate a XID
-}
-
-//Abstracts the type of underlying socket used
-type ConnectionInt interface {
- Close() error
- Write(packet []byte) error
- ReadFrom() ([]byte, net.IP, error)
- SetReadTimeout(t time.Duration) error
-}
-
-func New(options ...func(*Client) error) (*Client, error) {
- c := Client{
- timeout: time.Second * 10,
- broadcast: true,
- }
-
- err := c.SetOption(options...)
- if err != nil {
- return nil, err
- }
-
- if c.generateXID == nil {
- // https://tools.ietf.org/html/rfc2131#section-4.1 explains:
- //
- // A DHCP client MUST choose 'xid's in such a way as to minimize the chance
- // of using an 'xid' identical to one used by another client.
- //
- // Hence, seed a random number generator with the current time and hardware
- // address.
- h := fnv.New64()
- h.Write(c.hardwareAddr)
- seed := int64(h.Sum64()) + time.Now().Unix()
- rnd := rand.New(rand.NewSource(seed))
- var rndMu sync.Mutex
- c.generateXID = func(b []byte) {
- rndMu.Lock()
- defer rndMu.Unlock()
- rnd.Read(b)
- }
- }
-
- //if connection hasn't been set as an option create the default.
- if c.connection == nil {
- conn, err := NewInetSock()
- if err != nil {
- return nil, err
- }
- c.connection = conn
- }
-
- return &c, nil
-}
-
-func (c *Client) SetOption(options ...func(*Client) error) error {
- for _, opt := range options {
- if err := opt(c); err != nil {
- return err
- }
- }
- return nil
-}
-
-func Timeout(t time.Duration) func(*Client) error {
- return func(c *Client) error {
- c.timeout = t
- return nil
- }
-}
-
-func IgnoreServers(s []net.IP) func(*Client) error {
- return func(c *Client) error {
- c.ignoreServers = s
- return nil
- }
-}
-
-func HardwareAddr(h net.HardwareAddr) func(*Client) error {
- return func(c *Client) error {
- c.hardwareAddr = h
- return nil
- }
-}
-
-func Broadcast(b bool) func(*Client) error {
- return func(c *Client) error {
- c.broadcast = b
- return nil
- }
-}
-
-func Connection(conn ConnectionInt) func(*Client) error {
- return func(c *Client) error {
- c.connection = conn
- return nil
- }
-}
-
-func GenerateXID(g func([]byte)) func(*Client) error {
- return func(c *Client) error {
- c.generateXID = g
- return nil
- }
-}
-
-//Close Connections
-func (c *Client) Close() error {
- if c.connection != nil {
- return c.connection.Close()
- }
- return nil
-}
-
-//Send the Discovery Packet to the Broadcast Channel
-func (c *Client) SendDiscoverPacket() (dhcp4.Packet, error) {
- discoveryPacket := c.DiscoverPacket()
- discoveryPacket.PadToMinSize()
-
- return discoveryPacket, c.SendPacket(discoveryPacket)
-}
-
-// TimeoutError records a timeout when waiting for a DHCP packet.
-type TimeoutError struct {
- Timeout time.Duration
-}
-
-func (te *TimeoutError) Error() string {
- return fmt.Sprintf("no DHCP packet received within %v", te.Timeout)
-}
-
-//Retreive Offer...
-//Wait for the offer for a specific Discovery Packet.
-func (c *Client) GetOffer(discoverPacket *dhcp4.Packet) (dhcp4.Packet, error) {
- start := time.Now()
-
- for {
- timeout := c.timeout - time.Since(start)
- if timeout < 0 {
- return dhcp4.Packet{}, &TimeoutError{Timeout: c.timeout}
- }
-
- c.connection.SetReadTimeout(timeout)
- readBuffer, source, err := c.connection.ReadFrom()
- if err != nil {
- if errno, ok := err.(syscall.Errno); ok && errno == syscall.EAGAIN {
- return dhcp4.Packet{}, &TimeoutError{Timeout: c.timeout}
- }
- return dhcp4.Packet{}, err
- }
-
- offerPacket := dhcp4.Packet(readBuffer)
- offerPacketOptions := offerPacket.ParseOptions()
-
- // Ignore Servers in my Ignore list
- for _, ignoreServer := range c.ignoreServers {
- if source.Equal(ignoreServer) {
- continue
- }
-
- if offerPacket.SIAddr().Equal(ignoreServer) {
- continue
- }
- }
-
- if len(offerPacketOptions[dhcp4.OptionDHCPMessageType]) < 1 || dhcp4.MessageType(offerPacketOptions[dhcp4.OptionDHCPMessageType][0]) != dhcp4.Offer || !bytes.Equal(discoverPacket.XId(), offerPacket.XId()) {
- continue
- }
-
- return offerPacket, nil
- }
-
-}
-
-//Send Request Based On the offer Received.
-func (c *Client) SendRequest(offerPacket *dhcp4.Packet) (dhcp4.Packet, error) {
- requestPacket := c.RequestPacket(offerPacket)
- requestPacket.PadToMinSize()
-
- return requestPacket, c.SendPacket(requestPacket)
-}
-
-//Retreive Acknowledgement
-//Wait for the offer for a specific Request Packet.
-func (c *Client) GetAcknowledgement(requestPacket *dhcp4.Packet) (dhcp4.Packet, error) {
- start := time.Now()
-
- for {
- timeout := c.timeout - time.Since(start)
- if timeout < 0 {
- return dhcp4.Packet{}, &TimeoutError{Timeout: c.timeout}
- }
-
- c.connection.SetReadTimeout(timeout)
- readBuffer, source, err := c.connection.ReadFrom()
- if err != nil {
- if errno, ok := err.(syscall.Errno); ok && errno == syscall.EAGAIN {
- return dhcp4.Packet{}, &TimeoutError{Timeout: c.timeout}
- }
- return dhcp4.Packet{}, err
- }
-
- acknowledgementPacket := dhcp4.Packet(readBuffer)
- acknowledgementPacketOptions := acknowledgementPacket.ParseOptions()
-
- // Ignore Servers in my Ignore list
- for _, ignoreServer := range c.ignoreServers {
- if source.Equal(ignoreServer) {
- continue
- }
-
- if acknowledgementPacket.SIAddr().Equal(ignoreServer) {
- continue
- }
- }
-
- if !bytes.Equal(requestPacket.XId(), acknowledgementPacket.XId()) || len(acknowledgementPacketOptions[dhcp4.OptionDHCPMessageType]) < 1 || (dhcp4.MessageType(acknowledgementPacketOptions[dhcp4.OptionDHCPMessageType][0]) != dhcp4.ACK && dhcp4.MessageType(acknowledgementPacketOptions[dhcp4.OptionDHCPMessageType][0]) != dhcp4.NAK) {
- continue
- }
-
- return acknowledgementPacket, nil
- }
-}
-
-//Send Decline to the received acknowledgement.
-func (c *Client) SendDecline(acknowledgementPacket *dhcp4.Packet) (dhcp4.Packet, error) {
- declinePacket := c.DeclinePacket(acknowledgementPacket)
- declinePacket.PadToMinSize()
-
- return declinePacket, c.SendPacket(declinePacket)
-}
-
-//Send a DHCP Packet.
-func (c *Client) SendPacket(packet dhcp4.Packet) error {
- return c.connection.Write(packet)
-}
-
-//Create Discover Packet
-func (c *Client) DiscoverPacket() dhcp4.Packet {
- messageid := make([]byte, 4)
- c.generateXID(messageid)
-
- packet := dhcp4.NewPacket(dhcp4.BootRequest)
- packet.SetCHAddr(c.hardwareAddr)
- packet.SetXId(messageid)
- packet.SetBroadcast(c.broadcast)
-
- packet.AddOption(dhcp4.OptionDHCPMessageType, []byte{byte(dhcp4.Discover)})
- //packet.PadToMinSize()
- return packet
-}
-
-//Create Request Packet
-func (c *Client) RequestPacket(offerPacket *dhcp4.Packet) dhcp4.Packet {
- offerOptions := offerPacket.ParseOptions()
-
- packet := dhcp4.NewPacket(dhcp4.BootRequest)
- packet.SetCHAddr(c.hardwareAddr)
-
- packet.SetXId(offerPacket.XId())
- packet.SetCIAddr(offerPacket.CIAddr())
- packet.SetSIAddr(offerPacket.SIAddr())
-
- packet.SetBroadcast(c.broadcast)
- packet.AddOption(dhcp4.OptionDHCPMessageType, []byte{byte(dhcp4.Request)})
- packet.AddOption(dhcp4.OptionRequestedIPAddress, (offerPacket.YIAddr()).To4())
- packet.AddOption(dhcp4.OptionServerIdentifier, offerOptions[dhcp4.OptionServerIdentifier])
-
- return packet
-}
-
-//Create Request Packet For a Renew
-func (c *Client) RenewalRequestPacket(acknowledgement *dhcp4.Packet) dhcp4.Packet {
- messageid := make([]byte, 4)
- c.generateXID(messageid)
-
- acknowledgementOptions := acknowledgement.ParseOptions()
-
- packet := dhcp4.NewPacket(dhcp4.BootRequest)
- packet.SetCHAddr(acknowledgement.CHAddr())
-
- packet.SetXId(messageid)
- packet.SetCIAddr(acknowledgement.YIAddr())
- packet.SetSIAddr(acknowledgement.SIAddr())
-
- packet.SetBroadcast(c.broadcast)
- packet.AddOption(dhcp4.OptionDHCPMessageType, []byte{byte(dhcp4.Request)})
- packet.AddOption(dhcp4.OptionRequestedIPAddress, (acknowledgement.YIAddr()).To4())
- packet.AddOption(dhcp4.OptionServerIdentifier, acknowledgementOptions[dhcp4.OptionServerIdentifier])
-
- return packet
-}
-
-//Create Release Packet For a Release
-func (c *Client) ReleasePacket(acknowledgement *dhcp4.Packet) dhcp4.Packet {
- messageid := make([]byte, 4)
- c.generateXID(messageid)
-
- acknowledgementOptions := acknowledgement.ParseOptions()
-
- packet := dhcp4.NewPacket(dhcp4.BootRequest)
- packet.SetCHAddr(acknowledgement.CHAddr())
-
- packet.SetXId(messageid)
- packet.SetCIAddr(acknowledgement.YIAddr())
-
- packet.AddOption(dhcp4.OptionDHCPMessageType, []byte{byte(dhcp4.Release)})
- packet.AddOption(dhcp4.OptionServerIdentifier, acknowledgementOptions[dhcp4.OptionServerIdentifier])
-
- return packet
-}
-
-//Create Decline Packet
-func (c *Client) DeclinePacket(acknowledgement *dhcp4.Packet) dhcp4.Packet {
- messageid := make([]byte, 4)
- c.generateXID(messageid)
-
- acknowledgementOptions := acknowledgement.ParseOptions()
-
- packet := dhcp4.NewPacket(dhcp4.BootRequest)
- packet.SetCHAddr(acknowledgement.CHAddr())
- packet.SetXId(messageid)
-
- packet.AddOption(dhcp4.OptionDHCPMessageType, []byte{byte(dhcp4.Decline)})
- packet.AddOption(dhcp4.OptionRequestedIPAddress, (acknowledgement.YIAddr()).To4())
- packet.AddOption(dhcp4.OptionServerIdentifier, acknowledgementOptions[dhcp4.OptionServerIdentifier])
-
- return packet
-}
-
-//Lets do a Full DHCP Request.
-func (c *Client) Request() (bool, dhcp4.Packet, error) {
- discoveryPacket, err := c.SendDiscoverPacket()
- if err != nil {
- return false, discoveryPacket, err
- }
-
- offerPacket, err := c.GetOffer(&discoveryPacket)
- if err != nil {
- return false, offerPacket, err
- }
-
- requestPacket, err := c.SendRequest(&offerPacket)
- if err != nil {
- return false, requestPacket, err
- }
-
- acknowledgement, err := c.GetAcknowledgement(&requestPacket)
- if err != nil {
- return false, acknowledgement, err
- }
-
- acknowledgementOptions := acknowledgement.ParseOptions()
- if dhcp4.MessageType(acknowledgementOptions[dhcp4.OptionDHCPMessageType][0]) != dhcp4.ACK {
- return false, acknowledgement, nil
- }
-
- return true, acknowledgement, nil
-}
-
-//Renew a lease backed on the Acknowledgement Packet.
-//Returns Sucessfull, The AcknoledgementPacket, Any Errors
-func (c *Client) Renew(acknowledgement dhcp4.Packet) (bool, dhcp4.Packet, error) {
- renewRequest := c.RenewalRequestPacket(&acknowledgement)
- renewRequest.PadToMinSize()
-
- err := c.SendPacket(renewRequest)
- if err != nil {
- return false, renewRequest, err
- }
-
- newAcknowledgement, err := c.GetAcknowledgement(&renewRequest)
- if err != nil {
- return false, newAcknowledgement, err
- }
-
- newAcknowledgementOptions := newAcknowledgement.ParseOptions()
- if dhcp4.MessageType(newAcknowledgementOptions[dhcp4.OptionDHCPMessageType][0]) != dhcp4.ACK {
- return false, newAcknowledgement, nil
- }
-
- return true, newAcknowledgement, nil
-}
-
-//Release a lease backed on the Acknowledgement Packet.
-//Returns Any Errors
-func (c *Client) Release(acknowledgement dhcp4.Packet) error {
- release := c.ReleasePacket(&acknowledgement)
- release.PadToMinSize()
-
- return c.SendPacket(release)
-}
diff --git a/vendor/github.com/d2g/dhcp4client/generatexid.go b/vendor/github.com/d2g/dhcp4client/generatexid.go
deleted file mode 100644
index 6e9ffbc..0000000
--- a/vendor/github.com/d2g/dhcp4client/generatexid.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package dhcp4client
-
-import (
- cryptorand "crypto/rand"
- mathrand "math/rand"
-)
-
-func CryptoGenerateXID(b []byte) {
- if _, err := cryptorand.Read(b); err != nil {
- panic(err)
- }
-}
-
-func MathGenerateXID(b []byte) {
- if _, err := mathrand.Read(b); err != nil {
- panic(err)
- }
-}
diff --git a/vendor/github.com/d2g/dhcp4client/inetsock.go b/vendor/github.com/d2g/dhcp4client/inetsock.go
deleted file mode 100644
index 293f186..0000000
--- a/vendor/github.com/d2g/dhcp4client/inetsock.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package dhcp4client
-
-import (
- "net"
- "time"
-)
-
-type inetSock struct {
- *net.UDPConn
-
- laddr net.UDPAddr
- raddr net.UDPAddr
-}
-
-func NewInetSock(options ...func(*inetSock) error) (*inetSock, error) {
- c := &inetSock{
- laddr: net.UDPAddr{IP: net.IPv4(0, 0, 0, 0), Port: 68},
- raddr: net.UDPAddr{IP: net.IPv4bcast, Port: 67},
- }
-
- err := c.setOption(options...)
- if err != nil {
- return nil, err
- }
-
- conn, err := net.ListenUDP("udp4", &c.laddr)
- if err != nil {
- return nil, err
- }
-
- c.UDPConn = conn
- return c, err
-}
-
-func (c *inetSock) setOption(options ...func(*inetSock) error) error {
- for _, opt := range options {
- if err := opt(c); err != nil {
- return err
- }
- }
- return nil
-}
-
-func SetLocalAddr(l net.UDPAddr) func(*inetSock) error {
- return func(c *inetSock) error {
- c.laddr = l
- return nil
- }
-}
-
-func SetRemoteAddr(r net.UDPAddr) func(*inetSock) error {
- return func(c *inetSock) error {
- c.raddr = r
- return nil
- }
-}
-
-func (c *inetSock) Write(packet []byte) error {
- _, err := c.WriteToUDP(packet, &c.raddr)
- return err
-}
-
-func (c *inetSock) ReadFrom() ([]byte, net.IP, error) {
- readBuffer := make([]byte, MaxDHCPLen)
- n, source, err := c.ReadFromUDP(readBuffer)
- if source != nil {
- return readBuffer[:n], source.IP, err
- } else {
- return readBuffer[:n], net.IP{}, err
- }
-}
-
-func (c *inetSock) SetReadTimeout(t time.Duration) error {
- return c.SetReadDeadline(time.Now().Add(t))
-}
diff --git a/vendor/github.com/d2g/dhcp4client/pktsock_linux.go b/vendor/github.com/d2g/dhcp4client/pktsock_linux.go
deleted file mode 100644
index 99b5352..0000000
--- a/vendor/github.com/d2g/dhcp4client/pktsock_linux.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package dhcp4client
-
-import (
- "encoding/binary"
- "math/rand"
- "net"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-const (
- minIPHdrLen = 20
- maxIPHdrLen = 60
- udpHdrLen = 8
- ip4Ver = 0x40
- ttl = 16
- srcPort = 68
- dstPort = 67
-)
-
-var (
- bcastMAC = []byte{255, 255, 255, 255, 255, 255}
-)
-
-// abstracts AF_PACKET
-type packetSock struct {
- fd int
- ifindex int
-}
-
-func NewPacketSock(ifindex int) (*packetSock, error) {
- fd, err := unix.Socket(unix.AF_PACKET, unix.SOCK_DGRAM, int(swap16(unix.ETH_P_IP)))
- if err != nil {
- return nil, err
- }
-
- addr := unix.SockaddrLinklayer{
- Ifindex: ifindex,
- Protocol: swap16(unix.ETH_P_IP),
- }
-
- if err = unix.Bind(fd, &addr); err != nil {
- return nil, err
- }
-
- return &packetSock{
- fd: fd,
- ifindex: ifindex,
- }, nil
-}
-
-func (pc *packetSock) Close() error {
- return unix.Close(pc.fd)
-}
-
-func (pc *packetSock) Write(packet []byte) error {
- lladdr := unix.SockaddrLinklayer{
- Ifindex: pc.ifindex,
- Protocol: swap16(unix.ETH_P_IP),
- Halen: uint8(len(bcastMAC)),
- }
- copy(lladdr.Addr[:], bcastMAC)
-
- pkt := make([]byte, minIPHdrLen+udpHdrLen+len(packet))
-
- fillIPHdr(pkt[0:minIPHdrLen], udpHdrLen+uint16(len(packet)))
- fillUDPHdr(pkt[minIPHdrLen:minIPHdrLen+udpHdrLen], uint16(len(packet)))
-
- // payload
- copy(pkt[minIPHdrLen+udpHdrLen:len(pkt)], packet)
-
- return unix.Sendto(pc.fd, pkt, 0, &lladdr)
-}
-
-func (pc *packetSock) ReadFrom() ([]byte, net.IP, error) {
- pkt := make([]byte, maxIPHdrLen+udpHdrLen+MaxDHCPLen)
- n, _, err := unix.Recvfrom(pc.fd, pkt, 0)
- if err != nil {
- return nil, nil, err
- }
-
- // IP hdr len
- ihl := int(pkt[0]&0x0F) * 4
- // Source IP address
- src := net.IP(pkt[12:16])
-
- return pkt[ihl+udpHdrLen : n], src, nil
-}
-
-func (pc *packetSock) SetReadTimeout(t time.Duration) error {
-
- tv := unix.NsecToTimeval(t.Nanoseconds())
- return unix.SetsockoptTimeval(pc.fd, unix.SOL_SOCKET, unix.SO_RCVTIMEO, &tv)
-}
-
-// compute's 1's complement checksum
-func chksum(p []byte, csum []byte) {
- cklen := len(p)
- s := uint32(0)
- for i := 0; i < (cklen - 1); i += 2 {
- s += uint32(p[i+1])<<8 | uint32(p[i])
- }
- if cklen&1 == 1 {
- s += uint32(p[cklen-1])
- }
- s = (s >> 16) + (s & 0xffff)
- s = s + (s >> 16)
- s = ^s
-
- csum[0] = uint8(s & 0xff)
- csum[1] = uint8(s >> 8)
-}
-
-func fillIPHdr(hdr []byte, payloadLen uint16) {
- // version + IHL
- hdr[0] = ip4Ver | (minIPHdrLen / 4)
- // total length
- binary.BigEndian.PutUint16(hdr[2:4], uint16(len(hdr))+payloadLen)
- // identification
- if _, err := rand.Read(hdr[4:5]); err != nil {
- panic(err)
- }
- // TTL
- hdr[8] = 16
- // Protocol
- hdr[9] = unix.IPPROTO_UDP
- // dst IP
- copy(hdr[16:20], net.IPv4bcast.To4())
- // compute IP hdr checksum
- chksum(hdr[0:len(hdr)], hdr[10:12])
-}
-
-func fillUDPHdr(hdr []byte, payloadLen uint16) {
- // src port
- binary.BigEndian.PutUint16(hdr[0:2], srcPort)
- // dest port
- binary.BigEndian.PutUint16(hdr[2:4], dstPort)
- // length
- binary.BigEndian.PutUint16(hdr[4:6], udpHdrLen+payloadLen)
-}
-
-func swap16(x uint16) uint16 {
- var b [2]byte
- binary.BigEndian.PutUint16(b[:], x)
- return binary.LittleEndian.Uint16(b[:])
-}
diff --git a/vendor/github.com/kardianos/osext/LICENSE b/vendor/github.com/kardianos/osext/LICENSE
deleted file mode 100644
index 7448756..0000000
--- a/vendor/github.com/kardianos/osext/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/kardianos/osext/README.md b/vendor/github.com/kardianos/osext/README.md
deleted file mode 100644
index 15cbc3d..0000000
--- a/vendor/github.com/kardianos/osext/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-### Extensions to the "os" package.
-
-[![GoDoc](https://godoc.org/github.com/kardianos/osext?status.svg)](https://godoc.org/github.com/kardianos/osext)
-
-## Find the current Executable and ExecutableFolder.
-
-As of go1.8 the Executable function may be found in `os`. The Executable function
-in the std lib `os` package is used if available.
-
-There is sometimes utility in finding the current executable file
-that is running. This can be used for upgrading the current executable
-or finding resources located relative to the executable file. Both
-working directory and the os.Args[0] value are arbitrary and cannot
-be relied on; os.Args[0] can be "faked".
-
-Multi-platform and supports:
- * Linux
- * OS X
- * Windows
- * Plan 9
- * BSDs.
diff --git a/vendor/github.com/kardianos/osext/osext.go b/vendor/github.com/kardianos/osext/osext.go
deleted file mode 100644
index 17f380f..0000000
--- a/vendor/github.com/kardianos/osext/osext.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Extensions to the standard "os" package.
-package osext // import "github.com/kardianos/osext"
-
-import "path/filepath"
-
-var cx, ce = executableClean()
-
-func executableClean() (string, error) {
- p, err := executable()
- return filepath.Clean(p), err
-}
-
-// Executable returns an absolute path that can be used to
-// re-invoke the current program.
-// It may not be valid after the current program exits.
-func Executable() (string, error) {
- return cx, ce
-}
-
-// Returns same path as Executable, returns just the folder
-// path. Excludes the executable name and any trailing slash.
-func ExecutableFolder() (string, error) {
- p, err := Executable()
- if err != nil {
- return "", err
- }
-
- return filepath.Dir(p), nil
-}
diff --git a/vendor/github.com/kardianos/osext/osext_go18.go b/vendor/github.com/kardianos/osext/osext_go18.go
deleted file mode 100644
index 009d8a9..0000000
--- a/vendor/github.com/kardianos/osext/osext_go18.go
+++ /dev/null
@@ -1,9 +0,0 @@
-//+build go1.8,!openbsd
-
-package osext
-
-import "os"
-
-func executable() (string, error) {
- return os.Executable()
-}
diff --git a/vendor/github.com/kardianos/osext/osext_plan9.go b/vendor/github.com/kardianos/osext/osext_plan9.go
deleted file mode 100644
index 95e2371..0000000
--- a/vendor/github.com/kardianos/osext/osext_plan9.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//+build !go1.8
-
-package osext
-
-import (
- "os"
- "strconv"
- "syscall"
-)
-
-func executable() (string, error) {
- f, err := os.Open("/proc/" + strconv.Itoa(os.Getpid()) + "/text")
- if err != nil {
- return "", err
- }
- defer f.Close()
- return syscall.Fd2path(int(f.Fd()))
-}
diff --git a/vendor/github.com/kardianos/osext/osext_procfs.go b/vendor/github.com/kardianos/osext/osext_procfs.go
deleted file mode 100644
index e1f16f8..0000000
--- a/vendor/github.com/kardianos/osext/osext_procfs.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.8,android !go1.8,linux !go1.8,netbsd !go1.8,solaris !go1.8,dragonfly
-
-package osext
-
-import (
- "errors"
- "fmt"
- "os"
- "runtime"
- "strings"
-)
-
-func executable() (string, error) {
- switch runtime.GOOS {
- case "linux", "android":
- const deletedTag = " (deleted)"
- execpath, err := os.Readlink("/proc/self/exe")
- if err != nil {
- return execpath, err
- }
- execpath = strings.TrimSuffix(execpath, deletedTag)
- execpath = strings.TrimPrefix(execpath, deletedTag)
- return execpath, nil
- case "netbsd":
- return os.Readlink("/proc/curproc/exe")
- case "dragonfly":
- return os.Readlink("/proc/curproc/file")
- case "solaris":
- return os.Readlink(fmt.Sprintf("/proc/%d/path/a.out", os.Getpid()))
- }
- return "", errors.New("ExecPath not implemented for " + runtime.GOOS)
-}
diff --git a/vendor/github.com/kardianos/osext/osext_sysctl.go b/vendor/github.com/kardianos/osext/osext_sysctl.go
deleted file mode 100644
index 33cee25..0000000
--- a/vendor/github.com/kardianos/osext/osext_sysctl.go
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.8,darwin !go1.8,freebsd openbsd
-
-package osext
-
-import (
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "syscall"
- "unsafe"
-)
-
-var initCwd, initCwdErr = os.Getwd()
-
-func executable() (string, error) {
- var mib [4]int32
- switch runtime.GOOS {
- case "freebsd":
- mib = [4]int32{1 /* CTL_KERN */, 14 /* KERN_PROC */, 12 /* KERN_PROC_PATHNAME */, -1}
- case "darwin":
- mib = [4]int32{1 /* CTL_KERN */, 38 /* KERN_PROCARGS */, int32(os.Getpid()), -1}
- case "openbsd":
- mib = [4]int32{1 /* CTL_KERN */, 55 /* KERN_PROC_ARGS */, int32(os.Getpid()), 1 /* KERN_PROC_ARGV */}
- }
-
- n := uintptr(0)
- // Get length.
- _, _, errNum := syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 4, 0, uintptr(unsafe.Pointer(&n)), 0, 0)
- if errNum != 0 {
- return "", errNum
- }
- if n == 0 { // This shouldn't happen.
- return "", nil
- }
- buf := make([]byte, n)
- _, _, errNum = syscall.Syscall6(syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), 4, uintptr(unsafe.Pointer(&buf[0])), uintptr(unsafe.Pointer(&n)), 0, 0)
- if errNum != 0 {
- return "", errNum
- }
- if n == 0 { // This shouldn't happen.
- return "", nil
- }
-
- var execPath string
- switch runtime.GOOS {
- case "openbsd":
- // buf now contains **argv, with pointers to each of the C-style
- // NULL terminated arguments.
- var args []string
- argv := uintptr(unsafe.Pointer(&buf[0]))
- Loop:
- for {
- argp := *(**[1 << 20]byte)(unsafe.Pointer(argv))
- if argp == nil {
- break
- }
- for i := 0; uintptr(i) < n; i++ {
- // we don't want the full arguments list
- if string(argp[i]) == " " {
- break Loop
- }
- if argp[i] != 0 {
- continue
- }
- args = append(args, string(argp[:i]))
- n -= uintptr(i)
- break
- }
- if n < unsafe.Sizeof(argv) {
- break
- }
- argv += unsafe.Sizeof(argv)
- n -= unsafe.Sizeof(argv)
- }
- execPath = args[0]
- // There is no canonical way to get an executable path on
- // OpenBSD, so check PATH in case we are called directly
- if execPath[0] != '/' && execPath[0] != '.' {
- execIsInPath, err := exec.LookPath(execPath)
- if err == nil {
- execPath = execIsInPath
- }
- }
- default:
- for i, v := range buf {
- if v == 0 {
- buf = buf[:i]
- break
- }
- }
- execPath = string(buf)
- }
-
- var err error
- // execPath will not be empty due to above checks.
- // Try to get the absolute path if the execPath is not rooted.
- if execPath[0] != '/' {
- execPath, err = getAbs(execPath)
- if err != nil {
- return execPath, err
- }
- }
- // For darwin KERN_PROCARGS may return the path to a symlink rather than the
- // actual executable.
- if runtime.GOOS == "darwin" {
- if execPath, err = filepath.EvalSymlinks(execPath); err != nil {
- return execPath, err
- }
- }
- return execPath, nil
-}
-
-func getAbs(execPath string) (string, error) {
- if initCwdErr != nil {
- return execPath, initCwdErr
- }
- // The execPath may begin with a "../" or a "./" so clean it first.
- // Join the two paths, trailing and starting slashes undetermined, so use
- // the generic Join function.
- return filepath.Join(initCwd, filepath.Clean(execPath)), nil
-}
diff --git a/vendor/github.com/kardianos/osext/osext_windows.go b/vendor/github.com/kardianos/osext/osext_windows.go
deleted file mode 100644
index 074b3b3..0000000
--- a/vendor/github.com/kardianos/osext/osext_windows.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//+build !go1.8
-
-package osext
-
-import (
- "syscall"
- "unicode/utf16"
- "unsafe"
-)
-
-var (
- kernel = syscall.MustLoadDLL("kernel32.dll")
- getModuleFileNameProc = kernel.MustFindProc("GetModuleFileNameW")
-)
-
-// GetModuleFileName() with hModule = NULL
-func executable() (exePath string, err error) {
- return getModuleFileName()
-}
-
-func getModuleFileName() (string, error) {
- var n uint32
- b := make([]uint16, syscall.MAX_PATH)
- size := uint32(len(b))
-
- r0, _, e1 := getModuleFileNameProc.Call(0, uintptr(unsafe.Pointer(&b[0])), uintptr(size))
- n = uint32(r0)
- if n == 0 {
- return "", e1
- }
- return string(utf16.Decode(b[0:n])), nil
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 4680cfe..7db5122 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -92,10 +92,6 @@
github.com/coreos/etcd/pkg/tlsutil
# github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142
github.com/coreos/go-systemd/daemon
-# github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c
-github.com/d2g/dhcp4
-# github.com/d2g/dhcp4client v1.0.0
-github.com/d2g/dhcp4client
# github.com/davecgh/go-spew v1.1.1
github.com/davecgh/go-spew/spew
# github.com/dgrijalva/jwt-go v3.2.0+incompatible
@@ -201,8 +197,6 @@
github.com/jmespath/go-jmespath
# github.com/json-iterator/go v1.1.5
github.com/json-iterator/go
-# github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1
-github.com/kardianos/osext
# github.com/konsorten/go-windows-terminal-sequences v1.0.1
github.com/konsorten/go-windows-terminal-sequences
# github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329