Browse Source

Update dependency package and CI config

Chaohua Xu 6 years ago
parent
commit
7e390b4180
100 changed files with 7126 additions and 6654 deletions
  1. 26 0
      Gopkg.lock
  2. 130 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/auth.go
  3. 973 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/bucket.go
  4. 805 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/client.go
  5. 128 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/conf.go
  6. 730 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/conn.go
  7. 146 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/const.go
  8. 123 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/crc.go
  9. 568 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/download.go
  10. 94 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/error.go
  11. 28 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/limit_reader_1_6.go
  12. 91 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/limit_reader_1_7.go
  13. 257 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/livechannel.go
  14. 245 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/mime.go
  15. 68 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/model.go
  16. 468 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/multicopy.go
  17. 290 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/multipart.go
  18. 433 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/option.go
  19. 112 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/progress.go
  20. 26 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/transport_1_6.go
  21. 28 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/transport_1_7.go
  22. 566 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/type.go
  23. 526 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/upload.go
  24. 265 0
      vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/utils.go
  25. 0 3
      vendor/golang.org/x/crypto/AUTHORS
  26. 0 3
      vendor/golang.org/x/crypto/CONTRIBUTORS
  27. 0 951
      vendor/golang.org/x/crypto/ssh/terminal/terminal.go
  28. 0 114
      vendor/golang.org/x/crypto/ssh/terminal/util.go
  29. 0 12
      vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go
  30. 0 10
      vendor/golang.org/x/crypto/ssh/terminal/util_linux.go
  31. 0 58
      vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go
  32. 0 124
      vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go
  33. 0 103
      vendor/golang.org/x/crypto/ssh/terminal/util_windows.go
  34. 0 27
      vendor/golang.org/x/sys/LICENSE
  35. 0 22
      vendor/golang.org/x/sys/PATENTS
  36. 0 173
      vendor/golang.org/x/sys/unix/README.md
  37. 0 124
      vendor/golang.org/x/sys/unix/affinity_linux.go
  38. 0 14
      vendor/golang.org/x/sys/unix/aliases.go
  39. 0 29
      vendor/golang.org/x/sys/unix/asm_darwin_386.s
  40. 0 29
      vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
  41. 0 30
      vendor/golang.org/x/sys/unix/asm_darwin_arm.s
  42. 0 30
      vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
  43. 0 29
      vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
  44. 0 29
      vendor/golang.org/x/sys/unix/asm_freebsd_386.s
  45. 0 29
      vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
  46. 0 29
      vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
  47. 0 65
      vendor/golang.org/x/sys/unix/asm_linux_386.s
  48. 0 57
      vendor/golang.org/x/sys/unix/asm_linux_amd64.s
  49. 0 56
      vendor/golang.org/x/sys/unix/asm_linux_arm.s
  50. 0 52
      vendor/golang.org/x/sys/unix/asm_linux_arm64.s
  51. 0 56
      vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
  52. 0 54
      vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
  53. 0 56
      vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
  54. 0 56
      vendor/golang.org/x/sys/unix/asm_linux_s390x.s
  55. 0 29
      vendor/golang.org/x/sys/unix/asm_netbsd_386.s
  56. 0 29
      vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
  57. 0 29
      vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
  58. 0 29
      vendor/golang.org/x/sys/unix/asm_openbsd_386.s
  59. 0 29
      vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
  60. 0 29
      vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
  61. 0 17
      vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
  62. 0 35
      vendor/golang.org/x/sys/unix/bluetooth_linux.go
  63. 0 195
      vendor/golang.org/x/sys/unix/cap_freebsd.go
  64. 0 13
      vendor/golang.org/x/sys/unix/constants.go
  65. 0 37
      vendor/golang.org/x/sys/unix/dev_aix_ppc.go
  66. 0 39
      vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
  67. 0 24
      vendor/golang.org/x/sys/unix/dev_darwin.go
  68. 0 30
      vendor/golang.org/x/sys/unix/dev_dragonfly.go
  69. 0 30
      vendor/golang.org/x/sys/unix/dev_freebsd.go
  70. 0 42
      vendor/golang.org/x/sys/unix/dev_linux.go
  71. 0 29
      vendor/golang.org/x/sys/unix/dev_netbsd.go
  72. 0 29
      vendor/golang.org/x/sys/unix/dev_openbsd.go
  73. 0 17
      vendor/golang.org/x/sys/unix/dirent.go
  74. 0 9
      vendor/golang.org/x/sys/unix/endian_big.go
  75. 0 9
      vendor/golang.org/x/sys/unix/endian_little.go
  76. 0 31
      vendor/golang.org/x/sys/unix/env_unix.go
  77. 0 227
      vendor/golang.org/x/sys/unix/errors_freebsd_386.go
  78. 0 227
      vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
  79. 0 226
      vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
  80. 0 32
      vendor/golang.org/x/sys/unix/fcntl.go
  81. 0 13
      vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
  82. 0 62
      vendor/golang.org/x/sys/unix/gccgo.go
  83. 0 39
      vendor/golang.org/x/sys/unix/gccgo_c.c
  84. 0 20
      vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
  85. 0 30
      vendor/golang.org/x/sys/unix/ioctl.go
  86. 0 198
      vendor/golang.org/x/sys/unix/mkall.sh
  87. 0 632
      vendor/golang.org/x/sys/unix/mkerrors.sh
  88. 0 98
      vendor/golang.org/x/sys/unix/mkpost.go
  89. 0 341
      vendor/golang.org/x/sys/unix/mksyscall.pl
  90. 0 385
      vendor/golang.org/x/sys/unix/mksyscall_aix.pl
  91. 0 289
      vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
  92. 0 264
      vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl
  93. 0 39
      vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
  94. 0 50
      vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
  95. 0 50
      vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
  96. 0 58
      vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
  97. 0 50
      vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
  98. 0 95
      vendor/golang.org/x/sys/unix/openbsd_pledge.go
  99. 0 15
      vendor/golang.org/x/sys/unix/pagesize_unix.go
  100. 0 30
      vendor/golang.org/x/sys/unix/race.go

+ 26 - 0
Gopkg.lock

@@ -1,6 +1,14 @@
 # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
 
 
+[[projects]]
+  digest = "1:a9a98adb2a4181b9e4622eff8b6070646971a18427c265852f3686dbc7112ab1"
+  name = "github.com/aliyun/aliyun-oss-go-sdk"
+  packages = ["oss"]
+  pruneopts = "UT"
+  revision = "86c17b95fcd5db33628a61e492fb4a1a937d5906"
+  version = "1.9.5"
+
 [[projects]]
   digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
   name = "github.com/davecgh/go-spew"
@@ -65,14 +73,32 @@
   revision = "ffdc059bfe9ce6a4e144ba849dbedead332c6053"
   version = "v1.3.0"
 
+[[projects]]
+  branch = "master"
+  digest = "1:9fdc2b55e8e0fafe4b41884091e51e77344f7dc511c5acedcfd98200003bff90"
+  name = "golang.org/x/time"
+  packages = ["rate"]
+  pruneopts = "UT"
+  revision = "9d24e82272b4f38b78bc8cff74fa936d31ccd8ef"
+
+[[projects]]
+  digest = "1:d37c61a335d13bc49b3f90e9e13c8686e4548839b69c58549e727afb2245c454"
+  name = "gopkg.in/ini.v1"
+  packages = ["."]
+  pruneopts = "UT"
+  revision = "c85607071cf08ca1adaf48319cd1aa322e81d8c1"
+  version = "v1.42.0"
+
 [solve-meta]
   analyzer-name = "dep"
   analyzer-version = 1
   input-imports = [
+    "github.com/aliyun/aliyun-oss-go-sdk/oss",
     "github.com/jmespath/go-jmespath",
     "github.com/json-iterator/go",
     "github.com/satori/go.uuid",
     "github.com/stretchr/testify/assert",
+    "gopkg.in/ini.v1",
   ]
   solver-name = "gps-cdcl"
   solver-version = 1

+ 130 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/auth.go

@@ -0,0 +1,130 @@
+package oss
+
+import (
+	"bytes"
+	"crypto/hmac"
+	"crypto/sha1"
+	"encoding/base64"
+	"fmt"
+	"hash"
+	"io"
+	"net/http"
+	"sort"
+	"strconv"
+	"strings"
+)
+
+// headerSorter defines the key-value structure for storing the sorted data in signHeader.
+type headerSorter struct {
+	Keys []string
+	Vals []string
+}
+
+// signHeader signs the header and sets it as the authorization header.
+func (conn Conn) signHeader(req *http.Request, canonicalizedResource string) {
+	// Get the final authorization string
+	authorizationStr := "OSS " + conn.config.AccessKeyID + ":" + conn.getSignedStr(req, canonicalizedResource)
+
+	// Give the parameter "Authorization" value
+	req.Header.Set(HTTPHeaderAuthorization, authorizationStr)
+}
+
+func (conn Conn) getSignedStr(req *http.Request, canonicalizedResource string) string {
+	// Find out the "x-oss-"'s address in header of the request
+	temp := make(map[string]string)
+
+	for k, v := range req.Header {
+		if strings.HasPrefix(strings.ToLower(k), "x-oss-") {
+			temp[strings.ToLower(k)] = v[0]
+		}
+	}
+	hs := newHeaderSorter(temp)
+
+	// Sort the temp by the ascending order
+	hs.Sort()
+
+	// Get the canonicalizedOSSHeaders
+	canonicalizedOSSHeaders := ""
+	for i := range hs.Keys {
+		canonicalizedOSSHeaders += hs.Keys[i] + ":" + hs.Vals[i] + "\n"
+	}
+
+	// Give other parameters values
+	// when sign URL, date is expires
+	date := req.Header.Get(HTTPHeaderDate)
+	contentType := req.Header.Get(HTTPHeaderContentType)
+	contentMd5 := req.Header.Get(HTTPHeaderContentMD5)
+
+	signStr := req.Method + "\n" + contentMd5 + "\n" + contentType + "\n" + date + "\n" + canonicalizedOSSHeaders + canonicalizedResource
+
+	conn.config.WriteLog(Debug, "[Req:%p]signStr:%s.\n", req, signStr)
+
+	h := hmac.New(func() hash.Hash { return sha1.New() }, []byte(conn.config.AccessKeySecret))
+	io.WriteString(h, signStr)
+	signedStr := base64.StdEncoding.EncodeToString(h.Sum(nil))
+
+	return signedStr
+}
+
+func (conn Conn) getRtmpSignedStr(bucketName, channelName, playlistName string, expiration int64, params map[string]interface{}) string {
+	if params[HTTPParamAccessKeyID] == nil {
+		return ""
+	}
+
+	canonResource := fmt.Sprintf("/%s/%s", bucketName, channelName)
+	canonParamsKeys := []string{}
+	for key := range params {
+		if key != HTTPParamAccessKeyID && key != HTTPParamSignature && key != HTTPParamExpires && key != HTTPParamSecurityToken {
+			canonParamsKeys = append(canonParamsKeys, key)
+		}
+	}
+
+	sort.Strings(canonParamsKeys)
+	canonParamsStr := ""
+	for _, key := range canonParamsKeys {
+		canonParamsStr = fmt.Sprintf("%s%s:%s\n", canonParamsStr, key, params[key].(string))
+	}
+
+	expireStr := strconv.FormatInt(expiration, 10)
+	signStr := expireStr + "\n" + canonParamsStr + canonResource
+
+	h := hmac.New(func() hash.Hash { return sha1.New() }, []byte(conn.config.AccessKeySecret))
+	io.WriteString(h, signStr)
+	signedStr := base64.StdEncoding.EncodeToString(h.Sum(nil))
+	return signedStr
+}
+
+// newHeaderSorter is an additional function for function SignHeader.
+func newHeaderSorter(m map[string]string) *headerSorter {
+	hs := &headerSorter{
+		Keys: make([]string, 0, len(m)),
+		Vals: make([]string, 0, len(m)),
+	}
+
+	for k, v := range m {
+		hs.Keys = append(hs.Keys, k)
+		hs.Vals = append(hs.Vals, v)
+	}
+	return hs
+}
+
+// Sort is an additional function for function SignHeader.
+func (hs *headerSorter) Sort() {
+	sort.Sort(hs)
+}
+
+// Len is an additional function for function SignHeader.
+func (hs *headerSorter) Len() int {
+	return len(hs.Vals)
+}
+
+// Less is an additional function for function SignHeader.
+func (hs *headerSorter) Less(i, j int) bool {
+	return bytes.Compare([]byte(hs.Keys[i]), []byte(hs.Keys[j])) < 0
+}
+
+// Swap is an additional function for function SignHeader.
+func (hs *headerSorter) Swap(i, j int) {
+	hs.Vals[i], hs.Vals[j] = hs.Vals[j], hs.Vals[i]
+	hs.Keys[i], hs.Keys[j] = hs.Keys[j], hs.Keys[i]
+}

+ 973 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/bucket.go

@@ -0,0 +1,973 @@
+package oss
+
+import (
+	"bytes"
+	"crypto/md5"
+	"encoding/base64"
+	"encoding/xml"
+	"fmt"
+	"hash"
+	"hash/crc64"
+	"io"
+	"net/http"
+	"net/url"
+	"os"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// Bucket implements the operations of object.
+type Bucket struct {
+	Client     Client
+	BucketName string
+}
+
+// PutObject creates a new object and it will overwrite the original one if it exists already.
+//
+// objectKey    the object key in UTF-8 encoding. The length must be between 1 and 1023, and cannot start with "/" or "\".
+// reader    io.Reader instance for reading the data for uploading
+// options    the options for uploading the object. The valid options here are CacheControl, ContentDisposition, ContentEncoding
+//            Expires, ServerSideEncryption, ObjectACL and Meta. Refer to the link below for more details.
+//            https://help.aliyun.com/document_detail/oss/api-reference/object/PutObject.html
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) PutObject(objectKey string, reader io.Reader, options ...Option) error {
+	opts := addContentType(options, objectKey)
+
+	request := &PutObjectRequest{
+		ObjectKey: objectKey,
+		Reader:    reader,
+	}
+	resp, err := bucket.DoPutObject(request, opts)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+
+	return err
+}
+
+// PutObjectFromFile creates a new object from the local file.
+//
+// objectKey    object key.
+// filePath    the local file path to upload.
+// options    the options for uploading the object. Refer to the parameter options in PutObject for more details.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) PutObjectFromFile(objectKey, filePath string, options ...Option) error {
+	fd, err := os.Open(filePath)
+	if err != nil {
+		return err
+	}
+	defer fd.Close()
+
+	opts := addContentType(options, filePath, objectKey)
+
+	request := &PutObjectRequest{
+		ObjectKey: objectKey,
+		Reader:    fd,
+	}
+	resp, err := bucket.DoPutObject(request, opts)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+
+	return err
+}
+
+// DoPutObject does the actual upload work.
+//
+// request    the request instance for uploading an object.
+// options    the options for uploading an object.
+//
+// Response    the response from OSS.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) DoPutObject(request *PutObjectRequest, options []Option) (*Response, error) {
+	isOptSet, _, _ := isOptionSet(options, HTTPHeaderContentType)
+	if !isOptSet {
+		options = addContentType(options, request.ObjectKey)
+	}
+
+	listener := getProgressListener(options)
+
+	params := map[string]interface{}{}
+	resp, err := bucket.do("PUT", request.ObjectKey, params, options, request.Reader, listener)
+	if err != nil {
+		return nil, err
+	}
+
+	if bucket.getConfig().IsEnableCRC {
+		err = checkCRC(resp, "DoPutObject")
+		if err != nil {
+			return resp, err
+		}
+	}
+
+	err = checkRespCode(resp.StatusCode, []int{http.StatusOK})
+
+	return resp, err
+}
+
+// GetObject downloads the object.
+//
+// objectKey    the object key.
+// options    the options for downloading the object. The valid values are: Range, IfModifiedSince, IfUnmodifiedSince, IfMatch,
+//            IfNoneMatch, AcceptEncoding. For more details, please check out:
+//            https://help.aliyun.com/document_detail/oss/api-reference/object/GetObject.html
+//
+// io.ReadCloser    reader instance for reading data from response. It must be called close() after the usage and only valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) GetObject(objectKey string, options ...Option) (io.ReadCloser, error) {
+	result, err := bucket.DoGetObject(&GetObjectRequest{objectKey}, options)
+	if err != nil {
+		return nil, err
+	}
+
+	return result.Response, nil
+}
+
+// GetObjectToFile downloads the data to a local file.
+//
+// objectKey    the object key to download.
+// filePath    the local file to store the object data.
+// options    the options for downloading the object. Refer to the parameter options in method GetObject for more details.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) GetObjectToFile(objectKey, filePath string, options ...Option) error {
+	tempFilePath := filePath + TempFileSuffix
+
+	// Calls the API to actually download the object. Returns the result instance.
+	result, err := bucket.DoGetObject(&GetObjectRequest{objectKey}, options)
+	if err != nil {
+		return err
+	}
+	defer result.Response.Close()
+
+	// If the local file does not exist, create a new one. If it exists, overwrite it.
+	fd, err := os.OpenFile(tempFilePath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, FilePermMode)
+	if err != nil {
+		return err
+	}
+
+	// Copy the data to the local file path.
+	_, err = io.Copy(fd, result.Response.Body)
+	fd.Close()
+	if err != nil {
+		return err
+	}
+
+	// Compares the CRC value
+	hasRange, _, _ := isOptionSet(options, HTTPHeaderRange)
+	encodeOpt, _ := findOption(options, HTTPHeaderAcceptEncoding, nil)
+	acceptEncoding := ""
+	if encodeOpt != nil {
+		acceptEncoding = encodeOpt.(string)
+	}
+	if bucket.getConfig().IsEnableCRC && !hasRange && acceptEncoding != "gzip" {
+		result.Response.ClientCRC = result.ClientCRC.Sum64()
+		err = checkCRC(result.Response, "GetObjectToFile")
+		if err != nil {
+			os.Remove(tempFilePath)
+			return err
+		}
+	}
+
+	return os.Rename(tempFilePath, filePath)
+}
+
+// DoGetObject is the actual API that gets the object. It's the internal function called by other public APIs.
+//
+// request    the request to download the object.
+// options    the options for downloading the file. Checks out the parameter options in method GetObject.
+//
+// GetObjectResult    the result instance of getting the object.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) DoGetObject(request *GetObjectRequest, options []Option) (*GetObjectResult, error) {
+	params, _ := getRawParams(options)
+	resp, err := bucket.do("GET", request.ObjectKey, params, options, nil, nil)
+	if err != nil {
+		return nil, err
+	}
+
+	result := &GetObjectResult{
+		Response: resp,
+	}
+
+	// CRC
+	var crcCalc hash.Hash64
+	hasRange, _, _ := isOptionSet(options, HTTPHeaderRange)
+	if bucket.getConfig().IsEnableCRC && !hasRange {
+		crcCalc = crc64.New(crcTable())
+		result.ServerCRC = resp.ServerCRC
+		result.ClientCRC = crcCalc
+	}
+
+	// Progress
+	listener := getProgressListener(options)
+
+	contentLen, _ := strconv.ParseInt(resp.Headers.Get(HTTPHeaderContentLength), 10, 64)
+	resp.Body = TeeReader(resp.Body, crcCalc, contentLen, listener, nil)
+
+	return result, nil
+}
+
+// CopyObject copies the object inside the bucket.
+//
+// srcObjectKey    the source object to copy.
+// destObjectKey    the target object to copy.
+// options    options for copying an object. You can specify the conditions of copy. The valid conditions are CopySourceIfMatch,
+//            CopySourceIfNoneMatch, CopySourceIfModifiedSince, CopySourceIfUnmodifiedSince, MetadataDirective.
+//            Also you can specify the target object's attributes, such as CacheControl, ContentDisposition, ContentEncoding, Expires,
+//            ServerSideEncryption, ObjectACL, Meta. Refer to the link below for more details :
+//            https://help.aliyun.com/document_detail/oss/api-reference/object/CopyObject.html
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) CopyObject(srcObjectKey, destObjectKey string, options ...Option) (CopyObjectResult, error) {
+	var out CopyObjectResult
+	options = append(options, CopySource(bucket.BucketName, url.QueryEscape(srcObjectKey)))
+	params := map[string]interface{}{}
+	resp, err := bucket.do("PUT", destObjectKey, params, options, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// CopyObjectTo copies the object to another bucket.
+//
+// srcObjectKey    source object key. The source bucket is Bucket.BucketName .
+// destBucketName    target bucket name.
+// destObjectKey    target object name.
+// options    copy options, check out parameter options in function CopyObject for more details.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) CopyObjectTo(destBucketName, destObjectKey, srcObjectKey string, options ...Option) (CopyObjectResult, error) {
+	return bucket.copy(srcObjectKey, destBucketName, destObjectKey, options...)
+}
+
+//
+// CopyObjectFrom copies the object to another bucket.
+//
+// srcBucketName    source bucket name.
+// srcObjectKey    source object name.
+// destObjectKey    target object name. The target bucket name is Bucket.BucketName.
+// options    copy options. Check out parameter options in function CopyObject.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) CopyObjectFrom(srcBucketName, srcObjectKey, destObjectKey string, options ...Option) (CopyObjectResult, error) {
+	destBucketName := bucket.BucketName
+	var out CopyObjectResult
+	srcBucket, err := bucket.Client.Bucket(srcBucketName)
+	if err != nil {
+		return out, err
+	}
+
+	return srcBucket.copy(srcObjectKey, destBucketName, destObjectKey, options...)
+}
+
+func (bucket Bucket) copy(srcObjectKey, destBucketName, destObjectKey string, options ...Option) (CopyObjectResult, error) {
+	var out CopyObjectResult
+	options = append(options, CopySource(bucket.BucketName, url.QueryEscape(srcObjectKey)))
+	headers := make(map[string]string)
+	err := handleOptions(headers, options)
+	if err != nil {
+		return out, err
+	}
+	params := map[string]interface{}{}
+	resp, err := bucket.Client.Conn.Do("PUT", destBucketName, destObjectKey, params, headers, nil, 0, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// AppendObject uploads the data in the way of appending an existing or new object.
+//
+// AppendObject the parameter appendPosition specifies which postion (in the target object) to append. For the first append (to a non-existing file),
+// the appendPosition should be 0. The appendPosition in the subsequent calls will be the current object length.
+// For example, the first appendObject's appendPosition is 0 and it uploaded 65536 bytes data, then the second call's position is 65536.
+// The response header x-oss-next-append-position after each successful request also specifies the next call's append position (so the caller need not to maintain this information).
+//
+// objectKey    the target object to append to.
+// reader    io.Reader. The read instance for reading the data to append.
+// appendPosition    the start position to append.
+// destObjectProperties    the options for the first appending, such as CacheControl, ContentDisposition, ContentEncoding,
+//                         Expires, ServerSideEncryption, ObjectACL.
+//
+// int64    the next append position, it's valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) AppendObject(objectKey string, reader io.Reader, appendPosition int64, options ...Option) (int64, error) {
+	request := &AppendObjectRequest{
+		ObjectKey: objectKey,
+		Reader:    reader,
+		Position:  appendPosition,
+	}
+
+	result, err := bucket.DoAppendObject(request, options)
+	if err != nil {
+		return appendPosition, err
+	}
+
+	return result.NextPosition, err
+}
+
+// DoAppendObject is the actual API that does the object append.
+//
+// request    the request object for appending object.
+// options    the options for appending object.
+//
+// AppendObjectResult    the result object for appending object.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) DoAppendObject(request *AppendObjectRequest, options []Option) (*AppendObjectResult, error) {
+	params := map[string]interface{}{}
+	params["append"] = nil
+	params["position"] = strconv.FormatInt(request.Position, 10)
+	headers := make(map[string]string)
+
+	opts := addContentType(options, request.ObjectKey)
+	handleOptions(headers, opts)
+
+	var initCRC uint64
+	isCRCSet, initCRCOpt, _ := isOptionSet(options, initCRC64)
+	if isCRCSet {
+		initCRC = initCRCOpt.(uint64)
+	}
+
+	listener := getProgressListener(options)
+
+	handleOptions(headers, opts)
+	resp, err := bucket.Client.Conn.Do("POST", bucket.BucketName, request.ObjectKey, params, headers,
+		request.Reader, initCRC, listener)
+	if err != nil {
+		return nil, err
+	}
+	defer resp.Body.Close()
+
+	nextPosition, _ := strconv.ParseInt(resp.Headers.Get(HTTPHeaderOssNextAppendPosition), 10, 64)
+	result := &AppendObjectResult{
+		NextPosition: nextPosition,
+		CRC:          resp.ServerCRC,
+	}
+
+	if bucket.getConfig().IsEnableCRC && isCRCSet {
+		err = checkCRC(resp, "AppendObject")
+		if err != nil {
+			return result, err
+		}
+	}
+
+	return result, nil
+}
+
+// DeleteObject deletes the object.
+//
+// objectKey    the object key to delete.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) DeleteObject(objectKey string) error {
+	params := map[string]interface{}{}
+	resp, err := bucket.do("DELETE", objectKey, params, nil, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusNoContent})
+}
+
+// DeleteObjects deletes multiple objects.
+//
+// objectKeys    the object keys to delete.
+// options    the options for deleting objects.
+//            Supported option is DeleteObjectsQuiet which means it will not return error even deletion failed (not recommended). By default it's not used.
+//
+// DeleteObjectsResult    the result object.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) DeleteObjects(objectKeys []string, options ...Option) (DeleteObjectsResult, error) {
+	out := DeleteObjectsResult{}
+	dxml := deleteXML{}
+	for _, key := range objectKeys {
+		dxml.Objects = append(dxml.Objects, DeleteObject{Key: key})
+	}
+	isQuiet, _ := findOption(options, deleteObjectsQuiet, false)
+	dxml.Quiet = isQuiet.(bool)
+
+	bs, err := xml.Marshal(dxml)
+	if err != nil {
+		return out, err
+	}
+	buffer := new(bytes.Buffer)
+	buffer.Write(bs)
+
+	contentType := http.DetectContentType(buffer.Bytes())
+	options = append(options, ContentType(contentType))
+	sum := md5.Sum(bs)
+	b64 := base64.StdEncoding.EncodeToString(sum[:])
+	options = append(options, ContentMD5(b64))
+
+	params := map[string]interface{}{}
+	params["delete"] = nil
+	params["encoding-type"] = "url"
+
+	resp, err := bucket.do("POST", "", params, options, buffer, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	if !dxml.Quiet {
+		if err = xmlUnmarshal(resp.Body, &out); err == nil {
+			err = decodeDeleteObjectsResult(&out)
+		}
+	}
+	return out, err
+}
+
+// IsObjectExist checks if the object exists.
+//
+// bool    flag of object's existence (true:exists; false:non-exist) when error is nil.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) IsObjectExist(objectKey string) (bool, error) {
+	_, err := bucket.GetObjectMeta(objectKey)
+	if err == nil {
+		return true, nil
+	}
+
+	switch err.(type) {
+	case ServiceError:
+		if err.(ServiceError).StatusCode == 404 {
+			return false, nil
+		}
+	}
+
+	return false, err
+}
+
+// ListObjects lists the objects under the current bucket.
+//
+// options    it contains all the filters for listing objects.
+//            It could specify a prefix filter on object keys,  the max keys count to return and the object key marker and the delimiter for grouping object names.
+//            The key marker means the returned objects' key must be greater than it in lexicographic order.
+//
+//            For example, if the bucket has 8 objects, my-object-1, my-object-11, my-object-2, my-object-21,
+//            my-object-22, my-object-3, my-object-31, my-object-32. If the prefix is my-object-2 (no other filters), then it returns
+//            my-object-2, my-object-21, my-object-22 three objects. If the marker is my-object-22 (no other filters), then it returns
+//            my-object-3, my-object-31, my-object-32 three objects. If the max keys is 5, then it returns 5 objects.
+//            The three filters could be used together to achieve filter and paging functionality.
+//            If the prefix is the folder name, then it could list all files under this folder (including the files under its subfolders).
+//            But if the delimiter is specified with '/', then it only returns that folder's files (no subfolder's files). The direct subfolders are in the commonPrefixes properties.
+//            For example, if the bucket has three objects fun/test.jpg, fun/movie/001.avi, fun/movie/007.avi. And if the prefix is "fun/", then it returns all three objects.
+//            But if the delimiter is '/', then only "fun/test.jpg" is returned as files and fun/movie/ is returned as common prefix.
+//
+//            For common usage scenario, check out sample/list_object.go.
+//
+// ListObjectsResponse    the return value after operation succeeds (only valid when error is nil).
+//
+func (bucket Bucket) ListObjects(options ...Option) (ListObjectsResult, error) {
+	var out ListObjectsResult
+
+	options = append(options, EncodingType("url"))
+	params, err := getRawParams(options)
+	if err != nil {
+		return out, err
+	}
+
+	resp, err := bucket.do("GET", "", params, options, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	if err != nil {
+		return out, err
+	}
+
+	err = decodeListObjectsResult(&out)
+	return out, err
+}
+
+// SetObjectMeta sets the metadata of the Object.
+//
+// objectKey    object
+// options    options for setting the metadata. The valid options are CacheControl, ContentDisposition, ContentEncoding, Expires,
+//            ServerSideEncryption, and custom metadata.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) SetObjectMeta(objectKey string, options ...Option) error {
+	options = append(options, MetadataDirective(MetaReplace))
+	_, err := bucket.CopyObject(objectKey, objectKey, options...)
+	return err
+}
+
+// GetObjectDetailedMeta gets the object's detailed metadata
+//
+// objectKey    object key.
+// options    the constraints of the object. Only when the object meets the requirements this method will return the metadata. Otherwise returns error. Valid options are IfModifiedSince, IfUnmodifiedSince,
+//            IfMatch, IfNoneMatch. For more details check out https://help.aliyun.com/document_detail/oss/api-reference/object/HeadObject.html
+//
+// http.Header    object meta when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) GetObjectDetailedMeta(objectKey string, options ...Option) (http.Header, error) {
+	params := map[string]interface{}{}
+	resp, err := bucket.do("HEAD", objectKey, params, options, nil, nil)
+	if err != nil {
+		return nil, err
+	}
+	defer resp.Body.Close()
+
+	return resp.Headers, nil
+}
+
+// GetObjectMeta gets object metadata.
+//
+// GetObjectMeta is more lightweight than GetObjectDetailedMeta as it only returns basic metadata including ETag
+// size, LastModified. The size information is in the HTTP header Content-Length.
+//
+// objectKey    object key
+//
+// http.Header    the object's metadata, valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) GetObjectMeta(objectKey string, options ...Option) (http.Header, error) {
+	params := map[string]interface{}{}
+	params["objectMeta"] = nil
+	//resp, err := bucket.do("GET", objectKey, "?objectMeta", "", nil, nil, nil)
+	resp, err := bucket.do("HEAD", objectKey, params, options, nil, nil)
+	if err != nil {
+		return nil, err
+	}
+	defer resp.Body.Close()
+
+	return resp.Headers, nil
+}
+
+// SetObjectACL updates the object's ACL.
+//
+// Only the bucket's owner could update object's ACL which priority is higher than bucket's ACL.
+// For example, if the bucket ACL is private and object's ACL is public-read-write.
+// Then object's ACL is used and it means all users could read or write that object.
+// When the object's ACL is not set, then bucket's ACL is used as the object's ACL.
+//
+// Object read operations include GetObject, HeadObject, CopyObject and UploadPartCopy on the source object;
+// Object write operations include PutObject, PostObject, AppendObject, DeleteObject, DeleteMultipleObjects,
+// CompleteMultipartUpload and CopyObject on target object.
+//
+// objectKey    the target object key (to set the ACL on)
+// objectAcl    object ACL. Valid options are PrivateACL, PublicReadACL, PublicReadWriteACL.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) SetObjectACL(objectKey string, objectACL ACLType) error {
+	options := []Option{ObjectACL(objectACL)}
+	params := map[string]interface{}{}
+	params["acl"] = nil
+	resp, err := bucket.do("PUT", objectKey, params, options, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// GetObjectACL gets object's ACL
+//
+// objectKey    the object to get ACL from.
+//
+// GetObjectACLResult    the result object when error is nil. GetObjectACLResult.Acl is the object ACL.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) GetObjectACL(objectKey string) (GetObjectACLResult, error) {
+	var out GetObjectACLResult
+	params := map[string]interface{}{}
+	params["acl"] = nil
+	resp, err := bucket.do("GET", objectKey, params, nil, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// PutSymlink creates a symlink (to point to an existing object)
+//
+// Symlink cannot point to another symlink.
+// When creating a symlink, it does not check the existence of the target file, and does not check if the target file is symlink.
+// Neither it checks the caller's permission on the target file. All these checks are deferred to the actual GetObject call via this symlink.
+// If trying to add an existing file, as long as the caller has the write permission, the existing one will be overwritten.
+// If the x-oss-meta- is specified, it will be added as the metadata of the symlink file.
+//
+// symObjectKey    the symlink object's key.
+// targetObjectKey    the target object key to point to.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) PutSymlink(symObjectKey string, targetObjectKey string, options ...Option) error {
+	options = append(options, symlinkTarget(url.QueryEscape(targetObjectKey)))
+	params := map[string]interface{}{}
+	params["symlink"] = nil
+	resp, err := bucket.do("PUT", symObjectKey, params, options, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// GetSymlink gets the symlink object with the specified key.
+// If the symlink object does not exist, returns 404.
+//
+// objectKey    the symlink object's key.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//          When error is nil, the target file key is in the X-Oss-Symlink-Target header of the returned object.
+//
+func (bucket Bucket) GetSymlink(objectKey string) (http.Header, error) {
+	params := map[string]interface{}{}
+	params["symlink"] = nil
+	resp, err := bucket.do("GET", objectKey, params, nil, nil, nil)
+	if err != nil {
+		return nil, err
+	}
+	defer resp.Body.Close()
+
+	targetObjectKey := resp.Headers.Get(HTTPHeaderOssSymlinkTarget)
+	targetObjectKey, err = url.QueryUnescape(targetObjectKey)
+	if err != nil {
+		return resp.Headers, err
+	}
+	resp.Headers.Set(HTTPHeaderOssSymlinkTarget, targetObjectKey)
+	return resp.Headers, err
+}
+
+// RestoreObject restores the object from the archive storage.
+//
+// An archive object is in cold status by default and it cannot be accessed.
+// When restore is called on the cold object, it will become available for access after some time.
+// If multiple restores are called on the same file when the object is being restored, server side does nothing for additional calls but returns success.
+// By default, the restored object is available for access for one day. After that it will be unavailable again.
+// But if another RestoreObject are called after the file is restored, then it will extend one day's access time of that object, up to 7 days.
+//
+// objectKey    object key to restore.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) RestoreObject(objectKey string) error {
+	params := map[string]interface{}{}
+	params["restore"] = nil
+	resp, err := bucket.do("POST", objectKey, params, nil, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK, http.StatusAccepted})
+}
+
+// SignURL signs the URL. Users could access the object directly with this URL without getting the AK.
+//
+// objectKey    the target object to sign.
+// signURLConfig    the configuration for the signed URL
+//
+// string    returns the signed URL, when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) SignURL(objectKey string, method HTTPMethod, expiredInSec int64, options ...Option) (string, error) {
+	if expiredInSec < 0 {
+		return "", fmt.Errorf("invalid expires: %d, expires must bigger than 0", expiredInSec)
+	}
+	expiration := time.Now().Unix() + expiredInSec
+
+	params, err := getRawParams(options)
+	if err != nil {
+		return "", err
+	}
+
+	headers := make(map[string]string)
+	err = handleOptions(headers, options)
+	if err != nil {
+		return "", err
+	}
+
+	return bucket.Client.Conn.signURL(method, bucket.BucketName, objectKey, expiration, params, headers), nil
+}
+
+// PutObjectWithURL uploads an object with the URL. If the object exists, it will be overwritten.
+// PutObjectWithURL It will not generate minetype according to the key name.
+//
+// signedURL    signed URL.
+// reader    io.Reader the read instance for reading the data for the upload.
+// options    the options for uploading the data. The valid options are CacheControl, ContentDisposition, ContentEncoding,
+//            Expires, ServerSideEncryption, ObjectACL and custom metadata. Check out the following link for details:
+//            https://help.aliyun.com/document_detail/oss/api-reference/object/PutObject.html
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) PutObjectWithURL(signedURL string, reader io.Reader, options ...Option) error {
+	resp, err := bucket.DoPutObjectWithURL(signedURL, reader, options)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+
+	return err
+}
+
+// PutObjectFromFileWithURL uploads an object from a local file with the signed URL.
+// PutObjectFromFileWithURL It does not generate mimetype according to object key's name or the local file name.
+//
+// signedURL    the signed URL.
+// filePath    local file path, such as dirfile.txt, for uploading.
+// options    options for uploading, same as the options in PutObject function.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) PutObjectFromFileWithURL(signedURL, filePath string, options ...Option) error {
+	fd, err := os.Open(filePath)
+	if err != nil {
+		return err
+	}
+	defer fd.Close()
+
+	resp, err := bucket.DoPutObjectWithURL(signedURL, fd, options)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+
+	return err
+}
+
+// DoPutObjectWithURL is the actual API that does the upload with URL work(internal for SDK)
+//
+// signedURL    the signed URL.
+// reader    io.Reader the read instance for getting the data to upload.
+// options    options for uploading.
+//
+// Response    the response object which contains the HTTP response.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) DoPutObjectWithURL(signedURL string, reader io.Reader, options []Option) (*Response, error) {
+	listener := getProgressListener(options)
+
+	params := map[string]interface{}{}
+	resp, err := bucket.doURL("PUT", signedURL, params, options, reader, listener)
+	if err != nil {
+		return nil, err
+	}
+
+	if bucket.getConfig().IsEnableCRC {
+		err = checkCRC(resp, "DoPutObjectWithURL")
+		if err != nil {
+			return resp, err
+		}
+	}
+
+	err = checkRespCode(resp.StatusCode, []int{http.StatusOK})
+
+	return resp, err
+}
+
+// GetObjectWithURL downloads the object and returns the reader instance,  with the signed URL.
+//
+// signedURL    the signed URL.
+// options    options for downloading the object. Valid options are IfModifiedSince, IfUnmodifiedSince, IfMatch,
+//            IfNoneMatch, AcceptEncoding. For more information, check out the following link:
+//            https://help.aliyun.com/document_detail/oss/api-reference/object/GetObject.html
+//
+// io.ReadCloser    the reader object for getting the data from response. It needs be closed after the usage. It's only valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) GetObjectWithURL(signedURL string, options ...Option) (io.ReadCloser, error) {
+	result, err := bucket.DoGetObjectWithURL(signedURL, options)
+	if err != nil {
+		return nil, err
+	}
+	return result.Response, nil
+}
+
+// GetObjectToFileWithURL downloads the object into a local file with the signed URL.
+//
+// signedURL    the signed URL
+// filePath    the local file path to download to.
+// options    the options for downloading object. Check out the parameter options in function GetObject for the reference.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) GetObjectToFileWithURL(signedURL, filePath string, options ...Option) error {
+	tempFilePath := filePath + TempFileSuffix
+
+	// Get the object's content
+	result, err := bucket.DoGetObjectWithURL(signedURL, options)
+	if err != nil {
+		return err
+	}
+	defer result.Response.Close()
+
+	// If the file does not exist, create one. If exists, then overwrite it.
+	fd, err := os.OpenFile(tempFilePath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, FilePermMode)
+	if err != nil {
+		return err
+	}
+
+	// Save the data to the file.
+	_, err = io.Copy(fd, result.Response.Body)
+	fd.Close()
+	if err != nil {
+		return err
+	}
+
+	// Compare the CRC value. If CRC values do not match, return error.
+	hasRange, _, _ := isOptionSet(options, HTTPHeaderRange)
+	encodeOpt, _ := findOption(options, HTTPHeaderAcceptEncoding, nil)
+	acceptEncoding := ""
+	if encodeOpt != nil {
+		acceptEncoding = encodeOpt.(string)
+	}
+
+	if bucket.getConfig().IsEnableCRC && !hasRange && acceptEncoding != "gzip" {
+		result.Response.ClientCRC = result.ClientCRC.Sum64()
+		err = checkCRC(result.Response, "GetObjectToFileWithURL")
+		if err != nil {
+			os.Remove(tempFilePath)
+			return err
+		}
+	}
+
+	return os.Rename(tempFilePath, filePath)
+}
+
+// DoGetObjectWithURL is the actual API that downloads the file with the signed URL.
+//
+// signedURL    the signed URL.
+// options    the options for getting object. Check out parameter options in GetObject for the reference.
+//
+// GetObjectResult    the result object when the error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) DoGetObjectWithURL(signedURL string, options []Option) (*GetObjectResult, error) {
+	params, _ := getRawParams(options)
+	resp, err := bucket.doURL("GET", signedURL, params, options, nil, nil)
+	if err != nil {
+		return nil, err
+	}
+
+	result := &GetObjectResult{
+		Response: resp,
+	}
+
+	// CRC
+	var crcCalc hash.Hash64
+	hasRange, _, _ := isOptionSet(options, HTTPHeaderRange)
+	if bucket.getConfig().IsEnableCRC && !hasRange {
+		crcCalc = crc64.New(crcTable())
+		result.ServerCRC = resp.ServerCRC
+		result.ClientCRC = crcCalc
+	}
+
+	// Progress
+	listener := getProgressListener(options)
+
+	contentLen, _ := strconv.ParseInt(resp.Headers.Get(HTTPHeaderContentLength), 10, 64)
+	resp.Body = TeeReader(resp.Body, crcCalc, contentLen, listener, nil)
+
+	return result, nil
+}
+
+//
+// ProcessObject apply process on the specified image file.
+//
+// The supported process includes resize, rotate, crop, watermark, format,
+// udf, customized style, etc.
+//
+//
+// objectKey	object key to process.
+// process	process string, such as "image/resize,w_100|sys/saveas,o_dGVzdC5qcGc,b_dGVzdA"
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (bucket Bucket) ProcessObject(objectKey string, process string) (ProcessObjectResult, error) {
+	var out ProcessObjectResult
+	params := map[string]interface{}{}
+	params["x-oss-process"] = nil
+	processData := fmt.Sprintf("%v=%v", "x-oss-process", process)
+	data := strings.NewReader(processData)
+	resp, err := bucket.do("POST", objectKey, params, nil, data, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = jsonUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// Private
+func (bucket Bucket) do(method, objectName string, params map[string]interface{}, options []Option,
+	data io.Reader, listener ProgressListener) (*Response, error) {
+	headers := make(map[string]string)
+	err := handleOptions(headers, options)
+	if err != nil {
+		return nil, err
+	}
+	return bucket.Client.Conn.Do(method, bucket.BucketName, objectName,
+		params, headers, data, 0, listener)
+}
+
+func (bucket Bucket) doURL(method HTTPMethod, signedURL string, params map[string]interface{}, options []Option,
+	data io.Reader, listener ProgressListener) (*Response, error) {
+	headers := make(map[string]string)
+	err := handleOptions(headers, options)
+	if err != nil {
+		return nil, err
+	}
+	return bucket.Client.Conn.DoURL(method, signedURL, headers, data, 0, listener)
+}
+
+func (bucket Bucket) getConfig() *Config {
+	return bucket.Client.Config
+}
+
+func addContentType(options []Option, keys ...string) []Option {
+	typ := TypeByExtension("")
+	for _, key := range keys {
+		typ = TypeByExtension(key)
+		if typ != "" {
+			break
+		}
+	}
+
+	if typ == "" {
+		typ = "application/octet-stream"
+	}
+
+	opts := []Option{ContentType(typ)}
+	opts = append(opts, options...)
+
+	return opts
+}

+ 805 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/client.go

@@ -0,0 +1,805 @@
+// Package oss implements functions for access oss service.
+// It has two main struct Client and Bucket.
+package oss
+
+import (
+	"bytes"
+	"encoding/xml"
+	"fmt"
+	"io"
+	"log"
+	"net/http"
+	"strings"
+	"time"
+)
+
+// Client SDK's entry point. It's for bucket related options such as create/delete/set bucket (such as set/get ACL/lifecycle/referer/logging/website).
+// Object related operations are done by Bucket class.
+// Users use oss.New to create Client instance.
+//
+type (
+	// Client OSS client
+	Client struct {
+		Config     *Config      // OSS client configuration
+		Conn       *Conn        // Send HTTP request
+		HTTPClient *http.Client //http.Client to use - if nil will make its own
+	}
+
+	// ClientOption client option such as UseCname, Timeout, SecurityToken.
+	ClientOption func(*Client)
+)
+
+// New creates a new client.
+//
+// endpoint    the OSS datacenter endpoint such as http://oss-cn-hangzhou.aliyuncs.com .
+// accessKeyId    access key Id.
+// accessKeySecret    access key secret.
+//
+// Client    creates the new client instance, the returned value is valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func New(endpoint, accessKeyID, accessKeySecret string, options ...ClientOption) (*Client, error) {
+	// Configuration
+	config := getDefaultOssConfig()
+	config.Endpoint = endpoint
+	config.AccessKeyID = accessKeyID
+	config.AccessKeySecret = accessKeySecret
+
+	// URL parse
+	url := &urlMaker{}
+	url.Init(config.Endpoint, config.IsCname, config.IsUseProxy)
+
+	// HTTP connect
+	conn := &Conn{config: config, url: url}
+
+	// OSS client
+	client := &Client{
+		Config: config,
+		Conn:   conn,
+	}
+
+	// Client options parse
+	for _, option := range options {
+		option(client)
+	}
+
+	// Create HTTP connection
+	err := conn.init(config, url, client.HTTPClient)
+
+	return client, err
+}
+
+// Bucket gets the bucket instance.
+//
+// bucketName    the bucket name.
+// Bucket    the bucket object, when error is nil.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) Bucket(bucketName string) (*Bucket, error) {
+	return &Bucket{
+		client,
+		bucketName,
+	}, nil
+}
+
+// CreateBucket creates a bucket.
+//
+// bucketName    the bucket name, it's globably unique and immutable. The bucket name can only consist of lowercase letters, numbers and dash ('-').
+//               It must start with lowercase letter or number and the length can only be between 3 and 255.
+// options    options for creating the bucket, with optional ACL. The ACL could be ACLPrivate, ACLPublicRead, and ACLPublicReadWrite. By default it's ACLPrivate.
+//            It could also be specified with StorageClass option, which supports StorageStandard, StorageIA(infrequent access), StorageArchive.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) CreateBucket(bucketName string, options ...Option) error {
+	headers := make(map[string]string)
+	handleOptions(headers, options)
+
+	buffer := new(bytes.Buffer)
+
+	isOptSet, val, _ := isOptionSet(options, storageClass)
+	if isOptSet {
+		cbConfig := createBucketConfiguration{StorageClass: val.(StorageClassType)}
+		bs, err := xml.Marshal(cbConfig)
+		if err != nil {
+			return err
+		}
+		buffer.Write(bs)
+
+		contentType := http.DetectContentType(buffer.Bytes())
+		headers[HTTPHeaderContentType] = contentType
+	}
+
+	params := map[string]interface{}{}
+	resp, err := client.do("PUT", bucketName, params, headers, buffer)
+	if err != nil {
+		return err
+	}
+
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// ListBuckets lists buckets of the current account under the given endpoint, with optional filters.
+//
+// options    specifies the filters such as Prefix, Marker and MaxKeys. Prefix is the bucket name's prefix filter.
+//            And marker makes sure the returned buckets' name are greater than it in lexicographic order.
+//            Maxkeys limits the max keys to return, and by default it's 100 and up to 1000.
+//            For the common usage scenario, please check out list_bucket.go in the sample.
+// ListBucketsResponse    the response object if error is nil.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) ListBuckets(options ...Option) (ListBucketsResult, error) {
+	var out ListBucketsResult
+
+	params, err := getRawParams(options)
+	if err != nil {
+		return out, err
+	}
+
+	resp, err := client.do("GET", "", params, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// IsBucketExist checks if the bucket exists
+//
+// bucketName    the bucket name.
+//
+// bool    true if it exists, and it's only valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) IsBucketExist(bucketName string) (bool, error) {
+	listRes, err := client.ListBuckets(Prefix(bucketName), MaxKeys(1))
+	if err != nil {
+		return false, err
+	}
+
+	if len(listRes.Buckets) == 1 && listRes.Buckets[0].Name == bucketName {
+		return true, nil
+	}
+	return false, nil
+}
+
+// DeleteBucket deletes the bucket. Only empty bucket can be deleted (no object and parts).
+//
+// bucketName    the bucket name.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) DeleteBucket(bucketName string) error {
+	params := map[string]interface{}{}
+	resp, err := client.do("DELETE", bucketName, params, nil, nil)
+	if err != nil {
+		return err
+	}
+
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusNoContent})
+}
+
+// GetBucketLocation gets the bucket location.
+//
+// Checks out the following link for more information :
+// https://help.aliyun.com/document_detail/oss/user_guide/oss_concept/endpoint.html
+//
+// bucketName    the bucket name
+//
+// string    bucket's datacenter location
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) GetBucketLocation(bucketName string) (string, error) {
+	params := map[string]interface{}{}
+	params["location"] = nil
+	resp, err := client.do("GET", bucketName, params, nil, nil)
+	if err != nil {
+		return "", err
+	}
+	defer resp.Body.Close()
+
+	var LocationConstraint string
+	err = xmlUnmarshal(resp.Body, &LocationConstraint)
+	return LocationConstraint, err
+}
+
+// SetBucketACL sets bucket's ACL.
+//
+// bucketName    the bucket name
+// bucketAcl    the bucket ACL: ACLPrivate, ACLPublicRead and ACLPublicReadWrite.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) SetBucketACL(bucketName string, bucketACL ACLType) error {
+	headers := map[string]string{HTTPHeaderOssACL: string(bucketACL)}
+	params := map[string]interface{}{}
+	resp, err := client.do("PUT", bucketName, params, headers, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// GetBucketACL gets the bucket ACL.
+//
+// bucketName    the bucket name.
+//
+// GetBucketAclResponse    the result object, and it's only valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) GetBucketACL(bucketName string) (GetBucketACLResult, error) {
+	var out GetBucketACLResult
+	params := map[string]interface{}{}
+	params["acl"] = nil
+	resp, err := client.do("GET", bucketName, params, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// SetBucketLifecycle sets the bucket's lifecycle.
+//
+// For more information, checks out following link:
+// https://help.aliyun.com/document_detail/oss/user_guide/manage_object/object_lifecycle.html
+//
+// bucketName    the bucket name.
+// rules    the lifecycle rules. There're two kind of rules: absolute time expiration and relative time expiration in days and day/month/year respectively.
+//          Check out sample/bucket_lifecycle.go for more details.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) SetBucketLifecycle(bucketName string, rules []LifecycleRule) error {
+	lxml := lifecycleXML{Rules: convLifecycleRule(rules)}
+	bs, err := xml.Marshal(lxml)
+	if err != nil {
+		return err
+	}
+	buffer := new(bytes.Buffer)
+	buffer.Write(bs)
+
+	contentType := http.DetectContentType(buffer.Bytes())
+	headers := map[string]string{}
+	headers[HTTPHeaderContentType] = contentType
+
+	params := map[string]interface{}{}
+	params["lifecycle"] = nil
+	resp, err := client.do("PUT", bucketName, params, headers, buffer)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// DeleteBucketLifecycle deletes the bucket's lifecycle.
+//
+//
+// bucketName    the bucket name.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) DeleteBucketLifecycle(bucketName string) error {
+	params := map[string]interface{}{}
+	params["lifecycle"] = nil
+	resp, err := client.do("DELETE", bucketName, params, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusNoContent})
+}
+
+// GetBucketLifecycle gets the bucket's lifecycle settings.
+//
+// bucketName    the bucket name.
+//
+// GetBucketLifecycleResponse    the result object upon successful request. It's only valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) GetBucketLifecycle(bucketName string) (GetBucketLifecycleResult, error) {
+	var out GetBucketLifecycleResult
+	params := map[string]interface{}{}
+	params["lifecycle"] = nil
+	resp, err := client.do("GET", bucketName, params, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// SetBucketReferer sets the bucket's referer whitelist and the flag if allowing empty referrer.
+//
+// To avoid stealing link on OSS data, OSS supports the HTTP referrer header. A whitelist referrer could be set either by API or web console, as well as
+// the allowing empty referrer flag. Note that this applies to requests from webbrowser only.
+// For example, for a bucket os-example and its referrer http://www.aliyun.com, all requests from this URL could access the bucket.
+// For more information, please check out this link :
+// https://help.aliyun.com/document_detail/oss/user_guide/security_management/referer.html
+//
+// bucketName    the bucket name.
+// referers    the referrer white list. A bucket could have a referrer list and each referrer supports one '*' and multiple '?' as wildcards.
+//             The sample could be found in sample/bucket_referer.go
+// allowEmptyReferer    the flag of allowing empty referrer. By default it's true.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) SetBucketReferer(bucketName string, referers []string, allowEmptyReferer bool) error {
+	rxml := RefererXML{}
+	rxml.AllowEmptyReferer = allowEmptyReferer
+	if referers == nil {
+		rxml.RefererList = append(rxml.RefererList, "")
+	} else {
+		for _, referer := range referers {
+			rxml.RefererList = append(rxml.RefererList, referer)
+		}
+	}
+
+	bs, err := xml.Marshal(rxml)
+	if err != nil {
+		return err
+	}
+	buffer := new(bytes.Buffer)
+	buffer.Write(bs)
+
+	contentType := http.DetectContentType(buffer.Bytes())
+	headers := map[string]string{}
+	headers[HTTPHeaderContentType] = contentType
+
+	params := map[string]interface{}{}
+	params["referer"] = nil
+	resp, err := client.do("PUT", bucketName, params, headers, buffer)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// GetBucketReferer gets the bucket's referrer white list.
+//
+// bucketName    the bucket name.
+//
+// GetBucketRefererResponse    the result object upon successful request. It's only valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) GetBucketReferer(bucketName string) (GetBucketRefererResult, error) {
+	var out GetBucketRefererResult
+	params := map[string]interface{}{}
+	params["referer"] = nil
+	resp, err := client.do("GET", bucketName, params, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// SetBucketLogging sets the bucket logging settings.
+//
+// OSS could automatically store the access log. Only the bucket owner could enable the logging.
+// Once enabled, OSS would save all the access log into hourly log files in a specified bucket.
+// For more information, please check out https://help.aliyun.com/document_detail/oss/user_guide/security_management/logging.html
+//
+// bucketName    bucket name to enable the log.
+// targetBucket    the target bucket name to store the log files.
+// targetPrefix    the log files' prefix.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) SetBucketLogging(bucketName, targetBucket, targetPrefix string,
+	isEnable bool) error {
+	var err error
+	var bs []byte
+	if isEnable {
+		lxml := LoggingXML{}
+		lxml.LoggingEnabled.TargetBucket = targetBucket
+		lxml.LoggingEnabled.TargetPrefix = targetPrefix
+		bs, err = xml.Marshal(lxml)
+	} else {
+		lxml := loggingXMLEmpty{}
+		bs, err = xml.Marshal(lxml)
+	}
+
+	if err != nil {
+		return err
+	}
+
+	buffer := new(bytes.Buffer)
+	buffer.Write(bs)
+
+	contentType := http.DetectContentType(buffer.Bytes())
+	headers := map[string]string{}
+	headers[HTTPHeaderContentType] = contentType
+
+	params := map[string]interface{}{}
+	params["logging"] = nil
+	resp, err := client.do("PUT", bucketName, params, headers, buffer)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// DeleteBucketLogging deletes the logging configuration to disable the logging on the bucket.
+//
+// bucketName    the bucket name to disable the logging.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) DeleteBucketLogging(bucketName string) error {
+	params := map[string]interface{}{}
+	params["logging"] = nil
+	resp, err := client.do("DELETE", bucketName, params, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusNoContent})
+}
+
+// GetBucketLogging gets the bucket's logging settings
+//
+// bucketName    the bucket name
+// GetBucketLoggingResponse    the result object upon successful request. It's only valid when error is nil.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) GetBucketLogging(bucketName string) (GetBucketLoggingResult, error) {
+	var out GetBucketLoggingResult
+	params := map[string]interface{}{}
+	params["logging"] = nil
+	resp, err := client.do("GET", bucketName, params, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// SetBucketWebsite sets the bucket's static website's index and error page.
+//
+// OSS supports static web site hosting for the bucket data. When the bucket is enabled with that, you can access the file in the bucket like the way to access a static website.
+// For more information, please check out: https://help.aliyun.com/document_detail/oss/user_guide/static_host_website.html
+//
+// bucketName    the bucket name to enable static web site.
+// indexDocument    index page.
+// errorDocument    error page.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) SetBucketWebsite(bucketName, indexDocument, errorDocument string) error {
+	wxml := WebsiteXML{}
+	wxml.IndexDocument.Suffix = indexDocument
+	wxml.ErrorDocument.Key = errorDocument
+
+	bs, err := xml.Marshal(wxml)
+	if err != nil {
+		return err
+	}
+	buffer := new(bytes.Buffer)
+	buffer.Write(bs)
+
+	contentType := http.DetectContentType(buffer.Bytes())
+	headers := make(map[string]string)
+	headers[HTTPHeaderContentType] = contentType
+
+	params := map[string]interface{}{}
+	params["website"] = nil
+	resp, err := client.do("PUT", bucketName, params, headers, buffer)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// DeleteBucketWebsite deletes the bucket's static web site settings.
+//
+// bucketName    the bucket name.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) DeleteBucketWebsite(bucketName string) error {
+	params := map[string]interface{}{}
+	params["website"] = nil
+	resp, err := client.do("DELETE", bucketName, params, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusNoContent})
+}
+
+// GetBucketWebsite gets the bucket's default page (index page) and the error page.
+//
+// bucketName    the bucket name
+//
+// GetBucketWebsiteResponse    the result object upon successful request. It's only valid when error is nil.
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) GetBucketWebsite(bucketName string) (GetBucketWebsiteResult, error) {
+	var out GetBucketWebsiteResult
+	params := map[string]interface{}{}
+	params["website"] = nil
+	resp, err := client.do("GET", bucketName, params, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// SetBucketCORS sets the bucket's CORS rules
+//
+// For more information, please check out https://help.aliyun.com/document_detail/oss/user_guide/security_management/cors.html
+//
+// bucketName    the bucket name
+// corsRules    the CORS rules to set. The related sample code is in sample/bucket_cors.go.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) SetBucketCORS(bucketName string, corsRules []CORSRule) error {
+	corsxml := CORSXML{}
+	for _, v := range corsRules {
+		cr := CORSRule{}
+		cr.AllowedMethod = v.AllowedMethod
+		cr.AllowedOrigin = v.AllowedOrigin
+		cr.AllowedHeader = v.AllowedHeader
+		cr.ExposeHeader = v.ExposeHeader
+		cr.MaxAgeSeconds = v.MaxAgeSeconds
+		corsxml.CORSRules = append(corsxml.CORSRules, cr)
+	}
+
+	bs, err := xml.Marshal(corsxml)
+	if err != nil {
+		return err
+	}
+	buffer := new(bytes.Buffer)
+	buffer.Write(bs)
+
+	contentType := http.DetectContentType(buffer.Bytes())
+	headers := map[string]string{}
+	headers[HTTPHeaderContentType] = contentType
+
+	params := map[string]interface{}{}
+	params["cors"] = nil
+	resp, err := client.do("PUT", bucketName, params, headers, buffer)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// DeleteBucketCORS deletes the bucket's static website settings.
+//
+// bucketName    the bucket name.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) DeleteBucketCORS(bucketName string) error {
+	params := map[string]interface{}{}
+	params["cors"] = nil
+	resp, err := client.do("DELETE", bucketName, params, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusNoContent})
+}
+
+// GetBucketCORS gets the bucket's CORS settings.
+//
+// bucketName    the bucket name.
+// GetBucketCORSResult    the result object upon successful request. It's only valid when error is nil.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) GetBucketCORS(bucketName string) (GetBucketCORSResult, error) {
+	var out GetBucketCORSResult
+	params := map[string]interface{}{}
+	params["cors"] = nil
+	resp, err := client.do("GET", bucketName, params, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// GetBucketInfo gets the bucket information.
+//
+// bucketName    the bucket name.
+// GetBucketInfoResult    the result object upon successful request. It's only valid when error is nil.
+//
+// error    it's nil if no error, otherwise it's an error object.
+//
+func (client Client) GetBucketInfo(bucketName string) (GetBucketInfoResult, error) {
+	var out GetBucketInfoResult
+	params := map[string]interface{}{}
+	params["bucketInfo"] = nil
+	resp, err := client.do("GET", bucketName, params, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// LimitUploadSpeed: set upload bandwidth limit speed,default is 0,unlimited
+// upSpeed: KB/s, 0 is unlimited,default is 0
+// error:it's nil if success, otherwise failure
+func (client Client) LimitUploadSpeed(upSpeed int) error {
+	if client.Config == nil {
+		return fmt.Errorf("client config is nil")
+	}
+	return client.Config.LimitUploadSpeed(upSpeed)
+}
+
+// UseCname sets the flag of using CName. By default it's false.
+//
+// isUseCname    true: the endpoint has the CName, false: the endpoint does not have cname. Default is false.
+//
+func UseCname(isUseCname bool) ClientOption {
+	return func(client *Client) {
+		client.Config.IsCname = isUseCname
+		client.Conn.url.Init(client.Config.Endpoint, client.Config.IsCname, client.Config.IsUseProxy)
+	}
+}
+
+// Timeout sets the HTTP timeout in seconds.
+//
+// connectTimeoutSec    HTTP timeout in seconds. Default is 10 seconds. 0 means infinite (not recommended)
+// readWriteTimeout    HTTP read or write's timeout in seconds. Default is 20 seconds. 0 means infinite.
+//
+func Timeout(connectTimeoutSec, readWriteTimeout int64) ClientOption {
+	return func(client *Client) {
+		client.Config.HTTPTimeout.ConnectTimeout =
+			time.Second * time.Duration(connectTimeoutSec)
+		client.Config.HTTPTimeout.ReadWriteTimeout =
+			time.Second * time.Duration(readWriteTimeout)
+		client.Config.HTTPTimeout.HeaderTimeout =
+			time.Second * time.Duration(readWriteTimeout)
+		client.Config.HTTPTimeout.IdleConnTimeout =
+			time.Second * time.Duration(readWriteTimeout)
+		client.Config.HTTPTimeout.LongTimeout =
+			time.Second * time.Duration(readWriteTimeout*10)
+	}
+}
+
+// SecurityToken sets the temporary user's SecurityToken.
+//
+// token    STS token
+//
+func SecurityToken(token string) ClientOption {
+	return func(client *Client) {
+		client.Config.SecurityToken = strings.TrimSpace(token)
+	}
+}
+
+// EnableMD5 enables MD5 validation.
+//
+// isEnableMD5    true: enable MD5 validation; false: disable MD5 validation.
+//
+func EnableMD5(isEnableMD5 bool) ClientOption {
+	return func(client *Client) {
+		client.Config.IsEnableMD5 = isEnableMD5
+	}
+}
+
+// MD5ThresholdCalcInMemory sets the memory usage threshold for computing the MD5, default is 16MB.
+//
+// threshold    the memory threshold in bytes. When the uploaded content is more than 16MB, the temp file is used for computing the MD5.
+//
+func MD5ThresholdCalcInMemory(threshold int64) ClientOption {
+	return func(client *Client) {
+		client.Config.MD5Threshold = threshold
+	}
+}
+
+// EnableCRC enables the CRC checksum. Default is true.
+//
+// isEnableCRC    true: enable CRC checksum; false: disable the CRC checksum.
+//
+func EnableCRC(isEnableCRC bool) ClientOption {
+	return func(client *Client) {
+		client.Config.IsEnableCRC = isEnableCRC
+	}
+}
+
+// UserAgent specifies UserAgent. The default is aliyun-sdk-go/1.2.0 (windows/-/amd64;go1.5.2).
+//
+// userAgent    the user agent string.
+//
+func UserAgent(userAgent string) ClientOption {
+	return func(client *Client) {
+		client.Config.UserAgent = userAgent
+	}
+}
+
+// Proxy sets the proxy (optional). The default is not using proxy.
+//
+// proxyHost    the proxy host in the format "host:port". For example, proxy.com:80 .
+//
+func Proxy(proxyHost string) ClientOption {
+	return func(client *Client) {
+		client.Config.IsUseProxy = true
+		client.Config.ProxyHost = proxyHost
+		client.Conn.url.Init(client.Config.Endpoint, client.Config.IsCname, client.Config.IsUseProxy)
+	}
+}
+
+// AuthProxy sets the proxy information with user name and password.
+//
+// proxyHost    the proxy host in the format "host:port". For example, proxy.com:80 .
+// proxyUser    the proxy user name.
+// proxyPassword    the proxy password.
+//
+func AuthProxy(proxyHost, proxyUser, proxyPassword string) ClientOption {
+	return func(client *Client) {
+		client.Config.IsUseProxy = true
+		client.Config.ProxyHost = proxyHost
+		client.Config.IsAuthProxy = true
+		client.Config.ProxyUser = proxyUser
+		client.Config.ProxyPassword = proxyPassword
+		client.Conn.url.Init(client.Config.Endpoint, client.Config.IsCname, client.Config.IsUseProxy)
+	}
+}
+
+//
+// HTTPClient sets the http.Client in use to the one passed in
+//
+func HTTPClient(HTTPClient *http.Client) ClientOption {
+	return func(client *Client) {
+		client.HTTPClient = HTTPClient
+	}
+}
+
+//
+// SetLogLevel sets the oss sdk log level
+//
+func SetLogLevel(LogLevel int) ClientOption {
+	return func(client *Client) {
+		client.Config.LogLevel = LogLevel
+	}
+}
+
+//
+// SetLogLevel sets the oss sdk log level
+//
+func SetLogger(Logger *log.Logger) ClientOption {
+	return func(client *Client) {
+		client.Config.Logger = Logger
+	}
+}
+
+// Private
+func (client Client) do(method, bucketName string, params map[string]interface{},
+	headers map[string]string, data io.Reader) (*Response, error) {
+	return client.Conn.Do(method, bucketName, "", params,
+		headers, data, 0, nil)
+}

+ 128 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/conf.go

@@ -0,0 +1,128 @@
+package oss
+
+import (
+	"bytes"
+	"fmt"
+	"log"
+	"os"
+	"time"
+)
+
+const (
+	LogOff = iota
+	Error
+	Warn
+	Info
+	Debug
+)
+
+var LogTag = []string{"[error]", "[warn]", "[info]", "[debug]"}
+
+// HTTPTimeout defines HTTP timeout.
+type HTTPTimeout struct {
+	ConnectTimeout   time.Duration
+	ReadWriteTimeout time.Duration
+	HeaderTimeout    time.Duration
+	LongTimeout      time.Duration
+	IdleConnTimeout  time.Duration
+}
+
+type HTTPMaxConns struct {
+	MaxIdleConns        int
+	MaxIdleConnsPerHost int
+}
+
+// Config defines oss configuration
+type Config struct {
+	Endpoint         string       // OSS endpoint
+	AccessKeyID      string       // AccessId
+	AccessKeySecret  string       // AccessKey
+	RetryTimes       uint         // Retry count by default it's 5.
+	UserAgent        string       // SDK name/version/system information
+	IsDebug          bool         // Enable debug mode. Default is false.
+	Timeout          uint         // Timeout in seconds. By default it's 60.
+	SecurityToken    string       // STS Token
+	IsCname          bool         // If cname is in the endpoint.
+	HTTPTimeout      HTTPTimeout  // HTTP timeout
+	HTTPMaxConns     HTTPMaxConns // Http max connections
+	IsUseProxy       bool         // Flag of using proxy.
+	ProxyHost        string       // Flag of using proxy host.
+	IsAuthProxy      bool         // Flag of needing authentication.
+	ProxyUser        string       // Proxy user
+	ProxyPassword    string       // Proxy password
+	IsEnableMD5      bool         // Flag of enabling MD5 for upload.
+	MD5Threshold     int64        // Memory footprint threshold for each MD5 computation (16MB is the default), in byte. When the data is more than that, temp file is used.
+	IsEnableCRC      bool         // Flag of enabling CRC for upload.
+	LogLevel         int          // Log level
+	Logger           *log.Logger  // For write log
+	UploadLimitSpeed int          // Upload limit speed:KB/s, 0 is unlimited
+	UploadLimiter    *OssLimiter  // Bandwidth limit reader for upload
+}
+
+// LimitUploadSpeed, uploadSpeed:KB/s, 0 is unlimited,default is 0
+func (config *Config) LimitUploadSpeed(uploadSpeed int) error {
+	if uploadSpeed < 0 {
+		return fmt.Errorf("erro,speed is less than 0")
+	} else if uploadSpeed == 0 {
+		config.UploadLimitSpeed = 0
+		config.UploadLimiter = nil
+		return nil
+	}
+
+	var err error
+	config.UploadLimiter, err = GetOssLimiter(uploadSpeed)
+	if err == nil {
+		config.UploadLimitSpeed = uploadSpeed
+	}
+	return err
+}
+
+// WriteLog
+func (config *Config) WriteLog(LogLevel int, format string, a ...interface{}) {
+	if config.LogLevel < LogLevel || config.Logger == nil {
+		return
+	}
+
+	var logBuffer bytes.Buffer
+	logBuffer.WriteString(LogTag[LogLevel-1])
+	logBuffer.WriteString(fmt.Sprintf(format, a...))
+	config.Logger.Printf("%s", logBuffer.String())
+}
+
+// getDefaultOssConfig gets the default configuration.
+func getDefaultOssConfig() *Config {
+	config := Config{}
+
+	config.Endpoint = ""
+	config.AccessKeyID = ""
+	config.AccessKeySecret = ""
+	config.RetryTimes = 5
+	config.IsDebug = false
+	config.UserAgent = userAgent()
+	config.Timeout = 60 // Seconds
+	config.SecurityToken = ""
+	config.IsCname = false
+
+	config.HTTPTimeout.ConnectTimeout = time.Second * 30   // 30s
+	config.HTTPTimeout.ReadWriteTimeout = time.Second * 60 // 60s
+	config.HTTPTimeout.HeaderTimeout = time.Second * 60    // 60s
+	config.HTTPTimeout.LongTimeout = time.Second * 300     // 300s
+	config.HTTPTimeout.IdleConnTimeout = time.Second * 50  // 50s
+	config.HTTPMaxConns.MaxIdleConns = 100
+	config.HTTPMaxConns.MaxIdleConnsPerHost = 100
+
+	config.IsUseProxy = false
+	config.ProxyHost = ""
+	config.IsAuthProxy = false
+	config.ProxyUser = ""
+	config.ProxyPassword = ""
+
+	config.MD5Threshold = 16 * 1024 * 1024 // 16MB
+	config.IsEnableMD5 = false
+	config.IsEnableCRC = true
+
+	config.LogLevel = LogOff
+	config.Logger = log.New(os.Stdout, "", log.LstdFlags)
+
+	return &config
+}

+ 730 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/conn.go

@@ -0,0 +1,730 @@
+package oss
+
+import (
+	"bytes"
+	"crypto/md5"
+	"encoding/base64"
+	"encoding/json"
+	"encoding/xml"
+	"fmt"
+	"hash"
+	"io"
+	"io/ioutil"
+	"net"
+	"net/http"
+	"net/url"
+	"os"
+	"sort"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// Conn defines OSS Conn
+type Conn struct {
+	config *Config
+	url    *urlMaker
+	client *http.Client
+}
+
+var signKeyList = []string{"acl", "uploads", "location", "cors", "logging", "website", "referer", "lifecycle", "delete", "append", "tagging", "objectMeta", "uploadId", "partNumber", "security-token", "position", "img", "style", "styleName", "replication", "replicationProgress", "replicationLocation", "cname", "bucketInfo", "comp", "qos", "live", "status", "vod", "startTime", "endTime", "symlink", "x-oss-process", "response-content-type", "response-content-language", "response-expires", "response-cache-control", "response-content-disposition", "response-content-encoding", "udf", "udfName", "udfImage", "udfId", "udfImageDesc", "udfApplication", "comp", "udfApplicationLog", "restore", "callback", "callback-var"}
+
+// init initializes Conn
+func (conn *Conn) init(config *Config, urlMaker *urlMaker, client *http.Client) error {
+	if client == nil {
+		// New transport
+		transport := newTransport(conn, config)
+
+		// Proxy
+		if conn.config.IsUseProxy {
+			proxyURL, err := url.Parse(config.ProxyHost)
+			if err != nil {
+				return err
+			}
+			transport.Proxy = http.ProxyURL(proxyURL)
+		}
+		client = &http.Client{Transport: transport}
+	}
+
+	conn.config = config
+	conn.url = urlMaker
+	conn.client = client
+
+	return nil
+}
+
+// Do sends request and returns the response
+func (conn Conn) Do(method, bucketName, objectName string, params map[string]interface{}, headers map[string]string,
+	data io.Reader, initCRC uint64, listener ProgressListener) (*Response, error) {
+	urlParams := conn.getURLParams(params)
+	subResource := conn.getSubResource(params)
+	uri := conn.url.getURL(bucketName, objectName, urlParams)
+	resource := conn.url.getResource(bucketName, objectName, subResource)
+	return conn.doRequest(method, uri, resource, headers, data, initCRC, listener)
+}
+
+// DoURL sends the request with signed URL and returns the response result.
+func (conn Conn) DoURL(method HTTPMethod, signedURL string, headers map[string]string,
+	data io.Reader, initCRC uint64, listener ProgressListener) (*Response, error) {
+	// Get URI from signedURL
+	uri, err := url.ParseRequestURI(signedURL)
+	if err != nil {
+		return nil, err
+	}
+
+	m := strings.ToUpper(string(method))
+	req := &http.Request{
+		Method:     m,
+		URL:        uri,
+		Proto:      "HTTP/1.1",
+		ProtoMajor: 1,
+		ProtoMinor: 1,
+		Header:     make(http.Header),
+		Host:       uri.Host,
+	}
+
+	tracker := &readerTracker{completedBytes: 0}
+	fd, crc := conn.handleBody(req, data, initCRC, listener, tracker)
+	if fd != nil {
+		defer func() {
+			fd.Close()
+			os.Remove(fd.Name())
+		}()
+	}
+
+	if conn.config.IsAuthProxy {
+		auth := conn.config.ProxyUser + ":" + conn.config.ProxyPassword
+		basic := "Basic " + base64.StdEncoding.EncodeToString([]byte(auth))
+		req.Header.Set("Proxy-Authorization", basic)
+	}
+
+	req.Header.Set(HTTPHeaderHost, conn.config.Endpoint)
+	req.Header.Set(HTTPHeaderUserAgent, conn.config.UserAgent)
+
+	if headers != nil {
+		for k, v := range headers {
+			req.Header.Set(k, v)
+		}
+	}
+
+	// Transfer started
+	event := newProgressEvent(TransferStartedEvent, 0, req.ContentLength)
+	publishProgress(listener, event)
+
+	if conn.config.LogLevel >= Debug {
+		conn.LoggerHttpReq(req)
+	}
+
+	resp, err := conn.client.Do(req)
+	if err != nil {
+		// Transfer failed
+		event = newProgressEvent(TransferFailedEvent, tracker.completedBytes, req.ContentLength)
+		publishProgress(listener, event)
+		return nil, err
+	}
+
+	if conn.config.LogLevel >= Debug {
+		//print out http resp
+		conn.LoggerHttpResp(req, resp)
+	}
+
+	// Transfer completed
+	event = newProgressEvent(TransferCompletedEvent, tracker.completedBytes, req.ContentLength)
+	publishProgress(listener, event)
+
+	return conn.handleResponse(resp, crc)
+}
+
+func (conn Conn) getURLParams(params map[string]interface{}) string {
+	// Sort
+	keys := make([]string, 0, len(params))
+	for k := range params {
+		keys = append(keys, k)
+	}
+	sort.Strings(keys)
+
+	// Serialize
+	var buf bytes.Buffer
+	for _, k := range keys {
+		if buf.Len() > 0 {
+			buf.WriteByte('&')
+		}
+		buf.WriteString(url.QueryEscape(k))
+		if params[k] != nil {
+			buf.WriteString("=" + url.QueryEscape(params[k].(string)))
+		}
+	}
+
+	return buf.String()
+}
+
+func (conn Conn) getSubResource(params map[string]interface{}) string {
+	// Sort
+	keys := make([]string, 0, len(params))
+	for k := range params {
+		if conn.isParamSign(k) {
+			keys = append(keys, k)
+		}
+	}
+	sort.Strings(keys)
+
+	// Serialize
+	var buf bytes.Buffer
+	for _, k := range keys {
+		if buf.Len() > 0 {
+			buf.WriteByte('&')
+		}
+		buf.WriteString(k)
+		if params[k] != nil {
+			buf.WriteString("=" + params[k].(string))
+		}
+	}
+
+	return buf.String()
+}
+
+func (conn Conn) isParamSign(paramKey string) bool {
+	for _, k := range signKeyList {
+		if paramKey == k {
+			return true
+		}
+	}
+	return false
+}
+
+func (conn Conn) doRequest(method string, uri *url.URL, canonicalizedResource string, headers map[string]string,
+	data io.Reader, initCRC uint64, listener ProgressListener) (*Response, error) {
+	method = strings.ToUpper(method)
+	req := &http.Request{
+		Method:     method,
+		URL:        uri,
+		Proto:      "HTTP/1.1",
+		ProtoMajor: 1,
+		ProtoMinor: 1,
+		Header:     make(http.Header),
+		Host:       uri.Host,
+	}
+
+	tracker := &readerTracker{completedBytes: 0}
+	fd, crc := conn.handleBody(req, data, initCRC, listener, tracker)
+	if fd != nil {
+		defer func() {
+			fd.Close()
+			os.Remove(fd.Name())
+		}()
+	}
+
+	if conn.config.IsAuthProxy {
+		auth := conn.config.ProxyUser + ":" + conn.config.ProxyPassword
+		basic := "Basic " + base64.StdEncoding.EncodeToString([]byte(auth))
+		req.Header.Set("Proxy-Authorization", basic)
+	}
+
+	date := time.Now().UTC().Format(http.TimeFormat)
+	req.Header.Set(HTTPHeaderDate, date)
+	req.Header.Set(HTTPHeaderHost, conn.config.Endpoint)
+	req.Header.Set(HTTPHeaderUserAgent, conn.config.UserAgent)
+	if conn.config.SecurityToken != "" {
+		req.Header.Set(HTTPHeaderOssSecurityToken, conn.config.SecurityToken)
+	}
+
+	if headers != nil {
+		for k, v := range headers {
+			req.Header.Set(k, v)
+		}
+	}
+
+	conn.signHeader(req, canonicalizedResource)
+
+	// Transfer started
+	event := newProgressEvent(TransferStartedEvent, 0, req.ContentLength)
+	publishProgress(listener, event)
+
+	if conn.config.LogLevel >= Debug {
+		conn.LoggerHttpReq(req)
+	}
+
+	resp, err := conn.client.Do(req)
+
+	if err != nil {
+		// Transfer failed
+		event = newProgressEvent(TransferFailedEvent, tracker.completedBytes, req.ContentLength)
+		publishProgress(listener, event)
+		return nil, err
+	}
+
+	if conn.config.LogLevel >= Debug {
+		//print out http resp
+		conn.LoggerHttpResp(req, resp)
+	}
+
+	// Transfer completed
+	event = newProgressEvent(TransferCompletedEvent, tracker.completedBytes, req.ContentLength)
+	publishProgress(listener, event)
+
+	return conn.handleResponse(resp, crc)
+}
+
+func (conn Conn) signURL(method HTTPMethod, bucketName, objectName string, expiration int64, params map[string]interface{}, headers map[string]string) string {
+	if conn.config.SecurityToken != "" {
+		params[HTTPParamSecurityToken] = conn.config.SecurityToken
+	}
+	subResource := conn.getSubResource(params)
+	canonicalizedResource := conn.url.getResource(bucketName, objectName, subResource)
+
+	m := strings.ToUpper(string(method))
+	req := &http.Request{
+		Method: m,
+		Header: make(http.Header),
+	}
+
+	if conn.config.IsAuthProxy {
+		auth := conn.config.ProxyUser + ":" + conn.config.ProxyPassword
+		basic := "Basic " + base64.StdEncoding.EncodeToString([]byte(auth))
+		req.Header.Set("Proxy-Authorization", basic)
+	}
+
+	req.Header.Set(HTTPHeaderDate, strconv.FormatInt(expiration, 10))
+	req.Header.Set(HTTPHeaderHost, conn.config.Endpoint)
+	req.Header.Set(HTTPHeaderUserAgent, conn.config.UserAgent)
+
+	if headers != nil {
+		for k, v := range headers {
+			req.Header.Set(k, v)
+		}
+	}
+
+	signedStr := conn.getSignedStr(req, canonicalizedResource)
+
+	params[HTTPParamExpires] = strconv.FormatInt(expiration, 10)
+	params[HTTPParamAccessKeyID] = conn.config.AccessKeyID
+	params[HTTPParamSignature] = signedStr
+
+	urlParams := conn.getURLParams(params)
+	return conn.url.getSignURL(bucketName, objectName, urlParams)
+}
+
+func (conn Conn) signRtmpURL(bucketName, channelName, playlistName string, expiration int64) string {
+	params := map[string]interface{}{}
+	if playlistName != "" {
+		params[HTTPParamPlaylistName] = playlistName
+	}
+	expireStr := strconv.FormatInt(expiration, 10)
+	params[HTTPParamExpires] = expireStr
+
+	if conn.config.AccessKeyID != "" {
+		params[HTTPParamAccessKeyID] = conn.config.AccessKeyID
+		if conn.config.SecurityToken != "" {
+			params[HTTPParamSecurityToken] = conn.config.SecurityToken
+		}
+		signedStr := conn.getRtmpSignedStr(bucketName, channelName, playlistName, expiration, params)
+		params[HTTPParamSignature] = signedStr
+	}
+
+	urlParams := conn.getURLParams(params)
+	return conn.url.getSignRtmpURL(bucketName, channelName, urlParams)
+}
+
+// handleBody handles request body
+func (conn Conn) handleBody(req *http.Request, body io.Reader, initCRC uint64,
+	listener ProgressListener, tracker *readerTracker) (*os.File, hash.Hash64) {
+	var file *os.File
+	var crc hash.Hash64
+	reader := body
+
+	// Length
+	switch v := body.(type) {
+	case *bytes.Buffer:
+		req.ContentLength = int64(v.Len())
+	case *bytes.Reader:
+		req.ContentLength = int64(v.Len())
+	case *strings.Reader:
+		req.ContentLength = int64(v.Len())
+	case *os.File:
+		req.ContentLength = tryGetFileSize(v)
+	case *io.LimitedReader:
+		req.ContentLength = int64(v.N)
+	}
+	req.Header.Set(HTTPHeaderContentLength, strconv.FormatInt(req.ContentLength, 10))
+
+	// MD5
+	if body != nil && conn.config.IsEnableMD5 && req.Header.Get(HTTPHeaderContentMD5) == "" {
+		md5 := ""
+		reader, md5, file, _ = calcMD5(body, req.ContentLength, conn.config.MD5Threshold)
+		req.Header.Set(HTTPHeaderContentMD5, md5)
+	}
+
+	// CRC
+	if reader != nil && conn.config.IsEnableCRC {
+		crc = NewCRC(crcTable(), initCRC)
+		reader = TeeReader(reader, crc, req.ContentLength, listener, tracker)
+	}
+
+	// HTTP body
+	rc, ok := reader.(io.ReadCloser)
+	if !ok && reader != nil {
+		rc = ioutil.NopCloser(reader)
+	}
+
+	if conn.isUploadLimitReq(req) {
+		limitReader := &LimitSpeedReader{
+			reader:     rc,
+			ossLimiter: conn.config.UploadLimiter,
+		}
+		req.Body = limitReader
+	} else {
+		req.Body = rc
+	}
+	return file, crc
+}
+
+// isUploadLimitReq: judge limit upload speed or not
+func (conn Conn) isUploadLimitReq(req *http.Request) bool {
+	if conn.config.UploadLimitSpeed == 0 || conn.config.UploadLimiter == nil {
+		return false
+	}
+
+	if req.Method != "GET" && req.Method != "DELETE" && req.Method != "HEAD" {
+		if req.ContentLength > 0 {
+			return true
+		}
+	}
+	return false
+}
+
+func tryGetFileSize(f *os.File) int64 {
+	fInfo, _ := f.Stat()
+	return fInfo.Size()
+}
+
+// handleResponse handles response
+func (conn Conn) handleResponse(resp *http.Response, crc hash.Hash64) (*Response, error) {
+	var cliCRC uint64
+	var srvCRC uint64
+
+	statusCode := resp.StatusCode
+	if statusCode >= 400 && statusCode <= 505 {
+		// 4xx and 5xx indicate that the operation has error occurred
+		var respBody []byte
+		respBody, err := readResponseBody(resp)
+		if err != nil {
+			return nil, err
+		}
+
+		if len(respBody) == 0 {
+			err = ServiceError{
+				StatusCode: statusCode,
+				RequestID:  resp.Header.Get(HTTPHeaderOssRequestID),
+			}
+		} else {
+			// Response contains storage service error object, unmarshal
+			srvErr, errIn := serviceErrFromXML(respBody, resp.StatusCode,
+				resp.Header.Get(HTTPHeaderOssRequestID))
+			if errIn != nil { // error unmarshaling the error response
+				err = fmt.Errorf("oss: service returned invalid response body, status = %s, RequestId = %s", resp.Status, resp.Header.Get(HTTPHeaderOssRequestID))
+			} else {
+				err = srvErr
+			}
+		}
+
+		return &Response{
+			StatusCode: resp.StatusCode,
+			Headers:    resp.Header,
+			Body:       ioutil.NopCloser(bytes.NewReader(respBody)), // restore the body
+		}, err
+	} else if statusCode >= 300 && statusCode <= 307 {
+		// OSS use 3xx, but response has no body
+		err := fmt.Errorf("oss: service returned %d,%s", resp.StatusCode, resp.Status)
+		return &Response{
+			StatusCode: resp.StatusCode,
+			Headers:    resp.Header,
+			Body:       resp.Body,
+		}, err
+	}
+
+	if conn.config.IsEnableCRC && crc != nil {
+		cliCRC = crc.Sum64()
+	}
+	srvCRC, _ = strconv.ParseUint(resp.Header.Get(HTTPHeaderOssCRC64), 10, 64)
+
+	// 2xx, successful
+	return &Response{
+		StatusCode: resp.StatusCode,
+		Headers:    resp.Header,
+		Body:       resp.Body,
+		ClientCRC:  cliCRC,
+		ServerCRC:  srvCRC,
+	}, nil
+}
+
+func (conn Conn) LoggerHttpReq(req *http.Request) {
+	var logBuffer bytes.Buffer
+	logBuffer.WriteString(fmt.Sprintf("[Req:%p]Method:%s\t", req, req.Method))
+	logBuffer.WriteString(fmt.Sprintf("Host:%s\t", req.URL.Host))
+	logBuffer.WriteString(fmt.Sprintf("Path:%s\t", req.URL.Path))
+	logBuffer.WriteString(fmt.Sprintf("Query:%s\t", req.URL.RawQuery))
+	logBuffer.WriteString(fmt.Sprintf("Header info:"))
+
+	for k, v := range req.Header {
+		var valueBuffer bytes.Buffer
+		for j := 0; j < len(v); j++ {
+			if j > 0 {
+				valueBuffer.WriteString(" ")
+			}
+			valueBuffer.WriteString(v[j])
+		}
+		logBuffer.WriteString(fmt.Sprintf("\t%s:%s", k, valueBuffer.String()))
+	}
+	conn.config.WriteLog(Debug, "%s\n", logBuffer.String())
+}
+
+func (conn Conn) LoggerHttpResp(req *http.Request, resp *http.Response) {
+	var logBuffer bytes.Buffer
+	logBuffer.WriteString(fmt.Sprintf("[Resp:%p]StatusCode:%d\t", req, resp.StatusCode))
+	logBuffer.WriteString(fmt.Sprintf("Header info:"))
+	for k, v := range resp.Header {
+		var valueBuffer bytes.Buffer
+		for j := 0; j < len(v); j++ {
+			if j > 0 {
+				valueBuffer.WriteString(" ")
+			}
+			valueBuffer.WriteString(v[j])
+		}
+		logBuffer.WriteString(fmt.Sprintf("\t%s:%s", k, valueBuffer.String()))
+	}
+	conn.config.WriteLog(Debug, "%s\n", logBuffer.String())
+}
+
+func calcMD5(body io.Reader, contentLen, md5Threshold int64) (reader io.Reader, b64 string, tempFile *os.File, err error) {
+	if contentLen == 0 || contentLen > md5Threshold {
+		// Huge body, use temporary file
+		tempFile, err = ioutil.TempFile(os.TempDir(), TempFilePrefix)
+		if tempFile != nil {
+			io.Copy(tempFile, body)
+			tempFile.Seek(0, os.SEEK_SET)
+			md5 := md5.New()
+			io.Copy(md5, tempFile)
+			sum := md5.Sum(nil)
+			b64 = base64.StdEncoding.EncodeToString(sum[:])
+			tempFile.Seek(0, os.SEEK_SET)
+			reader = tempFile
+		}
+	} else {
+		// Small body, use memory
+		buf, _ := ioutil.ReadAll(body)
+		sum := md5.Sum(buf)
+		b64 = base64.StdEncoding.EncodeToString(sum[:])
+		reader = bytes.NewReader(buf)
+	}
+	return
+}
+
+func readResponseBody(resp *http.Response) ([]byte, error) {
+	defer resp.Body.Close()
+	out, err := ioutil.ReadAll(resp.Body)
+	if err == io.EOF {
+		err = nil
+	}
+	return out, err
+}
+
+func serviceErrFromXML(body []byte, statusCode int, requestID string) (ServiceError, error) {
+	var storageErr ServiceError
+
+	if err := xml.Unmarshal(body, &storageErr); err != nil {
+		return storageErr, err
+	}
+
+	storageErr.StatusCode = statusCode
+	storageErr.RequestID = requestID
+	storageErr.RawMessage = string(body)
+	return storageErr, nil
+}
+
+func xmlUnmarshal(body io.Reader, v interface{}) error {
+	data, err := ioutil.ReadAll(body)
+	if err != nil {
+		return err
+	}
+	return xml.Unmarshal(data, v)
+}
+
+func jsonUnmarshal(body io.Reader, v interface{}) error {
+	data, err := ioutil.ReadAll(body)
+	if err != nil {
+		return err
+	}
+	return json.Unmarshal(data, v)
+}
+
+// timeoutConn handles HTTP timeout
+type timeoutConn struct {
+	conn        net.Conn
+	timeout     time.Duration
+	longTimeout time.Duration
+}
+
+func newTimeoutConn(conn net.Conn, timeout time.Duration, longTimeout time.Duration) *timeoutConn {
+	conn.SetReadDeadline(time.Now().Add(longTimeout))
+	return &timeoutConn{
+		conn:        conn,
+		timeout:     timeout,
+		longTimeout: longTimeout,
+	}
+}
+
+func (c *timeoutConn) Read(b []byte) (n int, err error) {
+	c.SetReadDeadline(time.Now().Add(c.timeout))
+	n, err = c.conn.Read(b)
+	c.SetReadDeadline(time.Now().Add(c.longTimeout))
+	return n, err
+}
+
+func (c *timeoutConn) Write(b []byte) (n int, err error) {
+	c.SetWriteDeadline(time.Now().Add(c.timeout))
+	n, err = c.conn.Write(b)
+	c.SetReadDeadline(time.Now().Add(c.longTimeout))
+	return n, err
+}
+
+func (c *timeoutConn) Close() error {
+	return c.conn.Close()
+}
+
+func (c *timeoutConn) LocalAddr() net.Addr {
+	return c.conn.LocalAddr()
+}
+
+func (c *timeoutConn) RemoteAddr() net.Addr {
+	return c.conn.RemoteAddr()
+}
+
+func (c *timeoutConn) SetDeadline(t time.Time) error {
+	return c.conn.SetDeadline(t)
+}
+
+func (c *timeoutConn) SetReadDeadline(t time.Time) error {
+	return c.conn.SetReadDeadline(t)
+}
+
+func (c *timeoutConn) SetWriteDeadline(t time.Time) error {
+	return c.conn.SetWriteDeadline(t)
+}
+
+// UrlMaker builds URL and resource
+const (
+	urlTypeCname  = 1
+	urlTypeIP     = 2
+	urlTypeAliyun = 3
+)
+
+type urlMaker struct {
+	Scheme  string // HTTP or HTTPS
+	NetLoc  string // Host or IP
+	Type    int    // 1 CNAME, 2 IP, 3 ALIYUN
+	IsProxy bool   // Proxy
+}
+
+// Init parses endpoint
+func (um *urlMaker) Init(endpoint string, isCname bool, isProxy bool) {
+	if strings.HasPrefix(endpoint, "http://") {
+		um.Scheme = "http"
+		um.NetLoc = endpoint[len("http://"):]
+	} else if strings.HasPrefix(endpoint, "https://") {
+		um.Scheme = "https"
+		um.NetLoc = endpoint[len("https://"):]
+	} else {
+		um.Scheme = "http"
+		um.NetLoc = endpoint
+	}
+
+	host, _, err := net.SplitHostPort(um.NetLoc)
+	if err != nil {
+		host = um.NetLoc
+		if host[0] == '[' && host[len(host)-1] == ']' {
+			host = host[1 : len(host)-1]
+		}
+	}
+
+	ip := net.ParseIP(host)
+	if ip != nil {
+		um.Type = urlTypeIP
+	} else if isCname {
+		um.Type = urlTypeCname
+	} else {
+		um.Type = urlTypeAliyun
+	}
+	um.IsProxy = isProxy
+}
+
+// getURL gets URL
+func (um urlMaker) getURL(bucket, object, params string) *url.URL {
+	host, path := um.buildURL(bucket, object)
+	addr := ""
+	if params == "" {
+		addr = fmt.Sprintf("%s://%s%s", um.Scheme, host, path)
+	} else {
+		addr = fmt.Sprintf("%s://%s%s?%s", um.Scheme, host, path, params)
+	}
+	uri, _ := url.ParseRequestURI(addr)
+	return uri
+}
+
+// getSignURL gets sign URL
+func (um urlMaker) getSignURL(bucket, object, params string) string {
+	host, path := um.buildURL(bucket, object)
+	return fmt.Sprintf("%s://%s%s?%s", um.Scheme, host, path, params)
+}
+
+// getSignRtmpURL Build Sign Rtmp URL
+func (um urlMaker) getSignRtmpURL(bucket, channelName, params string) string {
+	host, path := um.buildURL(bucket, "live")
+
+	channelName = url.QueryEscape(channelName)
+	channelName = strings.Replace(channelName, "+", "%20", -1)
+
+	return fmt.Sprintf("rtmp://%s%s/%s?%s", host, path, channelName, params)
+}
+
+// buildURL builds URL
+func (um urlMaker) buildURL(bucket, object string) (string, string) {
+	var host = ""
+	var path = ""
+
+	object = url.QueryEscape(object)
+	object = strings.Replace(object, "+", "%20", -1)
+
+	if um.Type == urlTypeCname {
+		host = um.NetLoc
+		path = "/" + object
+	} else if um.Type == urlTypeIP {
+		if bucket == "" {
+			host = um.NetLoc
+			path = "/"
+		} else {
+			host = um.NetLoc
+			path = fmt.Sprintf("/%s/%s", bucket, object)
+		}
+	} else {
+		if bucket == "" {
+			host = um.NetLoc
+			path = "/"
+		} else {
+			host = bucket + "." + um.NetLoc
+			path = "/" + object
+		}
+	}
+
+	return host, path
+}
+
+// getResource gets canonicalized resource
+func (um urlMaker) getResource(bucketName, objectName, subResource string) string {
+	if subResource != "" {
+		subResource = "?" + subResource
+	}
+	if bucketName == "" {
+		return fmt.Sprintf("/%s%s", bucketName, subResource)
+	}
+	return fmt.Sprintf("/%s/%s%s", bucketName, objectName, subResource)
+}

+ 146 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/const.go

@@ -0,0 +1,146 @@
+package oss
+
+import "os"
+
+// ACLType bucket/object ACL
+type ACLType string
+
+const (
+	// ACLPrivate definition : private read and write
+	ACLPrivate ACLType = "private"
+
+	// ACLPublicRead definition : public read and private write
+	ACLPublicRead ACLType = "public-read"
+
+	// ACLPublicReadWrite definition : public read and public write
+	ACLPublicReadWrite ACLType = "public-read-write"
+
+	// ACLDefault Object. It's only applicable for object.
+	ACLDefault ACLType = "default"
+)
+
+// MetadataDirectiveType specifying whether use the metadata of source object when copying object.
+type MetadataDirectiveType string
+
+const (
+	// MetaCopy the target object's metadata is copied from the source one
+	MetaCopy MetadataDirectiveType = "COPY"
+
+	// MetaReplace the target object's metadata is created as part of the copy request (not same as the source one)
+	MetaReplace MetadataDirectiveType = "REPLACE"
+)
+
+// StorageClassType bucket storage type
+type StorageClassType string
+
+const (
+	// StorageStandard standard
+	StorageStandard StorageClassType = "Standard"
+
+	// StorageIA infrequent access
+	StorageIA StorageClassType = "IA"
+
+	// StorageArchive archive
+	StorageArchive StorageClassType = "Archive"
+)
+
+// PayerType the type of request payer
+type PayerType string
+
+const (
+	// Requester the requester who send the request
+	Requester PayerType = "requester"
+)
+
+// HTTPMethod HTTP request method
+type HTTPMethod string
+
+const (
+	// HTTPGet HTTP GET
+	HTTPGet HTTPMethod = "GET"
+
+	// HTTPPut HTTP PUT
+	HTTPPut HTTPMethod = "PUT"
+
+	// HTTPHead HTTP HEAD
+	HTTPHead HTTPMethod = "HEAD"
+
+	// HTTPPost HTTP POST
+	HTTPPost HTTPMethod = "POST"
+
+	// HTTPDelete HTTP DELETE
+	HTTPDelete HTTPMethod = "DELETE"
+)
+
+// HTTP headers
+const (
+	HTTPHeaderAcceptEncoding     string = "Accept-Encoding"
+	HTTPHeaderAuthorization             = "Authorization"
+	HTTPHeaderCacheControl              = "Cache-Control"
+	HTTPHeaderContentDisposition        = "Content-Disposition"
+	HTTPHeaderContentEncoding           = "Content-Encoding"
+	HTTPHeaderContentLength             = "Content-Length"
+	HTTPHeaderContentMD5                = "Content-MD5"
+	HTTPHeaderContentType               = "Content-Type"
+	HTTPHeaderContentLanguage           = "Content-Language"
+	HTTPHeaderDate                      = "Date"
+	HTTPHeaderEtag                      = "ETag"
+	HTTPHeaderExpires                   = "Expires"
+	HTTPHeaderHost                      = "Host"
+	HTTPHeaderLastModified              = "Last-Modified"
+	HTTPHeaderRange                     = "Range"
+	HTTPHeaderLocation                  = "Location"
+	HTTPHeaderOrigin                    = "Origin"
+	HTTPHeaderServer                    = "Server"
+	HTTPHeaderUserAgent                 = "User-Agent"
+	HTTPHeaderIfModifiedSince           = "If-Modified-Since"
+	HTTPHeaderIfUnmodifiedSince         = "If-Unmodified-Since"
+	HTTPHeaderIfMatch                   = "If-Match"
+	HTTPHeaderIfNoneMatch               = "If-None-Match"
+
+	HTTPHeaderOssACL                         = "X-Oss-Acl"
+	HTTPHeaderOssMetaPrefix                  = "X-Oss-Meta-"
+	HTTPHeaderOssObjectACL                   = "X-Oss-Object-Acl"
+	HTTPHeaderOssSecurityToken               = "X-Oss-Security-Token"
+	HTTPHeaderOssServerSideEncryption        = "X-Oss-Server-Side-Encryption"
+	HTTPHeaderOssServerSideEncryptionKeyID   = "X-Oss-Server-Side-Encryption-Key-Id"
+	HTTPHeaderOssCopySource                  = "X-Oss-Copy-Source"
+	HTTPHeaderOssCopySourceRange             = "X-Oss-Copy-Source-Range"
+	HTTPHeaderOssCopySourceIfMatch           = "X-Oss-Copy-Source-If-Match"
+	HTTPHeaderOssCopySourceIfNoneMatch       = "X-Oss-Copy-Source-If-None-Match"
+	HTTPHeaderOssCopySourceIfModifiedSince   = "X-Oss-Copy-Source-If-Modified-Since"
+	HTTPHeaderOssCopySourceIfUnmodifiedSince = "X-Oss-Copy-Source-If-Unmodified-Since"
+	HTTPHeaderOssMetadataDirective           = "X-Oss-Metadata-Directive"
+	HTTPHeaderOssNextAppendPosition          = "X-Oss-Next-Append-Position"
+	HTTPHeaderOssRequestID                   = "X-Oss-Request-Id"
+	HTTPHeaderOssCRC64                       = "X-Oss-Hash-Crc64ecma"
+	HTTPHeaderOssSymlinkTarget               = "X-Oss-Symlink-Target"
+	HTTPHeaderOssStorageClass                = "X-Oss-Storage-Class"
+	HTTPHeaderOssCallback                    = "X-Oss-Callback"
+	HTTPHeaderOssCallbackVar                 = "X-Oss-Callback-Var"
+	HTTPHeaderOSSRequester                   = "X-Oss-Request-Payer"
+)
+
+// HTTP Param
+const (
+	HTTPParamExpires       = "Expires"
+	HTTPParamAccessKeyID   = "OSSAccessKeyId"
+	HTTPParamSignature     = "Signature"
+	HTTPParamSecurityToken = "security-token"
+	HTTPParamPlaylistName  = "playlistName"
+)
+
+// Other constants
+const (
+	MaxPartSize = 5 * 1024 * 1024 * 1024 // Max part size, 5GB
+	MinPartSize = 100 * 1024             // Min part size, 100KB
+
+	FilePermMode = os.FileMode(0664) // Default file permission
+
+	TempFilePrefix = "oss-go-temp-" // Temp file prefix
+	TempFileSuffix = ".temp"        // Temp file suffix
+
+	CheckpointFileSuffix = ".cp" // Checkpoint file suffix
+
+	Version = "1.9.5" // Go SDK version
+)

+ 123 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/crc.go

@@ -0,0 +1,123 @@
+package oss
+
+import (
+	"hash"
+	"hash/crc64"
+)
+
+// digest represents the partial evaluation of a checksum.
+type digest struct {
+	crc uint64
+	tab *crc64.Table
+}
+
+// NewCRC creates a new hash.Hash64 computing the CRC64 checksum
+// using the polynomial represented by the Table.
+func NewCRC(tab *crc64.Table, init uint64) hash.Hash64 { return &digest{init, tab} }
+
+// Size returns the number of bytes sum will return.
+func (d *digest) Size() int { return crc64.Size }
+
+// BlockSize returns the hash's underlying block size.
+// The Write method must be able to accept any amount
+// of data, but it may operate more efficiently if all writes
+// are a multiple of the block size.
+func (d *digest) BlockSize() int { return 1 }
+
+// Reset resets the hash to its initial state.
+func (d *digest) Reset() { d.crc = 0 }
+
+// Write (via the embedded io.Writer interface) adds more data to the running hash.
+// It never returns an error.
+func (d *digest) Write(p []byte) (n int, err error) {
+	d.crc = crc64.Update(d.crc, d.tab, p)
+	return len(p), nil
+}
+
+// Sum64 returns CRC64 value.
+func (d *digest) Sum64() uint64 { return d.crc }
+
+// Sum returns hash value.
+func (d *digest) Sum(in []byte) []byte {
+	s := d.Sum64()
+	return append(in, byte(s>>56), byte(s>>48), byte(s>>40), byte(s>>32), byte(s>>24), byte(s>>16), byte(s>>8), byte(s))
+}
+
+// gf2Dim dimension of GF(2) vectors (length of CRC)
+const gf2Dim int = 64
+
+func gf2MatrixTimes(mat []uint64, vec uint64) uint64 {
+	var sum uint64
+	for i := 0; vec != 0; i++ {
+		if vec&1 != 0 {
+			sum ^= mat[i]
+		}
+
+		vec >>= 1
+	}
+	return sum
+}
+
+func gf2MatrixSquare(square []uint64, mat []uint64) {
+	for n := 0; n < gf2Dim; n++ {
+		square[n] = gf2MatrixTimes(mat, mat[n])
+	}
+}
+
+// CRC64Combine combines CRC64
+func CRC64Combine(crc1 uint64, crc2 uint64, len2 uint64) uint64 {
+	var even [gf2Dim]uint64 // Even-power-of-two zeros operator
+	var odd [gf2Dim]uint64  // Odd-power-of-two zeros operator
+
+	// Degenerate case
+	if len2 == 0 {
+		return crc1
+	}
+
+	// Put operator for one zero bit in odd
+	odd[0] = crc64.ECMA // CRC64 polynomial
+	var row uint64 = 1
+	for n := 1; n < gf2Dim; n++ {
+		odd[n] = row
+		row <<= 1
+	}
+
+	// Put operator for two zero bits in even
+	gf2MatrixSquare(even[:], odd[:])
+
+	// Put operator for four zero bits in odd
+	gf2MatrixSquare(odd[:], even[:])
+
+	// Apply len2 zeros to crc1, first square will put the operator for one zero byte, eight zero bits, in even
+	for {
+		// Apply zeros operator for this bit of len2
+		gf2MatrixSquare(even[:], odd[:])
+
+		if len2&1 != 0 {
+			crc1 = gf2MatrixTimes(even[:], crc1)
+		}
+
+		len2 >>= 1
+
+		// If no more bits set, then done
+		if len2 == 0 {
+			break
+		}
+
+		// Another iteration of the loop with odd and even swapped
+		gf2MatrixSquare(odd[:], even[:])
+		if len2&1 != 0 {
+			crc1 = gf2MatrixTimes(odd[:], crc1)
+		}
+		len2 >>= 1
+
+		// If no more bits set, then done
+		if len2 == 0 {
+			break
+		}
+	}
+
+	// Return combined CRC
+	crc1 ^= crc2
+	return crc1
+}

+ 568 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/download.go

@@ -0,0 +1,568 @@
+package oss
+
+import (
+	"crypto/md5"
+	"encoding/base64"
+	"encoding/json"
+	"errors"
+	"fmt"
+	"hash"
+	"hash/crc64"
+	"io"
+	"io/ioutil"
+	"net/http"
+	"os"
+	"path/filepath"
+	"strconv"
+)
+
+// DownloadFile downloads files with multipart download.
+//
+// objectKey    the object key.
+// filePath    the local file to download from objectKey in OSS.
+// partSize    the part size in bytes.
+// options    object's constraints, check out GetObject for the reference.
+//
+// error    it's nil when the call succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) DownloadFile(objectKey, filePath string, partSize int64, options ...Option) error {
+	if partSize < 1 {
+		return errors.New("oss: part size smaller than 1")
+	}
+
+	uRange, err := getRangeConfig(options)
+	if err != nil {
+		return err
+	}
+
+	cpConf := getCpConfig(options)
+	routines := getRoutines(options)
+
+	if cpConf != nil && cpConf.IsEnable {
+		cpFilePath := getDownloadCpFilePath(cpConf, bucket.BucketName, objectKey, filePath)
+		if cpFilePath != "" {
+			return bucket.downloadFileWithCp(objectKey, filePath, partSize, options, cpFilePath, routines, uRange)
+		}
+	}
+
+	return bucket.downloadFile(objectKey, filePath, partSize, options, routines, uRange)
+}
+
+func getDownloadCpFilePath(cpConf *cpConfig, srcBucket, srcObject, destFile string) string {
+	if cpConf.FilePath == "" && cpConf.DirPath != "" {
+		src := fmt.Sprintf("oss://%v/%v", srcBucket, srcObject)
+		absPath, _ := filepath.Abs(destFile)
+		cpFileName := getCpFileName(src, absPath)
+		cpConf.FilePath = cpConf.DirPath + string(os.PathSeparator) + cpFileName
+	}
+	return cpConf.FilePath
+}
+
+// getRangeConfig gets the download range from the options.
+func getRangeConfig(options []Option) (*unpackedRange, error) {
+	rangeOpt, err := findOption(options, HTTPHeaderRange, nil)
+	if err != nil || rangeOpt == nil {
+		return nil, err
+	}
+	return parseRange(rangeOpt.(string))
+}
+
+// ----- concurrent download without checkpoint  -----
+
+// downloadWorkerArg is download worker's parameters
+type downloadWorkerArg struct {
+	bucket    *Bucket
+	key       string
+	filePath  string
+	options   []Option
+	hook      downloadPartHook
+	enableCRC bool
+}
+
+// downloadPartHook is hook for test
+type downloadPartHook func(part downloadPart) error
+
+var downloadPartHooker downloadPartHook = defaultDownloadPartHook
+
+func defaultDownloadPartHook(part downloadPart) error {
+	return nil
+}
+
+// defaultDownloadProgressListener defines default ProgressListener, shields the ProgressListener in options of GetObject.
+type defaultDownloadProgressListener struct {
+}
+
+// ProgressChanged no-ops
+func (listener *defaultDownloadProgressListener) ProgressChanged(event *ProgressEvent) {
+}
+
+// downloadWorker
+func downloadWorker(id int, arg downloadWorkerArg, jobs <-chan downloadPart, results chan<- downloadPart, failed chan<- error, die <-chan bool) {
+	for part := range jobs {
+		if err := arg.hook(part); err != nil {
+			failed <- err
+			break
+		}
+
+		// Resolve options
+		r := Range(part.Start, part.End)
+		p := Progress(&defaultDownloadProgressListener{})
+		opts := make([]Option, len(arg.options)+2)
+		// Append orderly, can not be reversed!
+		opts = append(opts, arg.options...)
+		opts = append(opts, r, p)
+
+		rd, err := arg.bucket.GetObject(arg.key, opts...)
+		if err != nil {
+			failed <- err
+			break
+		}
+		defer rd.Close()
+
+		var crcCalc hash.Hash64
+		if arg.enableCRC {
+			crcCalc = crc64.New(crcTable())
+			contentLen := part.End - part.Start + 1
+			rd = ioutil.NopCloser(TeeReader(rd, crcCalc, contentLen, nil, nil))
+		}
+		defer rd.Close()
+
+		select {
+		case <-die:
+			return
+		default:
+		}
+
+		fd, err := os.OpenFile(arg.filePath, os.O_WRONLY, FilePermMode)
+		if err != nil {
+			failed <- err
+			break
+		}
+
+		_, err = fd.Seek(part.Start-part.Offset, os.SEEK_SET)
+		if err != nil {
+			fd.Close()
+			failed <- err
+			break
+		}
+
+		_, err = io.Copy(fd, rd)
+		if err != nil {
+			fd.Close()
+			failed <- err
+			break
+		}
+
+		if arg.enableCRC {
+			part.CRC64 = crcCalc.Sum64()
+		}
+
+		fd.Close()
+		results <- part
+	}
+}
+
+// downloadScheduler
+func downloadScheduler(jobs chan downloadPart, parts []downloadPart) {
+	for _, part := range parts {
+		jobs <- part
+	}
+	close(jobs)
+}
+
+// downloadPart defines download part
+type downloadPart struct {
+	Index  int    // Part number, starting from 0
+	Start  int64  // Start index
+	End    int64  // End index
+	Offset int64  // Offset
+	CRC64  uint64 // CRC check value of part
+}
+
+// getDownloadParts gets download parts
+func getDownloadParts(objectSize, partSize int64, uRange *unpackedRange) []downloadPart {
+	parts := []downloadPart{}
+	part := downloadPart{}
+	i := 0
+	start, end := adjustRange(uRange, objectSize)
+	for offset := start; offset < end; offset += partSize {
+		part.Index = i
+		part.Start = offset
+		part.End = GetPartEnd(offset, end, partSize)
+		part.Offset = start
+		part.CRC64 = 0
+		parts = append(parts, part)
+		i++
+	}
+	return parts
+}
+
+// getObjectBytes gets object bytes length
+func getObjectBytes(parts []downloadPart) int64 {
+	var ob int64
+	for _, part := range parts {
+		ob += (part.End - part.Start + 1)
+	}
+	return ob
+}
+
+// combineCRCInParts caculates the total CRC of continuous parts
+func combineCRCInParts(dps []downloadPart) uint64 {
+	if dps == nil || len(dps) == 0 {
+		return 0
+	}
+
+	crc := dps[0].CRC64
+	for i := 1; i < len(dps); i++ {
+		crc = CRC64Combine(crc, dps[i].CRC64, (uint64)(dps[i].End-dps[i].Start+1))
+	}
+
+	return crc
+}
+
+// downloadFile downloads file concurrently without checkpoint.
+func (bucket Bucket) downloadFile(objectKey, filePath string, partSize int64, options []Option, routines int, uRange *unpackedRange) error {
+	tempFilePath := filePath + TempFileSuffix
+	listener := getProgressListener(options)
+
+	payerOptions := []Option{}
+	payer := getPayer(options)
+	if payer != "" {
+		payerOptions = append(payerOptions, RequestPayer(PayerType(payer)))
+	}
+
+	// If the file does not exist, create one. If exists, the download will overwrite it.
+	fd, err := os.OpenFile(tempFilePath, os.O_WRONLY|os.O_CREATE, FilePermMode)
+	if err != nil {
+		return err
+	}
+	fd.Close()
+
+	meta, err := bucket.GetObjectDetailedMeta(objectKey, payerOptions...)
+	if err != nil {
+		return err
+	}
+
+	objectSize, err := strconv.ParseInt(meta.Get(HTTPHeaderContentLength), 10, 0)
+	if err != nil {
+		return err
+	}
+
+	enableCRC := false
+	expectedCRC := (uint64)(0)
+	if bucket.getConfig().IsEnableCRC && meta.Get(HTTPHeaderOssCRC64) != "" {
+		if uRange == nil || (!uRange.hasStart && !uRange.hasEnd) {
+			enableCRC = true
+			expectedCRC, _ = strconv.ParseUint(meta.Get(HTTPHeaderOssCRC64), 10, 0)
+		}
+	}
+
+	// Get the parts of the file
+	parts := getDownloadParts(objectSize, partSize, uRange)
+	jobs := make(chan downloadPart, len(parts))
+	results := make(chan downloadPart, len(parts))
+	failed := make(chan error)
+	die := make(chan bool)
+
+	var completedBytes int64
+	totalBytes := getObjectBytes(parts)
+	event := newProgressEvent(TransferStartedEvent, 0, totalBytes)
+	publishProgress(listener, event)
+
+	// Start the download workers
+	arg := downloadWorkerArg{&bucket, objectKey, tempFilePath, options, downloadPartHooker, enableCRC}
+	for w := 1; w <= routines; w++ {
+		go downloadWorker(w, arg, jobs, results, failed, die)
+	}
+
+	// Download parts concurrently
+	go downloadScheduler(jobs, parts)
+
+	// Waiting for parts download finished
+	completed := 0
+	for completed < len(parts) {
+		select {
+		case part := <-results:
+			completed++
+			completedBytes += (part.End - part.Start + 1)
+			parts[part.Index].CRC64 = part.CRC64
+			event = newProgressEvent(TransferDataEvent, completedBytes, totalBytes)
+			publishProgress(listener, event)
+		case err := <-failed:
+			close(die)
+			event = newProgressEvent(TransferFailedEvent, completedBytes, totalBytes)
+			publishProgress(listener, event)
+			return err
+		}
+
+		if completed >= len(parts) {
+			break
+		}
+	}
+
+	event = newProgressEvent(TransferCompletedEvent, completedBytes, totalBytes)
+	publishProgress(listener, event)
+
+	if enableCRC {
+		actualCRC := combineCRCInParts(parts)
+		err = checkDownloadCRC(actualCRC, expectedCRC)
+		if err != nil {
+			return err
+		}
+	}
+
+	return os.Rename(tempFilePath, filePath)
+}
+
+// ----- Concurrent download with chcekpoint  -----
+
+const downloadCpMagic = "92611BED-89E2-46B6-89E5-72F273D4B0A3"
+
+type downloadCheckpoint struct {
+	Magic     string         // Magic
+	MD5       string         // Checkpoint content MD5
+	FilePath  string         // Local file
+	Object    string         // Key
+	ObjStat   objectStat     // Object status
+	Parts     []downloadPart // All download parts
+	PartStat  []bool         // Parts' download status
+	Start     int64          // Start point of the file
+	End       int64          // End point of the file
+	enableCRC bool           // Whether has CRC check
+	CRC       uint64         // CRC check value
+}
+
+type objectStat struct {
+	Size         int64  // Object size
+	LastModified string // Last modified time
+	Etag         string // Etag
+}
+
+// isValid flags of checkpoint data is valid. It returns true when the data is valid and the checkpoint is valid and the object is not updated.
+func (cp downloadCheckpoint) isValid(meta http.Header, uRange *unpackedRange) (bool, error) {
+	// Compare the CP's Magic and the MD5
+	cpb := cp
+	cpb.MD5 = ""
+	js, _ := json.Marshal(cpb)
+	sum := md5.Sum(js)
+	b64 := base64.StdEncoding.EncodeToString(sum[:])
+
+	if cp.Magic != downloadCpMagic || b64 != cp.MD5 {
+		return false, nil
+	}
+
+	objectSize, err := strconv.ParseInt(meta.Get(HTTPHeaderContentLength), 10, 0)
+	if err != nil {
+		return false, err
+	}
+
+	// Compare the object size, last modified time and etag
+	if cp.ObjStat.Size != objectSize ||
+		cp.ObjStat.LastModified != meta.Get(HTTPHeaderLastModified) ||
+		cp.ObjStat.Etag != meta.Get(HTTPHeaderEtag) {
+		return false, nil
+	}
+
+	// Check the download range
+	if uRange != nil {
+		start, end := adjustRange(uRange, objectSize)
+		if start != cp.Start || end != cp.End {
+			return false, nil
+		}
+	}
+
+	return true, nil
+}
+
+// load checkpoint from local file
+func (cp *downloadCheckpoint) load(filePath string) error {
+	contents, err := ioutil.ReadFile(filePath)
+	if err != nil {
+		return err
+	}
+
+	err = json.Unmarshal(contents, cp)
+	return err
+}
+
+// dump funciton dumps to file
+func (cp *downloadCheckpoint) dump(filePath string) error {
+	bcp := *cp
+
+	// Calculate MD5
+	bcp.MD5 = ""
+	js, err := json.Marshal(bcp)
+	if err != nil {
+		return err
+	}
+	sum := md5.Sum(js)
+	b64 := base64.StdEncoding.EncodeToString(sum[:])
+	bcp.MD5 = b64
+
+	// Serialize
+	js, err = json.Marshal(bcp)
+	if err != nil {
+		return err
+	}
+
+	// Dump
+	return ioutil.WriteFile(filePath, js, FilePermMode)
+}
+
+// todoParts gets unfinished parts
+func (cp downloadCheckpoint) todoParts() []downloadPart {
+	dps := []downloadPart{}
+	for i, ps := range cp.PartStat {
+		if !ps {
+			dps = append(dps, cp.Parts[i])
+		}
+	}
+	return dps
+}
+
+// getCompletedBytes gets completed size
+func (cp downloadCheckpoint) getCompletedBytes() int64 {
+	var completedBytes int64
+	for i, part := range cp.Parts {
+		if cp.PartStat[i] {
+			completedBytes += (part.End - part.Start + 1)
+		}
+	}
+	return completedBytes
+}
+
+// prepare initiates download tasks
+func (cp *downloadCheckpoint) prepare(meta http.Header, bucket *Bucket, objectKey, filePath string, partSize int64, uRange *unpackedRange) error {
+	// CP
+	cp.Magic = downloadCpMagic
+	cp.FilePath = filePath
+	cp.Object = objectKey
+
+	objectSize, err := strconv.ParseInt(meta.Get(HTTPHeaderContentLength), 10, 0)
+	if err != nil {
+		return err
+	}
+
+	cp.ObjStat.Size = objectSize
+	cp.ObjStat.LastModified = meta.Get(HTTPHeaderLastModified)
+	cp.ObjStat.Etag = meta.Get(HTTPHeaderEtag)
+
+	if bucket.getConfig().IsEnableCRC && meta.Get(HTTPHeaderOssCRC64) != "" {
+		if uRange == nil || (!uRange.hasStart && !uRange.hasEnd) {
+			cp.enableCRC = true
+			cp.CRC, _ = strconv.ParseUint(meta.Get(HTTPHeaderOssCRC64), 10, 0)
+		}
+	}
+
+	// Parts
+	cp.Parts = getDownloadParts(objectSize, partSize, uRange)
+	cp.PartStat = make([]bool, len(cp.Parts))
+	for i := range cp.PartStat {
+		cp.PartStat[i] = false
+	}
+
+	return nil
+}
+
+func (cp *downloadCheckpoint) complete(cpFilePath, downFilepath string) error {
+	os.Remove(cpFilePath)
+	return os.Rename(downFilepath, cp.FilePath)
+}
+
+// downloadFileWithCp downloads files with checkpoint.
+func (bucket Bucket) downloadFileWithCp(objectKey, filePath string, partSize int64, options []Option, cpFilePath string, routines int, uRange *unpackedRange) error {
+	tempFilePath := filePath + TempFileSuffix
+	listener := getProgressListener(options)
+
+	payerOptions := []Option{}
+	payer := getPayer(options)
+	if payer != "" {
+		payerOptions = append(payerOptions, RequestPayer(PayerType(payer)))
+	}
+
+	// Load checkpoint data.
+	dcp := downloadCheckpoint{}
+	err := dcp.load(cpFilePath)
+	if err != nil {
+		os.Remove(cpFilePath)
+	}
+
+	// Get the object detailed meta.
+	meta, err := bucket.GetObjectDetailedMeta(objectKey, payerOptions...)
+	if err != nil {
+		return err
+	}
+
+	// Load error or data invalid. Re-initialize the download.
+	valid, err := dcp.isValid(meta, uRange)
+	if err != nil || !valid {
+		if err = dcp.prepare(meta, &bucket, objectKey, filePath, partSize, uRange); err != nil {
+			return err
+		}
+		os.Remove(cpFilePath)
+	}
+
+	// Create the file if not exists. Otherwise the parts download will overwrite it.
+	fd, err := os.OpenFile(tempFilePath, os.O_WRONLY|os.O_CREATE, FilePermMode)
+	if err != nil {
+		return err
+	}
+	fd.Close()
+
+	// Unfinished parts
+	parts := dcp.todoParts()
+	jobs := make(chan downloadPart, len(parts))
+	results := make(chan downloadPart, len(parts))
+	failed := make(chan error)
+	die := make(chan bool)
+
+	completedBytes := dcp.getCompletedBytes()
+	event := newProgressEvent(TransferStartedEvent, completedBytes, dcp.ObjStat.Size)
+	publishProgress(listener, event)
+
+	// Start the download workers routine
+	arg := downloadWorkerArg{&bucket, objectKey, tempFilePath, options, downloadPartHooker, dcp.enableCRC}
+	for w := 1; w <= routines; w++ {
+		go downloadWorker(w, arg, jobs, results, failed, die)
+	}
+
+	// Concurrently downloads parts
+	go downloadScheduler(jobs, parts)
+
+	// Wait for the parts download finished
+	completed := 0
+	for completed < len(parts) {
+		select {
+		case part := <-results:
+			completed++
+			dcp.PartStat[part.Index] = true
+			dcp.Parts[part.Index].CRC64 = part.CRC64
+			dcp.dump(cpFilePath)
+			completedBytes += (part.End - part.Start + 1)
+			event = newProgressEvent(TransferDataEvent, completedBytes, dcp.ObjStat.Size)
+			publishProgress(listener, event)
+		case err := <-failed:
+			close(die)
+			event = newProgressEvent(TransferFailedEvent, completedBytes, dcp.ObjStat.Size)
+			publishProgress(listener, event)
+			return err
+		}
+
+		if completed >= len(parts) {
+			break
+		}
+	}
+
+	event = newProgressEvent(TransferCompletedEvent, completedBytes, dcp.ObjStat.Size)
+	publishProgress(listener, event)
+
+	if dcp.enableCRC {
+		actualCRC := combineCRCInParts(dcp.Parts)
+		err = checkDownloadCRC(actualCRC, dcp.CRC)
+		if err != nil {
+			return err
+		}
+	}
+
+	return dcp.complete(cpFilePath, tempFilePath)
+}

+ 94 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/error.go

@@ -0,0 +1,94 @@
+package oss
+
+import (
+	"encoding/xml"
+	"fmt"
+	"net/http"
+	"strings"
+)
+
+// ServiceError contains fields of the error response from Oss Service REST API.
+type ServiceError struct {
+	XMLName    xml.Name `xml:"Error"`
+	Code       string   `xml:"Code"`      // The error code returned from OSS to the caller
+	Message    string   `xml:"Message"`   // The detail error message from OSS
+	RequestID  string   `xml:"RequestId"` // The UUID used to uniquely identify the request
+	HostID     string   `xml:"HostId"`    // The OSS server cluster's Id
+	Endpoint   string   `xml:"Endpoint"`
+	RawMessage string   // The raw messages from OSS
+	StatusCode int      // HTTP status code
+}
+
+// Error implements interface error
+func (e ServiceError) Error() string {
+	if e.Endpoint == "" {
+		return fmt.Sprintf("oss: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=\"%s\", RequestId=%s",
+			e.StatusCode, e.Code, e.Message, e.RequestID)
+	}
+	return fmt.Sprintf("oss: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=\"%s\", RequestId=%s, Endpoint=%s",
+		e.StatusCode, e.Code, e.Message, e.RequestID, e.Endpoint)
+}
+
+// UnexpectedStatusCodeError is returned when a storage service responds with neither an error
+// nor with an HTTP status code indicating success.
+type UnexpectedStatusCodeError struct {
+	allowed []int // The expected HTTP stats code returned from OSS
+	got     int   // The actual HTTP status code from OSS
+}
+
+// Error implements interface error
+func (e UnexpectedStatusCodeError) Error() string {
+	s := func(i int) string { return fmt.Sprintf("%d %s", i, http.StatusText(i)) }
+
+	got := s(e.got)
+	expected := []string{}
+	for _, v := range e.allowed {
+		expected = append(expected, s(v))
+	}
+	return fmt.Sprintf("oss: status code from service response is %s; was expecting %s",
+		got, strings.Join(expected, " or "))
+}
+
+// Got is the actual status code returned by oss.
+func (e UnexpectedStatusCodeError) Got() int {
+	return e.got
+}
+
+// checkRespCode returns UnexpectedStatusError if the given response code is not
+// one of the allowed status codes; otherwise nil.
+func checkRespCode(respCode int, allowed []int) error {
+	for _, v := range allowed {
+		if respCode == v {
+			return nil
+		}
+	}
+	return UnexpectedStatusCodeError{allowed, respCode}
+}
+
+// CRCCheckError is returned when crc check is inconsistent between client and server
+type CRCCheckError struct {
+	clientCRC uint64 // Calculated CRC64 in client
+	serverCRC uint64 // Calculated CRC64 in server
+	operation string // Upload operations such as PutObject/AppendObject/UploadPart, etc
+	requestID string // The request id of this operation
+}
+
+// Error implements interface error
+func (e CRCCheckError) Error() string {
+	return fmt.Sprintf("oss: the crc of %s is inconsistent, client %d but server %d; request id is %s",
+		e.operation, e.clientCRC, e.serverCRC, e.requestID)
+}
+
+func checkDownloadCRC(clientCRC, serverCRC uint64) error {
+	if clientCRC == serverCRC {
+		return nil
+	}
+	return CRCCheckError{clientCRC, serverCRC, "DownloadFile", ""}
+}
+
+func checkCRC(resp *Response, operation string) error {
+	if resp.Headers.Get(HTTPHeaderOssCRC64) == "" || resp.ClientCRC == resp.ServerCRC {
+		return nil
+	}
+	return CRCCheckError{resp.ClientCRC, resp.ServerCRC, operation, resp.Headers.Get(HTTPHeaderOssRequestID)}
+}

+ 28 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/limit_reader_1_6.go

@@ -0,0 +1,28 @@
+// +build !go1.7
+
+// "golang.org/x/time/rate" is depended on golang context package  go1.7 onward
+// this file is only for build,not supports limit upload speed
+package oss
+
+import (
+	"fmt"
+	"io"
+)
+
+const (
+	perTokenBandwidthSize int = 1024
+)
+
+type OssLimiter struct {
+}
+
+type LimitSpeedReader struct {
+	io.ReadCloser
+	reader     io.Reader
+	ossLimiter *OssLimiter
+}
+
+func GetOssLimiter(uploadSpeed int) (ossLimiter *OssLimiter, err error) {
+	err = fmt.Errorf("rate.Limiter is not supported below version go1.7")
+	return nil, err
+}

+ 91 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/limit_reader_1_7.go

@@ -0,0 +1,91 @@
+// +build go1.7
+
+package oss
+
+import (
+	"fmt"
+	"io"
+	"math"
+	"time"
+
+	"golang.org/x/time/rate"
+)
+
+const (
+	perTokenBandwidthSize int = 1024
+)
+
+// OssLimiter: wrapper rate.Limiter
+type OssLimiter struct {
+	limiter *rate.Limiter
+}
+
+// GetOssLimiter:create OssLimiter
+// uploadSpeed:KB/s
+func GetOssLimiter(uploadSpeed int) (ossLimiter *OssLimiter, err error) {
+	limiter := rate.NewLimiter(rate.Limit(uploadSpeed), uploadSpeed)
+
+	// first consume the initial full token,the limiter will behave more accurately
+	limiter.AllowN(time.Now(), uploadSpeed)
+
+	return &OssLimiter{
+		limiter: limiter,
+	}, nil
+}
+
+// LimitSpeedReader: for limit bandwidth upload
+type LimitSpeedReader struct {
+	io.ReadCloser
+	reader     io.Reader
+	ossLimiter *OssLimiter
+}
+
+// Read
+func (r *LimitSpeedReader) Read(p []byte) (n int, err error) {
+	n = 0
+	err = nil
+	start := 0
+	burst := r.ossLimiter.limiter.Burst()
+	var end int
+	var tmpN int
+	var tc int
+	for start < len(p) {
+		if start+burst*perTokenBandwidthSize < len(p) {
+			end = start + burst*perTokenBandwidthSize
+		} else {
+			end = len(p)
+		}
+
+		tmpN, err = r.reader.Read(p[start:end])
+		if tmpN > 0 {
+			n += tmpN
+			start = n
+		}
+
+		if err != nil {
+			return
+		}
+
+		tc = int(math.Ceil(float64(tmpN) / float64(perTokenBandwidthSize)))
+		now := time.Now()
+		re := r.ossLimiter.limiter.ReserveN(now, tc)
+		if !re.OK() {
+			err = fmt.Errorf("LimitSpeedReader.Read() failure,ReserveN error,start:%d,end:%d,burst:%d,perTokenBandwidthSize:%d",
+				start, end, burst, perTokenBandwidthSize)
+			return
+		} else {
+			timeDelay := re.Delay()
+			time.Sleep(timeDelay)
+		}
+	}
+	return
+}
+
+// Close ...
+func (r *LimitSpeedReader) Close() error {
+	rc, ok := r.reader.(io.ReadCloser)
+	if ok {
+		return rc.Close()
+	}
+	return nil
+}

+ 257 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/livechannel.go

@@ -0,0 +1,257 @@
+package oss
+
+import (
+	"bytes"
+	"encoding/xml"
+	"fmt"
+	"io"
+	"net/http"
+	"strconv"
+	"time"
+)
+
+//
+// CreateLiveChannel    create a live-channel
+//
+// channelName  the name of the channel
+// config       configuration of the channel
+//
+// CreateLiveChannelResult  the result of create live-channel
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) CreateLiveChannel(channelName string, config LiveChannelConfiguration) (CreateLiveChannelResult, error) {
+	var out CreateLiveChannelResult
+
+	bs, err := xml.Marshal(config)
+	if err != nil {
+		return out, err
+	}
+
+	buffer := new(bytes.Buffer)
+	buffer.Write(bs)
+
+	params := map[string]interface{}{}
+	params["live"] = nil
+	resp, err := bucket.do("PUT", channelName, params, nil, buffer, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+//
+// PutLiveChannelStatus Set the status of the live-channel: enabled/disabled
+//
+// channelName  the name of the channel
+// status       enabled/disabled
+//
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) PutLiveChannelStatus(channelName, status string) error {
+	params := map[string]interface{}{}
+	params["live"] = nil
+	params["status"] = status
+
+	resp, err := bucket.do("PUT", channelName, params, nil, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// PostVodPlaylist  create an playlist based on the specified playlist name, startTime and endTime
+//
+// channelName  the name of the channel
+// playlistName the name of the playlist, must end with ".m3u8"
+// startTime    the start time of the playlist
+// endTime      the endtime of the playlist
+//
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) PostVodPlaylist(channelName, playlistName string, startTime, endTime time.Time) error {
+	params := map[string]interface{}{}
+	params["vod"] = nil
+	params["startTime"] = strconv.FormatInt(startTime.Unix(), 10)
+	params["endTime"] = strconv.FormatInt(endTime.Unix(), 10)
+
+	key := fmt.Sprintf("%s/%s", channelName, playlistName)
+	resp, err := bucket.do("POST", key, params, nil, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+
+	return checkRespCode(resp.StatusCode, []int{http.StatusOK})
+}
+
+// GetVodPlaylist  get the playlist based on the specified channelName, startTime and endTime
+//
+// channelName  the name of the channel
+// startTime    the start time of the playlist
+// endTime      the endtime of the playlist
+//
+// io.ReadCloser reader instance for reading data from response. It must be called close() after the usage and only valid when error is nil.
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) GetVodPlaylist(channelName string, startTime, endTime time.Time) (io.ReadCloser, error) {
+	params := map[string]interface{}{}
+	params["vod"] = nil
+	params["startTime"] = strconv.FormatInt(startTime.Unix(), 10)
+	params["endTime"] = strconv.FormatInt(endTime.Unix(), 10)
+
+	resp, err := bucket.do("GET", channelName, params, nil, nil, nil)
+	if err != nil {
+		return nil, err
+	}
+
+	return resp.Body, nil
+}
+
+//
+// GetLiveChannelStat   Get the state of the live-channel
+//
+// channelName  the name of the channel
+//
+// LiveChannelStat  the state of the live-channel
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) GetLiveChannelStat(channelName string) (LiveChannelStat, error) {
+	var out LiveChannelStat
+	params := map[string]interface{}{}
+	params["live"] = nil
+	params["comp"] = "stat"
+
+	resp, err := bucket.do("GET", channelName, params, nil, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+//
+// GetLiveChannelInfo   Get the configuration info of the live-channel
+//
+// channelName  the name of the channel
+//
+// LiveChannelConfiguration the configuration info of the live-channel
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) GetLiveChannelInfo(channelName string) (LiveChannelConfiguration, error) {
+	var out LiveChannelConfiguration
+	params := map[string]interface{}{}
+	params["live"] = nil
+
+	resp, err := bucket.do("GET", channelName, params, nil, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+//
+// GetLiveChannelHistory    Get push records of live-channel
+//
+// channelName  the name of the channel
+//
+// LiveChannelHistory   push records
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) GetLiveChannelHistory(channelName string) (LiveChannelHistory, error) {
+	var out LiveChannelHistory
+	params := map[string]interface{}{}
+	params["live"] = nil
+	params["comp"] = "history"
+
+	resp, err := bucket.do("GET", channelName, params, nil, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+//
+// ListLiveChannel  list the live-channels
+//
+// options  Prefix: filter by the name start with the value of "Prefix"
+//          MaxKeys: the maximum count returned
+//          Marker: cursor from which starting list
+//
+// ListLiveChannelResult    live-channel list
+// error    nil if success, otherwise error
+//
+func (bucket Bucket) ListLiveChannel(options ...Option) (ListLiveChannelResult, error) {
+	var out ListLiveChannelResult
+
+	params, err := getRawParams(options)
+	if err != nil {
+		return out, err
+	}
+
+	params["live"] = nil
+
+	resp, err := bucket.do("GET", "", params, nil, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+//
+// DeleteLiveChannel    Delete the live-channel. When a client trying to stream the live-channel, the operation will fail. it will only delete the live-channel itself and the object generated by the live-channel will not be deleted.
+//
+// channelName  the name of the channel
+//
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) DeleteLiveChannel(channelName string) error {
+	params := map[string]interface{}{}
+	params["live"] = nil
+
+	if channelName == "" {
+		return fmt.Errorf("invalid argument: channel name is empty")
+	}
+
+	resp, err := bucket.do("DELETE", channelName, params, nil, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+
+	return checkRespCode(resp.StatusCode, []int{http.StatusNoContent})
+}
+
+//
+// SignRtmpURL  Generate a RTMP push-stream signature URL for the trusted user to push the RTMP stream to the live-channel.
+//
+// channelName  the name of the channel
+// playlistName the name of the playlist, must end with ".m3u8"
+// expires      expiration (in seconds)
+//
+// string       singed rtmp push stream url
+// error        nil if success, otherwise error
+//
+func (bucket Bucket) SignRtmpURL(channelName, playlistName string, expires int64) (string, error) {
+	if expires <= 0 {
+		return "", fmt.Errorf("invalid argument: %d, expires must greater than 0", expires)
+	}
+	expiration := time.Now().Unix() + expires
+
+	return bucket.Client.Conn.signRtmpURL(bucket.BucketName, channelName, playlistName, expiration), nil
+}

+ 245 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/mime.go

@@ -0,0 +1,245 @@
+package oss
+
+import (
+	"mime"
+	"path"
+	"strings"
+)
+
+var extToMimeType = map[string]string{
+	".xlsx":    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+	".xltx":    "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
+	".potx":    "application/vnd.openxmlformats-officedocument.presentationml.template",
+	".ppsx":    "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
+	".pptx":    "application/vnd.openxmlformats-officedocument.presentationml.presentation",
+	".sldx":    "application/vnd.openxmlformats-officedocument.presentationml.slide",
+	".docx":    "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+	".dotx":    "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
+	".xlam":    "application/vnd.ms-excel.addin.macroEnabled.12",
+	".xlsb":    "application/vnd.ms-excel.sheet.binary.macroEnabled.12",
+	".apk":     "application/vnd.android.package-archive",
+	".hqx":     "application/mac-binhex40",
+	".cpt":     "application/mac-compactpro",
+	".doc":     "application/msword",
+	".ogg":     "application/ogg",
+	".pdf":     "application/pdf",
+	".rtf":     "text/rtf",
+	".mif":     "application/vnd.mif",
+	".xls":     "application/vnd.ms-excel",
+	".ppt":     "application/vnd.ms-powerpoint",
+	".odc":     "application/vnd.oasis.opendocument.chart",
+	".odb":     "application/vnd.oasis.opendocument.database",
+	".odf":     "application/vnd.oasis.opendocument.formula",
+	".odg":     "application/vnd.oasis.opendocument.graphics",
+	".otg":     "application/vnd.oasis.opendocument.graphics-template",
+	".odi":     "application/vnd.oasis.opendocument.image",
+	".odp":     "application/vnd.oasis.opendocument.presentation",
+	".otp":     "application/vnd.oasis.opendocument.presentation-template",
+	".ods":     "application/vnd.oasis.opendocument.spreadsheet",
+	".ots":     "application/vnd.oasis.opendocument.spreadsheet-template",
+	".odt":     "application/vnd.oasis.opendocument.text",
+	".odm":     "application/vnd.oasis.opendocument.text-master",
+	".ott":     "application/vnd.oasis.opendocument.text-template",
+	".oth":     "application/vnd.oasis.opendocument.text-web",
+	".sxw":     "application/vnd.sun.xml.writer",
+	".stw":     "application/vnd.sun.xml.writer.template",
+	".sxc":     "application/vnd.sun.xml.calc",
+	".stc":     "application/vnd.sun.xml.calc.template",
+	".sxd":     "application/vnd.sun.xml.draw",
+	".std":     "application/vnd.sun.xml.draw.template",
+	".sxi":     "application/vnd.sun.xml.impress",
+	".sti":     "application/vnd.sun.xml.impress.template",
+	".sxg":     "application/vnd.sun.xml.writer.global",
+	".sxm":     "application/vnd.sun.xml.math",
+	".sis":     "application/vnd.symbian.install",
+	".wbxml":   "application/vnd.wap.wbxml",
+	".wmlc":    "application/vnd.wap.wmlc",
+	".wmlsc":   "application/vnd.wap.wmlscriptc",
+	".bcpio":   "application/x-bcpio",
+	".torrent": "application/x-bittorrent",
+	".bz2":     "application/x-bzip2",
+	".vcd":     "application/x-cdlink",
+	".pgn":     "application/x-chess-pgn",
+	".cpio":    "application/x-cpio",
+	".csh":     "application/x-csh",
+	".dvi":     "application/x-dvi",
+	".spl":     "application/x-futuresplash",
+	".gtar":    "application/x-gtar",
+	".hdf":     "application/x-hdf",
+	".jar":     "application/x-java-archive",
+	".jnlp":    "application/x-java-jnlp-file",
+	".js":      "application/x-javascript",
+	".ksp":     "application/x-kspread",
+	".chrt":    "application/x-kchart",
+	".kil":     "application/x-killustrator",
+	".latex":   "application/x-latex",
+	".rpm":     "application/x-rpm",
+	".sh":      "application/x-sh",
+	".shar":    "application/x-shar",
+	".swf":     "application/x-shockwave-flash",
+	".sit":     "application/x-stuffit",
+	".sv4cpio": "application/x-sv4cpio",
+	".sv4crc":  "application/x-sv4crc",
+	".tar":     "application/x-tar",
+	".tcl":     "application/x-tcl",
+	".tex":     "application/x-tex",
+	".man":     "application/x-troff-man",
+	".me":      "application/x-troff-me",
+	".ms":      "application/x-troff-ms",
+	".ustar":   "application/x-ustar",
+	".src":     "application/x-wais-source",
+	".zip":     "application/zip",
+	".m3u":     "audio/x-mpegurl",
+	".ra":      "audio/x-pn-realaudio",
+	".wav":     "audio/x-wav",
+	".wma":     "audio/x-ms-wma",
+	".wax":     "audio/x-ms-wax",
+	".pdb":     "chemical/x-pdb",
+	".xyz":     "chemical/x-xyz",
+	".bmp":     "image/bmp",
+	".gif":     "image/gif",
+	".ief":     "image/ief",
+	".png":     "image/png",
+	".wbmp":    "image/vnd.wap.wbmp",
+	".ras":     "image/x-cmu-raster",
+	".pnm":     "image/x-portable-anymap",
+	".pbm":     "image/x-portable-bitmap",
+	".pgm":     "image/x-portable-graymap",
+	".ppm":     "image/x-portable-pixmap",
+	".rgb":     "image/x-rgb",
+	".xbm":     "image/x-xbitmap",
+	".xpm":     "image/x-xpixmap",
+	".xwd":     "image/x-xwindowdump",
+	".css":     "text/css",
+	".rtx":     "text/richtext",
+	".tsv":     "text/tab-separated-values",
+	".jad":     "text/vnd.sun.j2me.app-descriptor",
+	".wml":     "text/vnd.wap.wml",
+	".wmls":    "text/vnd.wap.wmlscript",
+	".etx":     "text/x-setext",
+	".mxu":     "video/vnd.mpegurl",
+	".flv":     "video/x-flv",
+	".wm":      "video/x-ms-wm",
+	".wmv":     "video/x-ms-wmv",
+	".wmx":     "video/x-ms-wmx",
+	".wvx":     "video/x-ms-wvx",
+	".avi":     "video/x-msvideo",
+	".movie":   "video/x-sgi-movie",
+	".ice":     "x-conference/x-cooltalk",
+	".3gp":     "video/3gpp",
+	".ai":      "application/postscript",
+	".aif":     "audio/x-aiff",
+	".aifc":    "audio/x-aiff",
+	".aiff":    "audio/x-aiff",
+	".asc":     "text/plain",
+	".atom":    "application/atom+xml",
+	".au":      "audio/basic",
+	".bin":     "application/octet-stream",
+	".cdf":     "application/x-netcdf",
+	".cgm":     "image/cgm",
+	".class":   "application/octet-stream",
+	".dcr":     "application/x-director",
+	".dif":     "video/x-dv",
+	".dir":     "application/x-director",
+	".djv":     "image/vnd.djvu",
+	".djvu":    "image/vnd.djvu",
+	".dll":     "application/octet-stream",
+	".dmg":     "application/octet-stream",
+	".dms":     "application/octet-stream",
+	".dtd":     "application/xml-dtd",
+	".dv":      "video/x-dv",
+	".dxr":     "application/x-director",
+	".eps":     "application/postscript",
+	".exe":     "application/octet-stream",
+	".ez":      "application/andrew-inset",
+	".gram":    "application/srgs",
+	".grxml":   "application/srgs+xml",
+	".gz":      "application/x-gzip",
+	".htm":     "text/html",
+	".html":    "text/html",
+	".ico":     "image/x-icon",
+	".ics":     "text/calendar",
+	".ifb":     "text/calendar",
+	".iges":    "model/iges",
+	".igs":     "model/iges",
+	".jp2":     "image/jp2",
+	".jpe":     "image/jpeg",
+	".jpeg":    "image/jpeg",
+	".jpg":     "image/jpeg",
+	".kar":     "audio/midi",
+	".lha":     "application/octet-stream",
+	".lzh":     "application/octet-stream",
+	".m4a":     "audio/mp4a-latm",
+	".m4p":     "audio/mp4a-latm",
+	".m4u":     "video/vnd.mpegurl",
+	".m4v":     "video/x-m4v",
+	".mac":     "image/x-macpaint",
+	".mathml":  "application/mathml+xml",
+	".mesh":    "model/mesh",
+	".mid":     "audio/midi",
+	".midi":    "audio/midi",
+	".mov":     "video/quicktime",
+	".mp2":     "audio/mpeg",
+	".mp3":     "audio/mpeg",
+	".mp4":     "video/mp4",
+	".mpe":     "video/mpeg",
+	".mpeg":    "video/mpeg",
+	".mpg":     "video/mpeg",
+	".mpga":    "audio/mpeg",
+	".msh":     "model/mesh",
+	".nc":      "application/x-netcdf",
+	".oda":     "application/oda",
+	".ogv":     "video/ogv",
+	".pct":     "image/pict",
+	".pic":     "image/pict",
+	".pict":    "image/pict",
+	".pnt":     "image/x-macpaint",
+	".pntg":    "image/x-macpaint",
+	".ps":      "application/postscript",
+	".qt":      "video/quicktime",
+	".qti":     "image/x-quicktime",
+	".qtif":    "image/x-quicktime",
+	".ram":     "audio/x-pn-realaudio",
+	".rdf":     "application/rdf+xml",
+	".rm":      "application/vnd.rn-realmedia",
+	".roff":    "application/x-troff",
+	".sgm":     "text/sgml",
+	".sgml":    "text/sgml",
+	".silo":    "model/mesh",
+	".skd":     "application/x-koan",
+	".skm":     "application/x-koan",
+	".skp":     "application/x-koan",
+	".skt":     "application/x-koan",
+	".smi":     "application/smil",
+	".smil":    "application/smil",
+	".snd":     "audio/basic",
+	".so":      "application/octet-stream",
+	".svg":     "image/svg+xml",
+	".t":       "application/x-troff",
+	".texi":    "application/x-texinfo",
+	".texinfo": "application/x-texinfo",
+	".tif":     "image/tiff",
+	".tiff":    "image/tiff",
+	".tr":      "application/x-troff",
+	".txt":     "text/plain",
+	".vrml":    "model/vrml",
+	".vxml":    "application/voicexml+xml",
+	".webm":    "video/webm",
+	".wrl":     "model/vrml",
+	".xht":     "application/xhtml+xml",
+	".xhtml":   "application/xhtml+xml",
+	".xml":     "application/xml",
+	".xsl":     "application/xml",
+	".xslt":    "application/xslt+xml",
+	".xul":     "application/vnd.mozilla.xul+xml",
+}
+
+// TypeByExtension returns the MIME type associated with the file extension ext.
+// gets the file's MIME type for HTTP header Content-Type
+func TypeByExtension(filePath string) string {
+	typ := mime.TypeByExtension(path.Ext(filePath))
+	if typ == "" {
+		typ = extToMimeType[strings.ToLower(path.Ext(filePath))]
+	}
+	return typ
+}

+ 68 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/model.go

@@ -0,0 +1,68 @@
+package oss
+
+import (
+	"hash"
+	"io"
+	"net/http"
+)
+
+// Response defines HTTP response from OSS
+type Response struct {
+	StatusCode int
+	Headers    http.Header
+	Body       io.ReadCloser
+	ClientCRC  uint64
+	ServerCRC  uint64
+}
+
+func (r *Response) Read(p []byte) (n int, err error) {
+	return r.Body.Read(p)
+}
+
+func (r *Response) Close() error {
+	return r.Body.Close()
+}
+
+// PutObjectRequest is the request of DoPutObject
+type PutObjectRequest struct {
+	ObjectKey string
+	Reader    io.Reader
+}
+
+// GetObjectRequest is the request of DoGetObject
+type GetObjectRequest struct {
+	ObjectKey string
+}
+
+// GetObjectResult is the result of DoGetObject
+type GetObjectResult struct {
+	Response  *Response
+	ClientCRC hash.Hash64
+	ServerCRC uint64
+}
+
+// AppendObjectRequest is the requtest of DoAppendObject
+type AppendObjectRequest struct {
+	ObjectKey string
+	Reader    io.Reader
+	Position  int64
+}
+
+// AppendObjectResult is the result of DoAppendObject
+type AppendObjectResult struct {
+	NextPosition int64
+	CRC          uint64
+}
+
+// UploadPartRequest is the request of DoUploadPart
+type UploadPartRequest struct {
+	InitResult *InitiateMultipartUploadResult
+	Reader     io.Reader
+	PartSize   int64
+	PartNumber int
+}
+
+// UploadPartResult is the result of DoUploadPart
+type UploadPartResult struct {
+	Part UploadPart
+}

+ 468 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/multicopy.go

@@ -0,0 +1,468 @@
+package oss
+
+import (
+	"crypto/md5"
+	"encoding/base64"
+	"encoding/json"
+	"errors"
+	"fmt"
+	"io/ioutil"
+	"net/http"
+	"os"
+	"strconv"
+)
+
+// CopyFile is multipart copy object
+//
+// srcBucketName    source bucket name
+// srcObjectKey    source object name
+// destObjectKey    target object name in the form of bucketname.objectkey
+// partSize    the part size in byte.
+// options    object's contraints. Check out function InitiateMultipartUpload.
+//
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) CopyFile(srcBucketName, srcObjectKey, destObjectKey string, partSize int64, options ...Option) error {
+	destBucketName := bucket.BucketName
+	if partSize < MinPartSize || partSize > MaxPartSize {
+		return errors.New("oss: part size invalid range (1024KB, 5GB]")
+	}
+
+	cpConf := getCpConfig(options)
+	routines := getRoutines(options)
+
+	if cpConf != nil && cpConf.IsEnable {
+		cpFilePath := getCopyCpFilePath(cpConf, srcBucketName, srcObjectKey, destBucketName, destObjectKey)
+		if cpFilePath != "" {
+			return bucket.copyFileWithCp(srcBucketName, srcObjectKey, destBucketName, destObjectKey, partSize, options, cpFilePath, routines)
+		}
+	}
+
+	return bucket.copyFile(srcBucketName, srcObjectKey, destBucketName, destObjectKey,
+		partSize, options, routines)
+}
+
+func getCopyCpFilePath(cpConf *cpConfig, srcBucket, srcObject, destBucket, destObject string) string {
+	if cpConf.FilePath == "" && cpConf.DirPath != "" {
+		dest := fmt.Sprintf("oss://%v/%v", destBucket, destObject)
+		src := fmt.Sprintf("oss://%v/%v", srcBucket, srcObject)
+		cpFileName := getCpFileName(src, dest)
+		cpConf.FilePath = cpConf.DirPath + string(os.PathSeparator) + cpFileName
+	}
+	return cpConf.FilePath
+}
+
+// ----- Concurrently copy without checkpoint ---------
+
+// copyWorkerArg defines the copy worker arguments
+type copyWorkerArg struct {
+	bucket        *Bucket
+	imur          InitiateMultipartUploadResult
+	srcBucketName string
+	srcObjectKey  string
+	options       []Option
+	hook          copyPartHook
+}
+
+// copyPartHook is the hook for testing purpose
+type copyPartHook func(part copyPart) error
+
+var copyPartHooker copyPartHook = defaultCopyPartHook
+
+func defaultCopyPartHook(part copyPart) error {
+	return nil
+}
+
+// copyWorker copies worker
+func copyWorker(id int, arg copyWorkerArg, jobs <-chan copyPart, results chan<- UploadPart, failed chan<- error, die <-chan bool) {
+	for chunk := range jobs {
+		if err := arg.hook(chunk); err != nil {
+			failed <- err
+			break
+		}
+		chunkSize := chunk.End - chunk.Start + 1
+		part, err := arg.bucket.UploadPartCopy(arg.imur, arg.srcBucketName, arg.srcObjectKey,
+			chunk.Start, chunkSize, chunk.Number, arg.options...)
+		if err != nil {
+			failed <- err
+			break
+		}
+		select {
+		case <-die:
+			return
+		default:
+		}
+		results <- part
+	}
+}
+
+// copyScheduler
+func copyScheduler(jobs chan copyPart, parts []copyPart) {
+	for _, part := range parts {
+		jobs <- part
+	}
+	close(jobs)
+}
+
+// copyPart structure
+type copyPart struct {
+	Number int   // Part number (from 1 to 10,000)
+	Start  int64 // The start index in the source file.
+	End    int64 // The end index in the source file
+}
+
+// getCopyParts calculates copy parts
+func getCopyParts(objectSize, partSize int64) []copyPart {
+	parts := []copyPart{}
+	part := copyPart{}
+	i := 0
+	for offset := int64(0); offset < objectSize; offset += partSize {
+		part.Number = i + 1
+		part.Start = offset
+		part.End = GetPartEnd(offset, objectSize, partSize)
+		parts = append(parts, part)
+		i++
+	}
+	return parts
+}
+
+// getSrcObjectBytes gets the source file size
+func getSrcObjectBytes(parts []copyPart) int64 {
+	var ob int64
+	for _, part := range parts {
+		ob += (part.End - part.Start + 1)
+	}
+	return ob
+}
+
+// copyFile is a concurrently copy without checkpoint
+func (bucket Bucket) copyFile(srcBucketName, srcObjectKey, destBucketName, destObjectKey string,
+	partSize int64, options []Option, routines int) error {
+	descBucket, err := bucket.Client.Bucket(destBucketName)
+	srcBucket, err := bucket.Client.Bucket(srcBucketName)
+	listener := getProgressListener(options)
+
+	payerOptions := []Option{}
+	payer := getPayer(options)
+	if payer != "" {
+		payerOptions = append(payerOptions, RequestPayer(PayerType(payer)))
+	}
+
+	meta, err := srcBucket.GetObjectDetailedMeta(srcObjectKey, payerOptions...)
+	if err != nil {
+		return err
+	}
+
+	objectSize, err := strconv.ParseInt(meta.Get(HTTPHeaderContentLength), 10, 0)
+	if err != nil {
+		return err
+	}
+
+	// Get copy parts
+	parts := getCopyParts(objectSize, partSize)
+	// Initialize the multipart upload
+	imur, err := descBucket.InitiateMultipartUpload(destObjectKey, options...)
+	if err != nil {
+		return err
+	}
+
+	jobs := make(chan copyPart, len(parts))
+	results := make(chan UploadPart, len(parts))
+	failed := make(chan error)
+	die := make(chan bool)
+
+	var completedBytes int64
+	totalBytes := getSrcObjectBytes(parts)
+	event := newProgressEvent(TransferStartedEvent, 0, totalBytes)
+	publishProgress(listener, event)
+
+	// Start to copy workers
+	arg := copyWorkerArg{descBucket, imur, srcBucketName, srcObjectKey, payerOptions, copyPartHooker}
+	for w := 1; w <= routines; w++ {
+		go copyWorker(w, arg, jobs, results, failed, die)
+	}
+
+	// Start the scheduler
+	go copyScheduler(jobs, parts)
+
+	// Wait for the parts finished.
+	completed := 0
+	ups := make([]UploadPart, len(parts))
+	for completed < len(parts) {
+		select {
+		case part := <-results:
+			completed++
+			ups[part.PartNumber-1] = part
+			completedBytes += (parts[part.PartNumber-1].End - parts[part.PartNumber-1].Start + 1)
+			event = newProgressEvent(TransferDataEvent, completedBytes, totalBytes)
+			publishProgress(listener, event)
+		case err := <-failed:
+			close(die)
+			descBucket.AbortMultipartUpload(imur, payerOptions...)
+			event = newProgressEvent(TransferFailedEvent, completedBytes, totalBytes)
+			publishProgress(listener, event)
+			return err
+		}
+
+		if completed >= len(parts) {
+			break
+		}
+	}
+
+	event = newProgressEvent(TransferCompletedEvent, completedBytes, totalBytes)
+	publishProgress(listener, event)
+
+	// Complete the multipart upload
+	_, err = descBucket.CompleteMultipartUpload(imur, ups, payerOptions...)
+	if err != nil {
+		bucket.AbortMultipartUpload(imur, payerOptions...)
+		return err
+	}
+	return nil
+}
+
+// ----- Concurrently copy with checkpoint  -----
+
+const copyCpMagic = "84F1F18C-FF1D-403B-A1D8-9DEB5F65910A"
+
+type copyCheckpoint struct {
+	Magic          string       // Magic
+	MD5            string       // CP content MD5
+	SrcBucketName  string       // Source bucket
+	SrcObjectKey   string       // Source object
+	DestBucketName string       // Target bucket
+	DestObjectKey  string       // Target object
+	CopyID         string       // Copy ID
+	ObjStat        objectStat   // Object stat
+	Parts          []copyPart   // Copy parts
+	CopyParts      []UploadPart // The uploaded parts
+	PartStat       []bool       // The part status
+}
+
+// isValid checks if the data is valid which means CP is valid and object is not updated.
+func (cp copyCheckpoint) isValid(meta http.Header) (bool, error) {
+	// Compare CP's magic number and the MD5.
+	cpb := cp
+	cpb.MD5 = ""
+	js, _ := json.Marshal(cpb)
+	sum := md5.Sum(js)
+	b64 := base64.StdEncoding.EncodeToString(sum[:])
+
+	if cp.Magic != downloadCpMagic || b64 != cp.MD5 {
+		return false, nil
+	}
+
+	objectSize, err := strconv.ParseInt(meta.Get(HTTPHeaderContentLength), 10, 0)
+	if err != nil {
+		return false, err
+	}
+
+	// Compare the object size and last modified time and etag.
+	if cp.ObjStat.Size != objectSize ||
+		cp.ObjStat.LastModified != meta.Get(HTTPHeaderLastModified) ||
+		cp.ObjStat.Etag != meta.Get(HTTPHeaderEtag) {
+		return false, nil
+	}
+
+	return true, nil
+}
+
+// load loads from the checkpoint file
+func (cp *copyCheckpoint) load(filePath string) error {
+	contents, err := ioutil.ReadFile(filePath)
+	if err != nil {
+		return err
+	}
+
+	err = json.Unmarshal(contents, cp)
+	return err
+}
+
+// update updates the parts status
+func (cp *copyCheckpoint) update(part UploadPart) {
+	cp.CopyParts[part.PartNumber-1] = part
+	cp.PartStat[part.PartNumber-1] = true
+}
+
+// dump dumps the CP to the file
+func (cp *copyCheckpoint) dump(filePath string) error {
+	bcp := *cp
+
+	// Calculate MD5
+	bcp.MD5 = ""
+	js, err := json.Marshal(bcp)
+	if err != nil {
+		return err
+	}
+	sum := md5.Sum(js)
+	b64 := base64.StdEncoding.EncodeToString(sum[:])
+	bcp.MD5 = b64
+
+	// Serialization
+	js, err = json.Marshal(bcp)
+	if err != nil {
+		return err
+	}
+
+	// Dump
+	return ioutil.WriteFile(filePath, js, FilePermMode)
+}
+
+// todoParts returns unfinished parts
+func (cp copyCheckpoint) todoParts() []copyPart {
+	dps := []copyPart{}
+	for i, ps := range cp.PartStat {
+		if !ps {
+			dps = append(dps, cp.Parts[i])
+		}
+	}
+	return dps
+}
+
+// getCompletedBytes returns finished bytes count
+func (cp copyCheckpoint) getCompletedBytes() int64 {
+	var completedBytes int64
+	for i, part := range cp.Parts {
+		if cp.PartStat[i] {
+			completedBytes += (part.End - part.Start + 1)
+		}
+	}
+	return completedBytes
+}
+
+// prepare initializes the multipart upload
+func (cp *copyCheckpoint) prepare(meta http.Header, srcBucket *Bucket, srcObjectKey string, destBucket *Bucket, destObjectKey string,
+	partSize int64, options []Option) error {
+	// CP
+	cp.Magic = copyCpMagic
+	cp.SrcBucketName = srcBucket.BucketName
+	cp.SrcObjectKey = srcObjectKey
+	cp.DestBucketName = destBucket.BucketName
+	cp.DestObjectKey = destObjectKey
+
+	objectSize, err := strconv.ParseInt(meta.Get(HTTPHeaderContentLength), 10, 0)
+	if err != nil {
+		return err
+	}
+
+	cp.ObjStat.Size = objectSize
+	cp.ObjStat.LastModified = meta.Get(HTTPHeaderLastModified)
+	cp.ObjStat.Etag = meta.Get(HTTPHeaderEtag)
+
+	// Parts
+	cp.Parts = getCopyParts(objectSize, partSize)
+	cp.PartStat = make([]bool, len(cp.Parts))
+	for i := range cp.PartStat {
+		cp.PartStat[i] = false
+	}
+	cp.CopyParts = make([]UploadPart, len(cp.Parts))
+
+	// Init copy
+	imur, err := destBucket.InitiateMultipartUpload(destObjectKey, options...)
+	if err != nil {
+		return err
+	}
+	cp.CopyID = imur.UploadID
+
+	return nil
+}
+
+func (cp *copyCheckpoint) complete(bucket *Bucket, parts []UploadPart, cpFilePath string, options []Option) error {
+	imur := InitiateMultipartUploadResult{Bucket: cp.DestBucketName,
+		Key: cp.DestObjectKey, UploadID: cp.CopyID}
+	_, err := bucket.CompleteMultipartUpload(imur, parts, options...)
+	if err != nil {
+		return err
+	}
+	os.Remove(cpFilePath)
+	return err
+}
+
+// copyFileWithCp is concurrently copy with checkpoint
+func (bucket Bucket) copyFileWithCp(srcBucketName, srcObjectKey, destBucketName, destObjectKey string,
+	partSize int64, options []Option, cpFilePath string, routines int) error {
+	descBucket, err := bucket.Client.Bucket(destBucketName)
+	srcBucket, err := bucket.Client.Bucket(srcBucketName)
+	listener := getProgressListener(options)
+
+	payerOptions := []Option{}
+	payer := getPayer(options)
+	if payer != "" {
+		payerOptions = append(payerOptions, RequestPayer(PayerType(payer)))
+	}
+
+	// Load CP data
+	ccp := copyCheckpoint{}
+	err = ccp.load(cpFilePath)
+	if err != nil {
+		os.Remove(cpFilePath)
+	}
+
+	// Make sure the object is not updated.
+	meta, err := srcBucket.GetObjectDetailedMeta(srcObjectKey, payerOptions...)
+	if err != nil {
+		return err
+	}
+
+	// Load error or the CP data is invalid---reinitialize
+	valid, err := ccp.isValid(meta)
+	if err != nil || !valid {
+		if err = ccp.prepare(meta, srcBucket, srcObjectKey, descBucket, destObjectKey, partSize, options); err != nil {
+			return err
+		}
+		os.Remove(cpFilePath)
+	}
+
+	// Unfinished parts
+	parts := ccp.todoParts()
+	imur := InitiateMultipartUploadResult{
+		Bucket:   destBucketName,
+		Key:      destObjectKey,
+		UploadID: ccp.CopyID}
+
+	jobs := make(chan copyPart, len(parts))
+	results := make(chan UploadPart, len(parts))
+	failed := make(chan error)
+	die := make(chan bool)
+
+	completedBytes := ccp.getCompletedBytes()
+	event := newProgressEvent(TransferStartedEvent, completedBytes, ccp.ObjStat.Size)
+	publishProgress(listener, event)
+
+	// Start the worker coroutines
+	arg := copyWorkerArg{descBucket, imur, srcBucketName, srcObjectKey, payerOptions, copyPartHooker}
+	for w := 1; w <= routines; w++ {
+		go copyWorker(w, arg, jobs, results, failed, die)
+	}
+
+	// Start the scheduler
+	go copyScheduler(jobs, parts)
+
+	// Wait for the parts completed.
+	completed := 0
+	for completed < len(parts) {
+		select {
+		case part := <-results:
+			completed++
+			ccp.update(part)
+			ccp.dump(cpFilePath)
+			completedBytes += (parts[part.PartNumber-1].End - parts[part.PartNumber-1].Start + 1)
+			event = newProgressEvent(TransferDataEvent, completedBytes, ccp.ObjStat.Size)
+			publishProgress(listener, event)
+		case err := <-failed:
+			close(die)
+			event = newProgressEvent(TransferFailedEvent, completedBytes, ccp.ObjStat.Size)
+			publishProgress(listener, event)
+			return err
+		}
+
+		if completed >= len(parts) {
+			break
+		}
+	}
+
+	event = newProgressEvent(TransferCompletedEvent, completedBytes, ccp.ObjStat.Size)
+	publishProgress(listener, event)
+
+	return ccp.complete(descBucket, ccp.CopyParts, cpFilePath, payerOptions)
+}

+ 290 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/multipart.go

@@ -0,0 +1,290 @@
+package oss
+
+import (
+	"bytes"
+	"encoding/xml"
+	"io"
+	"net/http"
+	"net/url"
+	"os"
+	"sort"
+	"strconv"
+)
+
+// InitiateMultipartUpload initializes multipart upload
+//
+// objectKey    object name
+// options    the object constricts for upload. The valid options are CacheControl, ContentDisposition, ContentEncoding, Expires,
+//            ServerSideEncryption, Meta, check out the following link:
+//            https://help.aliyun.com/document_detail/oss/api-reference/multipart-upload/InitiateMultipartUpload.html
+//
+// InitiateMultipartUploadResult    the return value of the InitiateMultipartUpload, which is used for calls later on such as UploadPartFromFile,UploadPartCopy.
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) InitiateMultipartUpload(objectKey string, options ...Option) (InitiateMultipartUploadResult, error) {
+	var imur InitiateMultipartUploadResult
+	opts := addContentType(options, objectKey)
+	params := map[string]interface{}{}
+	params["uploads"] = nil
+	resp, err := bucket.do("POST", objectKey, params, opts, nil, nil)
+	if err != nil {
+		return imur, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &imur)
+	return imur, err
+}
+
+// UploadPart uploads parts
+//
+// After initializing a Multipart Upload, the upload Id and object key could be used for uploading the parts.
+// Each part has its part number (ranges from 1 to 10,000). And for each upload Id, the part number identifies the position of the part in the whole file.
+// And thus with the same part number and upload Id, another part upload will overwrite the data.
+// Except the last one, minimal part size is 100KB. There's no limit on the last part size.
+//
+// imur    the returned value of InitiateMultipartUpload.
+// reader    io.Reader the reader for the part's data.
+// size    the part size.
+// partNumber    the part number (ranges from 1 to 10,000). Invalid part number will lead to InvalidArgument error.
+//
+// UploadPart    the return value of the upload part. It consists of PartNumber and ETag. It's valid when error is nil.
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) UploadPart(imur InitiateMultipartUploadResult, reader io.Reader,
+	partSize int64, partNumber int, options ...Option) (UploadPart, error) {
+	request := &UploadPartRequest{
+		InitResult: &imur,
+		Reader:     reader,
+		PartSize:   partSize,
+		PartNumber: partNumber,
+	}
+
+	result, err := bucket.DoUploadPart(request, options)
+
+	return result.Part, err
+}
+
+// UploadPartFromFile uploads part from the file.
+//
+// imur    the return value of a successful InitiateMultipartUpload.
+// filePath    the local file path to upload.
+// startPosition    the start position in the local file.
+// partSize    the part size.
+// partNumber    the part number (from 1 to 10,000)
+//
+// UploadPart    the return value consists of PartNumber and ETag.
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) UploadPartFromFile(imur InitiateMultipartUploadResult, filePath string,
+	startPosition, partSize int64, partNumber int, options ...Option) (UploadPart, error) {
+	var part = UploadPart{}
+	fd, err := os.Open(filePath)
+	if err != nil {
+		return part, err
+	}
+	defer fd.Close()
+	fd.Seek(startPosition, os.SEEK_SET)
+
+	request := &UploadPartRequest{
+		InitResult: &imur,
+		Reader:     fd,
+		PartSize:   partSize,
+		PartNumber: partNumber,
+	}
+
+	result, err := bucket.DoUploadPart(request, options)
+
+	return result.Part, err
+}
+
+// DoUploadPart does the actual part upload.
+//
+// request    part upload request
+//
+// UploadPartResult    the result of uploading part.
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) DoUploadPart(request *UploadPartRequest, options []Option) (*UploadPartResult, error) {
+	listener := getProgressListener(options)
+	options = append(options, ContentLength(request.PartSize))
+	params := map[string]interface{}{}
+	params["partNumber"] = strconv.Itoa(request.PartNumber)
+	params["uploadId"] = request.InitResult.UploadID
+	resp, err := bucket.do("PUT", request.InitResult.Key, params, options,
+		&io.LimitedReader{R: request.Reader, N: request.PartSize}, listener)
+	if err != nil {
+		return &UploadPartResult{}, err
+	}
+	defer resp.Body.Close()
+
+	part := UploadPart{
+		ETag:       resp.Headers.Get(HTTPHeaderEtag),
+		PartNumber: request.PartNumber,
+	}
+
+	if bucket.getConfig().IsEnableCRC {
+		err = checkCRC(resp, "DoUploadPart")
+		if err != nil {
+			return &UploadPartResult{part}, err
+		}
+	}
+
+	return &UploadPartResult{part}, nil
+}
+
+// UploadPartCopy uploads part copy
+//
+// imur    the return value of InitiateMultipartUpload
+// copySrc    source Object name
+// startPosition    the part's start index in the source file
+// partSize    the part size
+// partNumber    the part number, ranges from 1 to 10,000. If it exceeds the range OSS returns InvalidArgument error.
+// options    the constraints of source object for the copy. The copy happens only when these contraints are met. Otherwise it returns error.
+//            CopySourceIfNoneMatch, CopySourceIfModifiedSince  CopySourceIfUnmodifiedSince, check out the following link for the detail
+//            https://help.aliyun.com/document_detail/oss/api-reference/multipart-upload/UploadPartCopy.html
+//
+// UploadPart    the return value consists of PartNumber and ETag.
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) UploadPartCopy(imur InitiateMultipartUploadResult, srcBucketName, srcObjectKey string,
+	startPosition, partSize int64, partNumber int, options ...Option) (UploadPart, error) {
+	var out UploadPartCopyResult
+	var part UploadPart
+
+	opts := []Option{CopySource(srcBucketName, url.QueryEscape(srcObjectKey)),
+		CopySourceRange(startPosition, partSize)}
+	opts = append(opts, options...)
+	params := map[string]interface{}{}
+	params["partNumber"] = strconv.Itoa(partNumber)
+	params["uploadId"] = imur.UploadID
+	resp, err := bucket.do("PUT", imur.Key, params, opts, nil, nil)
+	if err != nil {
+		return part, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	if err != nil {
+		return part, err
+	}
+	part.ETag = out.ETag
+	part.PartNumber = partNumber
+
+	return part, nil
+}
+
+// CompleteMultipartUpload completes the multipart upload.
+//
+// imur    the return value of InitiateMultipartUpload.
+// parts    the array of return value of UploadPart/UploadPartFromFile/UploadPartCopy.
+//
+// CompleteMultipartUploadResponse    the return value when the call succeeds. Only valid when the error is nil.
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) CompleteMultipartUpload(imur InitiateMultipartUploadResult,
+	parts []UploadPart, options ...Option) (CompleteMultipartUploadResult, error) {
+	var out CompleteMultipartUploadResult
+
+	sort.Sort(uploadParts(parts))
+	cxml := completeMultipartUploadXML{}
+	cxml.Part = parts
+	bs, err := xml.Marshal(cxml)
+	if err != nil {
+		return out, err
+	}
+	buffer := new(bytes.Buffer)
+	buffer.Write(bs)
+
+	params := map[string]interface{}{}
+	params["uploadId"] = imur.UploadID
+	resp, err := bucket.do("POST", imur.Key, params, options, buffer, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	return out, err
+}
+
+// AbortMultipartUpload aborts the multipart upload.
+//
+// imur    the return value of InitiateMultipartUpload.
+//
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) AbortMultipartUpload(imur InitiateMultipartUploadResult, options ...Option) error {
+	params := map[string]interface{}{}
+	params["uploadId"] = imur.UploadID
+	resp, err := bucket.do("DELETE", imur.Key, params, options, nil, nil)
+	if err != nil {
+		return err
+	}
+	defer resp.Body.Close()
+	return checkRespCode(resp.StatusCode, []int{http.StatusNoContent})
+}
+
+// ListUploadedParts lists the uploaded parts.
+//
+// imur    the return value of InitiateMultipartUpload.
+//
+// ListUploadedPartsResponse    the return value if it succeeds, only valid when error is nil.
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) ListUploadedParts(imur InitiateMultipartUploadResult, options ...Option) (ListUploadedPartsResult, error) {
+	var out ListUploadedPartsResult
+	options = append(options, EncodingType("url"))
+
+	params := map[string]interface{}{}
+	params, err := getRawParams(options)
+	if err != nil {
+		return out, err
+	}
+
+	params["uploadId"] = imur.UploadID
+	resp, err := bucket.do("GET", imur.Key, params, nil, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	if err != nil {
+		return out, err
+	}
+	err = decodeListUploadedPartsResult(&out)
+	return out, err
+}
+
+// ListMultipartUploads lists all ongoing multipart upload tasks
+//
+// options    listObject's filter. Prefix specifies the returned object's prefix; KeyMarker specifies the returned object's start point in lexicographic order;
+//            MaxKeys specifies the max entries to return; Delimiter is the character for grouping object keys.
+//
+// ListMultipartUploadResponse    the return value if it succeeds, only valid when error is nil.
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) ListMultipartUploads(options ...Option) (ListMultipartUploadResult, error) {
+	var out ListMultipartUploadResult
+
+	options = append(options, EncodingType("url"))
+	params, err := getRawParams(options)
+	if err != nil {
+		return out, err
+	}
+	params["uploads"] = nil
+
+	resp, err := bucket.do("GET", "", params, options, nil, nil)
+	if err != nil {
+		return out, err
+	}
+	defer resp.Body.Close()
+
+	err = xmlUnmarshal(resp.Body, &out)
+	if err != nil {
+		return out, err
+	}
+	err = decodeListMultipartUploadResult(&out)
+	return out, err
+}

+ 433 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/option.go

@@ -0,0 +1,433 @@
+package oss
+
+import (
+	"fmt"
+	"net/http"
+	"strconv"
+	"strings"
+	"time"
+)
+
+type optionType string
+
+const (
+	optionParam optionType = "HTTPParameter" // URL parameter
+	optionHTTP  optionType = "HTTPHeader"    // HTTP header
+	optionArg   optionType = "FuncArgument"  // Function argument
+)
+
+const (
+	deleteObjectsQuiet = "delete-objects-quiet"
+	routineNum         = "x-routine-num"
+	checkpointConfig   = "x-cp-config"
+	initCRC64          = "init-crc64"
+	progressListener   = "x-progress-listener"
+	storageClass       = "storage-class"
+)
+
+type (
+	optionValue struct {
+		Value interface{}
+		Type  optionType
+	}
+
+	// Option HTTP option
+	Option func(map[string]optionValue) error
+)
+
+// ACL is an option to set X-Oss-Acl header
+func ACL(acl ACLType) Option {
+	return setHeader(HTTPHeaderOssACL, string(acl))
+}
+
+// ContentType is an option to set Content-Type header
+func ContentType(value string) Option {
+	return setHeader(HTTPHeaderContentType, value)
+}
+
+// ContentLength is an option to set Content-Length header
+func ContentLength(length int64) Option {
+	return setHeader(HTTPHeaderContentLength, strconv.FormatInt(length, 10))
+}
+
+// CacheControl is an option to set Cache-Control header
+func CacheControl(value string) Option {
+	return setHeader(HTTPHeaderCacheControl, value)
+}
+
+// ContentDisposition is an option to set Content-Disposition header
+func ContentDisposition(value string) Option {
+	return setHeader(HTTPHeaderContentDisposition, value)
+}
+
+// ContentEncoding is an option to set Content-Encoding header
+func ContentEncoding(value string) Option {
+	return setHeader(HTTPHeaderContentEncoding, value)
+}
+
+// ContentLanguage is an option to set Content-Language header
+func ContentLanguage(value string) Option {
+	return setHeader(HTTPHeaderContentLanguage, value)
+}
+
+// ContentMD5 is an option to set Content-MD5 header
+func ContentMD5(value string) Option {
+	return setHeader(HTTPHeaderContentMD5, value)
+}
+
+// Expires is an option to set Expires header
+func Expires(t time.Time) Option {
+	return setHeader(HTTPHeaderExpires, t.Format(http.TimeFormat))
+}
+
+// Meta is an option to set Meta header
+func Meta(key, value string) Option {
+	return setHeader(HTTPHeaderOssMetaPrefix+key, value)
+}
+
+// Range is an option to set Range header, [start, end]
+func Range(start, end int64) Option {
+	return setHeader(HTTPHeaderRange, fmt.Sprintf("bytes=%d-%d", start, end))
+}
+
+// NormalizedRange is an option to set Range header, such as 1024-2048 or 1024- or -2048
+func NormalizedRange(nr string) Option {
+	return setHeader(HTTPHeaderRange, fmt.Sprintf("bytes=%s", strings.TrimSpace(nr)))
+}
+
+// AcceptEncoding is an option to set Accept-Encoding header
+func AcceptEncoding(value string) Option {
+	return setHeader(HTTPHeaderAcceptEncoding, value)
+}
+
+// IfModifiedSince is an option to set If-Modified-Since header
+func IfModifiedSince(t time.Time) Option {
+	return setHeader(HTTPHeaderIfModifiedSince, t.Format(http.TimeFormat))
+}
+
+// IfUnmodifiedSince is an option to set If-Unmodified-Since header
+func IfUnmodifiedSince(t time.Time) Option {
+	return setHeader(HTTPHeaderIfUnmodifiedSince, t.Format(http.TimeFormat))
+}
+
+// IfMatch is an option to set If-Match header
+func IfMatch(value string) Option {
+	return setHeader(HTTPHeaderIfMatch, value)
+}
+
+// IfNoneMatch is an option to set IfNoneMatch header
+func IfNoneMatch(value string) Option {
+	return setHeader(HTTPHeaderIfNoneMatch, value)
+}
+
+// CopySource is an option to set X-Oss-Copy-Source header
+func CopySource(sourceBucket, sourceObject string) Option {
+	return setHeader(HTTPHeaderOssCopySource, "/"+sourceBucket+"/"+sourceObject)
+}
+
+// CopySourceRange is an option to set X-Oss-Copy-Source header
+func CopySourceRange(startPosition, partSize int64) Option {
+	val := "bytes=" + strconv.FormatInt(startPosition, 10) + "-" +
+		strconv.FormatInt((startPosition+partSize-1), 10)
+	return setHeader(HTTPHeaderOssCopySourceRange, val)
+}
+
+// CopySourceIfMatch is an option to set X-Oss-Copy-Source-If-Match header
+func CopySourceIfMatch(value string) Option {
+	return setHeader(HTTPHeaderOssCopySourceIfMatch, value)
+}
+
+// CopySourceIfNoneMatch is an option to set X-Oss-Copy-Source-If-None-Match header
+func CopySourceIfNoneMatch(value string) Option {
+	return setHeader(HTTPHeaderOssCopySourceIfNoneMatch, value)
+}
+
+// CopySourceIfModifiedSince is an option to set X-Oss-CopySource-If-Modified-Since header
+func CopySourceIfModifiedSince(t time.Time) Option {
+	return setHeader(HTTPHeaderOssCopySourceIfModifiedSince, t.Format(http.TimeFormat))
+}
+
+// CopySourceIfUnmodifiedSince is an option to set X-Oss-Copy-Source-If-Unmodified-Since header
+func CopySourceIfUnmodifiedSince(t time.Time) Option {
+	return setHeader(HTTPHeaderOssCopySourceIfUnmodifiedSince, t.Format(http.TimeFormat))
+}
+
+// MetadataDirective is an option to set X-Oss-Metadata-Directive header
+func MetadataDirective(directive MetadataDirectiveType) Option {
+	return setHeader(HTTPHeaderOssMetadataDirective, string(directive))
+}
+
+// ServerSideEncryption is an option to set X-Oss-Server-Side-Encryption header
+func ServerSideEncryption(value string) Option {
+	return setHeader(HTTPHeaderOssServerSideEncryption, value)
+}
+
+// ServerSideEncryptionKeyID is an option to set X-Oss-Server-Side-Encryption-Key-Id header
+func ServerSideEncryptionKeyID(value string) Option {
+	return setHeader(HTTPHeaderOssServerSideEncryptionKeyID, value)
+}
+
+// ObjectACL is an option to set X-Oss-Object-Acl header
+func ObjectACL(acl ACLType) Option {
+	return setHeader(HTTPHeaderOssObjectACL, string(acl))
+}
+
+// symlinkTarget is an option to set X-Oss-Symlink-Target
+func symlinkTarget(targetObjectKey string) Option {
+	return setHeader(HTTPHeaderOssSymlinkTarget, targetObjectKey)
+}
+
+// Origin is an option to set Origin header
+func Origin(value string) Option {
+	return setHeader(HTTPHeaderOrigin, value)
+}
+
+// ObjectStorageClass is an option to set the storage class of object
+func ObjectStorageClass(storageClass StorageClassType) Option {
+	return setHeader(HTTPHeaderOssStorageClass, string(storageClass))
+}
+
+// Callback is an option to set callback values
+func Callback(callback string) Option {
+	return setHeader(HTTPHeaderOssCallback, callback)
+}
+
+// CallbackVar is an option to set callback user defined values
+func CallbackVar(callbackVar string) Option {
+	return setHeader(HTTPHeaderOssCallbackVar, callbackVar)
+}
+
+// RequestPayer is an option to set payer who pay for the request
+func RequestPayer(payerType PayerType) Option {
+	return setHeader(HTTPHeaderOSSRequester, string(payerType))
+}
+
+// Delimiter is an option to set delimiler parameter
+func Delimiter(value string) Option {
+	return addParam("delimiter", value)
+}
+
+// Marker is an option to set marker parameter
+func Marker(value string) Option {
+	return addParam("marker", value)
+}
+
+// MaxKeys is an option to set maxkeys parameter
+func MaxKeys(value int) Option {
+	return addParam("max-keys", strconv.Itoa(value))
+}
+
+// Prefix is an option to set prefix parameter
+func Prefix(value string) Option {
+	return addParam("prefix", value)
+}
+
+// EncodingType is an option to set encoding-type parameter
+func EncodingType(value string) Option {
+	return addParam("encoding-type", value)
+}
+
+// MaxUploads is an option to set max-uploads parameter
+func MaxUploads(value int) Option {
+	return addParam("max-uploads", strconv.Itoa(value))
+}
+
+// KeyMarker is an option to set key-marker parameter
+func KeyMarker(value string) Option {
+	return addParam("key-marker", value)
+}
+
+// UploadIDMarker is an option to set upload-id-marker parameter
+func UploadIDMarker(value string) Option {
+	return addParam("upload-id-marker", value)
+}
+
+// MaxParts is an option to set max-parts parameter
+func MaxParts(value int) Option {
+	return addParam("max-parts", strconv.Itoa(value))
+}
+
+// PartNumberMarker is an option to set part-number-marker parameter
+func PartNumberMarker(value int) Option {
+	return addParam("part-number-marker", strconv.Itoa(value))
+}
+
+// DeleteObjectsQuiet false:DeleteObjects in verbose mode; true:DeleteObjects in quite mode. Default is false.
+func DeleteObjectsQuiet(isQuiet bool) Option {
+	return addArg(deleteObjectsQuiet, isQuiet)
+}
+
+// StorageClass bucket storage class
+func StorageClass(value StorageClassType) Option {
+	return addArg(storageClass, value)
+}
+
+// Checkpoint configuration
+type cpConfig struct {
+	IsEnable bool
+	FilePath string
+	DirPath  string
+}
+
+// Checkpoint sets the isEnable flag and checkpoint file path for DownloadFile/UploadFile.
+func Checkpoint(isEnable bool, filePath string) Option {
+	return addArg(checkpointConfig, &cpConfig{IsEnable: isEnable, FilePath: filePath})
+}
+
+// CheckpointDir sets the isEnable flag and checkpoint dir path for DownloadFile/UploadFile.
+func CheckpointDir(isEnable bool, dirPath string) Option {
+	return addArg(checkpointConfig, &cpConfig{IsEnable: isEnable, DirPath: dirPath})
+}
+
+// Routines DownloadFile/UploadFile routine count
+func Routines(n int) Option {
+	return addArg(routineNum, n)
+}
+
+// InitCRC Init AppendObject CRC
+func InitCRC(initCRC uint64) Option {
+	return addArg(initCRC64, initCRC)
+}
+
+// Progress set progress listener
+func Progress(listener ProgressListener) Option {
+	return addArg(progressListener, listener)
+}
+
+// ResponseContentType is an option to set response-content-type param
+func ResponseContentType(value string) Option {
+	return addParam("response-content-type", value)
+}
+
+// ResponseContentLanguage is an option to set response-content-language param
+func ResponseContentLanguage(value string) Option {
+	return addParam("response-content-language", value)
+}
+
+// ResponseExpires is an option to set response-expires param
+func ResponseExpires(value string) Option {
+	return addParam("response-expires", value)
+}
+
+// ResponseCacheControl is an option to set response-cache-control param
+func ResponseCacheControl(value string) Option {
+	return addParam("response-cache-control", value)
+}
+
+// ResponseContentDisposition is an option to set response-content-disposition param
+func ResponseContentDisposition(value string) Option {
+	return addParam("response-content-disposition", value)
+}
+
+// ResponseContentEncoding is an option to set response-content-encoding param
+func ResponseContentEncoding(value string) Option {
+	return addParam("response-content-encoding", value)
+}
+
+// Process is an option to set x-oss-process param
+func Process(value string) Option {
+	return addParam("x-oss-process", value)
+}
+
+func setHeader(key string, value interface{}) Option {
+	return func(params map[string]optionValue) error {
+		if value == nil {
+			return nil
+		}
+		params[key] = optionValue{value, optionHTTP}
+		return nil
+	}
+}
+
+func addParam(key string, value interface{}) Option {
+	return func(params map[string]optionValue) error {
+		if value == nil {
+			return nil
+		}
+		params[key] = optionValue{value, optionParam}
+		return nil
+	}
+}
+
+func addArg(key string, value interface{}) Option {
+	return func(params map[string]optionValue) error {
+		if value == nil {
+			return nil
+		}
+		params[key] = optionValue{value, optionArg}
+		return nil
+	}
+}
+
+func handleOptions(headers map[string]string, options []Option) error {
+	params := map[string]optionValue{}
+	for _, option := range options {
+		if option != nil {
+			if err := option(params); err != nil {
+				return err
+			}
+		}
+	}
+
+	for k, v := range params {
+		if v.Type == optionHTTP {
+			headers[k] = v.Value.(string)
+		}
+	}
+	return nil
+}
+
+func getRawParams(options []Option) (map[string]interface{}, error) {
+	// Option
+	params := map[string]optionValue{}
+	for _, option := range options {
+		if option != nil {
+			if err := option(params); err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	paramsm := map[string]interface{}{}
+	// Serialize
+	for k, v := range params {
+		if v.Type == optionParam {
+			vs := params[k]
+			paramsm[k] = vs.Value.(string)
+		}
+	}
+
+	return paramsm, nil
+}
+
+func findOption(options []Option, param string, defaultVal interface{}) (interface{}, error) {
+	params := map[string]optionValue{}
+	for _, option := range options {
+		if option != nil {
+			if err := option(params); err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	if val, ok := params[param]; ok {
+		return val.Value, nil
+	}
+	return defaultVal, nil
+}
+
+func isOptionSet(options []Option, option string) (bool, interface{}, error) {
+	params := map[string]optionValue{}
+	for _, option := range options {
+		if option != nil {
+			if err := option(params); err != nil {
+				return false, nil, err
+			}
+		}
+	}
+
+	if val, ok := params[option]; ok {
+		return true, val.Value, nil
+	}
+	return false, nil, nil
+}

+ 112 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/progress.go

@@ -0,0 +1,112 @@
+package oss
+
+import "io"
+
+// ProgressEventType defines transfer progress event type
+type ProgressEventType int
+
+const (
+	// TransferStartedEvent transfer started, set TotalBytes
+	TransferStartedEvent ProgressEventType = 1 + iota
+	// TransferDataEvent transfer data, set ConsumedBytes anmd TotalBytes
+	TransferDataEvent
+	// TransferCompletedEvent transfer completed
+	TransferCompletedEvent
+	// TransferFailedEvent transfer encounters an error
+	TransferFailedEvent
+)
+
+// ProgressEvent defines progress event
+type ProgressEvent struct {
+	ConsumedBytes int64
+	TotalBytes    int64
+	EventType     ProgressEventType
+}
+
+// ProgressListener listens progress change
+type ProgressListener interface {
+	ProgressChanged(event *ProgressEvent)
+}
+
+// -------------------- Private --------------------
+
+func newProgressEvent(eventType ProgressEventType, consumed, total int64) *ProgressEvent {
+	return &ProgressEvent{
+		ConsumedBytes: consumed,
+		TotalBytes:    total,
+		EventType:     eventType}
+}
+
+// publishProgress
+func publishProgress(listener ProgressListener, event *ProgressEvent) {
+	if listener != nil && event != nil {
+		listener.ProgressChanged(event)
+	}
+}
+
+type readerTracker struct {
+	completedBytes int64
+}
+
+type teeReader struct {
+	reader        io.Reader
+	writer        io.Writer
+	listener      ProgressListener
+	consumedBytes int64
+	totalBytes    int64
+	tracker       *readerTracker
+}
+
+// TeeReader returns a Reader that writes to w what it reads from r.
+// All reads from r performed through it are matched with
+// corresponding writes to w.  There is no internal buffering -
+// the write must complete before the read completes.
+// Any error encountered while writing is reported as a read error.
+func TeeReader(reader io.Reader, writer io.Writer, totalBytes int64, listener ProgressListener, tracker *readerTracker) io.ReadCloser {
+	return &teeReader{
+		reader:        reader,
+		writer:        writer,
+		listener:      listener,
+		consumedBytes: 0,
+		totalBytes:    totalBytes,
+		tracker:       tracker,
+	}
+}
+
+func (t *teeReader) Read(p []byte) (n int, err error) {
+	n, err = t.reader.Read(p)
+
+	// Read encountered error
+	if err != nil && err != io.EOF {
+		event := newProgressEvent(TransferFailedEvent, t.consumedBytes, t.totalBytes)
+		publishProgress(t.listener, event)
+	}
+
+	if n > 0 {
+		t.consumedBytes += int64(n)
+		// CRC
+		if t.writer != nil {
+			if n, err := t.writer.Write(p[:n]); err != nil {
+				return n, err
+			}
+		}
+		// Progress
+		if t.listener != nil {
+			event := newProgressEvent(TransferDataEvent, t.consumedBytes, t.totalBytes)
+			publishProgress(t.listener, event)
+		}
+		// Track
+		if t.tracker != nil {
+			t.tracker.completedBytes = t.consumedBytes
+		}
+	}
+
+	return
+}
+
+func (t *teeReader) Close() error {
+	if rc, ok := t.reader.(io.ReadCloser); ok {
+		return rc.Close()
+	}
+	return nil
+}

+ 26 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/transport_1_6.go

@@ -0,0 +1,26 @@
+// +build !go1.7
+
+package oss
+
+import (
+	"net"
+	"net/http"
+)
+
+func newTransport(conn *Conn, config *Config) *http.Transport {
+	httpTimeOut := conn.config.HTTPTimeout
+	httpMaxConns := conn.config.HTTPMaxConns
+	// New Transport
+	transport := &http.Transport{
+		Dial: func(netw, addr string) (net.Conn, error) {
+			conn, err := net.DialTimeout(netw, addr, httpTimeOut.ConnectTimeout)
+			if err != nil {
+				return nil, err
+			}
+			return newTimeoutConn(conn, httpTimeOut.ReadWriteTimeout, httpTimeOut.LongTimeout), nil
+		},
+		MaxIdleConnsPerHost:   httpMaxConns.MaxIdleConnsPerHost,
+		ResponseHeaderTimeout: httpTimeOut.HeaderTimeout,
+	}
+	return transport
+}

+ 28 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/transport_1_7.go

@@ -0,0 +1,28 @@
+// +build go1.7
+
+package oss
+
+import (
+	"net"
+	"net/http"
+)
+
+func newTransport(conn *Conn, config *Config) *http.Transport {
+	httpTimeOut := conn.config.HTTPTimeout
+	httpMaxConns := conn.config.HTTPMaxConns
+	// New Transport
+	transport := &http.Transport{
+		Dial: func(netw, addr string) (net.Conn, error) {
+			conn, err := net.DialTimeout(netw, addr, httpTimeOut.ConnectTimeout)
+			if err != nil {
+				return nil, err
+			}
+			return newTimeoutConn(conn, httpTimeOut.ReadWriteTimeout, httpTimeOut.LongTimeout), nil
+		},
+		MaxIdleConns:          httpMaxConns.MaxIdleConns,
+		MaxIdleConnsPerHost:   httpMaxConns.MaxIdleConnsPerHost,
+		IdleConnTimeout:       httpTimeOut.IdleConnTimeout,
+		ResponseHeaderTimeout: httpTimeOut.HeaderTimeout,
+	}
+	return transport
+}

+ 566 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/type.go

@@ -0,0 +1,566 @@
+package oss
+
+import (
+	"encoding/xml"
+	"net/url"
+	"time"
+)
+
+// ListBucketsResult defines the result object from ListBuckets request
+type ListBucketsResult struct {
+	XMLName     xml.Name           `xml:"ListAllMyBucketsResult"`
+	Prefix      string             `xml:"Prefix"`         // The prefix in this query
+	Marker      string             `xml:"Marker"`         // The marker filter
+	MaxKeys     int                `xml:"MaxKeys"`        // The max entry count to return. This information is returned when IsTruncated is true.
+	IsTruncated bool               `xml:"IsTruncated"`    // Flag true means there's remaining buckets to return.
+	NextMarker  string             `xml:"NextMarker"`     // The marker filter for the next list call
+	Owner       Owner              `xml:"Owner"`          // The owner information
+	Buckets     []BucketProperties `xml:"Buckets>Bucket"` // The bucket list
+}
+
+// BucketProperties defines bucket properties
+type BucketProperties struct {
+	XMLName      xml.Name  `xml:"Bucket"`
+	Name         string    `xml:"Name"`         // Bucket name
+	Location     string    `xml:"Location"`     // Bucket datacenter
+	CreationDate time.Time `xml:"CreationDate"` // Bucket create time
+	StorageClass string    `xml:"StorageClass"` // Bucket storage class
+}
+
+// GetBucketACLResult defines GetBucketACL request's result
+type GetBucketACLResult struct {
+	XMLName xml.Name `xml:"AccessControlPolicy"`
+	ACL     string   `xml:"AccessControlList>Grant"` // Bucket ACL
+	Owner   Owner    `xml:"Owner"`                   // Bucket owner
+}
+
+// LifecycleConfiguration is the Bucket Lifecycle configuration
+type LifecycleConfiguration struct {
+	XMLName xml.Name        `xml:"LifecycleConfiguration"`
+	Rules   []LifecycleRule `xml:"Rule"`
+}
+
+// LifecycleRule defines Lifecycle rules
+type LifecycleRule struct {
+	XMLName    xml.Name            `xml:"Rule"`
+	ID         string              `xml:"ID"`         // The rule ID
+	Prefix     string              `xml:"Prefix"`     // The object key prefix
+	Status     string              `xml:"Status"`     // The rule status (enabled or not)
+	Expiration LifecycleExpiration `xml:"Expiration"` // The expiration property
+}
+
+// LifecycleExpiration defines the rule's expiration property
+type LifecycleExpiration struct {
+	XMLName xml.Name  `xml:"Expiration"`
+	Days    int       `xml:"Days,omitempty"` // Relative expiration time: The expiration time in days after the last modified time
+	Date    time.Time `xml:"Date,omitempty"` // Absolute expiration time: The expiration time in date.
+}
+
+type lifecycleXML struct {
+	XMLName xml.Name        `xml:"LifecycleConfiguration"`
+	Rules   []lifecycleRule `xml:"Rule"`
+}
+
+type lifecycleRule struct {
+	XMLName    xml.Name            `xml:"Rule"`
+	ID         string              `xml:"ID"`
+	Prefix     string              `xml:"Prefix"`
+	Status     string              `xml:"Status"`
+	Expiration lifecycleExpiration `xml:"Expiration"`
+}
+
+type lifecycleExpiration struct {
+	XMLName xml.Name `xml:"Expiration"`
+	Days    int      `xml:"Days,omitempty"`
+	Date    string   `xml:"Date,omitempty"`
+}
+
+const expirationDateFormat = "2006-01-02T15:04:05.000Z"
+
+func convLifecycleRule(rules []LifecycleRule) []lifecycleRule {
+	rs := []lifecycleRule{}
+	for _, rule := range rules {
+		r := lifecycleRule{}
+		r.ID = rule.ID
+		r.Prefix = rule.Prefix
+		r.Status = rule.Status
+		if rule.Expiration.Date.IsZero() {
+			r.Expiration.Days = rule.Expiration.Days
+		} else {
+			r.Expiration.Date = rule.Expiration.Date.Format(expirationDateFormat)
+		}
+		rs = append(rs, r)
+	}
+	return rs
+}
+
+// BuildLifecycleRuleByDays builds a lifecycle rule with specified expiration days
+func BuildLifecycleRuleByDays(id, prefix string, status bool, days int) LifecycleRule {
+	var statusStr = "Enabled"
+	if !status {
+		statusStr = "Disabled"
+	}
+	return LifecycleRule{ID: id, Prefix: prefix, Status: statusStr,
+		Expiration: LifecycleExpiration{Days: days}}
+}
+
+// BuildLifecycleRuleByDate builds a lifecycle rule with specified expiration time.
+func BuildLifecycleRuleByDate(id, prefix string, status bool, year, month, day int) LifecycleRule {
+	var statusStr = "Enabled"
+	if !status {
+		statusStr = "Disabled"
+	}
+	date := time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.UTC)
+	return LifecycleRule{ID: id, Prefix: prefix, Status: statusStr,
+		Expiration: LifecycleExpiration{Date: date}}
+}
+
+// GetBucketLifecycleResult defines GetBucketLifecycle's result object
+type GetBucketLifecycleResult LifecycleConfiguration
+
+// RefererXML defines Referer configuration
+type RefererXML struct {
+	XMLName           xml.Name `xml:"RefererConfiguration"`
+	AllowEmptyReferer bool     `xml:"AllowEmptyReferer"`   // Allow empty referrer
+	RefererList       []string `xml:"RefererList>Referer"` // Referer whitelist
+}
+
+// GetBucketRefererResult defines result object for GetBucketReferer request
+type GetBucketRefererResult RefererXML
+
+// LoggingXML defines logging configuration
+type LoggingXML struct {
+	XMLName        xml.Name       `xml:"BucketLoggingStatus"`
+	LoggingEnabled LoggingEnabled `xml:"LoggingEnabled"` // The logging configuration information
+}
+
+type loggingXMLEmpty struct {
+	XMLName xml.Name `xml:"BucketLoggingStatus"`
+}
+
+// LoggingEnabled defines the logging configuration information
+type LoggingEnabled struct {
+	XMLName      xml.Name `xml:"LoggingEnabled"`
+	TargetBucket string   `xml:"TargetBucket"` // The bucket name for storing the log files
+	TargetPrefix string   `xml:"TargetPrefix"` // The log file prefix
+}
+
+// GetBucketLoggingResult defines the result from GetBucketLogging request
+type GetBucketLoggingResult LoggingXML
+
+// WebsiteXML defines Website configuration
+type WebsiteXML struct {
+	XMLName       xml.Name      `xml:"WebsiteConfiguration"`
+	IndexDocument IndexDocument `xml:"IndexDocument"` // The index page
+	ErrorDocument ErrorDocument `xml:"ErrorDocument"` // The error page
+}
+
+// IndexDocument defines the index page info
+type IndexDocument struct {
+	XMLName xml.Name `xml:"IndexDocument"`
+	Suffix  string   `xml:"Suffix"` // The file name for the index page
+}
+
+// ErrorDocument defines the 404 error page info
+type ErrorDocument struct {
+	XMLName xml.Name `xml:"ErrorDocument"`
+	Key     string   `xml:"Key"` // 404 error file name
+}
+
+// GetBucketWebsiteResult defines the result from GetBucketWebsite request.
+type GetBucketWebsiteResult WebsiteXML
+
+// CORSXML defines CORS configuration
+type CORSXML struct {
+	XMLName   xml.Name   `xml:"CORSConfiguration"`
+	CORSRules []CORSRule `xml:"CORSRule"` // CORS rules
+}
+
+// CORSRule defines CORS rules
+type CORSRule struct {
+	XMLName       xml.Name `xml:"CORSRule"`
+	AllowedOrigin []string `xml:"AllowedOrigin"` // Allowed origins. By default it's wildcard '*'
+	AllowedMethod []string `xml:"AllowedMethod"` // Allowed methods
+	AllowedHeader []string `xml:"AllowedHeader"` // Allowed headers
+	ExposeHeader  []string `xml:"ExposeHeader"`  // Allowed response headers
+	MaxAgeSeconds int      `xml:"MaxAgeSeconds"` // Max cache ages in seconds
+}
+
+// GetBucketCORSResult defines the result from GetBucketCORS request.
+type GetBucketCORSResult CORSXML
+
+// GetBucketInfoResult defines the result from GetBucketInfo request.
+type GetBucketInfoResult struct {
+	XMLName    xml.Name   `xml:"BucketInfo"`
+	BucketInfo BucketInfo `xml:"Bucket"`
+}
+
+// BucketInfo defines Bucket information
+type BucketInfo struct {
+	XMLName          xml.Name  `xml:"Bucket"`
+	Name             string    `xml:"Name"`                    // Bucket name
+	Location         string    `xml:"Location"`                // Bucket datacenter
+	CreationDate     time.Time `xml:"CreationDate"`            // Bucket creation time
+	ExtranetEndpoint string    `xml:"ExtranetEndpoint"`        // Bucket external endpoint
+	IntranetEndpoint string    `xml:"IntranetEndpoint"`        // Bucket internal endpoint
+	ACL              string    `xml:"AccessControlList>Grant"` // Bucket ACL
+	Owner            Owner     `xml:"Owner"`                   // Bucket owner
+	StorageClass     string    `xml:"StorageClass"`            // Bucket storage class
+}
+
+// ListObjectsResult defines the result from ListObjects request
+type ListObjectsResult struct {
+	XMLName        xml.Name           `xml:"ListBucketResult"`
+	Prefix         string             `xml:"Prefix"`                // The object prefix
+	Marker         string             `xml:"Marker"`                // The marker filter.
+	MaxKeys        int                `xml:"MaxKeys"`               // Max keys to return
+	Delimiter      string             `xml:"Delimiter"`             // The delimiter for grouping objects' name
+	IsTruncated    bool               `xml:"IsTruncated"`           // Flag indicates if all results are returned (when it's false)
+	NextMarker     string             `xml:"NextMarker"`            // The start point of the next query
+	Objects        []ObjectProperties `xml:"Contents"`              // Object list
+	CommonPrefixes []string           `xml:"CommonPrefixes>Prefix"` // You can think of commonprefixes as "folders" whose names end with the delimiter
+}
+
+// ObjectProperties defines Objecct properties
+type ObjectProperties struct {
+	XMLName      xml.Name  `xml:"Contents"`
+	Key          string    `xml:"Key"`          // Object key
+	Type         string    `xml:"Type"`         // Object type
+	Size         int64     `xml:"Size"`         // Object size
+	ETag         string    `xml:"ETag"`         // Object ETag
+	Owner        Owner     `xml:"Owner"`        // Object owner information
+	LastModified time.Time `xml:"LastModified"` // Object last modified time
+	StorageClass string    `xml:"StorageClass"` // Object storage class (Standard, IA, Archive)
+}
+
+// Owner defines Bucket/Object's owner
+type Owner struct {
+	XMLName     xml.Name `xml:"Owner"`
+	ID          string   `xml:"ID"`          // Owner ID
+	DisplayName string   `xml:"DisplayName"` // Owner's display name
+}
+
+// CopyObjectResult defines result object of CopyObject
+type CopyObjectResult struct {
+	XMLName      xml.Name  `xml:"CopyObjectResult"`
+	LastModified time.Time `xml:"LastModified"` // New object's last modified time.
+	ETag         string    `xml:"ETag"`         // New object's ETag
+}
+
+// GetObjectACLResult defines result of GetObjectACL request
+type GetObjectACLResult GetBucketACLResult
+
+type deleteXML struct {
+	XMLName xml.Name       `xml:"Delete"`
+	Objects []DeleteObject `xml:"Object"` // Objects to delete
+	Quiet   bool           `xml:"Quiet"`  // Flag of quiet mode.
+}
+
+// DeleteObject defines the struct for deleting object
+type DeleteObject struct {
+	XMLName xml.Name `xml:"Object"`
+	Key     string   `xml:"Key"` // Object name
+}
+
+// DeleteObjectsResult defines result of DeleteObjects request
+type DeleteObjectsResult struct {
+	XMLName        xml.Name `xml:"DeleteResult"`
+	DeletedObjects []string `xml:"Deleted>Key"` // Deleted object list
+}
+
+// InitiateMultipartUploadResult defines result of InitiateMultipartUpload request
+type InitiateMultipartUploadResult struct {
+	XMLName  xml.Name `xml:"InitiateMultipartUploadResult"`
+	Bucket   string   `xml:"Bucket"`   // Bucket name
+	Key      string   `xml:"Key"`      // Object name to upload
+	UploadID string   `xml:"UploadId"` // Generated UploadId
+}
+
+// UploadPart defines the upload/copy part
+type UploadPart struct {
+	XMLName    xml.Name `xml:"Part"`
+	PartNumber int      `xml:"PartNumber"` // Part number
+	ETag       string   `xml:"ETag"`       // ETag value of the part's data
+}
+
+type uploadParts []UploadPart
+
+func (slice uploadParts) Len() int {
+	return len(slice)
+}
+
+func (slice uploadParts) Less(i, j int) bool {
+	return slice[i].PartNumber < slice[j].PartNumber
+}
+
+func (slice uploadParts) Swap(i, j int) {
+	slice[i], slice[j] = slice[j], slice[i]
+}
+
+// UploadPartCopyResult defines result object of multipart copy request.
+type UploadPartCopyResult struct {
+	XMLName      xml.Name  `xml:"CopyPartResult"`
+	LastModified time.Time `xml:"LastModified"` // Last modified time
+	ETag         string    `xml:"ETag"`         // ETag
+}
+
+type completeMultipartUploadXML struct {
+	XMLName xml.Name     `xml:"CompleteMultipartUpload"`
+	Part    []UploadPart `xml:"Part"`
+}
+
+// CompleteMultipartUploadResult defines result object of CompleteMultipartUploadRequest
+type CompleteMultipartUploadResult struct {
+	XMLName  xml.Name `xml:"CompleteMultipartUploadResult"`
+	Location string   `xml:"Location"` // Object URL
+	Bucket   string   `xml:"Bucket"`   // Bucket name
+	ETag     string   `xml:"ETag"`     // Object ETag
+	Key      string   `xml:"Key"`      // Object name
+}
+
+// ListUploadedPartsResult defines result object of ListUploadedParts
+type ListUploadedPartsResult struct {
+	XMLName              xml.Name       `xml:"ListPartsResult"`
+	Bucket               string         `xml:"Bucket"`               // Bucket name
+	Key                  string         `xml:"Key"`                  // Object name
+	UploadID             string         `xml:"UploadId"`             // Upload ID
+	NextPartNumberMarker string         `xml:"NextPartNumberMarker"` // Next part number
+	MaxParts             int            `xml:"MaxParts"`             // Max parts count
+	IsTruncated          bool           `xml:"IsTruncated"`          // Flag indicates all entries returned.false: all entries returned.
+	UploadedParts        []UploadedPart `xml:"Part"`                 // Uploaded parts
+}
+
+// UploadedPart defines uploaded part
+type UploadedPart struct {
+	XMLName      xml.Name  `xml:"Part"`
+	PartNumber   int       `xml:"PartNumber"`   // Part number
+	LastModified time.Time `xml:"LastModified"` // Last modified time
+	ETag         string    `xml:"ETag"`         // ETag cache
+	Size         int       `xml:"Size"`         // Part size
+}
+
+// ListMultipartUploadResult defines result object of ListMultipartUpload
+type ListMultipartUploadResult struct {
+	XMLName            xml.Name            `xml:"ListMultipartUploadsResult"`
+	Bucket             string              `xml:"Bucket"`                // Bucket name
+	Delimiter          string              `xml:"Delimiter"`             // Delimiter for grouping object.
+	Prefix             string              `xml:"Prefix"`                // Object prefix
+	KeyMarker          string              `xml:"KeyMarker"`             // Object key marker
+	UploadIDMarker     string              `xml:"UploadIdMarker"`        // UploadId marker
+	NextKeyMarker      string              `xml:"NextKeyMarker"`         // Next key marker, if not all entries returned.
+	NextUploadIDMarker string              `xml:"NextUploadIdMarker"`    // Next uploadId marker, if not all entries returned.
+	MaxUploads         int                 `xml:"MaxUploads"`            // Max uploads to return
+	IsTruncated        bool                `xml:"IsTruncated"`           // Flag indicates all entries are returned.
+	Uploads            []UncompletedUpload `xml:"Upload"`                // Ongoing uploads (not completed, not aborted)
+	CommonPrefixes     []string            `xml:"CommonPrefixes>Prefix"` // Common prefixes list.
+}
+
+// UncompletedUpload structure wraps an uncompleted upload task
+type UncompletedUpload struct {
+	XMLName   xml.Name  `xml:"Upload"`
+	Key       string    `xml:"Key"`       // Object name
+	UploadID  string    `xml:"UploadId"`  // The UploadId
+	Initiated time.Time `xml:"Initiated"` // Initialization time in the format such as 2012-02-23T04:18:23.000Z
+}
+
+// ProcessObjectResult defines result object of ProcessObject
+type ProcessObjectResult struct {
+	Bucket   string `json:"bucket"`
+	FileSize int    `json:"fileSize"`
+	Object   string `json:"object"`
+	Status   string `json:"status"`
+}
+
+// decodeDeleteObjectsResult decodes deleting objects result in URL encoding
+func decodeDeleteObjectsResult(result *DeleteObjectsResult) error {
+	var err error
+	for i := 0; i < len(result.DeletedObjects); i++ {
+		result.DeletedObjects[i], err = url.QueryUnescape(result.DeletedObjects[i])
+		if err != nil {
+			return err
+		}
+	}
+	return nil
+}
+
+// decodeListObjectsResult decodes list objects result in URL encoding
+func decodeListObjectsResult(result *ListObjectsResult) error {
+	var err error
+	result.Prefix, err = url.QueryUnescape(result.Prefix)
+	if err != nil {
+		return err
+	}
+	result.Marker, err = url.QueryUnescape(result.Marker)
+	if err != nil {
+		return err
+	}
+	result.Delimiter, err = url.QueryUnescape(result.Delimiter)
+	if err != nil {
+		return err
+	}
+	result.NextMarker, err = url.QueryUnescape(result.NextMarker)
+	if err != nil {
+		return err
+	}
+	for i := 0; i < len(result.Objects); i++ {
+		result.Objects[i].Key, err = url.QueryUnescape(result.Objects[i].Key)
+		if err != nil {
+			return err
+		}
+	}
+	for i := 0; i < len(result.CommonPrefixes); i++ {
+		result.CommonPrefixes[i], err = url.QueryUnescape(result.CommonPrefixes[i])
+		if err != nil {
+			return err
+		}
+	}
+	return nil
+}
+
+// decodeListUploadedPartsResult decodes
+func decodeListUploadedPartsResult(result *ListUploadedPartsResult) error {
+	var err error
+	result.Key, err = url.QueryUnescape(result.Key)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// decodeListMultipartUploadResult decodes list multipart upload result in URL encoding
+func decodeListMultipartUploadResult(result *ListMultipartUploadResult) error {
+	var err error
+	result.Prefix, err = url.QueryUnescape(result.Prefix)
+	if err != nil {
+		return err
+	}
+	result.Delimiter, err = url.QueryUnescape(result.Delimiter)
+	if err != nil {
+		return err
+	}
+	result.KeyMarker, err = url.QueryUnescape(result.KeyMarker)
+	if err != nil {
+		return err
+	}
+	result.NextKeyMarker, err = url.QueryUnescape(result.NextKeyMarker)
+	if err != nil {
+		return err
+	}
+	for i := 0; i < len(result.Uploads); i++ {
+		result.Uploads[i].Key, err = url.QueryUnescape(result.Uploads[i].Key)
+		if err != nil {
+			return err
+		}
+	}
+	for i := 0; i < len(result.CommonPrefixes); i++ {
+		result.CommonPrefixes[i], err = url.QueryUnescape(result.CommonPrefixes[i])
+		if err != nil {
+			return err
+		}
+	}
+	return nil
+}
+
+// createBucketConfiguration defines the configuration for creating a bucket.
+type createBucketConfiguration struct {
+	XMLName      xml.Name         `xml:"CreateBucketConfiguration"`
+	StorageClass StorageClassType `xml:"StorageClass,omitempty"`
+}
+
+// LiveChannelConfiguration defines the configuration for live-channel
+type LiveChannelConfiguration struct {
+	XMLName     xml.Name          `xml:"LiveChannelConfiguration"`
+	Description string            `xml:"Description,omitempty"` //Description of live-channel, up to 128 bytes
+	Status      string            `xml:"Status,omitempty"`      //Specify the status of livechannel
+	Target      LiveChannelTarget `xml:"Target"`                //target configuration of live-channel
+	// use point instead of struct to avoid omit empty snapshot
+	Snapshot *LiveChannelSnapshot `xml:"Snapshot,omitempty"` //snapshot configuration of live-channel
+}
+
+// LiveChannelTarget target configuration of live-channel
+type LiveChannelTarget struct {
+	XMLName      xml.Name `xml:"Target"`
+	Type         string   `xml:"Type"`                   //the type of object, only supports HLS
+	FragDuration int      `xml:"FragDuration,omitempty"` //the length of each ts object (in seconds), in the range [1,100]
+	FragCount    int      `xml:"FragCount,omitempty"`    //the number of ts objects in the m3u8 object, in the range of [1,100]
+	PlaylistName string   `xml:"PlaylistName,omitempty"` //the name of m3u8 object, which must end with ".m3u8" and the length range is [6,128]
+}
+
+// LiveChannelSnapshot snapshot configuration of live-channel
+type LiveChannelSnapshot struct {
+	XMLName     xml.Name `xml:"Snapshot"`
+	RoleName    string   `xml:"RoleName,omitempty"`    //The role of snapshot operations, it sholud has write permission of DestBucket and the permission to send messages to the NotifyTopic.
+	DestBucket  string   `xml:"DestBucket,omitempty"`  //Bucket the snapshots will be written to. should be the same owner as the source bucket.
+	NotifyTopic string   `xml:"NotifyTopic,omitempty"` //Topics of MNS for notifying users of high frequency screenshot operation results
+	Interval    int      `xml:"Interval,omitempty"`    //interval of snapshots, threre is no snapshot if no I-frame during the interval time
+}
+
+// CreateLiveChannelResult the result of crete live-channel
+type CreateLiveChannelResult struct {
+	XMLName     xml.Name `xml:"CreateLiveChannelResult"`
+	PublishUrls []string `xml:"PublishUrls>Url"` //push urls list
+	PlayUrls    []string `xml:"PlayUrls>Url"`    //play urls list
+}
+
+// LiveChannelStat the result of get live-channel state
+type LiveChannelStat struct {
+	XMLName       xml.Name         `xml:"LiveChannelStat"`
+	Status        string           `xml:"Status"`        //Current push status of live-channel: Disabled,Live,Idle
+	ConnectedTime time.Time        `xml:"ConnectedTime"` //The time when the client starts pushing, format: ISO8601
+	RemoteAddr    string           `xml:"RemoteAddr"`    //The ip address of the client
+	Video         LiveChannelVideo `xml:"Video"`         //Video stream information
+	Audio         LiveChannelAudio `xml:"Audio"`         //Audio stream information
+}
+
+// LiveChannelVideo video stream information
+type LiveChannelVideo struct {
+	XMLName   xml.Name `xml:"Video"`
+	Width     int      `xml:"Width"`     //Width (unit: pixels)
+	Height    int      `xml:"Height"`    //Height (unit: pixels)
+	FrameRate int      `xml:"FrameRate"` //FramRate
+	Bandwidth int      `xml:"Bandwidth"` //Bandwidth (unit: B/s)
+}
+
+// LiveChannelAudio audio stream information
+type LiveChannelAudio struct {
+	XMLName    xml.Name `xml:"Audio"`
+	SampleRate int      `xml:"SampleRate"` //SampleRate
+	Bandwidth  int      `xml:"Bandwidth"`  //Bandwidth (unit: B/s)
+	Codec      string   `xml:"Codec"`      //Encoding forma
+}
+
+// LiveChannelHistory the result of GetLiveChannelHistory, at most return up to lastest 10 push records
+type LiveChannelHistory struct {
+	XMLName xml.Name     `xml:"LiveChannelHistory"`
+	Record  []LiveRecord `xml:"LiveRecord"` //push records list
+}
+
+// LiveRecord push recode
+type LiveRecord struct {
+	XMLName    xml.Name  `xml:"LiveRecord"`
+	StartTime  time.Time `xml:"StartTime"`  //StartTime, format: ISO8601
+	EndTime    time.Time `xml:"EndTime"`    //EndTime, format: ISO8601
+	RemoteAddr string    `xml:"RemoteAddr"` //The ip address of remote client
+}
+
+// ListLiveChannelResult the result of ListLiveChannel
+type ListLiveChannelResult struct {
+	XMLName     xml.Name          `xml:"ListLiveChannelResult"`
+	Prefix      string            `xml:"Prefix"`      //Filter by the name start with the value of "Prefix"
+	Marker      string            `xml:"Marker"`      //cursor from which starting list
+	MaxKeys     int               `xml:"MaxKeys"`     //The maximum count returned. the default value is 100. it cannot be greater than 1000.
+	IsTruncated bool              `xml:"IsTruncated"` //Indicates whether all results have been returned, "true" indicates partial results returned while "false" indicates all results have been returned
+	NextMarker  string            `xml:"NextMarker"`  //NextMarker indicate the Marker value of the next request
+	LiveChannel []LiveChannelInfo `xml:"LiveChannel"` //The infomation of live-channel
+}
+
+// LiveChannelInfo the infomation of live-channel
+type LiveChannelInfo struct {
+	XMLName      xml.Name  `xml:"LiveChannel"`
+	Name         string    `xml:"Name"`            //The name of live-channel
+	Description  string    `xml:"Description"`     //Description of live-channel
+	Status       string    `xml:"Status"`          //Status: disabled or enabled
+	LastModified time.Time `xml:"LastModified"`    //Last modification time, format: ISO8601
+	PublishUrls  []string  `xml:"PublishUrls>Url"` //push urls list
+	PlayUrls     []string  `xml:"PlayUrls>Url"`    //play urls list
+}

+ 526 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/upload.go

@@ -0,0 +1,526 @@
+package oss
+
+import (
+	"crypto/md5"
+	"encoding/base64"
+	"encoding/hex"
+	"encoding/json"
+	"errors"
+	"fmt"
+	"io/ioutil"
+	"os"
+	"path/filepath"
+	"time"
+)
+
+// UploadFile is multipart file upload.
+//
+// objectKey    the object name.
+// filePath    the local file path to upload.
+// partSize    the part size in byte.
+// options    the options for uploading object.
+//
+// error    it's nil if the operation succeeds, otherwise it's an error object.
+//
+func (bucket Bucket) UploadFile(objectKey, filePath string, partSize int64, options ...Option) error {
+	if partSize < MinPartSize || partSize > MaxPartSize {
+		return errors.New("oss: part size invalid range (100KB, 5GB]")
+	}
+
+	cpConf := getCpConfig(options)
+	routines := getRoutines(options)
+
+	if cpConf != nil && cpConf.IsEnable {
+		cpFilePath := getUploadCpFilePath(cpConf, filePath, bucket.BucketName, objectKey)
+		if cpFilePath != "" {
+			return bucket.uploadFileWithCp(objectKey, filePath, partSize, options, cpFilePath, routines)
+		}
+	}
+
+	return bucket.uploadFile(objectKey, filePath, partSize, options, routines)
+}
+
+func getUploadCpFilePath(cpConf *cpConfig, srcFile, destBucket, destObject string) string {
+	if cpConf.FilePath == "" && cpConf.DirPath != "" {
+		dest := fmt.Sprintf("oss://%v/%v", destBucket, destObject)
+		absPath, _ := filepath.Abs(srcFile)
+		cpFileName := getCpFileName(absPath, dest)
+		cpConf.FilePath = cpConf.DirPath + string(os.PathSeparator) + cpFileName
+	}
+	return cpConf.FilePath
+}
+
+// ----- concurrent upload without checkpoint  -----
+
+// getCpConfig gets checkpoint configuration
+func getCpConfig(options []Option) *cpConfig {
+	cpcOpt, err := findOption(options, checkpointConfig, nil)
+	if err != nil || cpcOpt == nil {
+		return nil
+	}
+
+	return cpcOpt.(*cpConfig)
+}
+
+// getCpFileName return the name of the checkpoint file
+func getCpFileName(src, dest string) string {
+	md5Ctx := md5.New()
+	md5Ctx.Write([]byte(src))
+	srcCheckSum := hex.EncodeToString(md5Ctx.Sum(nil))
+
+	md5Ctx.Reset()
+	md5Ctx.Write([]byte(dest))
+	destCheckSum := hex.EncodeToString(md5Ctx.Sum(nil))
+
+	return fmt.Sprintf("%v-%v.cp", srcCheckSum, destCheckSum)
+}
+
+// getRoutines gets the routine count. by default it's 1.
+func getRoutines(options []Option) int {
+	rtnOpt, err := findOption(options, routineNum, nil)
+	if err != nil || rtnOpt == nil {
+		return 1
+	}
+
+	rs := rtnOpt.(int)
+	if rs < 1 {
+		rs = 1
+	} else if rs > 100 {
+		rs = 100
+	}
+
+	return rs
+}
+
+// getPayer return the payer of the request
+func getPayer(options []Option) string {
+	payerOpt, err := findOption(options, HTTPHeaderOSSRequester, nil)
+	if err != nil || payerOpt == nil {
+		return ""
+	}
+
+	return payerOpt.(string)
+}
+
+// getProgressListener gets the progress callback
+func getProgressListener(options []Option) ProgressListener {
+	isSet, listener, _ := isOptionSet(options, progressListener)
+	if !isSet {
+		return nil
+	}
+	return listener.(ProgressListener)
+}
+
+// uploadPartHook is for testing usage
+type uploadPartHook func(id int, chunk FileChunk) error
+
+var uploadPartHooker uploadPartHook = defaultUploadPart
+
+func defaultUploadPart(id int, chunk FileChunk) error {
+	return nil
+}
+
+// workerArg defines worker argument structure
+type workerArg struct {
+	bucket   *Bucket
+	filePath string
+	imur     InitiateMultipartUploadResult
+	options  []Option
+	hook     uploadPartHook
+}
+
+// worker is the worker coroutine function
+func worker(id int, arg workerArg, jobs <-chan FileChunk, results chan<- UploadPart, failed chan<- error, die <-chan bool) {
+	for chunk := range jobs {
+		if err := arg.hook(id, chunk); err != nil {
+			failed <- err
+			break
+		}
+		part, err := arg.bucket.UploadPartFromFile(arg.imur, arg.filePath, chunk.Offset, chunk.Size, chunk.Number, arg.options...)
+		if err != nil {
+			failed <- err
+			break
+		}
+		select {
+		case <-die:
+			return
+		default:
+		}
+		results <- part
+	}
+}
+
+// scheduler function
+func scheduler(jobs chan FileChunk, chunks []FileChunk) {
+	for _, chunk := range chunks {
+		jobs <- chunk
+	}
+	close(jobs)
+}
+
+func getTotalBytes(chunks []FileChunk) int64 {
+	var tb int64
+	for _, chunk := range chunks {
+		tb += chunk.Size
+	}
+	return tb
+}
+
+// uploadFile is a concurrent upload, without checkpoint
+func (bucket Bucket) uploadFile(objectKey, filePath string, partSize int64, options []Option, routines int) error {
+	listener := getProgressListener(options)
+
+	chunks, err := SplitFileByPartSize(filePath, partSize)
+	if err != nil {
+		return err
+	}
+
+	payerOptions := []Option{}
+	payer := getPayer(options)
+	if payer != "" {
+		payerOptions = append(payerOptions, RequestPayer(PayerType(payer)))
+	}
+
+	// Initialize the multipart upload
+	imur, err := bucket.InitiateMultipartUpload(objectKey, options...)
+	if err != nil {
+		return err
+	}
+
+	jobs := make(chan FileChunk, len(chunks))
+	results := make(chan UploadPart, len(chunks))
+	failed := make(chan error)
+	die := make(chan bool)
+
+	var completedBytes int64
+	totalBytes := getTotalBytes(chunks)
+	event := newProgressEvent(TransferStartedEvent, 0, totalBytes)
+	publishProgress(listener, event)
+
+	// Start the worker coroutine
+	arg := workerArg{&bucket, filePath, imur, payerOptions, uploadPartHooker}
+	for w := 1; w <= routines; w++ {
+		go worker(w, arg, jobs, results, failed, die)
+	}
+
+	// Schedule the jobs
+	go scheduler(jobs, chunks)
+
+	// Waiting for the upload finished
+	completed := 0
+	parts := make([]UploadPart, len(chunks))
+	for completed < len(chunks) {
+		select {
+		case part := <-results:
+			completed++
+			parts[part.PartNumber-1] = part
+			completedBytes += chunks[part.PartNumber-1].Size
+			event = newProgressEvent(TransferDataEvent, completedBytes, totalBytes)
+			publishProgress(listener, event)
+		case err := <-failed:
+			close(die)
+			event = newProgressEvent(TransferFailedEvent, completedBytes, totalBytes)
+			publishProgress(listener, event)
+			bucket.AbortMultipartUpload(imur, payerOptions...)
+			return err
+		}
+
+		if completed >= len(chunks) {
+			break
+		}
+	}
+
+	event = newProgressEvent(TransferStartedEvent, completedBytes, totalBytes)
+	publishProgress(listener, event)
+
+	// Complete the multpart upload
+	_, err = bucket.CompleteMultipartUpload(imur, parts, payerOptions...)
+	if err != nil {
+		bucket.AbortMultipartUpload(imur, payerOptions...)
+		return err
+	}
+	return nil
+}
+
+// ----- concurrent upload with checkpoint  -----
+const uploadCpMagic = "FE8BB4EA-B593-4FAC-AD7A-2459A36E2E62"
+
+type uploadCheckpoint struct {
+	Magic     string   // Magic
+	MD5       string   // Checkpoint file content's MD5
+	FilePath  string   // Local file path
+	FileStat  cpStat   // File state
+	ObjectKey string   // Key
+	UploadID  string   // Upload ID
+	Parts     []cpPart // All parts of the local file
+}
+
+type cpStat struct {
+	Size         int64     // File size
+	LastModified time.Time // File's last modified time
+	MD5          string    // Local file's MD5
+}
+
+type cpPart struct {
+	Chunk       FileChunk  // File chunk
+	Part        UploadPart // Uploaded part
+	IsCompleted bool       // Upload complete flag
+}
+
+// isValid checks if the uploaded data is valid---it's valid when the file is not updated and the checkpoint data is valid.
+func (cp uploadCheckpoint) isValid(filePath string) (bool, error) {
+	// Compare the CP's magic number and MD5.
+	cpb := cp
+	cpb.MD5 = ""
+	js, _ := json.Marshal(cpb)
+	sum := md5.Sum(js)
+	b64 := base64.StdEncoding.EncodeToString(sum[:])
+
+	if cp.Magic != uploadCpMagic || b64 != cp.MD5 {
+		return false, nil
+	}
+
+	// Make sure if the local file is updated.
+	fd, err := os.Open(filePath)
+	if err != nil {
+		return false, err
+	}
+	defer fd.Close()
+
+	st, err := fd.Stat()
+	if err != nil {
+		return false, err
+	}
+
+	md, err := calcFileMD5(filePath)
+	if err != nil {
+		return false, err
+	}
+
+	// Compare the file size, file's last modified time and file's MD5
+	if cp.FileStat.Size != st.Size() ||
+		cp.FileStat.LastModified != st.ModTime() ||
+		cp.FileStat.MD5 != md {
+		return false, nil
+	}
+
+	return true, nil
+}
+
+// load loads from the file
+func (cp *uploadCheckpoint) load(filePath string) error {
+	contents, err := ioutil.ReadFile(filePath)
+	if err != nil {
+		return err
+	}
+
+	err = json.Unmarshal(contents, cp)
+	return err
+}
+
+// dump dumps to the local file
+func (cp *uploadCheckpoint) dump(filePath string) error {
+	bcp := *cp
+
+	// Calculate MD5
+	bcp.MD5 = ""
+	js, err := json.Marshal(bcp)
+	if err != nil {
+		return err
+	}
+	sum := md5.Sum(js)
+	b64 := base64.StdEncoding.EncodeToString(sum[:])
+	bcp.MD5 = b64
+
+	// Serialization
+	js, err = json.Marshal(bcp)
+	if err != nil {
+		return err
+	}
+
+	// Dump
+	return ioutil.WriteFile(filePath, js, FilePermMode)
+}
+
+// updatePart updates the part status
+func (cp *uploadCheckpoint) updatePart(part UploadPart) {
+	cp.Parts[part.PartNumber-1].Part = part
+	cp.Parts[part.PartNumber-1].IsCompleted = true
+}
+
+// todoParts returns unfinished parts
+func (cp *uploadCheckpoint) todoParts() []FileChunk {
+	fcs := []FileChunk{}
+	for _, part := range cp.Parts {
+		if !part.IsCompleted {
+			fcs = append(fcs, part.Chunk)
+		}
+	}
+	return fcs
+}
+
+// allParts returns all parts
+func (cp *uploadCheckpoint) allParts() []UploadPart {
+	ps := []UploadPart{}
+	for _, part := range cp.Parts {
+		ps = append(ps, part.Part)
+	}
+	return ps
+}
+
+// getCompletedBytes returns completed bytes count
+func (cp *uploadCheckpoint) getCompletedBytes() int64 {
+	var completedBytes int64
+	for _, part := range cp.Parts {
+		if part.IsCompleted {
+			completedBytes += part.Chunk.Size
+		}
+	}
+	return completedBytes
+}
+
+// calcFileMD5 calculates the MD5 for the specified local file
+func calcFileMD5(filePath string) (string, error) {
+	return "", nil
+}
+
+// prepare initializes the multipart upload
+func prepare(cp *uploadCheckpoint, objectKey, filePath string, partSize int64, bucket *Bucket, options []Option) error {
+	// CP
+	cp.Magic = uploadCpMagic
+	cp.FilePath = filePath
+	cp.ObjectKey = objectKey
+
+	// Local file
+	fd, err := os.Open(filePath)
+	if err != nil {
+		return err
+	}
+	defer fd.Close()
+
+	st, err := fd.Stat()
+	if err != nil {
+		return err
+	}
+	cp.FileStat.Size = st.Size()
+	cp.FileStat.LastModified = st.ModTime()
+	md, err := calcFileMD5(filePath)
+	if err != nil {
+		return err
+	}
+	cp.FileStat.MD5 = md
+
+	// Chunks
+	parts, err := SplitFileByPartSize(filePath, partSize)
+	if err != nil {
+		return err
+	}
+
+	cp.Parts = make([]cpPart, len(parts))
+	for i, part := range parts {
+		cp.Parts[i].Chunk = part
+		cp.Parts[i].IsCompleted = false
+	}
+
+	// Init load
+	imur, err := bucket.InitiateMultipartUpload(objectKey, options...)
+	if err != nil {
+		return err
+	}
+	cp.UploadID = imur.UploadID
+
+	return nil
+}
+
+// complete completes the multipart upload and deletes the local CP files
+func complete(cp *uploadCheckpoint, bucket *Bucket, parts []UploadPart, cpFilePath string, options []Option) error {
+	imur := InitiateMultipartUploadResult{Bucket: bucket.BucketName,
+		Key: cp.ObjectKey, UploadID: cp.UploadID}
+	_, err := bucket.CompleteMultipartUpload(imur, parts, options...)
+	if err != nil {
+		return err
+	}
+	os.Remove(cpFilePath)
+	return err
+}
+
+// uploadFileWithCp handles concurrent upload with checkpoint
+func (bucket Bucket) uploadFileWithCp(objectKey, filePath string, partSize int64, options []Option, cpFilePath string, routines int) error {
+	listener := getProgressListener(options)
+
+	payerOptions := []Option{}
+	payer := getPayer(options)
+	if payer != "" {
+		payerOptions = append(payerOptions, RequestPayer(PayerType(payer)))
+	}
+
+	// Load CP data
+	ucp := uploadCheckpoint{}
+	err := ucp.load(cpFilePath)
+	if err != nil {
+		os.Remove(cpFilePath)
+	}
+
+	// Load error or the CP data is invalid.
+	valid, err := ucp.isValid(filePath)
+	if err != nil || !valid {
+		if err = prepare(&ucp, objectKey, filePath, partSize, &bucket, options); err != nil {
+			return err
+		}
+		os.Remove(cpFilePath)
+	}
+
+	chunks := ucp.todoParts()
+	imur := InitiateMultipartUploadResult{
+		Bucket:   bucket.BucketName,
+		Key:      objectKey,
+		UploadID: ucp.UploadID}
+
+	jobs := make(chan FileChunk, len(chunks))
+	results := make(chan UploadPart, len(chunks))
+	failed := make(chan error)
+	die := make(chan bool)
+
+	completedBytes := ucp.getCompletedBytes()
+	event := newProgressEvent(TransferStartedEvent, completedBytes, ucp.FileStat.Size)
+	publishProgress(listener, event)
+
+	// Start the workers
+	arg := workerArg{&bucket, filePath, imur, payerOptions, uploadPartHooker}
+	for w := 1; w <= routines; w++ {
+		go worker(w, arg, jobs, results, failed, die)
+	}
+
+	// Schedule jobs
+	go scheduler(jobs, chunks)
+
+	// Waiting for the job finished
+	completed := 0
+	for completed < len(chunks) {
+		select {
+		case part := <-results:
+			completed++
+			ucp.updatePart(part)
+			ucp.dump(cpFilePath)
+			completedBytes += ucp.Parts[part.PartNumber-1].Chunk.Size
+			event = newProgressEvent(TransferDataEvent, completedBytes, ucp.FileStat.Size)
+			publishProgress(listener, event)
+		case err := <-failed:
+			close(die)
+			event = newProgressEvent(TransferFailedEvent, completedBytes, ucp.FileStat.Size)
+			publishProgress(listener, event)
+			return err
+		}
+
+		if completed >= len(chunks) {
+			break
+		}
+	}
+
+	event = newProgressEvent(TransferCompletedEvent, completedBytes, ucp.FileStat.Size)
+	publishProgress(listener, event)
+
+	// Complete the multipart upload
+	err = complete(&ucp, &bucket, ucp.allParts(), cpFilePath, payerOptions)
+	return err
+}

+ 265 - 0
vendor/github.com/aliyun/aliyun-oss-go-sdk/oss/utils.go

@@ -0,0 +1,265 @@
+package oss
+
+import (
+	"bytes"
+	"errors"
+	"fmt"
+	"hash/crc64"
+	"net/http"
+	"os"
+	"os/exec"
+	"runtime"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// userAgent gets user agent
+// It has the SDK version information, OS information and GO version
+func userAgent() string {
+	sys := getSysInfo()
+	return fmt.Sprintf("aliyun-sdk-go/%s (%s/%s/%s;%s)", Version, sys.name,
+		sys.release, sys.machine, runtime.Version())
+}
+
+type sysInfo struct {
+	name    string // OS name such as windows/Linux
+	release string // OS version 2.6.32-220.23.2.ali1089.el5.x86_64 etc
+	machine string // CPU type amd64/x86_64
+}
+
+// getSysInfo gets system info
+// gets the OS information and CPU type
+func getSysInfo() sysInfo {
+	name := runtime.GOOS
+	release := "-"
+	machine := runtime.GOARCH
+	if out, err := exec.Command("uname", "-s").CombinedOutput(); err == nil {
+		name = string(bytes.TrimSpace(out))
+	}
+	if out, err := exec.Command("uname", "-r").CombinedOutput(); err == nil {
+		release = string(bytes.TrimSpace(out))
+	}
+	if out, err := exec.Command("uname", "-m").CombinedOutput(); err == nil {
+		machine = string(bytes.TrimSpace(out))
+	}
+	return sysInfo{name: name, release: release, machine: machine}
+}
+
+// unpackedRange
+type unpackedRange struct {
+	hasStart bool  // Flag indicates if the start point is specified
+	hasEnd   bool  // Flag indicates if the end point is specified
+	start    int64 // Start point
+	end      int64 // End point
+}
+
+// invalidRangeError returns invalid range error
+func invalidRangeError(r string) error {
+	return fmt.Errorf("InvalidRange %s", r)
+}
+
+// parseRange parse various styles of range such as bytes=M-N
+func parseRange(normalizedRange string) (*unpackedRange, error) {
+	var err error
+	hasStart := false
+	hasEnd := false
+	var start int64
+	var end int64
+
+	// Bytes==M-N or ranges=M-N
+	nrSlice := strings.Split(normalizedRange, "=")
+	if len(nrSlice) != 2 || nrSlice[0] != "bytes" {
+		return nil, invalidRangeError(normalizedRange)
+	}
+
+	// Bytes=M-N,X-Y
+	rSlice := strings.Split(nrSlice[1], ",")
+	rStr := rSlice[0]
+
+	if strings.HasSuffix(rStr, "-") { // M-
+		startStr := rStr[:len(rStr)-1]
+		start, err = strconv.ParseInt(startStr, 10, 64)
+		if err != nil {
+			return nil, invalidRangeError(normalizedRange)
+		}
+		hasStart = true
+	} else if strings.HasPrefix(rStr, "-") { // -N
+		len := rStr[1:]
+		end, err = strconv.ParseInt(len, 10, 64)
+		if err != nil {
+			return nil, invalidRangeError(normalizedRange)
+		}
+		if end == 0 { // -0
+			return nil, invalidRangeError(normalizedRange)
+		}
+		hasEnd = true
+	} else { // M-N
+		valSlice := strings.Split(rStr, "-")
+		if len(valSlice) != 2 {
+			return nil, invalidRangeError(normalizedRange)
+		}
+		start, err = strconv.ParseInt(valSlice[0], 10, 64)
+		if err != nil {
+			return nil, invalidRangeError(normalizedRange)
+		}
+		hasStart = true
+		end, err = strconv.ParseInt(valSlice[1], 10, 64)
+		if err != nil {
+			return nil, invalidRangeError(normalizedRange)
+		}
+		hasEnd = true
+	}
+
+	return &unpackedRange{hasStart, hasEnd, start, end}, nil
+}
+
+// adjustRange returns adjusted range, adjust the range according to the length of the file
+func adjustRange(ur *unpackedRange, size int64) (start, end int64) {
+	if ur == nil {
+		return 0, size
+	}
+
+	if ur.hasStart && ur.hasEnd {
+		start = ur.start
+		end = ur.end + 1
+		if ur.start < 0 || ur.start >= size || ur.end > size || ur.start > ur.end {
+			start = 0
+			end = size
+		}
+	} else if ur.hasStart {
+		start = ur.start
+		end = size
+		if ur.start < 0 || ur.start >= size {
+			start = 0
+		}
+	} else if ur.hasEnd {
+		start = size - ur.end
+		end = size
+		if ur.end < 0 || ur.end > size {
+			start = 0
+			end = size
+		}
+	}
+	return
+}
+
+// GetNowSec returns Unix time, the number of seconds elapsed since January 1, 1970 UTC.
+// gets the current time in Unix time, in seconds.
+func GetNowSec() int64 {
+	return time.Now().Unix()
+}
+
+// GetNowNanoSec returns t as a Unix time, the number of nanoseconds elapsed
+// since January 1, 1970 UTC. The result is undefined if the Unix time
+// in nanoseconds cannot be represented by an int64. Note that this
+// means the result of calling UnixNano on the zero Time is undefined.
+// gets the current time in Unix time, in nanoseconds.
+func GetNowNanoSec() int64 {
+	return time.Now().UnixNano()
+}
+
+// GetNowGMT gets the current time in GMT format.
+func GetNowGMT() string {
+	return time.Now().UTC().Format(http.TimeFormat)
+}
+
+// FileChunk is the file chunk definition
+type FileChunk struct {
+	Number int   // Chunk number
+	Offset int64 // Chunk offset
+	Size   int64 // Chunk size.
+}
+
+// SplitFileByPartNum splits big file into parts by the num of parts.
+// Split the file with specified parts count, returns the split result when error is nil.
+func SplitFileByPartNum(fileName string, chunkNum int) ([]FileChunk, error) {
+	if chunkNum <= 0 || chunkNum > 10000 {
+		return nil, errors.New("chunkNum invalid")
+	}
+
+	file, err := os.Open(fileName)
+	if err != nil {
+		return nil, err
+	}
+	defer file.Close()
+
+	stat, err := file.Stat()
+	if err != nil {
+		return nil, err
+	}
+
+	if int64(chunkNum) > stat.Size() {
+		return nil, errors.New("oss: chunkNum invalid")
+	}
+
+	var chunks []FileChunk
+	var chunk = FileChunk{}
+	var chunkN = (int64)(chunkNum)
+	for i := int64(0); i < chunkN; i++ {
+		chunk.Number = int(i + 1)
+		chunk.Offset = i * (stat.Size() / chunkN)
+		if i == chunkN-1 {
+			chunk.Size = stat.Size()/chunkN + stat.Size()%chunkN
+		} else {
+			chunk.Size = stat.Size() / chunkN
+		}
+		chunks = append(chunks, chunk)
+	}
+
+	return chunks, nil
+}
+
+// SplitFileByPartSize splits big file into parts by the size of parts.
+// Splits the file by the part size. Returns the FileChunk when error is nil.
+func SplitFileByPartSize(fileName string, chunkSize int64) ([]FileChunk, error) {
+	if chunkSize <= 0 {
+		return nil, errors.New("chunkSize invalid")
+	}
+
+	file, err := os.Open(fileName)
+	if err != nil {
+		return nil, err
+	}
+	defer file.Close()
+
+	stat, err := file.Stat()
+	if err != nil {
+		return nil, err
+	}
+	var chunkN = stat.Size() / chunkSize
+	if chunkN >= 10000 {
+		return nil, errors.New("Too many parts, please increase part size")
+	}
+
+	var chunks []FileChunk
+	var chunk = FileChunk{}
+	for i := int64(0); i < chunkN; i++ {
+		chunk.Number = int(i + 1)
+		chunk.Offset = i * chunkSize
+		chunk.Size = chunkSize
+		chunks = append(chunks, chunk)
+	}
+
+	if stat.Size()%chunkSize > 0 {
+		chunk.Number = len(chunks) + 1
+		chunk.Offset = int64(len(chunks)) * chunkSize
+		chunk.Size = stat.Size() % chunkSize
+		chunks = append(chunks, chunk)
+	}
+
+	return chunks, nil
+}
+
+// GetPartEnd calculates the end position
+func GetPartEnd(begin int64, total int64, per int64) int64 {
+	if begin+per > total {
+		return total - 1
+	}
+	return begin + per - 1
+}
+
+// crcTable returns the table constructed from the specified polynomial
+var crcTable = func() *crc64.Table {
+	return crc64.MakeTable(crc64.ECMA)
+}

+ 0 - 3
vendor/golang.org/x/crypto/AUTHORS

@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at https://tip.golang.org/AUTHORS.

+ 0 - 3
vendor/golang.org/x/crypto/CONTRIBUTORS

@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at https://tip.golang.org/CONTRIBUTORS.

+ 0 - 951
vendor/golang.org/x/crypto/ssh/terminal/terminal.go

@@ -1,951 +0,0 @@
-// Copyright 2011 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.
-
-package terminal
-
-import (
-	"bytes"
-	"io"
-	"sync"
-	"unicode/utf8"
-)
-
-// EscapeCodes contains escape sequences that can be written to the terminal in
-// order to achieve different styles of text.
-type EscapeCodes struct {
-	// Foreground colors
-	Black, Red, Green, Yellow, Blue, Magenta, Cyan, White []byte
-
-	// Reset all attributes
-	Reset []byte
-}
-
-var vt100EscapeCodes = EscapeCodes{
-	Black:   []byte{keyEscape, '[', '3', '0', 'm'},
-	Red:     []byte{keyEscape, '[', '3', '1', 'm'},
-	Green:   []byte{keyEscape, '[', '3', '2', 'm'},
-	Yellow:  []byte{keyEscape, '[', '3', '3', 'm'},
-	Blue:    []byte{keyEscape, '[', '3', '4', 'm'},
-	Magenta: []byte{keyEscape, '[', '3', '5', 'm'},
-	Cyan:    []byte{keyEscape, '[', '3', '6', 'm'},
-	White:   []byte{keyEscape, '[', '3', '7', 'm'},
-
-	Reset: []byte{keyEscape, '[', '0', 'm'},
-}
-
-// Terminal contains the state for running a VT100 terminal that is capable of
-// reading lines of input.
-type Terminal struct {
-	// AutoCompleteCallback, if non-null, is called for each keypress with
-	// the full input line and the current position of the cursor (in
-	// bytes, as an index into |line|). If it returns ok=false, the key
-	// press is processed normally. Otherwise it returns a replacement line
-	// and the new cursor position.
-	AutoCompleteCallback func(line string, pos int, key rune) (newLine string, newPos int, ok bool)
-
-	// Escape contains a pointer to the escape codes for this terminal.
-	// It's always a valid pointer, although the escape codes themselves
-	// may be empty if the terminal doesn't support them.
-	Escape *EscapeCodes
-
-	// lock protects the terminal and the state in this object from
-	// concurrent processing of a key press and a Write() call.
-	lock sync.Mutex
-
-	c      io.ReadWriter
-	prompt []rune
-
-	// line is the current line being entered.
-	line []rune
-	// pos is the logical position of the cursor in line
-	pos int
-	// echo is true if local echo is enabled
-	echo bool
-	// pasteActive is true iff there is a bracketed paste operation in
-	// progress.
-	pasteActive bool
-
-	// cursorX contains the current X value of the cursor where the left
-	// edge is 0. cursorY contains the row number where the first row of
-	// the current line is 0.
-	cursorX, cursorY int
-	// maxLine is the greatest value of cursorY so far.
-	maxLine int
-
-	termWidth, termHeight int
-
-	// outBuf contains the terminal data to be sent.
-	outBuf []byte
-	// remainder contains the remainder of any partial key sequences after
-	// a read. It aliases into inBuf.
-	remainder []byte
-	inBuf     [256]byte
-
-	// history contains previously entered commands so that they can be
-	// accessed with the up and down keys.
-	history stRingBuffer
-	// historyIndex stores the currently accessed history entry, where zero
-	// means the immediately previous entry.
-	historyIndex int
-	// When navigating up and down the history it's possible to return to
-	// the incomplete, initial line. That value is stored in
-	// historyPending.
-	historyPending string
-}
-
-// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is
-// a local terminal, that terminal must first have been put into raw mode.
-// prompt is a string that is written at the start of each input line (i.e.
-// "> ").
-func NewTerminal(c io.ReadWriter, prompt string) *Terminal {
-	return &Terminal{
-		Escape:       &vt100EscapeCodes,
-		c:            c,
-		prompt:       []rune(prompt),
-		termWidth:    80,
-		termHeight:   24,
-		echo:         true,
-		historyIndex: -1,
-	}
-}
-
-const (
-	keyCtrlD     = 4
-	keyCtrlU     = 21
-	keyEnter     = '\r'
-	keyEscape    = 27
-	keyBackspace = 127
-	keyUnknown   = 0xd800 /* UTF-16 surrogate area */ + iota
-	keyUp
-	keyDown
-	keyLeft
-	keyRight
-	keyAltLeft
-	keyAltRight
-	keyHome
-	keyEnd
-	keyDeleteWord
-	keyDeleteLine
-	keyClearScreen
-	keyPasteStart
-	keyPasteEnd
-)
-
-var (
-	crlf       = []byte{'\r', '\n'}
-	pasteStart = []byte{keyEscape, '[', '2', '0', '0', '~'}
-	pasteEnd   = []byte{keyEscape, '[', '2', '0', '1', '~'}
-)
-
-// bytesToKey tries to parse a key sequence from b. If successful, it returns
-// the key and the remainder of the input. Otherwise it returns utf8.RuneError.
-func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
-	if len(b) == 0 {
-		return utf8.RuneError, nil
-	}
-
-	if !pasteActive {
-		switch b[0] {
-		case 1: // ^A
-			return keyHome, b[1:]
-		case 5: // ^E
-			return keyEnd, b[1:]
-		case 8: // ^H
-			return keyBackspace, b[1:]
-		case 11: // ^K
-			return keyDeleteLine, b[1:]
-		case 12: // ^L
-			return keyClearScreen, b[1:]
-		case 23: // ^W
-			return keyDeleteWord, b[1:]
-		}
-	}
-
-	if b[0] != keyEscape {
-		if !utf8.FullRune(b) {
-			return utf8.RuneError, b
-		}
-		r, l := utf8.DecodeRune(b)
-		return r, b[l:]
-	}
-
-	if !pasteActive && len(b) >= 3 && b[0] == keyEscape && b[1] == '[' {
-		switch b[2] {
-		case 'A':
-			return keyUp, b[3:]
-		case 'B':
-			return keyDown, b[3:]
-		case 'C':
-			return keyRight, b[3:]
-		case 'D':
-			return keyLeft, b[3:]
-		case 'H':
-			return keyHome, b[3:]
-		case 'F':
-			return keyEnd, b[3:]
-		}
-	}
-
-	if !pasteActive && len(b) >= 6 && b[0] == keyEscape && b[1] == '[' && b[2] == '1' && b[3] == ';' && b[4] == '3' {
-		switch b[5] {
-		case 'C':
-			return keyAltRight, b[6:]
-		case 'D':
-			return keyAltLeft, b[6:]
-		}
-	}
-
-	if !pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteStart) {
-		return keyPasteStart, b[6:]
-	}
-
-	if pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteEnd) {
-		return keyPasteEnd, b[6:]
-	}
-
-	// If we get here then we have a key that we don't recognise, or a
-	// partial sequence. It's not clear how one should find the end of a
-	// sequence without knowing them all, but it seems that [a-zA-Z~] only
-	// appears at the end of a sequence.
-	for i, c := range b[0:] {
-		if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '~' {
-			return keyUnknown, b[i+1:]
-		}
-	}
-
-	return utf8.RuneError, b
-}
-
-// queue appends data to the end of t.outBuf
-func (t *Terminal) queue(data []rune) {
-	t.outBuf = append(t.outBuf, []byte(string(data))...)
-}
-
-var eraseUnderCursor = []rune{' ', keyEscape, '[', 'D'}
-var space = []rune{' '}
-
-func isPrintable(key rune) bool {
-	isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
-	return key >= 32 && !isInSurrogateArea
-}
-
-// moveCursorToPos appends data to t.outBuf which will move the cursor to the
-// given, logical position in the text.
-func (t *Terminal) moveCursorToPos(pos int) {
-	if !t.echo {
-		return
-	}
-
-	x := visualLength(t.prompt) + pos
-	y := x / t.termWidth
-	x = x % t.termWidth
-
-	up := 0
-	if y < t.cursorY {
-		up = t.cursorY - y
-	}
-
-	down := 0
-	if y > t.cursorY {
-		down = y - t.cursorY
-	}
-
-	left := 0
-	if x < t.cursorX {
-		left = t.cursorX - x
-	}
-
-	right := 0
-	if x > t.cursorX {
-		right = x - t.cursorX
-	}
-
-	t.cursorX = x
-	t.cursorY = y
-	t.move(up, down, left, right)
-}
-
-func (t *Terminal) move(up, down, left, right int) {
-	movement := make([]rune, 3*(up+down+left+right))
-	m := movement
-	for i := 0; i < up; i++ {
-		m[0] = keyEscape
-		m[1] = '['
-		m[2] = 'A'
-		m = m[3:]
-	}
-	for i := 0; i < down; i++ {
-		m[0] = keyEscape
-		m[1] = '['
-		m[2] = 'B'
-		m = m[3:]
-	}
-	for i := 0; i < left; i++ {
-		m[0] = keyEscape
-		m[1] = '['
-		m[2] = 'D'
-		m = m[3:]
-	}
-	for i := 0; i < right; i++ {
-		m[0] = keyEscape
-		m[1] = '['
-		m[2] = 'C'
-		m = m[3:]
-	}
-
-	t.queue(movement)
-}
-
-func (t *Terminal) clearLineToRight() {
-	op := []rune{keyEscape, '[', 'K'}
-	t.queue(op)
-}
-
-const maxLineLength = 4096
-
-func (t *Terminal) setLine(newLine []rune, newPos int) {
-	if t.echo {
-		t.moveCursorToPos(0)
-		t.writeLine(newLine)
-		for i := len(newLine); i < len(t.line); i++ {
-			t.writeLine(space)
-		}
-		t.moveCursorToPos(newPos)
-	}
-	t.line = newLine
-	t.pos = newPos
-}
-
-func (t *Terminal) advanceCursor(places int) {
-	t.cursorX += places
-	t.cursorY += t.cursorX / t.termWidth
-	if t.cursorY > t.maxLine {
-		t.maxLine = t.cursorY
-	}
-	t.cursorX = t.cursorX % t.termWidth
-
-	if places > 0 && t.cursorX == 0 {
-		// Normally terminals will advance the current position
-		// when writing a character. But that doesn't happen
-		// for the last character in a line. However, when
-		// writing a character (except a new line) that causes
-		// a line wrap, the position will be advanced two
-		// places.
-		//
-		// So, if we are stopping at the end of a line, we
-		// need to write a newline so that our cursor can be
-		// advanced to the next line.
-		t.outBuf = append(t.outBuf, '\r', '\n')
-	}
-}
-
-func (t *Terminal) eraseNPreviousChars(n int) {
-	if n == 0 {
-		return
-	}
-
-	if t.pos < n {
-		n = t.pos
-	}
-	t.pos -= n
-	t.moveCursorToPos(t.pos)
-
-	copy(t.line[t.pos:], t.line[n+t.pos:])
-	t.line = t.line[:len(t.line)-n]
-	if t.echo {
-		t.writeLine(t.line[t.pos:])
-		for i := 0; i < n; i++ {
-			t.queue(space)
-		}
-		t.advanceCursor(n)
-		t.moveCursorToPos(t.pos)
-	}
-}
-
-// countToLeftWord returns then number of characters from the cursor to the
-// start of the previous word.
-func (t *Terminal) countToLeftWord() int {
-	if t.pos == 0 {
-		return 0
-	}
-
-	pos := t.pos - 1
-	for pos > 0 {
-		if t.line[pos] != ' ' {
-			break
-		}
-		pos--
-	}
-	for pos > 0 {
-		if t.line[pos] == ' ' {
-			pos++
-			break
-		}
-		pos--
-	}
-
-	return t.pos - pos
-}
-
-// countToRightWord returns then number of characters from the cursor to the
-// start of the next word.
-func (t *Terminal) countToRightWord() int {
-	pos := t.pos
-	for pos < len(t.line) {
-		if t.line[pos] == ' ' {
-			break
-		}
-		pos++
-	}
-	for pos < len(t.line) {
-		if t.line[pos] != ' ' {
-			break
-		}
-		pos++
-	}
-	return pos - t.pos
-}
-
-// visualLength returns the number of visible glyphs in s.
-func visualLength(runes []rune) int {
-	inEscapeSeq := false
-	length := 0
-
-	for _, r := range runes {
-		switch {
-		case inEscapeSeq:
-			if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
-				inEscapeSeq = false
-			}
-		case r == '\x1b':
-			inEscapeSeq = true
-		default:
-			length++
-		}
-	}
-
-	return length
-}
-
-// handleKey processes the given key and, optionally, returns a line of text
-// that the user has entered.
-func (t *Terminal) handleKey(key rune) (line string, ok bool) {
-	if t.pasteActive && key != keyEnter {
-		t.addKeyToLine(key)
-		return
-	}
-
-	switch key {
-	case keyBackspace:
-		if t.pos == 0 {
-			return
-		}
-		t.eraseNPreviousChars(1)
-	case keyAltLeft:
-		// move left by a word.
-		t.pos -= t.countToLeftWord()
-		t.moveCursorToPos(t.pos)
-	case keyAltRight:
-		// move right by a word.
-		t.pos += t.countToRightWord()
-		t.moveCursorToPos(t.pos)
-	case keyLeft:
-		if t.pos == 0 {
-			return
-		}
-		t.pos--
-		t.moveCursorToPos(t.pos)
-	case keyRight:
-		if t.pos == len(t.line) {
-			return
-		}
-		t.pos++
-		t.moveCursorToPos(t.pos)
-	case keyHome:
-		if t.pos == 0 {
-			return
-		}
-		t.pos = 0
-		t.moveCursorToPos(t.pos)
-	case keyEnd:
-		if t.pos == len(t.line) {
-			return
-		}
-		t.pos = len(t.line)
-		t.moveCursorToPos(t.pos)
-	case keyUp:
-		entry, ok := t.history.NthPreviousEntry(t.historyIndex + 1)
-		if !ok {
-			return "", false
-		}
-		if t.historyIndex == -1 {
-			t.historyPending = string(t.line)
-		}
-		t.historyIndex++
-		runes := []rune(entry)
-		t.setLine(runes, len(runes))
-	case keyDown:
-		switch t.historyIndex {
-		case -1:
-			return
-		case 0:
-			runes := []rune(t.historyPending)
-			t.setLine(runes, len(runes))
-			t.historyIndex--
-		default:
-			entry, ok := t.history.NthPreviousEntry(t.historyIndex - 1)
-			if ok {
-				t.historyIndex--
-				runes := []rune(entry)
-				t.setLine(runes, len(runes))
-			}
-		}
-	case keyEnter:
-		t.moveCursorToPos(len(t.line))
-		t.queue([]rune("\r\n"))
-		line = string(t.line)
-		ok = true
-		t.line = t.line[:0]
-		t.pos = 0
-		t.cursorX = 0
-		t.cursorY = 0
-		t.maxLine = 0
-	case keyDeleteWord:
-		// Delete zero or more spaces and then one or more characters.
-		t.eraseNPreviousChars(t.countToLeftWord())
-	case keyDeleteLine:
-		// Delete everything from the current cursor position to the
-		// end of line.
-		for i := t.pos; i < len(t.line); i++ {
-			t.queue(space)
-			t.advanceCursor(1)
-		}
-		t.line = t.line[:t.pos]
-		t.moveCursorToPos(t.pos)
-	case keyCtrlD:
-		// Erase the character under the current position.
-		// The EOF case when the line is empty is handled in
-		// readLine().
-		if t.pos < len(t.line) {
-			t.pos++
-			t.eraseNPreviousChars(1)
-		}
-	case keyCtrlU:
-		t.eraseNPreviousChars(t.pos)
-	case keyClearScreen:
-		// Erases the screen and moves the cursor to the home position.
-		t.queue([]rune("\x1b[2J\x1b[H"))
-		t.queue(t.prompt)
-		t.cursorX, t.cursorY = 0, 0
-		t.advanceCursor(visualLength(t.prompt))
-		t.setLine(t.line, t.pos)
-	default:
-		if t.AutoCompleteCallback != nil {
-			prefix := string(t.line[:t.pos])
-			suffix := string(t.line[t.pos:])
-
-			t.lock.Unlock()
-			newLine, newPos, completeOk := t.AutoCompleteCallback(prefix+suffix, len(prefix), key)
-			t.lock.Lock()
-
-			if completeOk {
-				t.setLine([]rune(newLine), utf8.RuneCount([]byte(newLine)[:newPos]))
-				return
-			}
-		}
-		if !isPrintable(key) {
-			return
-		}
-		if len(t.line) == maxLineLength {
-			return
-		}
-		t.addKeyToLine(key)
-	}
-	return
-}
-
-// addKeyToLine inserts the given key at the current position in the current
-// line.
-func (t *Terminal) addKeyToLine(key rune) {
-	if len(t.line) == cap(t.line) {
-		newLine := make([]rune, len(t.line), 2*(1+len(t.line)))
-		copy(newLine, t.line)
-		t.line = newLine
-	}
-	t.line = t.line[:len(t.line)+1]
-	copy(t.line[t.pos+1:], t.line[t.pos:])
-	t.line[t.pos] = key
-	if t.echo {
-		t.writeLine(t.line[t.pos:])
-	}
-	t.pos++
-	t.moveCursorToPos(t.pos)
-}
-
-func (t *Terminal) writeLine(line []rune) {
-	for len(line) != 0 {
-		remainingOnLine := t.termWidth - t.cursorX
-		todo := len(line)
-		if todo > remainingOnLine {
-			todo = remainingOnLine
-		}
-		t.queue(line[:todo])
-		t.advanceCursor(visualLength(line[:todo]))
-		line = line[todo:]
-	}
-}
-
-// writeWithCRLF writes buf to w but replaces all occurrences of \n with \r\n.
-func writeWithCRLF(w io.Writer, buf []byte) (n int, err error) {
-	for len(buf) > 0 {
-		i := bytes.IndexByte(buf, '\n')
-		todo := len(buf)
-		if i >= 0 {
-			todo = i
-		}
-
-		var nn int
-		nn, err = w.Write(buf[:todo])
-		n += nn
-		if err != nil {
-			return n, err
-		}
-		buf = buf[todo:]
-
-		if i >= 0 {
-			if _, err = w.Write(crlf); err != nil {
-				return n, err
-			}
-			n++
-			buf = buf[1:]
-		}
-	}
-
-	return n, nil
-}
-
-func (t *Terminal) Write(buf []byte) (n int, err error) {
-	t.lock.Lock()
-	defer t.lock.Unlock()
-
-	if t.cursorX == 0 && t.cursorY == 0 {
-		// This is the easy case: there's nothing on the screen that we
-		// have to move out of the way.
-		return writeWithCRLF(t.c, buf)
-	}
-
-	// We have a prompt and possibly user input on the screen. We
-	// have to clear it first.
-	t.move(0 /* up */, 0 /* down */, t.cursorX /* left */, 0 /* right */)
-	t.cursorX = 0
-	t.clearLineToRight()
-
-	for t.cursorY > 0 {
-		t.move(1 /* up */, 0, 0, 0)
-		t.cursorY--
-		t.clearLineToRight()
-	}
-
-	if _, err = t.c.Write(t.outBuf); err != nil {
-		return
-	}
-	t.outBuf = t.outBuf[:0]
-
-	if n, err = writeWithCRLF(t.c, buf); err != nil {
-		return
-	}
-
-	t.writeLine(t.prompt)
-	if t.echo {
-		t.writeLine(t.line)
-	}
-
-	t.moveCursorToPos(t.pos)
-
-	if _, err = t.c.Write(t.outBuf); err != nil {
-		return
-	}
-	t.outBuf = t.outBuf[:0]
-	return
-}
-
-// ReadPassword temporarily changes the prompt and reads a password, without
-// echo, from the terminal.
-func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
-	t.lock.Lock()
-	defer t.lock.Unlock()
-
-	oldPrompt := t.prompt
-	t.prompt = []rune(prompt)
-	t.echo = false
-
-	line, err = t.readLine()
-
-	t.prompt = oldPrompt
-	t.echo = true
-
-	return
-}
-
-// ReadLine returns a line of input from the terminal.
-func (t *Terminal) ReadLine() (line string, err error) {
-	t.lock.Lock()
-	defer t.lock.Unlock()
-
-	return t.readLine()
-}
-
-func (t *Terminal) readLine() (line string, err error) {
-	// t.lock must be held at this point
-
-	if t.cursorX == 0 && t.cursorY == 0 {
-		t.writeLine(t.prompt)
-		t.c.Write(t.outBuf)
-		t.outBuf = t.outBuf[:0]
-	}
-
-	lineIsPasted := t.pasteActive
-
-	for {
-		rest := t.remainder
-		lineOk := false
-		for !lineOk {
-			var key rune
-			key, rest = bytesToKey(rest, t.pasteActive)
-			if key == utf8.RuneError {
-				break
-			}
-			if !t.pasteActive {
-				if key == keyCtrlD {
-					if len(t.line) == 0 {
-						return "", io.EOF
-					}
-				}
-				if key == keyPasteStart {
-					t.pasteActive = true
-					if len(t.line) == 0 {
-						lineIsPasted = true
-					}
-					continue
-				}
-			} else if key == keyPasteEnd {
-				t.pasteActive = false
-				continue
-			}
-			if !t.pasteActive {
-				lineIsPasted = false
-			}
-			line, lineOk = t.handleKey(key)
-		}
-		if len(rest) > 0 {
-			n := copy(t.inBuf[:], rest)
-			t.remainder = t.inBuf[:n]
-		} else {
-			t.remainder = nil
-		}
-		t.c.Write(t.outBuf)
-		t.outBuf = t.outBuf[:0]
-		if lineOk {
-			if t.echo {
-				t.historyIndex = -1
-				t.history.Add(line)
-			}
-			if lineIsPasted {
-				err = ErrPasteIndicator
-			}
-			return
-		}
-
-		// t.remainder is a slice at the beginning of t.inBuf
-		// containing a partial key sequence
-		readBuf := t.inBuf[len(t.remainder):]
-		var n int
-
-		t.lock.Unlock()
-		n, err = t.c.Read(readBuf)
-		t.lock.Lock()
-
-		if err != nil {
-			return
-		}
-
-		t.remainder = t.inBuf[:n+len(t.remainder)]
-	}
-}
-
-// SetPrompt sets the prompt to be used when reading subsequent lines.
-func (t *Terminal) SetPrompt(prompt string) {
-	t.lock.Lock()
-	defer t.lock.Unlock()
-
-	t.prompt = []rune(prompt)
-}
-
-func (t *Terminal) clearAndRepaintLinePlusNPrevious(numPrevLines int) {
-	// Move cursor to column zero at the start of the line.
-	t.move(t.cursorY, 0, t.cursorX, 0)
-	t.cursorX, t.cursorY = 0, 0
-	t.clearLineToRight()
-	for t.cursorY < numPrevLines {
-		// Move down a line
-		t.move(0, 1, 0, 0)
-		t.cursorY++
-		t.clearLineToRight()
-	}
-	// Move back to beginning.
-	t.move(t.cursorY, 0, 0, 0)
-	t.cursorX, t.cursorY = 0, 0
-
-	t.queue(t.prompt)
-	t.advanceCursor(visualLength(t.prompt))
-	t.writeLine(t.line)
-	t.moveCursorToPos(t.pos)
-}
-
-func (t *Terminal) SetSize(width, height int) error {
-	t.lock.Lock()
-	defer t.lock.Unlock()
-
-	if width == 0 {
-		width = 1
-	}
-
-	oldWidth := t.termWidth
-	t.termWidth, t.termHeight = width, height
-
-	switch {
-	case width == oldWidth:
-		// If the width didn't change then nothing else needs to be
-		// done.
-		return nil
-	case len(t.line) == 0 && t.cursorX == 0 && t.cursorY == 0:
-		// If there is nothing on current line and no prompt printed,
-		// just do nothing
-		return nil
-	case width < oldWidth:
-		// Some terminals (e.g. xterm) will truncate lines that were
-		// too long when shinking. Others, (e.g. gnome-terminal) will
-		// attempt to wrap them. For the former, repainting t.maxLine
-		// works great, but that behaviour goes badly wrong in the case
-		// of the latter because they have doubled every full line.
-
-		// We assume that we are working on a terminal that wraps lines
-		// and adjust the cursor position based on every previous line
-		// wrapping and turning into two. This causes the prompt on
-		// xterms to move upwards, which isn't great, but it avoids a
-		// huge mess with gnome-terminal.
-		if t.cursorX >= t.termWidth {
-			t.cursorX = t.termWidth - 1
-		}
-		t.cursorY *= 2
-		t.clearAndRepaintLinePlusNPrevious(t.maxLine * 2)
-	case width > oldWidth:
-		// If the terminal expands then our position calculations will
-		// be wrong in the future because we think the cursor is
-		// |t.pos| chars into the string, but there will be a gap at
-		// the end of any wrapped line.
-		//
-		// But the position will actually be correct until we move, so
-		// we can move back to the beginning and repaint everything.
-		t.clearAndRepaintLinePlusNPrevious(t.maxLine)
-	}
-
-	_, err := t.c.Write(t.outBuf)
-	t.outBuf = t.outBuf[:0]
-	return err
-}
-
-type pasteIndicatorError struct{}
-
-func (pasteIndicatorError) Error() string {
-	return "terminal: ErrPasteIndicator not correctly handled"
-}
-
-// ErrPasteIndicator may be returned from ReadLine as the error, in addition
-// to valid line data. It indicates that bracketed paste mode is enabled and
-// that the returned line consists only of pasted data. Programs may wish to
-// interpret pasted data more literally than typed data.
-var ErrPasteIndicator = pasteIndicatorError{}
-
-// SetBracketedPasteMode requests that the terminal bracket paste operations
-// with markers. Not all terminals support this but, if it is supported, then
-// enabling this mode will stop any autocomplete callback from running due to
-// pastes. Additionally, any lines that are completely pasted will be returned
-// from ReadLine with the error set to ErrPasteIndicator.
-func (t *Terminal) SetBracketedPasteMode(on bool) {
-	if on {
-		io.WriteString(t.c, "\x1b[?2004h")
-	} else {
-		io.WriteString(t.c, "\x1b[?2004l")
-	}
-}
-
-// stRingBuffer is a ring buffer of strings.
-type stRingBuffer struct {
-	// entries contains max elements.
-	entries []string
-	max     int
-	// head contains the index of the element most recently added to the ring.
-	head int
-	// size contains the number of elements in the ring.
-	size int
-}
-
-func (s *stRingBuffer) Add(a string) {
-	if s.entries == nil {
-		const defaultNumEntries = 100
-		s.entries = make([]string, defaultNumEntries)
-		s.max = defaultNumEntries
-	}
-
-	s.head = (s.head + 1) % s.max
-	s.entries[s.head] = a
-	if s.size < s.max {
-		s.size++
-	}
-}
-
-// NthPreviousEntry returns the value passed to the nth previous call to Add.
-// If n is zero then the immediately prior value is returned, if one, then the
-// next most recent, and so on. If such an element doesn't exist then ok is
-// false.
-func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
-	if n >= s.size {
-		return "", false
-	}
-	index := s.head - n
-	if index < 0 {
-		index += s.max
-	}
-	return s.entries[index], true
-}
-
-// readPasswordLine reads from reader until it finds \n or io.EOF.
-// The slice returned does not include the \n.
-// readPasswordLine also ignores any \r it finds.
-func readPasswordLine(reader io.Reader) ([]byte, error) {
-	var buf [1]byte
-	var ret []byte
-
-	for {
-		n, err := reader.Read(buf[:])
-		if n > 0 {
-			switch buf[0] {
-			case '\n':
-				return ret, nil
-			case '\r':
-				// remove \r from passwords on Windows
-			default:
-				ret = append(ret, buf[0])
-			}
-			continue
-		}
-		if err != nil {
-			if err == io.EOF && len(ret) > 0 {
-				return ret, nil
-			}
-			return ret, err
-		}
-	}
-}

+ 0 - 114
vendor/golang.org/x/crypto/ssh/terminal/util.go

@@ -1,114 +0,0 @@
-// Copyright 2011 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 darwin dragonfly freebsd linux,!appengine netbsd openbsd
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// 	oldState, err := terminal.MakeRaw(0)
-// 	if err != nil {
-// 	        panic(err)
-// 	}
-// 	defer terminal.Restore(0, oldState)
-package terminal // import "golang.org/x/crypto/ssh/terminal"
-
-import (
-	"golang.org/x/sys/unix"
-)
-
-// State contains the state of a terminal.
-type State struct {
-	termios unix.Termios
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
-	_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
-	return err == nil
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
-	termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
-	if err != nil {
-		return nil, err
-	}
-
-	oldState := State{termios: *termios}
-
-	// This attempts to replicate the behaviour documented for cfmakeraw in
-	// the termios(3) manpage.
-	termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
-	termios.Oflag &^= unix.OPOST
-	termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
-	termios.Cflag &^= unix.CSIZE | unix.PARENB
-	termios.Cflag |= unix.CS8
-	termios.Cc[unix.VMIN] = 1
-	termios.Cc[unix.VTIME] = 0
-	if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, termios); err != nil {
-		return nil, err
-	}
-
-	return &oldState, nil
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
-	termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
-	if err != nil {
-		return nil, err
-	}
-
-	return &State{termios: *termios}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
-	return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios)
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
-	ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
-	if err != nil {
-		return -1, -1, err
-	}
-	return int(ws.Col), int(ws.Row), nil
-}
-
-// passwordReader is an io.Reader that reads from a specific file descriptor.
-type passwordReader int
-
-func (r passwordReader) Read(buf []byte) (int, error) {
-	return unix.Read(int(r), buf)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo.  This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
-	termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
-	if err != nil {
-		return nil, err
-	}
-
-	newState := *termios
-	newState.Lflag &^= unix.ECHO
-	newState.Lflag |= unix.ICANON | unix.ISIG
-	newState.Iflag |= unix.ICRNL
-	if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, &newState); err != nil {
-		return nil, err
-	}
-
-	defer unix.IoctlSetTermios(fd, ioctlWriteTermios, termios)
-
-	return readPasswordLine(passwordReader(fd))
-}

+ 0 - 12
vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go

@@ -1,12 +0,0 @@
-// Copyright 2013 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 darwin dragonfly freebsd netbsd openbsd
-
-package terminal
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TIOCGETA
-const ioctlWriteTermios = unix.TIOCSETA

+ 0 - 10
vendor/golang.org/x/crypto/ssh/terminal/util_linux.go

@@ -1,10 +0,0 @@
-// Copyright 2013 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.
-
-package terminal
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TCGETS
-const ioctlWriteTermios = unix.TCSETS

+ 0 - 58
vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go

@@ -1,58 +0,0 @@
-// Copyright 2016 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.
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// 	oldState, err := terminal.MakeRaw(0)
-// 	if err != nil {
-// 	        panic(err)
-// 	}
-// 	defer terminal.Restore(0, oldState)
-package terminal
-
-import (
-	"fmt"
-	"runtime"
-)
-
-type State struct{}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
-	return false
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
-	return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
-	return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
-	return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
-	return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo.  This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
-	return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}

+ 0 - 124
vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go

@@ -1,124 +0,0 @@
-// Copyright 2015 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 solaris
-
-package terminal // import "golang.org/x/crypto/ssh/terminal"
-
-import (
-	"golang.org/x/sys/unix"
-	"io"
-	"syscall"
-)
-
-// State contains the state of a terminal.
-type State struct {
-	termios unix.Termios
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
-	_, err := unix.IoctlGetTermio(fd, unix.TCGETA)
-	return err == nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo.  This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
-	// see also: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libast/common/uwin/getpass.c
-	val, err := unix.IoctlGetTermios(fd, unix.TCGETS)
-	if err != nil {
-		return nil, err
-	}
-	oldState := *val
-
-	newState := oldState
-	newState.Lflag &^= syscall.ECHO
-	newState.Lflag |= syscall.ICANON | syscall.ISIG
-	newState.Iflag |= syscall.ICRNL
-	err = unix.IoctlSetTermios(fd, unix.TCSETS, &newState)
-	if err != nil {
-		return nil, err
-	}
-
-	defer unix.IoctlSetTermios(fd, unix.TCSETS, &oldState)
-
-	var buf [16]byte
-	var ret []byte
-	for {
-		n, err := syscall.Read(fd, buf[:])
-		if err != nil {
-			return nil, err
-		}
-		if n == 0 {
-			if len(ret) == 0 {
-				return nil, io.EOF
-			}
-			break
-		}
-		if buf[n-1] == '\n' {
-			n--
-		}
-		ret = append(ret, buf[:n]...)
-		if n < len(buf) {
-			break
-		}
-	}
-
-	return ret, nil
-}
-
-// MakeRaw puts the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-// see http://cr.illumos.org/~webrev/andy_js/1060/
-func MakeRaw(fd int) (*State, error) {
-	termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
-	if err != nil {
-		return nil, err
-	}
-
-	oldState := State{termios: *termios}
-
-	termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
-	termios.Oflag &^= unix.OPOST
-	termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
-	termios.Cflag &^= unix.CSIZE | unix.PARENB
-	termios.Cflag |= unix.CS8
-	termios.Cc[unix.VMIN] = 1
-	termios.Cc[unix.VTIME] = 0
-
-	if err := unix.IoctlSetTermios(fd, unix.TCSETS, termios); err != nil {
-		return nil, err
-	}
-
-	return &oldState, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, oldState *State) error {
-	return unix.IoctlSetTermios(fd, unix.TCSETS, &oldState.termios)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
-	termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
-	if err != nil {
-		return nil, err
-	}
-
-	return &State{termios: *termios}, nil
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
-	ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
-	if err != nil {
-		return 0, 0, err
-	}
-	return int(ws.Col), int(ws.Row), nil
-}

+ 0 - 103
vendor/golang.org/x/crypto/ssh/terminal/util_windows.go

@@ -1,103 +0,0 @@
-// Copyright 2011 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 windows
-
-// Package terminal provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// 	oldState, err := terminal.MakeRaw(0)
-// 	if err != nil {
-// 	        panic(err)
-// 	}
-// 	defer terminal.Restore(0, oldState)
-package terminal
-
-import (
-	"os"
-
-	"golang.org/x/sys/windows"
-)
-
-type State struct {
-	mode uint32
-}
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
-	var st uint32
-	err := windows.GetConsoleMode(windows.Handle(fd), &st)
-	return err == nil
-}
-
-// MakeRaw put the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
-	var st uint32
-	if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
-		return nil, err
-	}
-	raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
-	if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
-		return nil, err
-	}
-	return &State{st}, nil
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
-	var st uint32
-	if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
-		return nil, err
-	}
-	return &State{st}, nil
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, state *State) error {
-	return windows.SetConsoleMode(windows.Handle(fd), state.mode)
-}
-
-// GetSize returns the dimensions of the given terminal.
-func GetSize(fd int) (width, height int, err error) {
-	var info windows.ConsoleScreenBufferInfo
-	if err := windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info); err != nil {
-		return 0, 0, err
-	}
-	return int(info.Size.X), int(info.Size.Y), nil
-}
-
-// ReadPassword reads a line of input from a terminal without local echo.  This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
-	var st uint32
-	if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
-		return nil, err
-	}
-	old := st
-
-	st &^= (windows.ENABLE_ECHO_INPUT)
-	st |= (windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
-	if err := windows.SetConsoleMode(windows.Handle(fd), st); err != nil {
-		return nil, err
-	}
-
-	defer windows.SetConsoleMode(windows.Handle(fd), old)
-
-	var h windows.Handle
-	p, _ := windows.GetCurrentProcess()
-	if err := windows.DuplicateHandle(p, windows.Handle(fd), p, &h, 0, false, windows.DUPLICATE_SAME_ACCESS); err != nil {
-		return nil, err
-	}
-
-	f := os.NewFile(uintptr(h), "stdin")
-	defer f.Close()
-	return readPasswordLine(f)
-}

+ 0 - 27
vendor/golang.org/x/sys/LICENSE

@@ -1,27 +0,0 @@
-Copyright (c) 2009 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.

+ 0 - 22
vendor/golang.org/x/sys/PATENTS

@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go.  This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation.  If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.

+ 0 - 173
vendor/golang.org/x/sys/unix/README.md

@@ -1,173 +0,0 @@
-# Building `sys/unix`
-
-The sys/unix package provides access to the raw system call interface of the
-underlying operating system. See: https://godoc.org/golang.org/x/sys/unix
-
-Porting Go to a new architecture/OS combination or adding syscalls, types, or
-constants to an existing architecture/OS pair requires some manual effort;
-however, there are tools that automate much of the process.
-
-## Build Systems
-
-There are currently two ways we generate the necessary files. We are currently
-migrating the build system to use containers so the builds are reproducible.
-This is being done on an OS-by-OS basis. Please update this documentation as
-components of the build system change.
-
-### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`)
-
-The old build system generates the Go files based on the C header files
-present on your system. This means that files
-for a given GOOS/GOARCH pair must be generated on a system with that OS and
-architecture. This also means that the generated code can differ from system
-to system, based on differences in the header files.
-
-To avoid this, if you are using the old build system, only generate the Go
-files on an installation with unmodified header files. It is also important to
-keep track of which version of the OS the files were generated from (ex.
-Darwin 14 vs Darwin 15). This makes it easier to track the progress of changes
-and have each OS upgrade correspond to a single change.
-
-To build the files for your current OS and architecture, make sure GOOS and
-GOARCH are set correctly and run `mkall.sh`. This will generate the files for
-your specific system. Running `mkall.sh -n` shows the commands that will be run.
-
-Requirements: bash, perl, go
-
-### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`)
-
-The new build system uses a Docker container to generate the go files directly
-from source checkouts of the kernel and various system libraries. This means
-that on any platform that supports Docker, all the files using the new build
-system can be generated at once, and generated files will not change based on
-what the person running the scripts has installed on their computer.
-
-The OS specific files for the new build system are located in the `${GOOS}`
-directory, and the build is coordinated by the `${GOOS}/mkall.go` program. When
-the kernel or system library updates, modify the Dockerfile at
-`${GOOS}/Dockerfile` to checkout the new release of the source.
-
-To build all the files under the new build system, you must be on an amd64/Linux
-system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
-then generate all of the files for all of the GOOS/GOARCH pairs in the new build
-system. Running `mkall.sh -n` shows the commands that will be run.
-
-Requirements: bash, perl, go, docker
-
-## Component files
-
-This section describes the various files used in the code generation process.
-It also contains instructions on how to modify these files to add a new
-architecture/OS or to add additional syscalls, types, or constants. Note that
-if you are using the new build system, the scripts cannot be called normally.
-They must be called from within the docker container.
-
-### asm files
-
-The hand-written assembly file at `asm_${GOOS}_${GOARCH}.s` implements system
-call dispatch. There are three entry points:
-```
-  func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
-  func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
-  func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
-```
-The first and second are the standard ones; they differ only in how many
-arguments can be passed to the kernel. The third is for low-level use by the
-ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
-let it know that a system call is running.
-
-When porting Go to an new architecture/OS, this file must be implemented for
-each GOOS/GOARCH pair.
-
-### mksysnum
-
-Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl`
-for the old system). This script takes in a list of header files containing the
-syscall number declarations and parses them to produce the corresponding list of
-Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
-constants.
-
-Adding new syscall numbers is mostly done by running the build on a sufficiently
-new installation of the target OS (or updating the source checkouts for the
-new build system). However, depending on the OS, you make need to update the
-parsing in mksysnum.
-
-### mksyscall.pl
-
-The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
-hand-written Go files which implement system calls (for unix, the specific OS,
-or the specific OS/Architecture pair respectively) that need special handling
-and list `//sys` comments giving prototypes for ones that can be generated.
-
-The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts
-them into syscalls. This requires the name of the prototype in the comment to
-match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
-prototype can be exported (capitalized) or not.
-
-Adding a new syscall often just requires adding a new `//sys` function prototype
-with the desired arguments and a capitalized name so it is exported. However, if
-you want the interface to the syscall to be different, often one will make an
-unexported `//sys` prototype, an then write a custom wrapper in
-`syscall_${GOOS}.go`.
-
-### types files
-
-For each OS, there is a hand-written Go file at `${GOOS}/types.go` (or
-`types_${GOOS}.go` on the old system). This file includes standard C headers and
-creates Go type aliases to the corresponding C types. The file is then fed
-through godef to get the Go compatible definitions. Finally, the generated code
-is fed though mkpost.go to format the code correctly and remove any hidden or
-private identifiers. This cleaned-up code is written to
-`ztypes_${GOOS}_${GOARCH}.go`.
-
-The hardest part about preparing this file is figuring out which headers to
-include and which symbols need to be `#define`d to get the actual data
-structures that pass through to the kernel system calls. Some C libraries
-preset alternate versions for binary compatibility and translate them on the
-way in and out of system calls, but there is almost always a `#define` that can
-get the real ones.
-See `types_darwin.go` and `linux/types.go` for examples.
-
-To add a new type, add in the necessary include statement at the top of the
-file (if it is not already there) and add in a type alias line. Note that if
-your type is significantly different on different architectures, you may need
-some `#if/#elif` macros in your include statements.
-
-### mkerrors.sh
-
-This script is used to generate the system's various constants. This doesn't
-just include the error numbers and error strings, but also the signal numbers
-an a wide variety of miscellaneous constants. The constants come from the list
-of include files in the `includes_${uname}` variable. A regex then picks out
-the desired `#define` statements, and generates the corresponding Go constants.
-The error numbers and strings are generated from `#include <errno.h>`, and the
-signal numbers and strings are generated from `#include <signal.h>`. All of
-these constants are written to `zerrors_${GOOS}_${GOARCH}.go` via a C program,
-`_errors.c`, which prints out all the constants.
-
-To add a constant, add the header that includes it to the appropriate variable.
-Then, edit the regex (if necessary) to match the desired constant. Avoid making
-the regex too broad to avoid matching unintended constants.
-
-
-## Generated files
-
-### `zerror_${GOOS}_${GOARCH}.go`
-
-A file containing all of the system's generated error numbers, error strings,
-signal numbers, and constants. Generated by `mkerrors.sh` (see above).
-
-### `zsyscall_${GOOS}_${GOARCH}.go`
-
-A file containing all the generated syscalls for a specific GOOS and GOARCH.
-Generated by `mksyscall.pl` (see above).
-
-### `zsysnum_${GOOS}_${GOARCH}.go`
-
-A list of numeric constants for all the syscall number of the specific GOOS
-and GOARCH. Generated by mksysnum (see above).
-
-### `ztypes_${GOOS}_${GOARCH}.go`
-
-A file containing Go types for passing into (or returning from) syscalls.
-Generated by godefs and the types file (see above).

+ 0 - 124
vendor/golang.org/x/sys/unix/affinity_linux.go

@@ -1,124 +0,0 @@
-// Copyright 2018 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.
-
-// CPU affinity functions
-
-package unix
-
-import (
-	"unsafe"
-)
-
-const cpuSetSize = _CPU_SETSIZE / _NCPUBITS
-
-// CPUSet represents a CPU affinity mask.
-type CPUSet [cpuSetSize]cpuMask
-
-func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
-	_, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set)))
-	if e != 0 {
-		return errnoErr(e)
-	}
-	return nil
-}
-
-// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
-// If pid is 0 the calling thread is used.
-func SchedGetaffinity(pid int, set *CPUSet) error {
-	return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set)
-}
-
-// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
-// If pid is 0 the calling thread is used.
-func SchedSetaffinity(pid int, set *CPUSet) error {
-	return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set)
-}
-
-// Zero clears the set s, so that it contains no CPUs.
-func (s *CPUSet) Zero() {
-	for i := range s {
-		s[i] = 0
-	}
-}
-
-func cpuBitsIndex(cpu int) int {
-	return cpu / _NCPUBITS
-}
-
-func cpuBitsMask(cpu int) cpuMask {
-	return cpuMask(1 << (uint(cpu) % _NCPUBITS))
-}
-
-// Set adds cpu to the set s.
-func (s *CPUSet) Set(cpu int) {
-	i := cpuBitsIndex(cpu)
-	if i < len(s) {
-		s[i] |= cpuBitsMask(cpu)
-	}
-}
-
-// Clear removes cpu from the set s.
-func (s *CPUSet) Clear(cpu int) {
-	i := cpuBitsIndex(cpu)
-	if i < len(s) {
-		s[i] &^= cpuBitsMask(cpu)
-	}
-}
-
-// IsSet reports whether cpu is in the set s.
-func (s *CPUSet) IsSet(cpu int) bool {
-	i := cpuBitsIndex(cpu)
-	if i < len(s) {
-		return s[i]&cpuBitsMask(cpu) != 0
-	}
-	return false
-}
-
-// Count returns the number of CPUs in the set s.
-func (s *CPUSet) Count() int {
-	c := 0
-	for _, b := range s {
-		c += onesCount64(uint64(b))
-	}
-	return c
-}
-
-// onesCount64 is a copy of Go 1.9's math/bits.OnesCount64.
-// Once this package can require Go 1.9, we can delete this
-// and update the caller to use bits.OnesCount64.
-func onesCount64(x uint64) int {
-	const m0 = 0x5555555555555555 // 01010101 ...
-	const m1 = 0x3333333333333333 // 00110011 ...
-	const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ...
-	const m3 = 0x00ff00ff00ff00ff // etc.
-	const m4 = 0x0000ffff0000ffff
-
-	// Implementation: Parallel summing of adjacent bits.
-	// See "Hacker's Delight", Chap. 5: Counting Bits.
-	// The following pattern shows the general approach:
-	//
-	//   x = x>>1&(m0&m) + x&(m0&m)
-	//   x = x>>2&(m1&m) + x&(m1&m)
-	//   x = x>>4&(m2&m) + x&(m2&m)
-	//   x = x>>8&(m3&m) + x&(m3&m)
-	//   x = x>>16&(m4&m) + x&(m4&m)
-	//   x = x>>32&(m5&m) + x&(m5&m)
-	//   return int(x)
-	//
-	// Masking (& operations) can be left away when there's no
-	// danger that a field's sum will carry over into the next
-	// field: Since the result cannot be > 64, 8 bits is enough
-	// and we can ignore the masks for the shifts by 8 and up.
-	// Per "Hacker's Delight", the first line can be simplified
-	// more, but it saves at best one instruction, so we leave
-	// it alone for clarity.
-	const m = 1<<64 - 1
-	x = x>>1&(m0&m) + x&(m0&m)
-	x = x>>2&(m1&m) + x&(m1&m)
-	x = (x>>4 + x) & (m2 & m)
-	x += x >> 8
-	x += x >> 16
-	x += x >> 32
-	return int(x) & (1<<7 - 1)
-}

+ 0 - 14
vendor/golang.org/x/sys/unix/aliases.go

@@ -1,14 +0,0 @@
-// Copyright 2018 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 aix darwin dragonfly freebsd linux netbsd openbsd solaris
-// +build go1.9
-
-package unix
-
-import "syscall"
-
-type Signal = syscall.Signal
-type Errno = syscall.Errno
-type SysProcAttr = syscall.SysProcAttr

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_darwin_386.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-52
-	JMP	syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_darwin_amd64.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-56
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-104
-	JMP	syscall·Syscall9(SB)
-
-TEXT	·RawSyscall(SB),NOSPLIT,$0-56
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 30
vendor/golang.org/x/sys/unix/asm_darwin_arm.s

@@ -1,30 +0,0 @@
-// Copyright 2015 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 !gccgo
-// +build arm,darwin
-
-#include "textflag.h"
-
-//
-// System call support for ARM, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	B	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	B	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-52
-	B	syscall·Syscall9(SB)
-
-TEXT	·RawSyscall(SB),NOSPLIT,$0-28
-	B	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	B	syscall·RawSyscall6(SB)

+ 0 - 30
vendor/golang.org/x/sys/unix/asm_darwin_arm64.s

@@ -1,30 +0,0 @@
-// Copyright 2015 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 !gccgo
-// +build arm64,darwin
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-56
-	B	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-80
-	B	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-104
-	B	syscall·Syscall9(SB)
-
-TEXT	·RawSyscall(SB),NOSPLIT,$0-56
-	B	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
-	B	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, DragonFly
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-56
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-104
-	JMP	syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_freebsd_386.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-52
-	JMP	syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-56
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-104
-	JMP	syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_freebsd_arm.s

@@ -1,29 +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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	B	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	B	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-52
-	B	syscall·Syscall9(SB)
-
-TEXT	·RawSyscall(SB),NOSPLIT,$0-28
-	B	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	B	syscall·RawSyscall6(SB)

+ 0 - 65
vendor/golang.org/x/sys/unix/asm_linux_386.s

@@ -1,65 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for 386, Linux
-//
-
-// See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
-// instead of the glibc-specific "CALL 0x10(GS)".
-#define INVOKE_SYSCALL	INT	$0x80
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
-	JMP	syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
-	CALL	runtime·entersyscall(SB)
-	MOVL	trap+0(FP), AX  // syscall entry
-	MOVL	a1+4(FP), BX
-	MOVL	a2+8(FP), CX
-	MOVL	a3+12(FP), DX
-	MOVL	$0, SI
-	MOVL	$0, DI
-	INVOKE_SYSCALL
-	MOVL	AX, r1+16(FP)
-	MOVL	DX, r2+20(FP)
-	CALL	runtime·exitsyscall(SB)
-	RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
-	JMP	syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
-	MOVL	trap+0(FP), AX  // syscall entry
-	MOVL	a1+4(FP), BX
-	MOVL	a2+8(FP), CX
-	MOVL	a3+12(FP), DX
-	MOVL	$0, SI
-	MOVL	$0, DI
-	INVOKE_SYSCALL
-	MOVL	AX, r1+16(FP)
-	MOVL	DX, r2+20(FP)
-	RET
-
-TEXT ·socketcall(SB),NOSPLIT,$0-36
-	JMP	syscall·socketcall(SB)
-
-TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
-	JMP	syscall·rawsocketcall(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-28
-	JMP	syscall·seek(SB)

+ 0 - 57
vendor/golang.org/x/sys/unix/asm_linux_amd64.s

@@ -1,57 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for AMD64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
-	JMP	syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
-	CALL	runtime·entersyscall(SB)
-	MOVQ	a1+8(FP), DI
-	MOVQ	a2+16(FP), SI
-	MOVQ	a3+24(FP), DX
-	MOVQ	$0, R10
-	MOVQ	$0, R8
-	MOVQ	$0, R9
-	MOVQ	trap+0(FP), AX	// syscall entry
-	SYSCALL
-	MOVQ	AX, r1+32(FP)
-	MOVQ	DX, r2+40(FP)
-	CALL	runtime·exitsyscall(SB)
-	RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
-	JMP	syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
-	MOVQ	a1+8(FP), DI
-	MOVQ	a2+16(FP), SI
-	MOVQ	a3+24(FP), DX
-	MOVQ	$0, R10
-	MOVQ	$0, R8
-	MOVQ	$0, R9
-	MOVQ	trap+0(FP), AX	// syscall entry
-	SYSCALL
-	MOVQ	AX, r1+32(FP)
-	MOVQ	DX, r2+40(FP)
-	RET
-
-TEXT ·gettimeofday(SB),NOSPLIT,$0-16
-	JMP	syscall·gettimeofday(SB)

+ 0 - 56
vendor/golang.org/x/sys/unix/asm_linux_arm.s

@@ -1,56 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for arm, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
-	B	syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
-	B	syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
-	BL	runtime·entersyscall(SB)
-	MOVW	trap+0(FP), R7
-	MOVW	a1+4(FP), R0
-	MOVW	a2+8(FP), R1
-	MOVW	a3+12(FP), R2
-	MOVW	$0, R3
-	MOVW	$0, R4
-	MOVW	$0, R5
-	SWI	$0
-	MOVW	R0, r1+16(FP)
-	MOVW	$0, R0
-	MOVW	R0, r2+20(FP)
-	BL	runtime·exitsyscall(SB)
-	RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
-	B	syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
-	B	syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
-	MOVW	trap+0(FP), R7	// syscall entry
-	MOVW	a1+4(FP), R0
-	MOVW	a2+8(FP), R1
-	MOVW	a3+12(FP), R2
-	SWI	$0
-	MOVW	R0, r1+16(FP)
-	MOVW	$0, R0
-	MOVW	R0, r2+20(FP)
-	RET
-
-TEXT ·seek(SB),NOSPLIT,$0-28
-	B	syscall·seek(SB)

+ 0 - 52
vendor/golang.org/x/sys/unix/asm_linux_arm64.s

@@ -1,52 +0,0 @@
-// Copyright 2015 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 linux
-// +build arm64
-// +build !gccgo
-
-#include "textflag.h"
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
-	B	syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
-	B	syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
-	BL	runtime·entersyscall(SB)
-	MOVD	a1+8(FP), R0
-	MOVD	a2+16(FP), R1
-	MOVD	a3+24(FP), R2
-	MOVD	$0, R3
-	MOVD	$0, R4
-	MOVD	$0, R5
-	MOVD	trap+0(FP), R8	// syscall entry
-	SVC
-	MOVD	R0, r1+32(FP)	// r1
-	MOVD	R1, r2+40(FP)	// r2
-	BL	runtime·exitsyscall(SB)
-	RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
-	B	syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
-	B	syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
-	MOVD	a1+8(FP), R0
-	MOVD	a2+16(FP), R1
-	MOVD	a3+24(FP), R2
-	MOVD	$0, R3
-	MOVD	$0, R4
-	MOVD	$0, R5
-	MOVD	trap+0(FP), R8	// syscall entry
-	SVC
-	MOVD	R0, r1+32(FP)
-	MOVD	R1, r2+40(FP)
-	RET

+ 0 - 56
vendor/golang.org/x/sys/unix/asm_linux_mips64x.s

@@ -1,56 +0,0 @@
-// Copyright 2015 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 linux
-// +build mips64 mips64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for mips64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
-	JMP	syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
-	JAL	runtime·entersyscall(SB)
-	MOVV	a1+8(FP), R4
-	MOVV	a2+16(FP), R5
-	MOVV	a3+24(FP), R6
-	MOVV	R0, R7
-	MOVV	R0, R8
-	MOVV	R0, R9
-	MOVV	trap+0(FP), R2	// syscall entry
-	SYSCALL
-	MOVV	R2, r1+32(FP)
-	MOVV	R3, r2+40(FP)
-	JAL	runtime·exitsyscall(SB)
-	RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
-	JMP	syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
-	MOVV	a1+8(FP), R4
-	MOVV	a2+16(FP), R5
-	MOVV	a3+24(FP), R6
-	MOVV	R0, R7
-	MOVV	R0, R8
-	MOVV	R0, R9
-	MOVV	trap+0(FP), R2	// syscall entry
-	SYSCALL
-	MOVV	R2, r1+32(FP)
-	MOVV	R3, r2+40(FP)
-	RET

+ 0 - 54
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s

@@ -1,54 +0,0 @@
-// Copyright 2016 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 linux
-// +build mips mipsle
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for mips, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
-	JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
-	JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
-	JMP syscall·Syscall9(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
-	JAL	runtime·entersyscall(SB)
-	MOVW	a1+4(FP), R4
-	MOVW	a2+8(FP), R5
-	MOVW	a3+12(FP), R6
-	MOVW	R0, R7
-	MOVW	trap+0(FP), R2	// syscall entry
-	SYSCALL
-	MOVW	R2, r1+16(FP)	// r1
-	MOVW	R3, r2+20(FP)	// r2
-	JAL	runtime·exitsyscall(SB)
-	RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
-	JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
-	JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
-	MOVW	a1+4(FP), R4
-	MOVW	a2+8(FP), R5
-	MOVW	a3+12(FP), R6
-	MOVW	trap+0(FP), R2	// syscall entry
-	SYSCALL
-	MOVW	R2, r1+16(FP)
-	MOVW	R3, r2+20(FP)
-	RET

+ 0 - 56
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s

@@ -1,56 +0,0 @@
-// Copyright 2014 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 linux
-// +build ppc64 ppc64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for ppc64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
-	BR	syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
-	BR	syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
-	BL	runtime·entersyscall(SB)
-	MOVD	a1+8(FP), R3
-	MOVD	a2+16(FP), R4
-	MOVD	a3+24(FP), R5
-	MOVD	R0, R6
-	MOVD	R0, R7
-	MOVD	R0, R8
-	MOVD	trap+0(FP), R9	// syscall entry
-	SYSCALL R9
-	MOVD	R3, r1+32(FP)
-	MOVD	R4, r2+40(FP)
-	BL	runtime·exitsyscall(SB)
-	RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
-	BR	syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
-	BR	syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
-	MOVD	a1+8(FP), R3
-	MOVD	a2+16(FP), R4
-	MOVD	a3+24(FP), R5
-	MOVD	R0, R6
-	MOVD	R0, R7
-	MOVD	R0, R8
-	MOVD	trap+0(FP), R9	// syscall entry
-	SYSCALL R9
-	MOVD	R3, r1+32(FP)
-	MOVD	R4, r2+40(FP)
-	RET

+ 0 - 56
vendor/golang.org/x/sys/unix/asm_linux_s390x.s

@@ -1,56 +0,0 @@
-// Copyright 2016 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 s390x
-// +build linux
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for s390x, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
-	BR	syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
-	BR	syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
-	BL	runtime·entersyscall(SB)
-	MOVD	a1+8(FP), R2
-	MOVD	a2+16(FP), R3
-	MOVD	a3+24(FP), R4
-	MOVD	$0, R5
-	MOVD	$0, R6
-	MOVD	$0, R7
-	MOVD	trap+0(FP), R1	// syscall entry
-	SYSCALL
-	MOVD	R2, r1+32(FP)
-	MOVD	R3, r2+40(FP)
-	BL	runtime·exitsyscall(SB)
-	RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
-	BR	syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
-	BR	syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
-	MOVD	a1+8(FP), R2
-	MOVD	a2+16(FP), R3
-	MOVD	a3+24(FP), R4
-	MOVD	$0, R5
-	MOVD	$0, R6
-	MOVD	$0, R7
-	MOVD	trap+0(FP), R1	// syscall entry
-	SYSCALL
-	MOVD	R2, r1+32(FP)
-	MOVD	R3, r2+40(FP)
-	RET

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_netbsd_386.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-52
-	JMP	syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-56
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-104
-	JMP	syscall·Syscall9(SB)
-
-TEXT	·RawSyscall(SB),NOSPLIT,$0-56
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_netbsd_arm.s

@@ -1,29 +0,0 @@
-// Copyright 2013 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	B	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	B	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-52
-	B	syscall·Syscall9(SB)
-
-TEXT	·RawSyscall(SB),NOSPLIT,$0-28
-	B	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	B	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_openbsd_386.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-52
-	JMP	syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s

@@ -1,29 +0,0 @@
-// Copyright 2009 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-56
-	JMP	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-104
-	JMP	syscall·Syscall9(SB)
-
-TEXT	·RawSyscall(SB),NOSPLIT,$0-56
-	JMP	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-80
-	JMP	syscall·RawSyscall6(SB)

+ 0 - 29
vendor/golang.org/x/sys/unix/asm_openbsd_arm.s

@@ -1,29 +0,0 @@
-// Copyright 2017 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT	·Syscall(SB),NOSPLIT,$0-28
-	B	syscall·Syscall(SB)
-
-TEXT	·Syscall6(SB),NOSPLIT,$0-40
-	B	syscall·Syscall6(SB)
-
-TEXT	·Syscall9(SB),NOSPLIT,$0-52
-	B	syscall·Syscall9(SB)
-
-TEXT	·RawSyscall(SB),NOSPLIT,$0-28
-	B	syscall·RawSyscall(SB)
-
-TEXT	·RawSyscall6(SB),NOSPLIT,$0-40
-	B	syscall·RawSyscall6(SB)

+ 0 - 17
vendor/golang.org/x/sys/unix/asm_solaris_amd64.s

@@ -1,17 +0,0 @@
-// Copyright 2014 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 !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
-//
-
-TEXT ·sysvicall6(SB),NOSPLIT,$0-88
-	JMP	syscall·sysvicall6(SB)
-
-TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
-	JMP	syscall·rawSysvicall6(SB)

+ 0 - 35
vendor/golang.org/x/sys/unix/bluetooth_linux.go

@@ -1,35 +0,0 @@
-// Copyright 2016 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.
-
-// Bluetooth sockets and messages
-
-package unix
-
-// Bluetooth Protocols
-const (
-	BTPROTO_L2CAP  = 0
-	BTPROTO_HCI    = 1
-	BTPROTO_SCO    = 2
-	BTPROTO_RFCOMM = 3
-	BTPROTO_BNEP   = 4
-	BTPROTO_CMTP   = 5
-	BTPROTO_HIDP   = 6
-	BTPROTO_AVDTP  = 7
-)
-
-const (
-	HCI_CHANNEL_RAW     = 0
-	HCI_CHANNEL_USER    = 1
-	HCI_CHANNEL_MONITOR = 2
-	HCI_CHANNEL_CONTROL = 3
-)
-
-// Socketoption Level
-const (
-	SOL_BLUETOOTH = 0x112
-	SOL_HCI       = 0x0
-	SOL_L2CAP     = 0x6
-	SOL_RFCOMM    = 0x12
-	SOL_SCO       = 0x11
-)

+ 0 - 195
vendor/golang.org/x/sys/unix/cap_freebsd.go

@@ -1,195 +0,0 @@
-// Copyright 2017 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 freebsd
-
-package unix
-
-import (
-	"errors"
-	"fmt"
-)
-
-// Go implementation of C mostly found in /usr/src/sys/kern/subr_capability.c
-
-const (
-	// This is the version of CapRights this package understands. See C implementation for parallels.
-	capRightsGoVersion = CAP_RIGHTS_VERSION_00
-	capArSizeMin       = CAP_RIGHTS_VERSION_00 + 2
-	capArSizeMax       = capRightsGoVersion + 2
-)
-
-var (
-	bit2idx = []int{
-		-1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1,
-		4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-	}
-)
-
-func capidxbit(right uint64) int {
-	return int((right >> 57) & 0x1f)
-}
-
-func rightToIndex(right uint64) (int, error) {
-	idx := capidxbit(right)
-	if idx < 0 || idx >= len(bit2idx) {
-		return -2, fmt.Errorf("index for right 0x%x out of range", right)
-	}
-	return bit2idx[idx], nil
-}
-
-func caprver(right uint64) int {
-	return int(right >> 62)
-}
-
-func capver(rights *CapRights) int {
-	return caprver(rights.Rights[0])
-}
-
-func caparsize(rights *CapRights) int {
-	return capver(rights) + 2
-}
-
-// CapRightsSet sets the permissions in setrights in rights.
-func CapRightsSet(rights *CapRights, setrights []uint64) error {
-	// This is essentially a copy of cap_rights_vset()
-	if capver(rights) != CAP_RIGHTS_VERSION_00 {
-		return fmt.Errorf("bad rights version %d", capver(rights))
-	}
-
-	n := caparsize(rights)
-	if n < capArSizeMin || n > capArSizeMax {
-		return errors.New("bad rights size")
-	}
-
-	for _, right := range setrights {
-		if caprver(right) != CAP_RIGHTS_VERSION_00 {
-			return errors.New("bad right version")
-		}
-		i, err := rightToIndex(right)
-		if err != nil {
-			return err
-		}
-		if i >= n {
-			return errors.New("index overflow")
-		}
-		if capidxbit(rights.Rights[i]) != capidxbit(right) {
-			return errors.New("index mismatch")
-		}
-		rights.Rights[i] |= right
-		if capidxbit(rights.Rights[i]) != capidxbit(right) {
-			return errors.New("index mismatch (after assign)")
-		}
-	}
-
-	return nil
-}
-
-// CapRightsClear clears the permissions in clearrights from rights.
-func CapRightsClear(rights *CapRights, clearrights []uint64) error {
-	// This is essentially a copy of cap_rights_vclear()
-	if capver(rights) != CAP_RIGHTS_VERSION_00 {
-		return fmt.Errorf("bad rights version %d", capver(rights))
-	}
-
-	n := caparsize(rights)
-	if n < capArSizeMin || n > capArSizeMax {
-		return errors.New("bad rights size")
-	}
-
-	for _, right := range clearrights {
-		if caprver(right) != CAP_RIGHTS_VERSION_00 {
-			return errors.New("bad right version")
-		}
-		i, err := rightToIndex(right)
-		if err != nil {
-			return err
-		}
-		if i >= n {
-			return errors.New("index overflow")
-		}
-		if capidxbit(rights.Rights[i]) != capidxbit(right) {
-			return errors.New("index mismatch")
-		}
-		rights.Rights[i] &= ^(right & 0x01FFFFFFFFFFFFFF)
-		if capidxbit(rights.Rights[i]) != capidxbit(right) {
-			return errors.New("index mismatch (after assign)")
-		}
-	}
-
-	return nil
-}
-
-// CapRightsIsSet checks whether all the permissions in setrights are present in rights.
-func CapRightsIsSet(rights *CapRights, setrights []uint64) (bool, error) {
-	// This is essentially a copy of cap_rights_is_vset()
-	if capver(rights) != CAP_RIGHTS_VERSION_00 {
-		return false, fmt.Errorf("bad rights version %d", capver(rights))
-	}
-
-	n := caparsize(rights)
-	if n < capArSizeMin || n > capArSizeMax {
-		return false, errors.New("bad rights size")
-	}
-
-	for _, right := range setrights {
-		if caprver(right) != CAP_RIGHTS_VERSION_00 {
-			return false, errors.New("bad right version")
-		}
-		i, err := rightToIndex(right)
-		if err != nil {
-			return false, err
-		}
-		if i >= n {
-			return false, errors.New("index overflow")
-		}
-		if capidxbit(rights.Rights[i]) != capidxbit(right) {
-			return false, errors.New("index mismatch")
-		}
-		if (rights.Rights[i] & right) != right {
-			return false, nil
-		}
-	}
-
-	return true, nil
-}
-
-func capright(idx uint64, bit uint64) uint64 {
-	return ((1 << (57 + idx)) | bit)
-}
-
-// CapRightsInit returns a pointer to an initialised CapRights structure filled with rights.
-// See man cap_rights_init(3) and rights(4).
-func CapRightsInit(rights []uint64) (*CapRights, error) {
-	var r CapRights
-	r.Rights[0] = (capRightsGoVersion << 62) | capright(0, 0)
-	r.Rights[1] = capright(1, 0)
-
-	err := CapRightsSet(&r, rights)
-	if err != nil {
-		return nil, err
-	}
-	return &r, nil
-}
-
-// CapRightsLimit reduces the operations permitted on fd to at most those contained in rights.
-// The capability rights on fd can never be increased by CapRightsLimit.
-// See man cap_rights_limit(2) and rights(4).
-func CapRightsLimit(fd uintptr, rights *CapRights) error {
-	return capRightsLimit(int(fd), rights)
-}
-
-// CapRightsGet returns a CapRights structure containing the operations permitted on fd.
-// See man cap_rights_get(3) and rights(4).
-func CapRightsGet(fd uintptr) (*CapRights, error) {
-	r, err := CapRightsInit(nil)
-	if err != nil {
-		return nil, err
-	}
-	err = capRightsGet(capRightsGoVersion, int(fd), r)
-	if err != nil {
-		return nil, err
-	}
-	return r, nil
-}

+ 0 - 13
vendor/golang.org/x/sys/unix/constants.go

@@ -1,13 +0,0 @@
-// Copyright 2015 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 aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-const (
-	R_OK = 0x4
-	W_OK = 0x2
-	X_OK = 0x1
-)

+ 0 - 37
vendor/golang.org/x/sys/unix/dev_aix_ppc.go

@@ -1,37 +0,0 @@
-// Copyright 2018 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 aix
-// +build ppc
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by the Linux kernel and glibc.
-//
-// The information below is extracted and adapted from bits/sysmacros.h in the
-// glibc sources:
-//
-// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
-// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
-// number and m is a hex digit of the minor number. This is backward compatible
-// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
-// backward compatible with the Linux kernel, which for some architectures uses
-// 32-bit dev_t, encoded as mmmM MMmm.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
-	return uint32((dev >> 16) & 0xffff)
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
-	return uint32(dev & 0xffff)
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
-	return uint64(((major) << 16) | (minor))
-}

+ 0 - 39
vendor/golang.org/x/sys/unix/dev_aix_ppc64.go

@@ -1,39 +0,0 @@
-// Copyright 2018 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 aix
-// +build ppc64
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by the Linux kernel and glibc.
-//
-// The information below is extracted and adapted from bits/sysmacros.h in the
-// glibc sources:
-//
-// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
-// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
-// number and m is a hex digit of the minor number. This is backward compatible
-// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
-// backward compatible with the Linux kernel, which for some architectures uses
-// 32-bit dev_t, encoded as mmmM MMmm.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
-	return uint32((dev & 0x3fffffff00000000) >> 32)
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
-	return uint32((dev & 0x00000000ffffffff) >> 0)
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
-	var DEVNO64 uint64
-	DEVNO64 = 0x8000000000000000
-	return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64)
-}

+ 0 - 24
vendor/golang.org/x/sys/unix/dev_darwin.go

@@ -1,24 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in Darwin's sys/types.h header.
-
-package unix
-
-// Major returns the major component of a Darwin device number.
-func Major(dev uint64) uint32 {
-	return uint32((dev >> 24) & 0xff)
-}
-
-// Minor returns the minor component of a Darwin device number.
-func Minor(dev uint64) uint32 {
-	return uint32(dev & 0xffffff)
-}
-
-// Mkdev returns a Darwin device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
-	return (uint64(major) << 24) | uint64(minor)
-}

+ 0 - 30
vendor/golang.org/x/sys/unix/dev_dragonfly.go

@@ -1,30 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in Dragonfly's sys/types.h header.
-//
-// The information below is extracted and adapted from sys/types.h:
-//
-// Minor gives a cookie instead of an index since in order to avoid changing the
-// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
-// devices that don't use them.
-
-package unix
-
-// Major returns the major component of a DragonFlyBSD device number.
-func Major(dev uint64) uint32 {
-	return uint32((dev >> 8) & 0xff)
-}
-
-// Minor returns the minor component of a DragonFlyBSD device number.
-func Minor(dev uint64) uint32 {
-	return uint32(dev & 0xffff00ff)
-}
-
-// Mkdev returns a DragonFlyBSD device number generated from the given major and
-// minor components.
-func Mkdev(major, minor uint32) uint64 {
-	return (uint64(major) << 8) | uint64(minor)
-}

+ 0 - 30
vendor/golang.org/x/sys/unix/dev_freebsd.go

@@ -1,30 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in FreeBSD's sys/types.h header.
-//
-// The information below is extracted and adapted from sys/types.h:
-//
-// Minor gives a cookie instead of an index since in order to avoid changing the
-// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
-// devices that don't use them.
-
-package unix
-
-// Major returns the major component of a FreeBSD device number.
-func Major(dev uint64) uint32 {
-	return uint32((dev >> 8) & 0xff)
-}
-
-// Minor returns the minor component of a FreeBSD device number.
-func Minor(dev uint64) uint32 {
-	return uint32(dev & 0xffff00ff)
-}
-
-// Mkdev returns a FreeBSD device number generated from the given major and
-// minor components.
-func Mkdev(major, minor uint32) uint64 {
-	return (uint64(major) << 8) | uint64(minor)
-}

+ 0 - 42
vendor/golang.org/x/sys/unix/dev_linux.go

@@ -1,42 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by the Linux kernel and glibc.
-//
-// The information below is extracted and adapted from bits/sysmacros.h in the
-// glibc sources:
-//
-// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
-// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
-// number and m is a hex digit of the minor number. This is backward compatible
-// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
-// backward compatible with the Linux kernel, which for some architectures uses
-// 32-bit dev_t, encoded as mmmM MMmm.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
-	major := uint32((dev & 0x00000000000fff00) >> 8)
-	major |= uint32((dev & 0xfffff00000000000) >> 32)
-	return major
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
-	minor := uint32((dev & 0x00000000000000ff) >> 0)
-	minor |= uint32((dev & 0x00000ffffff00000) >> 12)
-	return minor
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
-	dev := (uint64(major) & 0x00000fff) << 8
-	dev |= (uint64(major) & 0xfffff000) << 32
-	dev |= (uint64(minor) & 0x000000ff) << 0
-	dev |= (uint64(minor) & 0xffffff00) << 12
-	return dev
-}

+ 0 - 29
vendor/golang.org/x/sys/unix/dev_netbsd.go

@@ -1,29 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in NetBSD's sys/types.h header.
-
-package unix
-
-// Major returns the major component of a NetBSD device number.
-func Major(dev uint64) uint32 {
-	return uint32((dev & 0x000fff00) >> 8)
-}
-
-// Minor returns the minor component of a NetBSD device number.
-func Minor(dev uint64) uint32 {
-	minor := uint32((dev & 0x000000ff) >> 0)
-	minor |= uint32((dev & 0xfff00000) >> 12)
-	return minor
-}
-
-// Mkdev returns a NetBSD device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
-	dev := (uint64(major) << 8) & 0x000fff00
-	dev |= (uint64(minor) << 12) & 0xfff00000
-	dev |= (uint64(minor) << 0) & 0x000000ff
-	return dev
-}

+ 0 - 29
vendor/golang.org/x/sys/unix/dev_openbsd.go

@@ -1,29 +0,0 @@
-// Copyright 2017 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.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in OpenBSD's sys/types.h header.
-
-package unix
-
-// Major returns the major component of an OpenBSD device number.
-func Major(dev uint64) uint32 {
-	return uint32((dev & 0x0000ff00) >> 8)
-}
-
-// Minor returns the minor component of an OpenBSD device number.
-func Minor(dev uint64) uint32 {
-	minor := uint32((dev & 0x000000ff) >> 0)
-	minor |= uint32((dev & 0xffff0000) >> 8)
-	return minor
-}
-
-// Mkdev returns an OpenBSD device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
-	dev := (uint64(major) << 8) & 0x0000ff00
-	dev |= (uint64(minor) << 8) & 0xffff0000
-	dev |= (uint64(minor) << 0) & 0x000000ff
-	return dev
-}

+ 0 - 17
vendor/golang.org/x/sys/unix/dirent.go

@@ -1,17 +0,0 @@
-// Copyright 2009 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 aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
-
-package unix
-
-import "syscall"
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number of
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
-	return syscall.ParseDirent(buf, max, names)
-}

+ 0 - 9
vendor/golang.org/x/sys/unix/endian_big.go

@@ -1,9 +0,0 @@
-// Copyright 2016 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 ppc64 s390x mips mips64
-
-package unix
-
-const isBigEndian = true

+ 0 - 9
vendor/golang.org/x/sys/unix/endian_little.go

@@ -1,9 +0,0 @@
-// Copyright 2016 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 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le
-
-package unix
-
-const isBigEndian = false

+ 0 - 31
vendor/golang.org/x/sys/unix/env_unix.go

@@ -1,31 +0,0 @@
-// Copyright 2010 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 aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-// Unix environment variables.
-
-package unix
-
-import "syscall"
-
-func Getenv(key string) (value string, found bool) {
-	return syscall.Getenv(key)
-}
-
-func Setenv(key, value string) error {
-	return syscall.Setenv(key, value)
-}
-
-func Clearenv() {
-	syscall.Clearenv()
-}
-
-func Environ() []string {
-	return syscall.Environ()
-}
-
-func Unsetenv(key string) error {
-	return syscall.Unsetenv(key)
-}

+ 0 - 227
vendor/golang.org/x/sys/unix/errors_freebsd_386.go

@@ -1,227 +0,0 @@
-// Copyright 2017 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.
-
-// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
-// them here for backwards compatibility.
-
-package unix
-
-const (
-	IFF_SMART                         = 0x20
-	IFT_1822                          = 0x2
-	IFT_A12MPPSWITCH                  = 0x82
-	IFT_AAL2                          = 0xbb
-	IFT_AAL5                          = 0x31
-	IFT_ADSL                          = 0x5e
-	IFT_AFLANE8023                    = 0x3b
-	IFT_AFLANE8025                    = 0x3c
-	IFT_ARAP                          = 0x58
-	IFT_ARCNET                        = 0x23
-	IFT_ARCNETPLUS                    = 0x24
-	IFT_ASYNC                         = 0x54
-	IFT_ATM                           = 0x25
-	IFT_ATMDXI                        = 0x69
-	IFT_ATMFUNI                       = 0x6a
-	IFT_ATMIMA                        = 0x6b
-	IFT_ATMLOGICAL                    = 0x50
-	IFT_ATMRADIO                      = 0xbd
-	IFT_ATMSUBINTERFACE               = 0x86
-	IFT_ATMVCIENDPT                   = 0xc2
-	IFT_ATMVIRTUAL                    = 0x95
-	IFT_BGPPOLICYACCOUNTING           = 0xa2
-	IFT_BSC                           = 0x53
-	IFT_CCTEMUL                       = 0x3d
-	IFT_CEPT                          = 0x13
-	IFT_CES                           = 0x85
-	IFT_CHANNEL                       = 0x46
-	IFT_CNR                           = 0x55
-	IFT_COFFEE                        = 0x84
-	IFT_COMPOSITELINK                 = 0x9b
-	IFT_DCN                           = 0x8d
-	IFT_DIGITALPOWERLINE              = 0x8a
-	IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
-	IFT_DLSW                          = 0x4a
-	IFT_DOCSCABLEDOWNSTREAM           = 0x80
-	IFT_DOCSCABLEMACLAYER             = 0x7f
-	IFT_DOCSCABLEUPSTREAM             = 0x81
-	IFT_DS0                           = 0x51
-	IFT_DS0BUNDLE                     = 0x52
-	IFT_DS1FDL                        = 0xaa
-	IFT_DS3                           = 0x1e
-	IFT_DTM                           = 0x8c
-	IFT_DVBASILN                      = 0xac
-	IFT_DVBASIOUT                     = 0xad
-	IFT_DVBRCCDOWNSTREAM              = 0x93
-	IFT_DVBRCCMACLAYER                = 0x92
-	IFT_DVBRCCUPSTREAM                = 0x94
-	IFT_ENC                           = 0xf4
-	IFT_EON                           = 0x19
-	IFT_EPLRS                         = 0x57
-	IFT_ESCON                         = 0x49
-	IFT_ETHER                         = 0x6
-	IFT_FAITH                         = 0xf2
-	IFT_FAST                          = 0x7d
-	IFT_FASTETHER                     = 0x3e
-	IFT_FASTETHERFX                   = 0x45
-	IFT_FDDI                          = 0xf
-	IFT_FIBRECHANNEL                  = 0x38
-	IFT_FRAMERELAYINTERCONNECT        = 0x3a
-	IFT_FRAMERELAYMPI                 = 0x5c
-	IFT_FRDLCIENDPT                   = 0xc1
-	IFT_FRELAY                        = 0x20
-	IFT_FRELAYDCE                     = 0x2c
-	IFT_FRF16MFRBUNDLE                = 0xa3
-	IFT_FRFORWARD                     = 0x9e
-	IFT_G703AT2MB                     = 0x43
-	IFT_G703AT64K                     = 0x42
-	IFT_GIF                           = 0xf0
-	IFT_GIGABITETHERNET               = 0x75
-	IFT_GR303IDT                      = 0xb2
-	IFT_GR303RDT                      = 0xb1
-	IFT_H323GATEKEEPER                = 0xa4
-	IFT_H323PROXY                     = 0xa5
-	IFT_HDH1822                       = 0x3
-	IFT_HDLC                          = 0x76
-	IFT_HDSL2                         = 0xa8
-	IFT_HIPERLAN2                     = 0xb7
-	IFT_HIPPI                         = 0x2f
-	IFT_HIPPIINTERFACE                = 0x39
-	IFT_HOSTPAD                       = 0x5a
-	IFT_HSSI                          = 0x2e
-	IFT_HY                            = 0xe
-	IFT_IBM370PARCHAN                 = 0x48
-	IFT_IDSL                          = 0x9a
-	IFT_IEEE80211                     = 0x47
-	IFT_IEEE80212                     = 0x37
-	IFT_IEEE8023ADLAG                 = 0xa1
-	IFT_IFGSN                         = 0x91
-	IFT_IMT                           = 0xbe
-	IFT_INTERLEAVE                    = 0x7c
-	IFT_IP                            = 0x7e
-	IFT_IPFORWARD                     = 0x8e
-	IFT_IPOVERATM                     = 0x72
-	IFT_IPOVERCDLC                    = 0x6d
-	IFT_IPOVERCLAW                    = 0x6e
-	IFT_IPSWITCH                      = 0x4e
-	IFT_IPXIP                         = 0xf9
-	IFT_ISDN                          = 0x3f
-	IFT_ISDNBASIC                     = 0x14
-	IFT_ISDNPRIMARY                   = 0x15
-	IFT_ISDNS                         = 0x4b
-	IFT_ISDNU                         = 0x4c
-	IFT_ISO88022LLC                   = 0x29
-	IFT_ISO88023                      = 0x7
-	IFT_ISO88024                      = 0x8
-	IFT_ISO88025                      = 0x9
-	IFT_ISO88025CRFPINT               = 0x62
-	IFT_ISO88025DTR                   = 0x56
-	IFT_ISO88025FIBER                 = 0x73
-	IFT_ISO88026                      = 0xa
-	IFT_ISUP                          = 0xb3
-	IFT_L3IPXVLAN                     = 0x89
-	IFT_LAPB                          = 0x10
-	IFT_LAPD                          = 0x4d
-	IFT_LAPF                          = 0x77
-	IFT_LOCALTALK                     = 0x2a
-	IFT_LOOP                          = 0x18
-	IFT_MEDIAMAILOVERIP               = 0x8b
-	IFT_MFSIGLINK                     = 0xa7
-	IFT_MIOX25                        = 0x26
-	IFT_MODEM                         = 0x30
-	IFT_MPC                           = 0x71
-	IFT_MPLS                          = 0xa6
-	IFT_MPLSTUNNEL                    = 0x96
-	IFT_MSDSL                         = 0x8f
-	IFT_MVL                           = 0xbf
-	IFT_MYRINET                       = 0x63
-	IFT_NFAS                          = 0xaf
-	IFT_NSIP                          = 0x1b
-	IFT_OPTICALCHANNEL                = 0xc3
-	IFT_OPTICALTRANSPORT              = 0xc4
-	IFT_OTHER                         = 0x1
-	IFT_P10                           = 0xc
-	IFT_P80                           = 0xd
-	IFT_PARA                          = 0x22
-	IFT_PFLOG                         = 0xf6
-	IFT_PFSYNC                        = 0xf7
-	IFT_PLC                           = 0xae
-	IFT_POS                           = 0xab
-	IFT_PPPMULTILINKBUNDLE            = 0x6c
-	IFT_PROPBWAP2MP                   = 0xb8
-	IFT_PROPCNLS                      = 0x59
-	IFT_PROPDOCSWIRELESSDOWNSTREAM    = 0xb5
-	IFT_PROPDOCSWIRELESSMACLAYER      = 0xb4
-	IFT_PROPDOCSWIRELESSUPSTREAM      = 0xb6
-	IFT_PROPMUX                       = 0x36
-	IFT_PROPWIRELESSP2P               = 0x9d
-	IFT_PTPSERIAL                     = 0x16
-	IFT_PVC                           = 0xf1
-	IFT_QLLC                          = 0x44
-	IFT_RADIOMAC                      = 0xbc
-	IFT_RADSL                         = 0x5f
-	IFT_REACHDSL                      = 0xc0
-	IFT_RFC1483                       = 0x9f
-	IFT_RS232                         = 0x21
-	IFT_RSRB                          = 0x4f
-	IFT_SDLC                          = 0x11
-	IFT_SDSL                          = 0x60
-	IFT_SHDSL                         = 0xa9
-	IFT_SIP                           = 0x1f
-	IFT_SLIP                          = 0x1c
-	IFT_SMDSDXI                       = 0x2b
-	IFT_SMDSICIP                      = 0x34
-	IFT_SONET                         = 0x27
-	IFT_SONETOVERHEADCHANNEL          = 0xb9
-	IFT_SONETPATH                     = 0x32
-	IFT_SONETVT                       = 0x33
-	IFT_SRP                           = 0x97
-	IFT_SS7SIGLINK                    = 0x9c
-	IFT_STACKTOSTACK                  = 0x6f
-	IFT_STARLAN                       = 0xb
-	IFT_STF                           = 0xd7
-	IFT_T1                            = 0x12
-	IFT_TDLC                          = 0x74
-	IFT_TERMPAD                       = 0x5b
-	IFT_TR008                         = 0xb0
-	IFT_TRANSPHDLC                    = 0x7b
-	IFT_TUNNEL                        = 0x83
-	IFT_ULTRA                         = 0x1d
-	IFT_USB                           = 0xa0
-	IFT_V11                           = 0x40
-	IFT_V35                           = 0x2d
-	IFT_V36                           = 0x41
-	IFT_V37                           = 0x78
-	IFT_VDSL                          = 0x61
-	IFT_VIRTUALIPADDRESS              = 0x70
-	IFT_VOICEEM                       = 0x64
-	IFT_VOICEENCAP                    = 0x67
-	IFT_VOICEFXO                      = 0x65
-	IFT_VOICEFXS                      = 0x66
-	IFT_VOICEOVERATM                  = 0x98
-	IFT_VOICEOVERFRAMERELAY           = 0x99
-	IFT_VOICEOVERIP                   = 0x68
-	IFT_X213                          = 0x5d
-	IFT_X25                           = 0x5
-	IFT_X25DDN                        = 0x4
-	IFT_X25HUNTGROUP                  = 0x7a
-	IFT_X25MLP                        = 0x79
-	IFT_X25PLE                        = 0x28
-	IFT_XETHER                        = 0x1a
-	IPPROTO_MAXID                     = 0x34
-	IPV6_FAITH                        = 0x1d
-	IP_FAITH                          = 0x16
-	MAP_NORESERVE                     = 0x40
-	MAP_RENAME                        = 0x20
-	NET_RT_MAXID                      = 0x6
-	RTF_PRCLONING                     = 0x10000
-	RTM_OLDADD                        = 0x9
-	RTM_OLDDEL                        = 0xa
-	SIOCADDRT                         = 0x8030720a
-	SIOCALIFADDR                      = 0x8118691b
-	SIOCDELRT                         = 0x8030720b
-	SIOCDLIFADDR                      = 0x8118691d
-	SIOCGLIFADDR                      = 0xc118691c
-	SIOCGLIFPHYADDR                   = 0xc118694b
-	SIOCSLIFPHYADDR                   = 0x8118694a
-)

+ 0 - 227
vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go

@@ -1,227 +0,0 @@
-// Copyright 2017 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.
-
-// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
-// them here for backwards compatibility.
-
-package unix
-
-const (
-	IFF_SMART                         = 0x20
-	IFT_1822                          = 0x2
-	IFT_A12MPPSWITCH                  = 0x82
-	IFT_AAL2                          = 0xbb
-	IFT_AAL5                          = 0x31
-	IFT_ADSL                          = 0x5e
-	IFT_AFLANE8023                    = 0x3b
-	IFT_AFLANE8025                    = 0x3c
-	IFT_ARAP                          = 0x58
-	IFT_ARCNET                        = 0x23
-	IFT_ARCNETPLUS                    = 0x24
-	IFT_ASYNC                         = 0x54
-	IFT_ATM                           = 0x25
-	IFT_ATMDXI                        = 0x69
-	IFT_ATMFUNI                       = 0x6a
-	IFT_ATMIMA                        = 0x6b
-	IFT_ATMLOGICAL                    = 0x50
-	IFT_ATMRADIO                      = 0xbd
-	IFT_ATMSUBINTERFACE               = 0x86
-	IFT_ATMVCIENDPT                   = 0xc2
-	IFT_ATMVIRTUAL                    = 0x95
-	IFT_BGPPOLICYACCOUNTING           = 0xa2
-	IFT_BSC                           = 0x53
-	IFT_CCTEMUL                       = 0x3d
-	IFT_CEPT                          = 0x13
-	IFT_CES                           = 0x85
-	IFT_CHANNEL                       = 0x46
-	IFT_CNR                           = 0x55
-	IFT_COFFEE                        = 0x84
-	IFT_COMPOSITELINK                 = 0x9b
-	IFT_DCN                           = 0x8d
-	IFT_DIGITALPOWERLINE              = 0x8a
-	IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
-	IFT_DLSW                          = 0x4a
-	IFT_DOCSCABLEDOWNSTREAM           = 0x80
-	IFT_DOCSCABLEMACLAYER             = 0x7f
-	IFT_DOCSCABLEUPSTREAM             = 0x81
-	IFT_DS0                           = 0x51
-	IFT_DS0BUNDLE                     = 0x52
-	IFT_DS1FDL                        = 0xaa
-	IFT_DS3                           = 0x1e
-	IFT_DTM                           = 0x8c
-	IFT_DVBASILN                      = 0xac
-	IFT_DVBASIOUT                     = 0xad
-	IFT_DVBRCCDOWNSTREAM              = 0x93
-	IFT_DVBRCCMACLAYER                = 0x92
-	IFT_DVBRCCUPSTREAM                = 0x94
-	IFT_ENC                           = 0xf4
-	IFT_EON                           = 0x19
-	IFT_EPLRS                         = 0x57
-	IFT_ESCON                         = 0x49
-	IFT_ETHER                         = 0x6
-	IFT_FAITH                         = 0xf2
-	IFT_FAST                          = 0x7d
-	IFT_FASTETHER                     = 0x3e
-	IFT_FASTETHERFX                   = 0x45
-	IFT_FDDI                          = 0xf
-	IFT_FIBRECHANNEL                  = 0x38
-	IFT_FRAMERELAYINTERCONNECT        = 0x3a
-	IFT_FRAMERELAYMPI                 = 0x5c
-	IFT_FRDLCIENDPT                   = 0xc1
-	IFT_FRELAY                        = 0x20
-	IFT_FRELAYDCE                     = 0x2c
-	IFT_FRF16MFRBUNDLE                = 0xa3
-	IFT_FRFORWARD                     = 0x9e
-	IFT_G703AT2MB                     = 0x43
-	IFT_G703AT64K                     = 0x42
-	IFT_GIF                           = 0xf0
-	IFT_GIGABITETHERNET               = 0x75
-	IFT_GR303IDT                      = 0xb2
-	IFT_GR303RDT                      = 0xb1
-	IFT_H323GATEKEEPER                = 0xa4
-	IFT_H323PROXY                     = 0xa5
-	IFT_HDH1822                       = 0x3
-	IFT_HDLC                          = 0x76
-	IFT_HDSL2                         = 0xa8
-	IFT_HIPERLAN2                     = 0xb7
-	IFT_HIPPI                         = 0x2f
-	IFT_HIPPIINTERFACE                = 0x39
-	IFT_HOSTPAD                       = 0x5a
-	IFT_HSSI                          = 0x2e
-	IFT_HY                            = 0xe
-	IFT_IBM370PARCHAN                 = 0x48
-	IFT_IDSL                          = 0x9a
-	IFT_IEEE80211                     = 0x47
-	IFT_IEEE80212                     = 0x37
-	IFT_IEEE8023ADLAG                 = 0xa1
-	IFT_IFGSN                         = 0x91
-	IFT_IMT                           = 0xbe
-	IFT_INTERLEAVE                    = 0x7c
-	IFT_IP                            = 0x7e
-	IFT_IPFORWARD                     = 0x8e
-	IFT_IPOVERATM                     = 0x72
-	IFT_IPOVERCDLC                    = 0x6d
-	IFT_IPOVERCLAW                    = 0x6e
-	IFT_IPSWITCH                      = 0x4e
-	IFT_IPXIP                         = 0xf9
-	IFT_ISDN                          = 0x3f
-	IFT_ISDNBASIC                     = 0x14
-	IFT_ISDNPRIMARY                   = 0x15
-	IFT_ISDNS                         = 0x4b
-	IFT_ISDNU                         = 0x4c
-	IFT_ISO88022LLC                   = 0x29
-	IFT_ISO88023                      = 0x7
-	IFT_ISO88024                      = 0x8
-	IFT_ISO88025                      = 0x9
-	IFT_ISO88025CRFPINT               = 0x62
-	IFT_ISO88025DTR                   = 0x56
-	IFT_ISO88025FIBER                 = 0x73
-	IFT_ISO88026                      = 0xa
-	IFT_ISUP                          = 0xb3
-	IFT_L3IPXVLAN                     = 0x89
-	IFT_LAPB                          = 0x10
-	IFT_LAPD                          = 0x4d
-	IFT_LAPF                          = 0x77
-	IFT_LOCALTALK                     = 0x2a
-	IFT_LOOP                          = 0x18
-	IFT_MEDIAMAILOVERIP               = 0x8b
-	IFT_MFSIGLINK                     = 0xa7
-	IFT_MIOX25                        = 0x26
-	IFT_MODEM                         = 0x30
-	IFT_MPC                           = 0x71
-	IFT_MPLS                          = 0xa6
-	IFT_MPLSTUNNEL                    = 0x96
-	IFT_MSDSL                         = 0x8f
-	IFT_MVL                           = 0xbf
-	IFT_MYRINET                       = 0x63
-	IFT_NFAS                          = 0xaf
-	IFT_NSIP                          = 0x1b
-	IFT_OPTICALCHANNEL                = 0xc3
-	IFT_OPTICALTRANSPORT              = 0xc4
-	IFT_OTHER                         = 0x1
-	IFT_P10                           = 0xc
-	IFT_P80                           = 0xd
-	IFT_PARA                          = 0x22
-	IFT_PFLOG                         = 0xf6
-	IFT_PFSYNC                        = 0xf7
-	IFT_PLC                           = 0xae
-	IFT_POS                           = 0xab
-	IFT_PPPMULTILINKBUNDLE            = 0x6c
-	IFT_PROPBWAP2MP                   = 0xb8
-	IFT_PROPCNLS                      = 0x59
-	IFT_PROPDOCSWIRELESSDOWNSTREAM    = 0xb5
-	IFT_PROPDOCSWIRELESSMACLAYER      = 0xb4
-	IFT_PROPDOCSWIRELESSUPSTREAM      = 0xb6
-	IFT_PROPMUX                       = 0x36
-	IFT_PROPWIRELESSP2P               = 0x9d
-	IFT_PTPSERIAL                     = 0x16
-	IFT_PVC                           = 0xf1
-	IFT_QLLC                          = 0x44
-	IFT_RADIOMAC                      = 0xbc
-	IFT_RADSL                         = 0x5f
-	IFT_REACHDSL                      = 0xc0
-	IFT_RFC1483                       = 0x9f
-	IFT_RS232                         = 0x21
-	IFT_RSRB                          = 0x4f
-	IFT_SDLC                          = 0x11
-	IFT_SDSL                          = 0x60
-	IFT_SHDSL                         = 0xa9
-	IFT_SIP                           = 0x1f
-	IFT_SLIP                          = 0x1c
-	IFT_SMDSDXI                       = 0x2b
-	IFT_SMDSICIP                      = 0x34
-	IFT_SONET                         = 0x27
-	IFT_SONETOVERHEADCHANNEL          = 0xb9
-	IFT_SONETPATH                     = 0x32
-	IFT_SONETVT                       = 0x33
-	IFT_SRP                           = 0x97
-	IFT_SS7SIGLINK                    = 0x9c
-	IFT_STACKTOSTACK                  = 0x6f
-	IFT_STARLAN                       = 0xb
-	IFT_STF                           = 0xd7
-	IFT_T1                            = 0x12
-	IFT_TDLC                          = 0x74
-	IFT_TERMPAD                       = 0x5b
-	IFT_TR008                         = 0xb0
-	IFT_TRANSPHDLC                    = 0x7b
-	IFT_TUNNEL                        = 0x83
-	IFT_ULTRA                         = 0x1d
-	IFT_USB                           = 0xa0
-	IFT_V11                           = 0x40
-	IFT_V35                           = 0x2d
-	IFT_V36                           = 0x41
-	IFT_V37                           = 0x78
-	IFT_VDSL                          = 0x61
-	IFT_VIRTUALIPADDRESS              = 0x70
-	IFT_VOICEEM                       = 0x64
-	IFT_VOICEENCAP                    = 0x67
-	IFT_VOICEFXO                      = 0x65
-	IFT_VOICEFXS                      = 0x66
-	IFT_VOICEOVERATM                  = 0x98
-	IFT_VOICEOVERFRAMERELAY           = 0x99
-	IFT_VOICEOVERIP                   = 0x68
-	IFT_X213                          = 0x5d
-	IFT_X25                           = 0x5
-	IFT_X25DDN                        = 0x4
-	IFT_X25HUNTGROUP                  = 0x7a
-	IFT_X25MLP                        = 0x79
-	IFT_X25PLE                        = 0x28
-	IFT_XETHER                        = 0x1a
-	IPPROTO_MAXID                     = 0x34
-	IPV6_FAITH                        = 0x1d
-	IP_FAITH                          = 0x16
-	MAP_NORESERVE                     = 0x40
-	MAP_RENAME                        = 0x20
-	NET_RT_MAXID                      = 0x6
-	RTF_PRCLONING                     = 0x10000
-	RTM_OLDADD                        = 0x9
-	RTM_OLDDEL                        = 0xa
-	SIOCADDRT                         = 0x8040720a
-	SIOCALIFADDR                      = 0x8118691b
-	SIOCDELRT                         = 0x8040720b
-	SIOCDLIFADDR                      = 0x8118691d
-	SIOCGLIFADDR                      = 0xc118691c
-	SIOCGLIFPHYADDR                   = 0xc118694b
-	SIOCSLIFPHYADDR                   = 0x8118694a
-)

+ 0 - 226
vendor/golang.org/x/sys/unix/errors_freebsd_arm.go

@@ -1,226 +0,0 @@
-// Copyright 2017 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.
-
-package unix
-
-const (
-	IFT_1822                          = 0x2
-	IFT_A12MPPSWITCH                  = 0x82
-	IFT_AAL2                          = 0xbb
-	IFT_AAL5                          = 0x31
-	IFT_ADSL                          = 0x5e
-	IFT_AFLANE8023                    = 0x3b
-	IFT_AFLANE8025                    = 0x3c
-	IFT_ARAP                          = 0x58
-	IFT_ARCNET                        = 0x23
-	IFT_ARCNETPLUS                    = 0x24
-	IFT_ASYNC                         = 0x54
-	IFT_ATM                           = 0x25
-	IFT_ATMDXI                        = 0x69
-	IFT_ATMFUNI                       = 0x6a
-	IFT_ATMIMA                        = 0x6b
-	IFT_ATMLOGICAL                    = 0x50
-	IFT_ATMRADIO                      = 0xbd
-	IFT_ATMSUBINTERFACE               = 0x86
-	IFT_ATMVCIENDPT                   = 0xc2
-	IFT_ATMVIRTUAL                    = 0x95
-	IFT_BGPPOLICYACCOUNTING           = 0xa2
-	IFT_BSC                           = 0x53
-	IFT_CCTEMUL                       = 0x3d
-	IFT_CEPT                          = 0x13
-	IFT_CES                           = 0x85
-	IFT_CHANNEL                       = 0x46
-	IFT_CNR                           = 0x55
-	IFT_COFFEE                        = 0x84
-	IFT_COMPOSITELINK                 = 0x9b
-	IFT_DCN                           = 0x8d
-	IFT_DIGITALPOWERLINE              = 0x8a
-	IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
-	IFT_DLSW                          = 0x4a
-	IFT_DOCSCABLEDOWNSTREAM           = 0x80
-	IFT_DOCSCABLEMACLAYER             = 0x7f
-	IFT_DOCSCABLEUPSTREAM             = 0x81
-	IFT_DS0                           = 0x51
-	IFT_DS0BUNDLE                     = 0x52
-	IFT_DS1FDL                        = 0xaa
-	IFT_DS3                           = 0x1e
-	IFT_DTM                           = 0x8c
-	IFT_DVBASILN                      = 0xac
-	IFT_DVBASIOUT                     = 0xad
-	IFT_DVBRCCDOWNSTREAM              = 0x93
-	IFT_DVBRCCMACLAYER                = 0x92
-	IFT_DVBRCCUPSTREAM                = 0x94
-	IFT_ENC                           = 0xf4
-	IFT_EON                           = 0x19
-	IFT_EPLRS                         = 0x57
-	IFT_ESCON                         = 0x49
-	IFT_ETHER                         = 0x6
-	IFT_FAST                          = 0x7d
-	IFT_FASTETHER                     = 0x3e
-	IFT_FASTETHERFX                   = 0x45
-	IFT_FDDI                          = 0xf
-	IFT_FIBRECHANNEL                  = 0x38
-	IFT_FRAMERELAYINTERCONNECT        = 0x3a
-	IFT_FRAMERELAYMPI                 = 0x5c
-	IFT_FRDLCIENDPT                   = 0xc1
-	IFT_FRELAY                        = 0x20
-	IFT_FRELAYDCE                     = 0x2c
-	IFT_FRF16MFRBUNDLE                = 0xa3
-	IFT_FRFORWARD                     = 0x9e
-	IFT_G703AT2MB                     = 0x43
-	IFT_G703AT64K                     = 0x42
-	IFT_GIF                           = 0xf0
-	IFT_GIGABITETHERNET               = 0x75
-	IFT_GR303IDT                      = 0xb2
-	IFT_GR303RDT                      = 0xb1
-	IFT_H323GATEKEEPER                = 0xa4
-	IFT_H323PROXY                     = 0xa5
-	IFT_HDH1822                       = 0x3
-	IFT_HDLC                          = 0x76
-	IFT_HDSL2                         = 0xa8
-	IFT_HIPERLAN2                     = 0xb7
-	IFT_HIPPI                         = 0x2f
-	IFT_HIPPIINTERFACE                = 0x39
-	IFT_HOSTPAD                       = 0x5a
-	IFT_HSSI                          = 0x2e
-	IFT_HY                            = 0xe
-	IFT_IBM370PARCHAN                 = 0x48
-	IFT_IDSL                          = 0x9a
-	IFT_IEEE80211                     = 0x47
-	IFT_IEEE80212                     = 0x37
-	IFT_IEEE8023ADLAG                 = 0xa1
-	IFT_IFGSN                         = 0x91
-	IFT_IMT                           = 0xbe
-	IFT_INTERLEAVE                    = 0x7c
-	IFT_IP                            = 0x7e
-	IFT_IPFORWARD                     = 0x8e
-	IFT_IPOVERATM                     = 0x72
-	IFT_IPOVERCDLC                    = 0x6d
-	IFT_IPOVERCLAW                    = 0x6e
-	IFT_IPSWITCH                      = 0x4e
-	IFT_ISDN                          = 0x3f
-	IFT_ISDNBASIC                     = 0x14
-	IFT_ISDNPRIMARY                   = 0x15
-	IFT_ISDNS                         = 0x4b
-	IFT_ISDNU                         = 0x4c
-	IFT_ISO88022LLC                   = 0x29
-	IFT_ISO88023                      = 0x7
-	IFT_ISO88024                      = 0x8
-	IFT_ISO88025                      = 0x9
-	IFT_ISO88025CRFPINT               = 0x62
-	IFT_ISO88025DTR                   = 0x56
-	IFT_ISO88025FIBER                 = 0x73
-	IFT_ISO88026                      = 0xa
-	IFT_ISUP                          = 0xb3
-	IFT_L3IPXVLAN                     = 0x89
-	IFT_LAPB                          = 0x10
-	IFT_LAPD                          = 0x4d
-	IFT_LAPF                          = 0x77
-	IFT_LOCALTALK                     = 0x2a
-	IFT_LOOP                          = 0x18
-	IFT_MEDIAMAILOVERIP               = 0x8b
-	IFT_MFSIGLINK                     = 0xa7
-	IFT_MIOX25                        = 0x26
-	IFT_MODEM                         = 0x30
-	IFT_MPC                           = 0x71
-	IFT_MPLS                          = 0xa6
-	IFT_MPLSTUNNEL                    = 0x96
-	IFT_MSDSL                         = 0x8f
-	IFT_MVL                           = 0xbf
-	IFT_MYRINET                       = 0x63
-	IFT_NFAS                          = 0xaf
-	IFT_NSIP                          = 0x1b
-	IFT_OPTICALCHANNEL                = 0xc3
-	IFT_OPTICALTRANSPORT              = 0xc4
-	IFT_OTHER                         = 0x1
-	IFT_P10                           = 0xc
-	IFT_P80                           = 0xd
-	IFT_PARA                          = 0x22
-	IFT_PFLOG                         = 0xf6
-	IFT_PFSYNC                        = 0xf7
-	IFT_PLC                           = 0xae
-	IFT_POS                           = 0xab
-	IFT_PPPMULTILINKBUNDLE            = 0x6c
-	IFT_PROPBWAP2MP                   = 0xb8
-	IFT_PROPCNLS                      = 0x59
-	IFT_PROPDOCSWIRELESSDOWNSTREAM    = 0xb5
-	IFT_PROPDOCSWIRELESSMACLAYER      = 0xb4
-	IFT_PROPDOCSWIRELESSUPSTREAM      = 0xb6
-	IFT_PROPMUX                       = 0x36
-	IFT_PROPWIRELESSP2P               = 0x9d
-	IFT_PTPSERIAL                     = 0x16
-	IFT_PVC                           = 0xf1
-	IFT_QLLC                          = 0x44
-	IFT_RADIOMAC                      = 0xbc
-	IFT_RADSL                         = 0x5f
-	IFT_REACHDSL                      = 0xc0
-	IFT_RFC1483                       = 0x9f
-	IFT_RS232                         = 0x21
-	IFT_RSRB                          = 0x4f
-	IFT_SDLC                          = 0x11
-	IFT_SDSL                          = 0x60
-	IFT_SHDSL                         = 0xa9
-	IFT_SIP                           = 0x1f
-	IFT_SLIP                          = 0x1c
-	IFT_SMDSDXI                       = 0x2b
-	IFT_SMDSICIP                      = 0x34
-	IFT_SONET                         = 0x27
-	IFT_SONETOVERHEADCHANNEL          = 0xb9
-	IFT_SONETPATH                     = 0x32
-	IFT_SONETVT                       = 0x33
-	IFT_SRP                           = 0x97
-	IFT_SS7SIGLINK                    = 0x9c
-	IFT_STACKTOSTACK                  = 0x6f
-	IFT_STARLAN                       = 0xb
-	IFT_STF                           = 0xd7
-	IFT_T1                            = 0x12
-	IFT_TDLC                          = 0x74
-	IFT_TERMPAD                       = 0x5b
-	IFT_TR008                         = 0xb0
-	IFT_TRANSPHDLC                    = 0x7b
-	IFT_TUNNEL                        = 0x83
-	IFT_ULTRA                         = 0x1d
-	IFT_USB                           = 0xa0
-	IFT_V11                           = 0x40
-	IFT_V35                           = 0x2d
-	IFT_V36                           = 0x41
-	IFT_V37                           = 0x78
-	IFT_VDSL                          = 0x61
-	IFT_VIRTUALIPADDRESS              = 0x70
-	IFT_VOICEEM                       = 0x64
-	IFT_VOICEENCAP                    = 0x67
-	IFT_VOICEFXO                      = 0x65
-	IFT_VOICEFXS                      = 0x66
-	IFT_VOICEOVERATM                  = 0x98
-	IFT_VOICEOVERFRAMERELAY           = 0x99
-	IFT_VOICEOVERIP                   = 0x68
-	IFT_X213                          = 0x5d
-	IFT_X25                           = 0x5
-	IFT_X25DDN                        = 0x4
-	IFT_X25HUNTGROUP                  = 0x7a
-	IFT_X25MLP                        = 0x79
-	IFT_X25PLE                        = 0x28
-	IFT_XETHER                        = 0x1a
-
-	// missing constants on FreeBSD-11.1-RELEASE, copied from old values in ztypes_freebsd_arm.go
-	IFF_SMART       = 0x20
-	IFT_FAITH       = 0xf2
-	IFT_IPXIP       = 0xf9
-	IPPROTO_MAXID   = 0x34
-	IPV6_FAITH      = 0x1d
-	IP_FAITH        = 0x16
-	MAP_NORESERVE   = 0x40
-	MAP_RENAME      = 0x20
-	NET_RT_MAXID    = 0x6
-	RTF_PRCLONING   = 0x10000
-	RTM_OLDADD      = 0x9
-	RTM_OLDDEL      = 0xa
-	SIOCADDRT       = 0x8030720a
-	SIOCALIFADDR    = 0x8118691b
-	SIOCDELRT       = 0x8030720b
-	SIOCDLIFADDR    = 0x8118691d
-	SIOCGLIFADDR    = 0xc118691c
-	SIOCGLIFPHYADDR = 0xc118694b
-	SIOCSLIFPHYADDR = 0x8118694a
-)

+ 0 - 32
vendor/golang.org/x/sys/unix/fcntl.go

@@ -1,32 +0,0 @@
-// Copyright 2014 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 darwin dragonfly freebsd linux netbsd openbsd
-
-package unix
-
-import "unsafe"
-
-// fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
-// systems by flock_linux_32bit.go to be SYS_FCNTL64.
-var fcntl64Syscall uintptr = SYS_FCNTL
-
-// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
-func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
-	valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg))
-	var err error
-	if errno != 0 {
-		err = errno
-	}
-	return int(valptr), err
-}
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
-	_, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
-	if errno == 0 {
-		return nil
-	}
-	return errno
-}

+ 0 - 13
vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go

@@ -1,13 +0,0 @@
-// +build linux,386 linux,arm linux,mips linux,mipsle
-
-// Copyright 2014 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.
-
-package unix
-
-func init() {
-	// On 32-bit Linux systems, the fcntl syscall that matches Go's
-	// Flock_t type is SYS_FCNTL64, not SYS_FCNTL.
-	fcntl64Syscall = SYS_FCNTL64
-}

+ 0 - 62
vendor/golang.org/x/sys/unix/gccgo.go

@@ -1,62 +0,0 @@
-// Copyright 2015 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 gccgo
-// +build !aix
-
-package unix
-
-import "syscall"
-
-// We can't use the gc-syntax .s files for gccgo. On the plus side
-// much of the functionality can be written directly in Go.
-
-//extern gccgoRealSyscallNoError
-func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
-
-//extern gccgoRealSyscall
-func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
-
-func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
-	syscall.Entersyscall()
-	r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
-	syscall.Exitsyscall()
-	return r, 0
-}
-
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
-	syscall.Entersyscall()
-	r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
-	syscall.Exitsyscall()
-	return r, 0, syscall.Errno(errno)
-}
-
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
-	syscall.Entersyscall()
-	r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
-	syscall.Exitsyscall()
-	return r, 0, syscall.Errno(errno)
-}
-
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
-	syscall.Entersyscall()
-	r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
-	syscall.Exitsyscall()
-	return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
-	r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
-	return r, 0
-}
-
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
-	r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
-	return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
-	r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
-	return r, 0, syscall.Errno(errno)
-}

+ 0 - 39
vendor/golang.org/x/sys/unix/gccgo_c.c

@@ -1,39 +0,0 @@
-// Copyright 2015 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 gccgo
-// +build !aix
-
-#include <errno.h>
-#include <stdint.h>
-#include <unistd.h>
-
-#define _STRINGIFY2_(x) #x
-#define _STRINGIFY_(x) _STRINGIFY2_(x)
-#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
-
-// Call syscall from C code because the gccgo support for calling from
-// Go to C does not support varargs functions.
-
-struct ret {
-	uintptr_t r;
-	uintptr_t err;
-};
-
-struct ret
-gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
-{
-	struct ret r;
-
-	errno = 0;
-	r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
-	r.err = errno;
-	return r;
-}
-
-uintptr_t
-gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
-{
-	return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
-}

+ 0 - 20
vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go

@@ -1,20 +0,0 @@
-// Copyright 2015 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 gccgo,linux,amd64
-
-package unix
-
-import "syscall"
-
-//extern gettimeofday
-func realGettimeofday(*Timeval, *byte) int32
-
-func gettimeofday(tv *Timeval) (err syscall.Errno) {
-	r := realGettimeofday(tv, nil)
-	if r < 0 {
-		return syscall.GetErrno()
-	}
-	return 0
-}

+ 0 - 30
vendor/golang.org/x/sys/unix/ioctl.go

@@ -1,30 +0,0 @@
-// Copyright 2018 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 darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-import "runtime"
-
-// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
-//
-// To change fd's window size, the req argument should be TIOCSWINSZ.
-func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
-	// TODO: if we get the chance, remove the req parameter and
-	// hardcode TIOCSWINSZ.
-	err := ioctlSetWinsize(fd, req, value)
-	runtime.KeepAlive(value)
-	return err
-}
-
-// IoctlSetTermios performs an ioctl on fd with a *Termios.
-//
-// The req value will usually be TCSETA or TIOCSETA.
-func IoctlSetTermios(fd int, req uint, value *Termios) error {
-	// TODO: if we get the chance, remove the req parameter.
-	err := ioctlSetTermios(fd, req, value)
-	runtime.KeepAlive(value)
-	return err
-}

+ 0 - 198
vendor/golang.org/x/sys/unix/mkall.sh

@@ -1,198 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 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.
-
-# This script runs or (given -n) prints suggested commands to generate files for
-# the Architecture/OS specified by the GOARCH and GOOS environment variables.
-# See README.md for more information about how the build system works.
-
-GOOSARCH="${GOOS}_${GOARCH}"
-
-# defaults
-mksyscall="./mksyscall.pl"
-mkerrors="./mkerrors.sh"
-zerrors="zerrors_$GOOSARCH.go"
-mksysctl=""
-zsysctl="zsysctl_$GOOSARCH.go"
-mksysnum=
-mktypes=
-run="sh"
-cmd=""
-
-case "$1" in
--syscalls)
-	for i in zsyscall*go
-	do
-		# Run the command line that appears in the first line
-		# of the generated file to regenerate it.
-		sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
-		rm _$i
-	done
-	exit 0
-	;;
--n)
-	run="cat"
-	cmd="echo"
-	shift
-esac
-
-case "$#" in
-0)
-	;;
-*)
-	echo 'usage: mkall.sh [-n]' 1>&2
-	exit 2
-esac
-
-if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
-	# Use then new build system
-	# Files generated through docker (use $cmd so you can Ctl-C the build or run)
-	$cmd docker build --tag generate:$GOOS $GOOS
-	$cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
-	exit
-fi
-
-GOOSARCH_in=syscall_$GOOSARCH.go
-case "$GOOSARCH" in
-_* | *_ | _)
-	echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
-	exit 1
-	;;
-aix_ppc)
-	mkerrors="$mkerrors -maix32"
-	mksyscall="perl mksyscall_aix.pl -aix"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-aix_ppc64)
-	mkerrors="$mkerrors -maix64"
-	mksyscall="perl mksyscall_aix.pl -aix"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-darwin_386)
-	mkerrors="$mkerrors -m32"
-	mksyscall="./mksyscall.pl -l32"
-	mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-darwin_amd64)
-	mkerrors="$mkerrors -m64"
-	mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-darwin_arm)
-	mkerrors="$mkerrors"
-	mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-darwin_arm64)
-	mkerrors="$mkerrors -m64"
-	mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-dragonfly_amd64)
-	mkerrors="$mkerrors -m64"
-	mksyscall="./mksyscall.pl -dragonfly"
-	mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-freebsd_386)
-	mkerrors="$mkerrors -m32"
-	mksyscall="./mksyscall.pl -l32"
-	mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-freebsd_amd64)
-	mkerrors="$mkerrors -m64"
-	mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-freebsd_arm)
-	mkerrors="$mkerrors"
-	mksyscall="./mksyscall.pl -l32 -arm"
-	mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
-	# Let the type of C char be signed for making the bare syscall
-	# API consistent across platforms.
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
-	;;
-linux_sparc64)
-	GOOSARCH_in=syscall_linux_sparc64.go
-	unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h
-	mkerrors="$mkerrors -m64"
-	mksysnum="./mksysnum_linux.pl $unistd_h"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-netbsd_386)
-	mkerrors="$mkerrors -m32"
-	mksyscall="./mksyscall.pl -l32 -netbsd"
-	mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-netbsd_amd64)
-	mkerrors="$mkerrors -m64"
-	mksyscall="./mksyscall.pl -netbsd"
-	mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-netbsd_arm)
-	mkerrors="$mkerrors"
-	mksyscall="./mksyscall.pl -l32 -netbsd -arm"
-	mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
-	# Let the type of C char be signed for making the bare syscall
-	# API consistent across platforms.
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
-	;;
-openbsd_386)
-	mkerrors="$mkerrors -m32"
-	mksyscall="./mksyscall.pl -l32 -openbsd"
-	mksysctl="./mksysctl_openbsd.pl"
-	mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-openbsd_amd64)
-	mkerrors="$mkerrors -m64"
-	mksyscall="./mksyscall.pl -openbsd"
-	mksysctl="./mksysctl_openbsd.pl"
-	mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-openbsd_arm)
-	mkerrors="$mkerrors"
-	mksyscall="./mksyscall.pl -l32 -openbsd -arm"
-	mksysctl="./mksysctl_openbsd.pl"
-	mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
-	# Let the type of C char be signed for making the bare syscall
-	# API consistent across platforms.
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
-	;;
-solaris_amd64)
-	mksyscall="./mksyscall_solaris.pl"
-	mkerrors="$mkerrors -m64"
-	mksysnum=
-	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
-	;;
-*)
-	echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
-	exit 1
-	;;
-esac
-
-(
-	if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
-	case "$GOOS" in
-	*)
-		syscall_goos="syscall_$GOOS.go"
-		case "$GOOS" in
-		darwin | dragonfly | freebsd | netbsd | openbsd)
-			syscall_goos="syscall_bsd.go $syscall_goos"
-			;;
-		esac
-		if [ -n "$mksyscall" ]; then echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
-		;;
-	esac
-	if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
-	if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
-	if [ -n "$mktypes" ]; then
-		echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
-	fi
-) | $run

+ 0 - 632
vendor/golang.org/x/sys/unix/mkerrors.sh

@@ -1,632 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 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.
-
-# Generate Go code listing errors and other #defined constant
-# values (ENAMETOOLONG etc.), by asking the preprocessor
-# about the definitions.
-
-unset LANG
-export LC_ALL=C
-export LC_CTYPE=C
-
-if test -z "$GOARCH" -o -z "$GOOS"; then
-	echo 1>&2 "GOARCH or GOOS not defined in environment"
-	exit 1
-fi
-
-# Check that we are using the new build system if we should
-if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
-	if [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
-		echo 1>&2 "In the new build system, mkerrors should not be called directly."
-		echo 1>&2 "See README.md"
-		exit 1
-	fi
-fi
-
-if [[ "$GOOS" = "aix" ]]; then
-	CC=${CC:-gcc}
-else
-	CC=${CC:-cc}
-fi
-
-if [[ "$GOOS" = "solaris" ]]; then
-	# Assumes GNU versions of utilities in PATH.
-	export PATH=/usr/gnu/bin:$PATH
-fi
-
-uname=$(uname)
-
-includes_AIX='
-#include <net/if.h>
-#include <net/netopt.h>
-#include <netinet/ip_mroute.h>
-#include <sys/protosw.h>
-#include <sys/stropts.h>
-#include <sys/mman.h>
-#include <sys/poll.h>
-#include <termios.h>
-#include <fcntl.h>
-
-#define AF_LOCAL AF_UNIX
-'
-
-includes_Darwin='
-#define _DARWIN_C_SOURCE
-#define KERNEL
-#define _DARWIN_USE_64_BIT_INODE
-#include <stdint.h>
-#include <sys/attr.h>
-#include <sys/types.h>
-#include <sys/event.h>
-#include <sys/ptrace.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/sysctl.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <sys/xattr.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <termios.h>
-'
-
-includes_DragonFly='
-#include <sys/types.h>
-#include <sys/event.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <termios.h>
-#include <netinet/ip.h>
-#include <net/ip_mroute/ip_mroute.h>
-'
-
-includes_FreeBSD='
-#include <sys/capability.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/event.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <termios.h>
-#include <netinet/ip.h>
-#include <netinet/ip_mroute.h>
-#include <sys/extattr.h>
-
-#if __FreeBSD__ >= 10
-#define IFT_CARP	0xf8	// IFT_CARP is deprecated in FreeBSD 10
-#undef SIOCAIFADDR
-#define SIOCAIFADDR	_IOW(105, 26, struct oifaliasreq)	// ifaliasreq contains if_data
-#undef SIOCSIFPHYADDR
-#define SIOCSIFPHYADDR	_IOW(105, 70, struct oifaliasreq)	// ifaliasreq contains if_data
-#endif
-'
-
-includes_Linux='
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#ifndef __LP64__
-#define _FILE_OFFSET_BITS 64
-#endif
-#define _GNU_SOURCE
-
-// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
-// these structures. We just include them copied from <bits/termios.h>.
-#if defined(__powerpc__)
-struct sgttyb {
-        char    sg_ispeed;
-        char    sg_ospeed;
-        char    sg_erase;
-        char    sg_kill;
-        short   sg_flags;
-};
-
-struct tchars {
-        char    t_intrc;
-        char    t_quitc;
-        char    t_startc;
-        char    t_stopc;
-        char    t_eofc;
-        char    t_brkc;
-};
-
-struct ltchars {
-        char    t_suspc;
-        char    t_dsuspc;
-        char    t_rprntc;
-        char    t_flushc;
-        char    t_werasc;
-        char    t_lnextc;
-};
-#endif
-
-#include <bits/sockaddr.h>
-#include <sys/epoll.h>
-#include <sys/eventfd.h>
-#include <sys/inotify.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/prctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/xattr.h>
-#include <linux/if.h>
-#include <linux/if_alg.h>
-#include <linux/if_arp.h>
-#include <linux/if_ether.h>
-#include <linux/if_tun.h>
-#include <linux/if_packet.h>
-#include <linux/if_addr.h>
-#include <linux/falloc.h>
-#include <linux/filter.h>
-#include <linux/fs.h>
-#include <linux/keyctl.h>
-#include <linux/magic.h>
-#include <linux/netfilter/nfnetlink.h>
-#include <linux/netlink.h>
-#include <linux/net_namespace.h>
-#include <linux/perf_event.h>
-#include <linux/random.h>
-#include <linux/reboot.h>
-#include <linux/rtnetlink.h>
-#include <linux/ptrace.h>
-#include <linux/sched.h>
-#include <linux/seccomp.h>
-#include <linux/sockios.h>
-#include <linux/wait.h>
-#include <linux/icmpv6.h>
-#include <linux/serial.h>
-#include <linux/can.h>
-#include <linux/vm_sockets.h>
-#include <linux/taskstats.h>
-#include <linux/genetlink.h>
-#include <linux/watchdog.h>
-#include <linux/hdreg.h>
-#include <linux/rtc.h>
-#include <mtd/ubi-user.h>
-#include <net/route.h>
-#include <asm/termbits.h>
-
-#ifndef MSG_FASTOPEN
-#define MSG_FASTOPEN    0x20000000
-#endif
-
-#ifndef PTRACE_GETREGS
-#define PTRACE_GETREGS	0xc
-#endif
-
-#ifndef PTRACE_SETREGS
-#define PTRACE_SETREGS	0xd
-#endif
-
-#ifndef SOL_NETLINK
-#define SOL_NETLINK	270
-#endif
-
-#ifdef SOL_BLUETOOTH
-// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
-// but it is already in bluetooth_linux.go
-#undef SOL_BLUETOOTH
-#endif
-
-// Certain constants are missing from the fs/crypto UAPI
-#define FS_KEY_DESC_PREFIX              "fscrypt:"
-#define FS_KEY_DESC_PREFIX_SIZE         8
-#define FS_MAX_KEY_SIZE                 64
-'
-
-includes_NetBSD='
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/event.h>
-#include <sys/extattr.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/sysctl.h>
-#include <sys/termios.h>
-#include <sys/ttycom.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_mroute.h>
-#include <netinet/if_ether.h>
-
-// Needed since <sys/param.h> refers to it...
-#define schedppq 1
-'
-
-includes_OpenBSD='
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/event.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/stat.h>
-#include <sys/sysctl.h>
-#include <sys/termios.h>
-#include <sys/ttycom.h>
-#include <sys/unistd.h>
-#include <sys/wait.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_var.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_mroute.h>
-#include <netinet/if_ether.h>
-#include <net/if_bridge.h>
-
-// We keep some constants not supported in OpenBSD 5.5 and beyond for
-// the promise of compatibility.
-#define EMUL_ENABLED		0x1
-#define EMUL_NATIVE		0x2
-#define IPV6_FAITH		0x1d
-#define IPV6_OPTIONS		0x1
-#define IPV6_RTHDR_STRICT	0x1
-#define IPV6_SOCKOPT_RESERVED1	0x3
-#define SIOCGIFGENERIC		0xc020693a
-#define SIOCSIFGENERIC		0x80206939
-#define WALTSIG			0x4
-'
-
-includes_SunOS='
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#include <sys/mkdev.h>
-#include <net/bpf.h>
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_types.h>
-#include <net/route.h>
-#include <netinet/in.h>
-#include <termios.h>
-#include <netinet/ip.h>
-#include <netinet/ip_mroute.h>
-'
-
-
-includes='
-#include <sys/types.h>
-#include <sys/file.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-#include <netinet/ip6.h>
-#include <netinet/tcp.h>
-#include <errno.h>
-#include <sys/signal.h>
-#include <signal.h>
-#include <sys/resource.h>
-#include <time.h>
-'
-ccflags="$@"
-
-# Write go tool cgo -godefs input.
-(
-	echo package unix
-	echo
-	echo '/*'
-	indirect="includes_$(uname)"
-	echo "${!indirect} $includes"
-	echo '*/'
-	echo 'import "C"'
-	echo 'import "syscall"'
-	echo
-	echo 'const ('
-
-	# The gcc command line prints all the #defines
-	# it encounters while processing the input
-	echo "${!indirect} $includes" | $CC -x c - -E -dM $ccflags |
-	awk '
-		$1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
-
-		$2 ~ /^E([ABCD]X|[BIS]P|[SD]I|S|FL)$/ {next}  # 386 registers
-		$2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
-		$2 ~ /^(SCM_SRCRT)$/ {next}
-		$2 ~ /^(MAP_FAILED)$/ {next}
-		$2 ~ /^ELF_.*$/ {next}# <asm/elf.h> contains ELF_ARCH, etc.
-
-		$2 ~ /^EXTATTR_NAMESPACE_NAMES/ ||
-		$2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next}
-
-		$2 !~ /^ETH_/ &&
-		$2 !~ /^EPROC_/ &&
-		$2 !~ /^EQUIV_/ &&
-		$2 !~ /^EXPR_/ &&
-		$2 ~ /^E[A-Z0-9_]+$/ ||
-		$2 ~ /^B[0-9_]+$/ ||
-		$2 ~ /^(OLD|NEW)DEV$/ ||
-		$2 == "BOTHER" ||
-		$2 ~ /^CI?BAUD(EX)?$/ ||
-		$2 == "IBSHIFT" ||
-		$2 ~ /^V[A-Z0-9]+$/ ||
-		$2 ~ /^CS[A-Z0-9]/ ||
-		$2 ~ /^I(SIG|CANON|CRNL|UCLC|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
-		$2 ~ /^IGN/ ||
-		$2 ~ /^IX(ON|ANY|OFF)$/ ||
-		$2 ~ /^IN(LCR|PCK)$/ ||
-		$2 !~ "X86_CR3_PCID_NOFLUSH" &&
-		$2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
-		$2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ ||
-		$2 == "BRKINT" ||
-		$2 == "HUPCL" ||
-		$2 == "PENDIN" ||
-		$2 == "TOSTOP" ||
-		$2 == "XCASE" ||
-		$2 == "ALTWERASE" ||
-		$2 == "NOKERNINFO" ||
-		$2 ~ /^PAR/ ||
-		$2 ~ /^SIG[^_]/ ||
-		$2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ ||
-		$2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ ||
-		$2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ ||
-		$2 ~ /^O?XTABS$/ ||
-		$2 ~ /^TC[IO](ON|OFF)$/ ||
-		$2 ~ /^IN_/ ||
-		$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
-		$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
-		$2 ~ /^TP_STATUS_/ ||
-		$2 ~ /^FALLOC_/ ||
-		$2 == "ICMPV6_FILTER" ||
-		$2 == "SOMAXCONN" ||
-		$2 == "NAME_MAX" ||
-		$2 == "IFNAMSIZ" ||
-		$2 ~ /^CTL_(HW|KERN|MAXNAME|NET|QUERY)$/ ||
-		$2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
-		$2 ~ /^HW_MACHINE$/ ||
-		$2 ~ /^SYSCTL_VERS/ ||
-		$2 ~ /^(MS|MNT|UMOUNT)_/ ||
-		$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
-		$2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ ||
-		$2 ~ /^LINUX_REBOOT_CMD_/ ||
-		$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
-		$2 !~ "NLA_TYPE_MASK" &&
-		$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
-		$2 ~ /^SIOC/ ||
-		$2 ~ /^TIOC/ ||
-		$2 ~ /^TCGET/ ||
-		$2 ~ /^TCSET/ ||
-		$2 ~ /^TC(FLSH|SBRKP?|XONC)$/ ||
-		$2 !~ "RTF_BITS" &&
-		$2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
-		$2 ~ /^BIOC/ ||
-		$2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ ||
-		$2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
-		$2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
-		$2 ~ /^CLONE_[A-Z_]+/ ||
-		$2 !~ /^(BPF_TIMEVAL)$/ &&
-		$2 ~ /^(BPF|DLT)_/ ||
-		$2 ~ /^CLOCK_/ ||
-		$2 ~ /^CAN_/ ||
-		$2 ~ /^CAP_/ ||
-		$2 ~ /^ALG_/ ||
-		$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ ||
-		$2 ~ /^GRND_/ ||
-		$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
-		$2 ~ /^KEYCTL_/ ||
-		$2 ~ /^PERF_EVENT_IOC_/ ||
-		$2 ~ /^SECCOMP_MODE_/ ||
-		$2 ~ /^SPLICE_/ ||
-		$2 !~ /^AUDIT_RECORD_MAGIC/ &&
-		$2 !~ /IOC_MAGIC/ &&
-		$2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ ||
-		$2 ~ /^(VM|VMADDR)_/ ||
-		$2 ~ /^IOCTL_VM_SOCKETS_/ ||
-		$2 ~ /^(TASKSTATS|TS)_/ ||
-		$2 ~ /^CGROUPSTATS_/ ||
-		$2 ~ /^GENL_/ ||
-		$2 ~ /^STATX_/ ||
-		$2 ~ /^RENAME/ ||
-		$2 ~ /^UBI_IOC[A-Z]/ ||
-		$2 ~ /^UTIME_/ ||
-		$2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ ||
-		$2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ ||
-		$2 ~ /^FSOPT_/ ||
-		$2 ~ /^WDIOC_/ ||
-		$2 ~ /^NFN/ ||
-		$2 ~ /^(HDIO|WIN|SMART)_/ ||
-		$2 !~ "WMESGLEN" &&
-		$2 ~ /^W[A-Z0-9]+$/ ||
-		$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
-		$2 ~ /^__WCOREFLAG$/ {next}
-		$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
-
-		{next}
-	' | sort
-
-	echo ')'
-) >_const.go
-
-# Pull out the error names for later.
-errors=$(
-	echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
-	awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
-	sort
-)
-
-# Pull out the signal names for later.
-signals=$(
-	echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
-	awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
-	egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
-	sort
-)
-
-# Again, writing regexps to a file.
-echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
-	awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print "^\t" $2 "[ \t]*=" }' |
-	sort >_error.grep
-echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
-	awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
-	egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
-	sort >_signal.grep
-
-echo '// mkerrors.sh' "$@"
-echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
-echo
-echo "// +build ${GOARCH},${GOOS}"
-echo
-go tool cgo -godefs -- "$@" _const.go >_error.out
-cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
-echo
-echo '// Errors'
-echo 'const ('
-cat _error.out | grep -f _error.grep | sed 's/=\(.*\)/= syscall.Errno(\1)/'
-echo ')'
-
-echo
-echo '// Signals'
-echo 'const ('
-cat _error.out | grep -f _signal.grep | sed 's/=\(.*\)/= syscall.Signal(\1)/'
-echo ')'
-
-# Run C program to print error and syscall strings.
-(
-	echo -E "
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <string.h>
-#include <signal.h>
-
-#define nelem(x) (sizeof(x)/sizeof((x)[0]))
-
-enum { A = 'A', Z = 'Z', a = 'a', z = 'z' }; // avoid need for single quotes below
-
-struct tuple {
-	int num;
-	const char *name;
-};
-
-struct tuple errors[] = {
-"
-	for i in $errors
-	do
-		echo -E '	{'$i', "'$i'" },'
-	done
-
-	echo -E "
-};
-
-struct tuple signals[] = {
-"
-	for i in $signals
-	do
-		echo -E '	{'$i', "'$i'" },'
-	done
-
-	# Use -E because on some systems bash builtin interprets \n itself.
-	echo -E '
-};
-
-static int
-tuplecmp(const void *a, const void *b)
-{
-	return ((struct tuple *)a)->num - ((struct tuple *)b)->num;
-}
-
-int
-main(void)
-{
-	int i, e;
-	char buf[1024], *p;
-
-	printf("\n\n// Error table\n");
-	printf("var errorList = [...]struct {\n");
-	printf("\tnum  syscall.Errno\n");
-	printf("\tname string\n");
-	printf("\tdesc string\n");
-	printf("} {\n");
-	qsort(errors, nelem(errors), sizeof errors[0], tuplecmp);
-	for(i=0; i<nelem(errors); i++) {
-		e = errors[i].num;
-		if(i > 0 && errors[i-1].num == e)
-			continue;
-		strcpy(buf, strerror(e));
-		// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
-		if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
-			buf[0] += a - A;
-		printf("\t{ %d, \"%s\", \"%s\" },\n", e, errors[i].name, buf);
-	}
-	printf("}\n\n");
-
-	printf("\n\n// Signal table\n");
-	printf("var signalList = [...]struct {\n");
-	printf("\tnum  syscall.Signal\n");
-	printf("\tname string\n");
-	printf("\tdesc string\n");
-	printf("} {\n");
-	qsort(signals, nelem(signals), sizeof signals[0], tuplecmp);
-	for(i=0; i<nelem(signals); i++) {
-		e = signals[i].num;
-		if(i > 0 && signals[i-1].num == e)
-			continue;
-		strcpy(buf, strsignal(e));
-		// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
-		if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
-			buf[0] += a - A;
-		// cut trailing : number.
-		p = strrchr(buf, ":"[0]);
-		if(p)
-			*p = '\0';
-		printf("\t{ %d, \"%s\", \"%s\" },\n", e, signals[i].name, buf);
-	}
-	printf("}\n\n");
-
-	return 0;
-}
-
-'
-) >_errors.c
-
-$CC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go _error.grep _signal.grep _error.out

+ 0 - 98
vendor/golang.org/x/sys/unix/mkpost.go

@@ -1,98 +0,0 @@
-// Copyright 2016 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 ignore
-
-// mkpost processes the output of cgo -godefs to
-// modify the generated types. It is used to clean up
-// the sys API in an architecture specific manner.
-//
-// mkpost is run after cgo -godefs; see README.md.
-package main
-
-import (
-	"bytes"
-	"fmt"
-	"go/format"
-	"io/ioutil"
-	"log"
-	"os"
-	"regexp"
-)
-
-func main() {
-	// Get the OS and architecture (using GOARCH_TARGET if it exists)
-	goos := os.Getenv("GOOS")
-	goarch := os.Getenv("GOARCH_TARGET")
-	if goarch == "" {
-		goarch = os.Getenv("GOARCH")
-	}
-	// Check that we are using the new build system if we should be.
-	if goos == "linux" && goarch != "sparc64" {
-		if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
-			os.Stderr.WriteString("In the new build system, mkpost should not be called directly.\n")
-			os.Stderr.WriteString("See README.md\n")
-			os.Exit(1)
-		}
-	}
-
-	b, err := ioutil.ReadAll(os.Stdin)
-	if err != nil {
-		log.Fatal(err)
-	}
-
-	// Intentionally export __val fields in Fsid and Sigset_t
-	valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`)
-	b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}"))
-
-	// If we have empty Ptrace structs, we should delete them. Only s390x emits
-	// nonempty Ptrace structs.
-	ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
-	b = ptraceRexexp.ReplaceAll(b, nil)
-
-	// Replace the control_regs union with a blank identifier for now.
-	controlRegsRegex := regexp.MustCompile(`(Control_regs)\s+\[0\]uint64`)
-	b = controlRegsRegex.ReplaceAll(b, []byte("_ [0]uint64"))
-
-	// Remove fields that are added by glibc
-	// Note that this is unstable as the identifers are private.
-	removeFieldsRegex := regexp.MustCompile(`X__glibc\S*`)
-	b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
-
-	// Convert [65]int8 to [65]byte in Utsname members to simplify
-	// conversion to string; see golang.org/issue/20753
-	convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`)
-	b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte"))
-
-	// Remove spare fields (e.g. in Statx_t)
-	spareFieldsRegex := regexp.MustCompile(`X__spare\S*`)
-	b = spareFieldsRegex.ReplaceAll(b, []byte("_"))
-
-	// Remove cgo padding fields
-	removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`)
-	b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_"))
-
-	// Remove padding, hidden, or unused fields
-	removeFieldsRegex = regexp.MustCompile(`\b(X_\S+|Padding)`)
-	b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
-
-	// Remove the first line of warning from cgo
-	b = b[bytes.IndexByte(b, '\n')+1:]
-	// Modify the command in the header to include:
-	//  mkpost, our own warning, and a build tag.
-	replacement := fmt.Sprintf(`$1 | go run mkpost.go
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build %s,%s`, goarch, goos)
-	cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
-	b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
-
-	// gofmt
-	b, err = format.Source(b)
-	if err != nil {
-		log.Fatal(err)
-	}
-
-	os.Stdout.Write(b)
-}

+ 0 - 341
vendor/golang.org/x/sys/unix/mksyscall.pl

@@ -1,341 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2009 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.
-
-# This program reads a file containing function prototypes
-# (like syscall_darwin.go) and generates system call bodies.
-# The prototypes are marked by lines beginning with "//sys"
-# and read like func declarations if //sys is replaced by func, but:
-#	* The parameter lists must give a name for each argument.
-#	  This includes return parameters.
-#	* The parameter lists must give a type for each argument:
-#	  the (x, y, z int) shorthand is not allowed.
-#	* If the return parameter is an error number, it must be named errno.
-
-# A line beginning with //sysnb is like //sys, except that the
-# goroutine will not be suspended during the execution of the system
-# call.  This must only be used for system calls which can never
-# block, as otherwise the system call could cause all goroutines to
-# hang.
-
-use strict;
-
-my $cmdline = "mksyscall.pl " . join(' ', @ARGV);
-my $errors = 0;
-my $_32bit = "";
-my $plan9 = 0;
-my $openbsd = 0;
-my $netbsd = 0;
-my $dragonfly = 0;
-my $arm = 0; # 64-bit value should use (even, odd)-pair
-my $tags = "";  # build tags
-
-if($ARGV[0] eq "-b32") {
-	$_32bit = "big-endian";
-	shift;
-} elsif($ARGV[0] eq "-l32") {
-	$_32bit = "little-endian";
-	shift;
-}
-if($ARGV[0] eq "-plan9") {
-	$plan9 = 1;
-	shift;
-}
-if($ARGV[0] eq "-openbsd") {
-	$openbsd = 1;
-	shift;
-}
-if($ARGV[0] eq "-netbsd") {
-	$netbsd = 1;
-	shift;
-}
-if($ARGV[0] eq "-dragonfly") {
-	$dragonfly = 1;
-	shift;
-}
-if($ARGV[0] eq "-arm") {
-	$arm = 1;
-	shift;
-}
-if($ARGV[0] eq "-tags") {
-	shift;
-	$tags = $ARGV[0];
-	shift;
-}
-
-if($ARGV[0] =~ /^-/) {
-	print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
-	exit 1;
-}
-
-# Check that we are using the new build system if we should
-if($ENV{'GOOS'} eq "linux" && $ENV{'GOARCH'} ne "sparc64") {
-	if($ENV{'GOLANG_SYS_BUILD'} ne "docker") {
-		print STDERR "In the new build system, mksyscall should not be called directly.\n";
-		print STDERR "See README.md\n";
-		exit 1;
-	}
-}
-
-
-sub parseparamlist($) {
-	my ($list) = @_;
-	$list =~ s/^\s*//;
-	$list =~ s/\s*$//;
-	if($list eq "") {
-		return ();
-	}
-	return split(/\s*,\s*/, $list);
-}
-
-sub parseparam($) {
-	my ($p) = @_;
-	if($p !~ /^(\S*) (\S*)$/) {
-		print STDERR "$ARGV:$.: malformed parameter: $p\n";
-		$errors = 1;
-		return ("xx", "int");
-	}
-	return ($1, $2);
-}
-
-my $text = "";
-while(<>) {
-	chomp;
-	s/\s+/ /g;
-	s/^\s+//;
-	s/\s+$//;
-	my $nonblock = /^\/\/sysnb /;
-	next if !/^\/\/sys / && !$nonblock;
-
-	# Line must be of the form
-	#	func Open(path string, mode int, perm int) (fd int, errno error)
-	# Split into name, in params, out params.
-	if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) {
-		print STDERR "$ARGV:$.: malformed //sys declaration\n";
-		$errors = 1;
-		next;
-	}
-	my ($func, $in, $out, $sysname) = ($2, $3, $4, $5);
-
-	# Split argument lists on comma.
-	my @in = parseparamlist($in);
-	my @out = parseparamlist($out);
-
-	# Try in vain to keep people from editing this file.
-	# The theory is that they jump into the middle of the file
-	# without reading the header.
-	$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
-
-	# Go function header.
-	my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : "";
-	$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl;
-
-	# Check if err return available
-	my $errvar = "";
-	foreach my $p (@out) {
-		my ($name, $type) = parseparam($p);
-		if($type eq "error") {
-			$errvar = $name;
-			last;
-		}
-	}
-
-	# Prepare arguments to Syscall.
-	my @args = ();
-	my $n = 0;
-	foreach my $p (@in) {
-		my ($name, $type) = parseparam($p);
-		if($type =~ /^\*/) {
-			push @args, "uintptr(unsafe.Pointer($name))";
-		} elsif($type eq "string" && $errvar ne "") {
-			$text .= "\tvar _p$n *byte\n";
-			$text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
-			$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
-			push @args, "uintptr(unsafe.Pointer(_p$n))";
-			$n++;
-		} elsif($type eq "string") {
-			print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
-			$text .= "\tvar _p$n *byte\n";
-			$text .= "\t_p$n, _ = BytePtrFromString($name)\n";
-			push @args, "uintptr(unsafe.Pointer(_p$n))";
-			$n++;
-		} elsif($type =~ /^\[\](.*)/) {
-			# Convert slice into pointer, length.
-			# Have to be careful not to take address of &a[0] if len == 0:
-			# pass dummy pointer in that case.
-			# Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
-			$text .= "\tvar _p$n unsafe.Pointer\n";
-			$text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}";
-			$text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}";
-			$text .= "\n";
-			push @args, "uintptr(_p$n)", "uintptr(len($name))";
-			$n++;
-		} elsif($type eq "int64" && ($openbsd || $netbsd)) {
-			push @args, "0";
-			if($_32bit eq "big-endian") {
-				push @args, "uintptr($name>>32)", "uintptr($name)";
-			} elsif($_32bit eq "little-endian") {
-				push @args, "uintptr($name)", "uintptr($name>>32)";
-			} else {
-				push @args, "uintptr($name)";
-			}
-		} elsif($type eq "int64" && $dragonfly) {
-			if ($func !~ /^extp(read|write)/i) {
-				push @args, "0";
-			}
-			if($_32bit eq "big-endian") {
-				push @args, "uintptr($name>>32)", "uintptr($name)";
-			} elsif($_32bit eq "little-endian") {
-				push @args, "uintptr($name)", "uintptr($name>>32)";
-			} else {
-				push @args, "uintptr($name)";
-			}
-		} elsif($type eq "int64" && $_32bit ne "") {
-			if(@args % 2 && $arm) {
-				# arm abi specifies 64-bit argument uses
-				# (even, odd) pair
-				push @args, "0"
-			}
-			if($_32bit eq "big-endian") {
-				push @args, "uintptr($name>>32)", "uintptr($name)";
-			} else {
-				push @args, "uintptr($name)", "uintptr($name>>32)";
-			}
-		} else {
-			push @args, "uintptr($name)";
-		}
-	}
-
-	# Determine which form to use; pad args with zeros.
-	my $asm = "Syscall";
-	if ($nonblock) {
-		if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
-			$asm = "RawSyscallNoError";
-		} else {
-			$asm = "RawSyscall";
-		}
-	} else {
-		if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
-			$asm = "SyscallNoError";
-		}
-	}
-	if(@args <= 3) {
-		while(@args < 3) {
-			push @args, "0";
-		}
-	} elsif(@args <= 6) {
-		$asm .= "6";
-		while(@args < 6) {
-			push @args, "0";
-		}
-	} elsif(@args <= 9) {
-		$asm .= "9";
-		while(@args < 9) {
-			push @args, "0";
-		}
-	} else {
-		print STDERR "$ARGV:$.: too many arguments to system call\n";
-	}
-
-	# System call number.
-	if($sysname eq "") {
-		$sysname = "SYS_$func";
-		$sysname =~ s/([a-z])([A-Z])/${1}_$2/g;	# turn FooBar into Foo_Bar
-		$sysname =~ y/a-z/A-Z/;
-	}
-
-	# Actual call.
-	my $args = join(', ', @args);
-	my $call = "$asm($sysname, $args)";
-
-	# Assign return values.
-	my $body = "";
-	my @ret = ("_", "_", "_");
-	my $do_errno = 0;
-	for(my $i=0; $i<@out; $i++) {
-		my $p = $out[$i];
-		my ($name, $type) = parseparam($p);
-		my $reg = "";
-		if($name eq "err" && !$plan9) {
-			$reg = "e1";
-			$ret[2] = $reg;
-			$do_errno = 1;
-		} elsif($name eq "err" && $plan9) {
-			$ret[0] = "r0";
-			$ret[2] = "e1";
-			next;
-		} else {
-			$reg = sprintf("r%d", $i);
-			$ret[$i] = $reg;
-		}
-		if($type eq "bool") {
-			$reg = "$reg != 0";
-		}
-		if($type eq "int64" && $_32bit ne "") {
-			# 64-bit number in r1:r0 or r0:r1.
-			if($i+2 > @out) {
-				print STDERR "$ARGV:$.: not enough registers for int64 return\n";
-			}
-			if($_32bit eq "big-endian") {
-				$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
-			} else {
-				$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
-			}
-			$ret[$i] = sprintf("r%d", $i);
-			$ret[$i+1] = sprintf("r%d", $i+1);
-		}
-		if($reg ne "e1" || $plan9) {
-			$body .= "\t$name = $type($reg)\n";
-		}
-	}
-	if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
-		$text .= "\t$call\n";
-	} else {
-		if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
-			# raw syscall without error on Linux, see golang.org/issue/22924
-			$text .= "\t$ret[0], $ret[1] := $call\n";
-		} else {
-			$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
-		}
-	}
-	$text .= $body;
-
-	if ($plan9 && $ret[2] eq "e1") {
-		$text .= "\tif int32(r0) == -1 {\n";
-		$text .= "\t\terr = e1\n";
-		$text .= "\t}\n";
-	} elsif ($do_errno) {
-		$text .= "\tif e1 != 0 {\n";
-		$text .= "\t\terr = errnoErr(e1)\n";
-		$text .= "\t}\n";
-	}
-	$text .= "\treturn\n";
-	$text .= "}\n\n";
-}
-
-chomp $text;
-chomp $text;
-
-if($errors) {
-	exit 1;
-}
-
-print <<EOF;
-// $cmdline
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build $tags
-
-package unix
-
-import (
-	"syscall"
-	"unsafe"
-)
-
-var _ syscall.Errno
-
-$text
-EOF
-exit 0;

+ 0 - 385
vendor/golang.org/x/sys/unix/mksyscall_aix.pl

@@ -1,385 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2018 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.
-
-# This program reads a file containing function prototypes
-# (like syscall_aix.go) and generates system call bodies.
-# The prototypes are marked by lines beginning with "//sys"
-# and read like func declarations if //sys is replaced by func, but:
-#	* The parameter lists must give a name for each argument.
-#	  This includes return parameters.
-#	* The parameter lists must give a type for each argument:
-#	  the (x, y, z int) shorthand is not allowed.
-#	* If the return parameter is an error number, it must be named err.
-#	* If go func name needs to be different than its libc name,
-#	* or the function is not in libc, name could be specified
-#	* at the end, after "=" sign, like
-#	  //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
-
-use strict;
-
-my $cmdline = "mksyscall_aix.pl " . join(' ', @ARGV);
-my $errors = 0;
-my $_32bit = "";
-my $tags = "";  # build tags
-my $aix = 0;
-my $solaris = 0;
-
-binmode STDOUT;
-
-if($ARGV[0] eq "-b32") {
-	$_32bit = "big-endian";
-	shift;
-} elsif($ARGV[0] eq "-l32") {
-	$_32bit = "little-endian";
-	shift;
-}
-if($ARGV[0] eq "-aix") {
-	$aix = 1;
-	shift;
-}
-if($ARGV[0] eq "-tags") {
-	shift;
-	$tags = $ARGV[0];
-	shift;
-}
-
-if($ARGV[0] =~ /^-/) {
-	print STDERR "usage: mksyscall_aix.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
-	exit 1;
-}
-
-sub parseparamlist($) {
-	my ($list) = @_;
-	$list =~ s/^\s*//;
-	$list =~ s/\s*$//;
-	if($list eq "") {
-		return ();
-	}
-	return split(/\s*,\s*/, $list);
-}
-
-sub parseparam($) {
-	my ($p) = @_;
-	if($p !~ /^(\S*) (\S*)$/) {
-		print STDERR "$ARGV:$.: malformed parameter: $p\n";
-		$errors = 1;
-		return ("xx", "int");
-	}
-	return ($1, $2);
-}
-
-my $package = "";
-my $text = "";
-my $c_extern = "/*\n#include <stdint.h>\n";
-my @vars = ();
-while(<>) {
-	chomp;
-	s/\s+/ /g;
-	s/^\s+//;
-	s/\s+$//;
-	$package = $1 if !$package && /^package (\S+)$/;
-	my $nonblock = /^\/\/sysnb /;
-	next if !/^\/\/sys / && !$nonblock;
-
-	# Line must be of the form
-	# func Open(path string, mode int, perm int) (fd int, err error)
-	# Split into name, in params, out params.
-	if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
-		print STDERR "$ARGV:$.: malformed //sys declaration\n";
-		$errors = 1;
-		next;
-	}
-	my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
-
-	# Split argument lists on comma.
-	my @in = parseparamlist($in);
-	my @out = parseparamlist($out);
-
-	$in = join(', ', @in);
-	$out = join(', ', @out);
-
-	# Try in vain to keep people from editing this file.
-	# The theory is that they jump into the middle of the file
-	# without reading the header.
-	$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
-
-	# Check if value return, err return available
-	my $errvar = "";
-	my $retvar = "";
-	my $rettype = "";
-	foreach my $p (@out) {
-		my ($name, $type) = parseparam($p);
-		if($type eq "error") {
-			$errvar = $name;
-		} else {
-			$retvar = $name;
-			$rettype = $type;
-		}
-	}
-
-	# System call name.
-	#if($func ne "fcntl") {
-
-	if($sysname eq "") {
-		$sysname = "$func";
-	}
-
-	$sysname =~ s/([a-z])([A-Z])/${1}_$2/g;
-	$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
-
-	my $C_rettype = "";
-	if($rettype eq "unsafe.Pointer") {
-		$C_rettype = "uintptr_t";
-	} elsif($rettype eq "uintptr") {
-		$C_rettype = "uintptr_t";
-	} elsif($rettype =~ /^_/) {
-		$C_rettype = "uintptr_t";
-	} elsif($rettype eq "int") {
-		$C_rettype = "int";
-	} elsif($rettype eq "int32") {
-		$C_rettype = "int";
-	} elsif($rettype eq "int64") {
-		$C_rettype = "long long";
-	} elsif($rettype eq "uint32") {
-		$C_rettype = "unsigned int";
-	} elsif($rettype eq "uint64") {
-		$C_rettype = "unsigned long long";
-	} else {
-		$C_rettype = "int";
-	}
-	if($sysname eq "exit") {
-		$C_rettype = "void";
-	}
-
-	# Change types to c
-	my @c_in = ();
-	foreach my $p (@in) {
-		my ($name, $type) = parseparam($p);
-		if($type =~ /^\*/) {
-			push @c_in, "uintptr_t";
-			} elsif($type eq "string") {
-			push @c_in, "uintptr_t";
-		} elsif($type =~ /^\[\](.*)/) {
-			push @c_in, "uintptr_t", "size_t";
-		} elsif($type eq "unsafe.Pointer") {
-			push @c_in, "uintptr_t";
-		} elsif($type eq "uintptr") {
-			push @c_in, "uintptr_t";
-		} elsif($type =~ /^_/) {
-			push @c_in, "uintptr_t";
-		} elsif($type eq "int") {
-			push @c_in, "int";
-		} elsif($type eq "int32") {
-			push @c_in, "int";
-		} elsif($type eq "int64") {
-			push @c_in, "long long";
-		} elsif($type eq "uint32") {
-			push @c_in, "unsigned int";
-		} elsif($type eq "uint64") {
-			push @c_in, "unsigned long long";
-		} else {
-			push @c_in, "int";
-		}
-	}
-
-	if ($func ne "fcntl" && $func ne "FcntlInt" && $func ne "readlen" && $func ne "writelen") {
-		# Imports of system calls from libc
-		$c_extern .= "$C_rettype $sysname";
-		my $c_in = join(', ', @c_in);
-		$c_extern .= "($c_in);\n";
-	}
-
-	# So file name.
-	if($aix) {
-		if($modname eq "") {
-			$modname = "libc.a/shr_64.o";
-		} else {
-			print STDERR "$func: only syscall using libc are available\n";
-			$errors = 1;
-			next;
-		}
-	}
-
-	my $strconvfunc = "C.CString";
-	my $strconvtype = "*byte";
-
-	# Go function header.
-	if($out ne "") {
-		$out = " ($out)";
-	}
-	if($text ne "") {
-		$text .= "\n"
-	}
-
-	$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ;
-
-	# Prepare arguments to call.
-	my @args = ();
-	my $n = 0;
-	my $arg_n = 0;
-	foreach my $p (@in) {
-		my ($name, $type) = parseparam($p);
-		if($type =~ /^\*/) {
-			push @args, "C.uintptr_t(uintptr(unsafe.Pointer($name)))";
-		} elsif($type eq "string" && $errvar ne "") {
-			$text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n";
-			push @args, "C.uintptr_t(_p$n)";
-			$n++;
-		} elsif($type eq "string") {
-			print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
-			$text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n";
-			push @args, "C.uintptr_t(_p$n)";
-			$n++;
-		} elsif($type =~ /^\[\](.*)/) {
-			# Convert slice into pointer, length.
-			# Have to be careful not to take address of &a[0] if len == 0:
-			# pass nil in that case.
-			$text .= "\tvar _p$n *$1\n";
-			$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
-			push @args, "C.uintptr_t(uintptr(unsafe.Pointer(_p$n)))";
-			$n++;
-			$text .= "\tvar _p$n int\n";
-			$text .= "\t_p$n = len($name)\n";
-			push @args, "C.size_t(_p$n)";
-			$n++;
-		} elsif($type eq "int64" && $_32bit ne "") {
-			if($_32bit eq "big-endian") {
-				push @args, "uintptr($name >> 32)", "uintptr($name)";
-			} else {
-				push @args, "uintptr($name)", "uintptr($name >> 32)";
-			}
-			$n++;
-		} elsif($type eq "bool") {
-			$text .= "\tvar _p$n uint32\n";
-			$text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
-			push @args, "_p$n";
-			$n++;
-		} elsif($type =~ /^_/) {
-			push @args, "C.uintptr_t(uintptr($name))";
-		} elsif($type eq "unsafe.Pointer") {
-			push @args, "C.uintptr_t(uintptr($name))";
-		} elsif($type eq "int") {
-			if (($arg_n == 2) && (($func eq "readlen") || ($func eq "writelen"))) {
-				push @args, "C.size_t($name)";
-			} elsif ($arg_n == 0 && $func eq "fcntl") {
-				push @args, "C.uintptr_t($name)";
-			} elsif (($arg_n == 2) && (($func eq "fcntl") || ($func eq "FcntlInt"))) {
-				push @args, "C.uintptr_t($name)";
-			} else {
-				push @args, "C.int($name)";
-			}
-		} elsif($type eq "int32") {
-			push @args, "C.int($name)";
-		} elsif($type eq "int64") {
-			push @args, "C.longlong($name)";
-		} elsif($type eq "uint32") {
-			push @args, "C.uint($name)";
-		} elsif($type eq "uint64") {
-			push @args, "C.ulonglong($name)";
-		} elsif($type eq "uintptr") {
-			push @args, "C.uintptr_t($name)";
-		} else {
-			push @args, "C.int($name)";
-		}
-		$arg_n++;
-	}
-	my $nargs = @args;
-
-
-	# Determine which form to use; pad args with zeros.
-	if ($nonblock) {
-	}
-
-	my $args = join(', ', @args);
-	my $call = "";
-	if ($sysname eq "exit") {
-		if ($errvar ne "") {
-			$call .= "er :=";
-		} else {
-			$call .= "";
-		}
-	}  elsif ($errvar ne "") {
-		$call .= "r0,er :=";
-	}  elsif ($retvar ne "") {
-		$call .= "r0,_ :=";
-	}  else {
-		$call .= ""
-	}
-	$call .= "C.$sysname($args)";
-
-	# Assign return values.
-	my $body = "";
-	my $failexpr = "";
-
-	for(my $i=0; $i<@out; $i++) {
-		my $p = $out[$i];
-		my ($name, $type) = parseparam($p);
-		my $reg = "";
-		if($name eq "err") {
-			$reg = "e1";
-		} else {
-			$reg = "r0";
-		}
-		if($reg ne "e1" ) {
-						$body .= "\t$name = $type($reg)\n";
-		}
-	}
-
-	# verify return
-	if ($sysname ne "exit" && $errvar ne "") {
-		if ($C_rettype =~ /^uintptr/) {
-			$body .= "\tif \(uintptr\(r0\) ==\^uintptr\(0\) && er != nil\) {\n";
-			$body .= "\t\t$errvar = er\n";
-			$body .= "\t}\n";
-		} else {
-			$body .= "\tif \(r0 ==-1 && er != nil\) {\n";
-			$body .= "\t\t$errvar = er\n";
-			$body .= "\t}\n";
-		}
-	} elsif ($errvar ne "") {
-		$body .= "\tif \(er != nil\) {\n";
-		$body .= "\t\t$errvar = er\n";
-		$body .= "\t}\n";
-	}
-
-	$text .= "\t$call\n";
-	$text .= $body;
-
-	$text .= "\treturn\n";
-	$text .= "}\n";
-}
-
-if($errors) {
-	exit 1;
-}
-
-print <<EOF;
-// $cmdline
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build $tags
-
-package $package
-
-
-$c_extern
-*/
-import "C"
-import (
-	"unsafe"
-	"syscall"
-)
-
-
-EOF
-
-print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
-
-chomp($_=<<EOF);
-
-$text
-EOF
-print $_;
-exit 0;

+ 0 - 289
vendor/golang.org/x/sys/unix/mksyscall_solaris.pl

@@ -1,289 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2009 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.
-
-# This program reads a file containing function prototypes
-# (like syscall_solaris.go) and generates system call bodies.
-# The prototypes are marked by lines beginning with "//sys"
-# and read like func declarations if //sys is replaced by func, but:
-#	* The parameter lists must give a name for each argument.
-#	  This includes return parameters.
-#	* The parameter lists must give a type for each argument:
-#	  the (x, y, z int) shorthand is not allowed.
-#	* If the return parameter is an error number, it must be named err.
-#	* If go func name needs to be different than its libc name,
-#	* or the function is not in libc, name could be specified
-#	* at the end, after "=" sign, like
-#	  //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
-
-use strict;
-
-my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV);
-my $errors = 0;
-my $_32bit = "";
-my $tags = "";  # build tags
-
-binmode STDOUT;
-
-if($ARGV[0] eq "-b32") {
-	$_32bit = "big-endian";
-	shift;
-} elsif($ARGV[0] eq "-l32") {
-	$_32bit = "little-endian";
-	shift;
-}
-if($ARGV[0] eq "-tags") {
-	shift;
-	$tags = $ARGV[0];
-	shift;
-}
-
-if($ARGV[0] =~ /^-/) {
-	print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
-	exit 1;
-}
-
-sub parseparamlist($) {
-	my ($list) = @_;
-	$list =~ s/^\s*//;
-	$list =~ s/\s*$//;
-	if($list eq "") {
-		return ();
-	}
-	return split(/\s*,\s*/, $list);
-}
-
-sub parseparam($) {
-	my ($p) = @_;
-	if($p !~ /^(\S*) (\S*)$/) {
-		print STDERR "$ARGV:$.: malformed parameter: $p\n";
-		$errors = 1;
-		return ("xx", "int");
-	}
-	return ($1, $2);
-}
-
-my $package = "";
-my $text = "";
-my $dynimports = "";
-my $linknames = "";
-my @vars = ();
-while(<>) {
-	chomp;
-	s/\s+/ /g;
-	s/^\s+//;
-	s/\s+$//;
-	$package = $1 if !$package && /^package (\S+)$/;
-	my $nonblock = /^\/\/sysnb /;
-	next if !/^\/\/sys / && !$nonblock;
-
-	# Line must be of the form
-	#	func Open(path string, mode int, perm int) (fd int, err error)
-	# Split into name, in params, out params.
-	if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
-		print STDERR "$ARGV:$.: malformed //sys declaration\n";
-		$errors = 1;
-		next;
-	}
-	my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
-
-	# Split argument lists on comma.
-	my @in = parseparamlist($in);
-	my @out = parseparamlist($out);
-
-	# So file name.
-	if($modname eq "") {
-		$modname = "libc";
-	}
-
-	# System call name.
-	if($sysname eq "") {
-		$sysname = "$func";
-	}
-
-	# System call pointer variable name.
-	my $sysvarname = "proc$sysname";
-
-	my $strconvfunc = "BytePtrFromString";
-	my $strconvtype = "*byte";
-
-	$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
-
-	# Runtime import of function to allow cross-platform builds.
-	$dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n";
-	# Link symbol to proc address variable.
-	$linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n";
-	# Library proc address variable.
-	push @vars, $sysvarname;
-
-	# Go function header.
-	$out = join(', ', @out);
-	if($out ne "") {
-		$out = " ($out)";
-	}
-	if($text ne "") {
-		$text .= "\n"
-	}
-	$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out;
-
-	# Check if err return available
-	my $errvar = "";
-	foreach my $p (@out) {
-		my ($name, $type) = parseparam($p);
-		if($type eq "error") {
-			$errvar = $name;
-			last;
-		}
-	}
-
-	# Prepare arguments to Syscall.
-	my @args = ();
-	my $n = 0;
-	foreach my $p (@in) {
-		my ($name, $type) = parseparam($p);
-		if($type =~ /^\*/) {
-			push @args, "uintptr(unsafe.Pointer($name))";
-		} elsif($type eq "string" && $errvar ne "") {
-			$text .= "\tvar _p$n $strconvtype\n";
-			$text .= "\t_p$n, $errvar = $strconvfunc($name)\n";
-			$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
-			push @args, "uintptr(unsafe.Pointer(_p$n))";
-			$n++;
-		} elsif($type eq "string") {
-			print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
-			$text .= "\tvar _p$n $strconvtype\n";
-			$text .= "\t_p$n, _ = $strconvfunc($name)\n";
-			push @args, "uintptr(unsafe.Pointer(_p$n))";
-			$n++;
-		} elsif($type =~ /^\[\](.*)/) {
-			# Convert slice into pointer, length.
-			# Have to be careful not to take address of &a[0] if len == 0:
-			# pass nil in that case.
-			$text .= "\tvar _p$n *$1\n";
-			$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
-			push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))";
-			$n++;
-		} elsif($type eq "int64" && $_32bit ne "") {
-			if($_32bit eq "big-endian") {
-				push @args, "uintptr($name >> 32)", "uintptr($name)";
-			} else {
-				push @args, "uintptr($name)", "uintptr($name >> 32)";
-			}
-		} elsif($type eq "bool") {
- 			$text .= "\tvar _p$n uint32\n";
-			$text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
-			push @args, "uintptr(_p$n)";
-			$n++;
-		} else {
-			push @args, "uintptr($name)";
-		}
-	}
-	my $nargs = @args;
-
-	# Determine which form to use; pad args with zeros.
-	my $asm = "sysvicall6";
-	if ($nonblock) {
-		$asm = "rawSysvicall6";
-	}
-	if(@args <= 6) {
-		while(@args < 6) {
-			push @args, "0";
-		}
-	} else {
-		print STDERR "$ARGV:$.: too many arguments to system call\n";
-	}
-
-	# Actual call.
-	my $args = join(', ', @args);
-	my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)";
-
-	# Assign return values.
-	my $body = "";
-	my $failexpr = "";
-	my @ret = ("_", "_", "_");
-	my @pout= ();
-	my $do_errno = 0;
-	for(my $i=0; $i<@out; $i++) {
-		my $p = $out[$i];
-		my ($name, $type) = parseparam($p);
-		my $reg = "";
-		if($name eq "err") {
-			$reg = "e1";
-			$ret[2] = $reg;
-			$do_errno = 1;
-		} else {
-			$reg = sprintf("r%d", $i);
-			$ret[$i] = $reg;
-		}
-		if($type eq "bool") {
-			$reg = "$reg != 0";
-		}
-		if($type eq "int64" && $_32bit ne "") {
-			# 64-bit number in r1:r0 or r0:r1.
-			if($i+2 > @out) {
-				print STDERR "$ARGV:$.: not enough registers for int64 return\n";
-			}
-			if($_32bit eq "big-endian") {
-				$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
-			} else {
-				$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
-			}
-			$ret[$i] = sprintf("r%d", $i);
-			$ret[$i+1] = sprintf("r%d", $i+1);
-		}
-		if($reg ne "e1") {
-			$body .= "\t$name = $type($reg)\n";
-		}
-	}
-	if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
-		$text .= "\t$call\n";
-	} else {
-		$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
-	}
-	$text .= $body;
-
-	if ($do_errno) {
-		$text .= "\tif e1 != 0 {\n";
-		$text .= "\t\terr = e1\n";
-		$text .= "\t}\n";
-	}
-	$text .= "\treturn\n";
-	$text .= "}\n";
-}
-
-if($errors) {
-	exit 1;
-}
-
-print <<EOF;
-// $cmdline
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build $tags
-
-package $package
-
-import (
-	"syscall"
-	"unsafe"
-)
-EOF
-
-print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
-
-my $vardecls = "\t" . join(",\n\t", @vars);
-$vardecls .= " syscallFunc";
-
-chomp($_=<<EOF);
-
-$dynimports
-$linknames
-var (
-$vardecls
-)
-
-$text
-EOF
-print $_;
-exit 0;

+ 0 - 264
vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl

@@ -1,264 +0,0 @@
-#!/usr/bin/env perl
-
-# Copyright 2011 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.
-
-#
-# Parse the header files for OpenBSD and generate a Go usable sysctl MIB.
-#
-# Build a MIB with each entry being an array containing the level, type and
-# a hash that will contain additional entries if the current entry is a node.
-# We then walk this MIB and create a flattened sysctl name to OID hash.
-#
-
-use strict;
-
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
-	print STDERR "GOARCH or GOOS not defined in environment\n";
-	exit 1;
-}
-
-my $debug = 0;
-my %ctls = ();
-
-my @headers = qw (
-	sys/sysctl.h
-	sys/socket.h
-	sys/tty.h
-	sys/malloc.h
-	sys/mount.h
-	sys/namei.h
-	sys/sem.h
-	sys/shm.h
-	sys/vmmeter.h
-	uvm/uvm_param.h
-	uvm/uvm_swap_encrypt.h
-	ddb/db_var.h
-	net/if.h
-	net/if_pfsync.h
-	net/pipex.h
-	netinet/in.h
-	netinet/icmp_var.h
-	netinet/igmp_var.h
-	netinet/ip_ah.h
-	netinet/ip_carp.h
-	netinet/ip_divert.h
-	netinet/ip_esp.h
-	netinet/ip_ether.h
-	netinet/ip_gre.h
-	netinet/ip_ipcomp.h
-	netinet/ip_ipip.h
-	netinet/pim_var.h
-	netinet/tcp_var.h
-	netinet/udp_var.h
-	netinet6/in6.h
-	netinet6/ip6_divert.h
-	netinet6/pim6_var.h
-	netinet/icmp6.h
-	netmpls/mpls.h
-);
-
-my @ctls = qw (
-	kern
-	vm
-	fs
-	net
-	#debug				# Special handling required
-	hw
-	#machdep			# Arch specific
-	user
-	ddb
-	#vfs				# Special handling required
-	fs.posix
-	kern.forkstat
-	kern.intrcnt
-	kern.malloc
-	kern.nchstats
-	kern.seminfo
-	kern.shminfo
-	kern.timecounter
-	kern.tty
-	kern.watchdog
-	net.bpf
-	net.ifq
-	net.inet
-	net.inet.ah
-	net.inet.carp
-	net.inet.divert
-	net.inet.esp
-	net.inet.etherip
-	net.inet.gre
-	net.inet.icmp
-	net.inet.igmp
-	net.inet.ip
-	net.inet.ip.ifq
-	net.inet.ipcomp
-	net.inet.ipip
-	net.inet.mobileip
-	net.inet.pfsync
-	net.inet.pim
-	net.inet.tcp
-	net.inet.udp
-	net.inet6
-	net.inet6.divert
-	net.inet6.ip6
-	net.inet6.icmp6
-	net.inet6.pim6
-	net.inet6.tcp6
-	net.inet6.udp6
-	net.mpls
-	net.mpls.ifq
-	net.key
-	net.pflow
-	net.pfsync
-	net.pipex
-	net.rt
-	vm.swapencrypt
-	#vfsgenctl			# Special handling required
-);
-
-# Node name "fixups"
-my %ctl_map = (
-	"ipproto" => "net.inet",
-	"net.inet.ipproto" => "net.inet",
-	"net.inet6.ipv6proto" => "net.inet6",
-	"net.inet6.ipv6" => "net.inet6.ip6",
-	"net.inet.icmpv6" => "net.inet6.icmp6",
-	"net.inet6.divert6" => "net.inet6.divert",
-	"net.inet6.tcp6" => "net.inet.tcp",
-	"net.inet6.udp6" => "net.inet.udp",
-	"mpls" => "net.mpls",
-	"swpenc" => "vm.swapencrypt"
-);
-
-# Node mappings
-my %node_map = (
-	"net.inet.ip.ifq" => "net.ifq",
-	"net.inet.pfsync" => "net.pfsync",
-	"net.mpls.ifq" => "net.ifq"
-);
-
-my $ctlname;
-my %mib = ();
-my %sysctl = ();
-my $node;
-
-sub debug() {
-	print STDERR "$_[0]\n" if $debug;
-}
-
-# Walk the MIB and build a sysctl name to OID mapping.
-sub build_sysctl() {
-	my ($node, $name, $oid) = @_;
-	my %node = %{$node};
-	my @oid = @{$oid};
-
-	foreach my $key (sort keys %node) {
-		my @node = @{$node{$key}};
-		my $nodename = $name.($name ne '' ? '.' : '').$key;
-		my @nodeoid = (@oid, $node[0]);
-		if ($node[1] eq 'CTLTYPE_NODE') {
-			if (exists $node_map{$nodename}) {
-				$node = \%mib;
-				$ctlname = $node_map{$nodename};
-				foreach my $part (split /\./, $ctlname) {
-					$node = \%{@{$$node{$part}}[2]};
-				}
-			} else {
-				$node = $node[2];
-			}
-			&build_sysctl($node, $nodename, \@nodeoid);
-		} elsif ($node[1] ne '') {
-			$sysctl{$nodename} = \@nodeoid;
-		}
-	}
-}
-
-foreach my $ctl (@ctls) {
-	$ctls{$ctl} = $ctl;
-}
-
-# Build MIB
-foreach my $header (@headers) {
-	&debug("Processing $header...");
-	open HEADER, "/usr/include/$header" ||
-	    print STDERR "Failed to open $header\n";
-	while (<HEADER>) {
-		if ($_ =~ /^#define\s+(CTL_NAMES)\s+{/ ||
-		    $_ =~ /^#define\s+(CTL_(.*)_NAMES)\s+{/ ||
-		    $_ =~ /^#define\s+((.*)CTL_NAMES)\s+{/) {
-			if ($1 eq 'CTL_NAMES') {
-				# Top level.
-				$node = \%mib;
-			} else {
-				# Node.
-				my $nodename = lc($2);
-				if ($header =~ /^netinet\//) {
-					$ctlname = "net.inet.$nodename";
-				} elsif ($header =~ /^netinet6\//) {
-					$ctlname = "net.inet6.$nodename";
-				} elsif ($header =~ /^net\//) {
-					$ctlname = "net.$nodename";
-				} else {
-					$ctlname = "$nodename";
-					$ctlname =~ s/^(fs|net|kern)_/$1\./;
-				}
-				if (exists $ctl_map{$ctlname}) {
-					$ctlname = $ctl_map{$ctlname};
-				}
-				if (not exists $ctls{$ctlname}) {
-					&debug("Ignoring $ctlname...");
-					next;
-				}
-
-				# Walk down from the top of the MIB.
-				$node = \%mib;
-				foreach my $part (split /\./, $ctlname) {
-					if (not exists $$node{$part}) {
-						&debug("Missing node $part");
-						$$node{$part} = [ 0, '', {} ];
-					}
-					$node = \%{@{$$node{$part}}[2]};
-				}
-			}
-
-			# Populate current node with entries.
-			my $i = -1;
-			while (defined($_) && $_ !~ /^}/) {
-				$_ = <HEADER>;
-				$i++ if $_ =~ /{.*}/;
-				next if $_ !~ /{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}/;
-				$$node{$1} = [ $i, $2, {} ];
-			}
-		}
-	}
-	close HEADER;
-}
-
-&build_sysctl(\%mib, "", []);
-
-print <<EOF;
-// mksysctl_openbsd.pl
-// Code generated by the command above; DO NOT EDIT.
-
-// +build $ENV{'GOARCH'},$ENV{'GOOS'}
-
-package unix;
-
-type mibentry struct {
-	ctlname string
-	ctloid []_C_int
-}
-
-var sysctlMib = []mibentry {
-EOF
-
-foreach my $name (sort keys %sysctl) {
-	my @oid = @{$sysctl{$name}};
-	print "\t{ \"$name\", []_C_int{ ", join(', ', @oid), " } }, \n";
-}
-
-print <<EOF;
-}
-EOF

+ 0 - 39
vendor/golang.org/x/sys/unix/mksysnum_darwin.pl

@@ -1,39 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2009 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.
-#
-# Generate system call table for Darwin from sys/syscall.h
-
-use strict;
-
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
-	print STDERR "GOARCH or GOOS not defined in environment\n";
-	exit 1;
-}
-
-my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
-
-print <<EOF;
-// $command
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build $ENV{'GOARCH'},$ENV{'GOOS'}
-
-package unix
-
-const (
-EOF
-
-while(<>){
-	if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
-		my $name = $1;
-		my $num = $2;
-		$name =~ y/a-z/A-Z/;
-		print "	SYS_$name = $num;"
-	}
-}
-
-print <<EOF;
-)
-EOF

+ 0 - 50
vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl

@@ -1,50 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2009 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.
-#
-# Generate system call table for DragonFly from master list
-# (for example, /usr/src/sys/kern/syscalls.master).
-
-use strict;
-
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
-	print STDERR "GOARCH or GOOS not defined in environment\n";
-	exit 1;
-}
-
-my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
-
-print <<EOF;
-// $command
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build $ENV{'GOARCH'},$ENV{'GOOS'}
-
-package unix
-
-const (
-EOF
-
-while(<>){
-	if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
-		my $num = $1;
-		my $proto = $2;
-		my $name = "SYS_$3";
-		$name =~ y/a-z/A-Z/;
-
-		# There are multiple entries for enosys and nosys, so comment them out.
-		if($name =~ /^SYS_E?NOSYS$/){
-			$name = "// $name";
-		}
-		if($name eq 'SYS_SYS_EXIT'){
-			$name = 'SYS_EXIT';
-		}
-
-		print "	$name = $num;  // $proto\n";
-	}
-}
-
-print <<EOF;
-)
-EOF

+ 0 - 50
vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl

@@ -1,50 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2009 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.
-#
-# Generate system call table for FreeBSD from master list
-# (for example, /usr/src/sys/kern/syscalls.master).
-
-use strict;
-
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
-	print STDERR "GOARCH or GOOS not defined in environment\n";
-	exit 1;
-}
-
-my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
-
-print <<EOF;
-// $command
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build $ENV{'GOARCH'},$ENV{'GOOS'}
-
-package unix
-
-const (
-EOF
-
-while(<>){
-	if(/^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$/){
-		my $num = $1;
-		my $proto = $2;
-		my $name = "SYS_$3";
-		$name =~ y/a-z/A-Z/;
-
-		# There are multiple entries for enosys and nosys, so comment them out.
-		if($name =~ /^SYS_E?NOSYS$/){
-			$name = "// $name";
-		}
-		if($name eq 'SYS_SYS_EXIT'){
-			$name = 'SYS_EXIT';
-		}
-
-		print "	$name = $num;  // $proto\n";
-	}
-}
-
-print <<EOF;
-)
-EOF

+ 0 - 58
vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl

@@ -1,58 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2009 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.
-#
-# Generate system call table for OpenBSD from master list
-# (for example, /usr/src/sys/kern/syscalls.master).
-
-use strict;
-
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
-	print STDERR "GOARCH or GOOS not defined in environment\n";
-	exit 1;
-}
-
-my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
-
-print <<EOF;
-// $command
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build $ENV{'GOARCH'},$ENV{'GOOS'}
-
-package unix
-
-const (
-EOF
-
-my $line = '';
-while(<>){
-	if($line =~ /^(.*)\\$/) {
-		# Handle continuation
-		$line = $1;
-		$_ =~ s/^\s+//;
-		$line .= $_;
-	} else {
-		# New line
-		$line = $_;
-	}
-	next if $line =~ /\\$/;
-	if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
-		my $num = $1;
-		my $proto = $6;
-		my $compat = $8;
-		my $name = "$7_$9";
-
-		$name = "$7_$11" if $11 ne '';
-		$name =~ y/a-z/A-Z/;
-
-		if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') {
-			print "	$name = $num;  // $proto\n";
-		}
-	}
-}
-
-print <<EOF;
-)
-EOF

+ 0 - 50
vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl

@@ -1,50 +0,0 @@
-#!/usr/bin/env perl
-# Copyright 2009 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.
-#
-# Generate system call table for OpenBSD from master list
-# (for example, /usr/src/sys/kern/syscalls.master).
-
-use strict;
-
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
-	print STDERR "GOARCH or GOOS not defined in environment\n";
-	exit 1;
-}
-
-my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
-
-print <<EOF;
-// $command
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-// +build $ENV{'GOARCH'},$ENV{'GOOS'}
-
-package unix
-
-const (
-EOF
-
-while(<>){
-	if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
-		my $num = $1;
-		my $proto = $3;
-		my $name = $4;
-		$name =~ y/a-z/A-Z/;
-
-		# There are multiple entries for enosys and nosys, so comment them out.
-		if($name =~ /^SYS_E?NOSYS$/){
-			$name = "// $name";
-		}
-		if($name eq 'SYS_SYS_EXIT'){
-			$name = 'SYS_EXIT';
-		}
-
-		print "	$name = $num;  // $proto\n";
-	}
-}
-
-print <<EOF;
-)
-EOF

+ 0 - 95
vendor/golang.org/x/sys/unix/openbsd_pledge.go

@@ -1,95 +0,0 @@
-// Copyright 2016 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 openbsd
-// +build 386 amd64 arm
-
-package unix
-
-import (
-	"errors"
-	"fmt"
-	"strconv"
-	"syscall"
-	"unsafe"
-)
-
-const (
-	_SYS_PLEDGE = 108
-)
-
-// Pledge implements the pledge syscall.
-//
-// The pledge syscall does not accept execpromises on OpenBSD releases
-// before 6.3.
-//
-// execpromises must be empty when Pledge is called on OpenBSD
-// releases predating 6.3, otherwise an error will be returned.
-//
-// For more information see pledge(2).
-func Pledge(promises, execpromises string) error {
-	maj, min, err := majmin()
-	if err != nil {
-		return err
-	}
-
-	// If OpenBSD <= 5.9, pledge is not available.
-	if (maj == 5 && min != 9) || maj < 5 {
-		return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min)
-	}
-
-	// If OpenBSD <= 6.2 and execpromises is not empty
-	// return an error - execpromises is not available before 6.3
-	if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" {
-		return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min)
-	}
-
-	pptr, err := syscall.BytePtrFromString(promises)
-	if err != nil {
-		return err
-	}
-
-	// This variable will hold either a nil unsafe.Pointer or
-	// an unsafe.Pointer to a string (execpromises).
-	var expr unsafe.Pointer
-
-	// If we're running on OpenBSD > 6.2, pass execpromises to the syscall.
-	if maj > 6 || (maj == 6 && min > 2) {
-		exptr, err := syscall.BytePtrFromString(execpromises)
-		if err != nil {
-			return err
-		}
-		expr = unsafe.Pointer(exptr)
-	}
-
-	_, _, e := syscall.Syscall(_SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
-	if e != 0 {
-		return e
-	}
-
-	return nil
-}
-
-// majmin returns major and minor version number for an OpenBSD system.
-func majmin() (major int, minor int, err error) {
-	var v Utsname
-	err = Uname(&v)
-	if err != nil {
-		return
-	}
-
-	major, err = strconv.Atoi(string(v.Release[0]))
-	if err != nil {
-		err = errors.New("cannot parse major version number returned by uname")
-		return
-	}
-
-	minor, err = strconv.Atoi(string(v.Release[2]))
-	if err != nil {
-		err = errors.New("cannot parse minor version number returned by uname")
-		return
-	}
-
-	return
-}

+ 0 - 15
vendor/golang.org/x/sys/unix/pagesize_unix.go

@@ -1,15 +0,0 @@
-// Copyright 2017 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 aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-// For Unix, get the pagesize from the runtime.
-
-package unix
-
-import "syscall"
-
-func Getpagesize() int {
-	return syscall.Getpagesize()
-}

+ 0 - 30
vendor/golang.org/x/sys/unix/race.go

@@ -1,30 +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 darwin,race linux,race freebsd,race
-
-package unix
-
-import (
-	"runtime"
-	"unsafe"
-)
-
-const raceenabled = true
-
-func raceAcquire(addr unsafe.Pointer) {
-	runtime.RaceAcquire(addr)
-}
-
-func raceReleaseMerge(addr unsafe.Pointer) {
-	runtime.RaceReleaseMerge(addr)
-}
-
-func raceReadRange(addr unsafe.Pointer, len int) {
-	runtime.RaceReadRange(addr, len)
-}
-
-func raceWriteRange(addr unsafe.Pointer, len int) {
-	runtime.RaceWriteRange(addr, len)
-}

Some files were not shown because too many files changed in this diff