From 91d564b174d3b3f60d3f8a4fbacccfeb4c5f3584 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 17 Nov 2017 10:18:19 +1300 Subject: [PATCH] dep update, adjust for new moddwatch interface --- Gopkg.lock | 18 +- Gopkg.toml | 6 +- .../cortesi/moddwatch/.appveyor.yml | 22 + .../github.com/cortesi/moddwatch/.travis.yml | 18 + .../github.com/cortesi/moddwatch/Gopkg.lock | 50 +- .../github.com/cortesi/moddwatch/Gopkg.toml | 4 + vendor/github.com/cortesi/moddwatch/README.md | 8 +- .../cortesi/moddwatch/filter/filter.go | 151 ++----- .../cortesi/moddwatch/filter/filter_test.go | 166 ++----- vendor/github.com/cortesi/moddwatch/watch.go | 260 ++++++++--- .../cortesi/moddwatch/watch_test.go | 427 +++++++++++++++++- vendor/github.com/cortesi/termlog/.travis.yml | 2 +- vendor/github.com/cortesi/termlog/Gopkg.lock | 45 ++ vendor/github.com/cortesi/termlog/Gopkg.toml | 34 ++ .../dustin/go-humanize/README.markdown | 32 ++ vendor/github.com/dustin/go-humanize/comma.go | 2 +- .../dustin/go-humanize/english/words.go | 96 ++++ .../dustin/go-humanize/english/words_test.go | 94 ++++ vendor/github.com/dustin/go-humanize/times.go | 2 +- .../dustin/go-humanize/times_test.go | 11 + vendor/github.com/fatih/color/.travis.yml | 2 +- vendor/github.com/fatih/color/README.md | 18 +- vendor/github.com/fatih/color/color.go | 2 +- .../x/crypto/blake2s/blake2s_test.go | 2 +- vendor/golang.org/x/crypto/ocsp/ocsp_test.go | 10 +- vendor/golang.org/x/crypto/ssh/cipher.go | 2 +- vendor/golang.org/x/crypto/ssh/client.go | 21 + vendor/golang.org/x/crypto/ssh/client_auth.go | 30 +- vendor/golang.org/x/crypto/ssh/client_test.go | 38 ++ vendor/golang.org/x/crypto/ssh/handshake.go | 6 + vendor/golang.org/x/crypto/ssh/messages.go | 16 +- vendor/golang.org/x/crypto/ssh/server.go | 17 + .../golang.org/x/crypto/ssh/terminal/util.go | 69 ++- .../x/crypto/ssh/test/banner_test.go | 33 ++ .../x/crypto/ssh/test/test_unix_test.go | 3 + vendor/golang.org/x/crypto/ssh/transport.go | 2 +- vendor/golang.org/x/net/html/doc.go | 8 +- vendor/golang.org/x/net/http2/server.go | 11 +- vendor/golang.org/x/net/http2/server_test.go | 8 +- vendor/golang.org/x/net/http2/transport.go | 67 ++- .../golang.org/x/net/http2/transport_test.go | 28 ++ vendor/golang.org/x/net/idna/idna.go | 17 +- vendor/golang.org/x/sys/unix/file_unix.go | 27 -- vendor/golang.org/x/sys/unix/mkerrors.sh | 10 +- vendor/golang.org/x/sys/unix/syscall_bsd.go | 11 +- .../golang.org/x/sys/unix/syscall_bsd_test.go | 8 + .../golang.org/x/sys/unix/syscall_darwin.go | 77 ++++ .../x/sys/unix/syscall_dragonfly.go | 45 +- .../golang.org/x/sys/unix/syscall_freebsd.go | 5 + vendor/golang.org/x/sys/unix/syscall_linux.go | 4 + .../x/sys/unix/syscall_linux_test.go | 2 +- .../golang.org/x/sys/unix/syscall_netbsd.go | 46 +- .../golang.org/x/sys/unix/syscall_openbsd.go | 68 ++- .../x/sys/unix/syscall_unix_test.go | 6 + vendor/golang.org/x/sys/unix/types_darwin.go | 5 + .../golang.org/x/sys/unix/types_dragonfly.go | 2 + vendor/golang.org/x/sys/unix/types_netbsd.go | 2 + vendor/golang.org/x/sys/unix/types_openbsd.go | 2 + .../x/sys/unix/zerrors_darwin_386.go | 96 ++++ .../x/sys/unix/zerrors_darwin_amd64.go | 96 ++++ .../x/sys/unix/zerrors_darwin_arm.go | 96 ++++ .../x/sys/unix/zerrors_darwin_arm64.go | 96 ++++ .../x/sys/unix/zerrors_linux_386.go | 1 + .../x/sys/unix/zerrors_linux_amd64.go | 1 + .../x/sys/unix/zerrors_linux_arm.go | 1 + .../x/sys/unix/zerrors_linux_arm64.go | 1 + .../x/sys/unix/zerrors_linux_mips.go | 1 + .../x/sys/unix/zerrors_linux_mips64.go | 1 + .../x/sys/unix/zerrors_linux_mips64le.go | 1 + .../x/sys/unix/zerrors_linux_mipsle.go | 1 + .../x/sys/unix/zerrors_linux_ppc64.go | 1 + .../x/sys/unix/zerrors_linux_ppc64le.go | 1 + .../x/sys/unix/zerrors_linux_s390x.go | 1 + .../x/sys/unix/zsyscall_darwin_386.go | 22 +- .../x/sys/unix/zsyscall_darwin_amd64.go | 22 +- .../x/sys/unix/zsyscall_darwin_arm.go | 24 +- .../x/sys/unix/zsyscall_darwin_arm64.go | 22 +- .../x/sys/unix/zsyscall_dragonfly_amd64.go | 10 + .../x/sys/unix/zsyscall_netbsd_386.go | 10 + .../x/sys/unix/zsyscall_netbsd_amd64.go | 10 + .../x/sys/unix/zsyscall_netbsd_arm.go | 10 + .../x/sys/unix/zsyscall_openbsd_386.go | 10 + .../x/sys/unix/zsyscall_openbsd_amd64.go | 10 + .../x/sys/unix/zsyscall_openbsd_arm.go | 10 + .../x/sys/unix/zsysnum_darwin_386.go | 60 ++- .../x/sys/unix/zsysnum_darwin_amd64.go | 60 ++- .../x/sys/unix/zsysnum_darwin_arm.go | 14 +- .../x/sys/unix/zsysnum_darwin_arm64.go | 14 +- .../x/sys/unix/ztypes_darwin_386.go | 8 + .../x/sys/unix/ztypes_darwin_amd64.go | 8 + .../x/sys/unix/ztypes_darwin_arm.go | 8 + .../x/sys/unix/ztypes_darwin_arm64.go | 8 + .../x/sys/unix/ztypes_dragonfly_amd64.go | 7 + .../x/sys/unix/ztypes_netbsd_386.go | 7 + .../x/sys/unix/ztypes_netbsd_amd64.go | 7 + .../x/sys/unix/ztypes_netbsd_arm.go | 7 + .../x/sys/unix/ztypes_openbsd_386.go | 7 + .../x/sys/unix/ztypes_openbsd_amd64.go | 7 + .../x/sys/unix/ztypes_openbsd_arm.go | 7 + .../x/sys/windows/syscall_windows.go | 69 +++ .../x/sys/windows/syscall_windows_test.go | 2 +- .../golang.org/x/sys/windows/types_windows.go | 34 ++ watch.go | 41 +- 103 files changed, 2468 insertions(+), 640 deletions(-) create mode 100644 vendor/github.com/cortesi/moddwatch/.appveyor.yml create mode 100644 vendor/github.com/cortesi/moddwatch/.travis.yml create mode 100644 vendor/github.com/cortesi/termlog/Gopkg.lock create mode 100644 vendor/github.com/cortesi/termlog/Gopkg.toml create mode 100644 vendor/github.com/dustin/go-humanize/english/words.go create mode 100644 vendor/github.com/dustin/go-humanize/english/words_test.go create mode 100644 vendor/golang.org/x/crypto/ssh/test/banner_test.go delete mode 100644 vendor/golang.org/x/sys/unix/file_unix.go diff --git a/Gopkg.lock b/Gopkg.lock index 6889a06..77f5e1c 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -29,13 +29,13 @@ branch = "master" name = "github.com/cortesi/moddwatch" packages = [".","filter"] - revision = "240471ee3dbcb471822bdbd1d583857869dec519" + revision = "228c18fd534b875242534ee3179a70d0ff69a0b1" [[projects]] branch = "master" name = "github.com/cortesi/termlog" packages = ["."] - revision = "2ed14eb6ce62ec5bcc3fd25885a1d13d53f34fd1" + revision = "87cefd5ac843f65364f70a1fd2477bb6437690e8" [[projects]] branch = "master" @@ -47,13 +47,13 @@ branch = "master" name = "github.com/dustin/go-humanize" packages = ["."] - revision = "77ed807830b4df581417e7f89eb81d4872832b72" + revision = "bb3d318650d48840a39aa21a027c6630e198e626" [[projects]] + branch = "master" name = "github.com/fatih/color" packages = ["."] - revision = "570b54cabe6b8eb0bc2dfce68d964677d63b5260" - version = "v1.5.0" + revision = "5df930a27be2502f99b292b7cc09ebad4d0891f4" [[projects]] branch = "master" @@ -113,19 +113,19 @@ branch = "master" name = "golang.org/x/crypto" packages = ["ssh/terminal"] - revision = "bd6f299fb381e4c3393d1c4b1f0b94f5e77650c8" + revision = "9f005a07e0d31d45e6656d241bb5c0f2efd4bc94" [[projects]] branch = "master" name = "golang.org/x/net" packages = ["context"] - revision = "c73622c77280266305273cb545f54516ced95b93" + revision = "9dfe39835686865bff950a07b394c12a98ddc811" [[projects]] branch = "master" name = "golang.org/x/sys" packages = ["unix","windows"] - revision = "95c6576299259db960f6c5b9b69ea52422860fce" + revision = "bf42f188b9bc6f2cf5b8ee5a912ef1aedd0eba4c" [[projects]] name = "gopkg.in/alecthomas/kingpin.v2" @@ -136,6 +136,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "cf1a06dc17f0bf13d465e60e51bb76fbd8175685a836a34287727393070091cc" + inputs-digest = "9c792dae845ce7fb874e4b2d55806bc45bf065d3a71f751ccb326bdecff9d3d6" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 9c37e87..339ed7b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -39,7 +39,7 @@ [[constraint]] name = "github.com/fatih/color" - version = "1.5.0" + branch = "master" [[constraint]] branch = "master" @@ -66,5 +66,5 @@ name = "golang.org/x/net" [[constraint]] - name = "gopkg.in/alecthomas/kingpin.v2" - version = "2.2.5" + branch = "master" + name = "github.com/alecthomas/kingpin" diff --git a/vendor/github.com/cortesi/moddwatch/.appveyor.yml b/vendor/github.com/cortesi/moddwatch/.appveyor.yml new file mode 100644 index 0000000..d55e746 --- /dev/null +++ b/vendor/github.com/cortesi/moddwatch/.appveyor.yml @@ -0,0 +1,22 @@ +version: "{build}" + +os: Windows Server 2012 R2 + +clone_folder: c:\gopath\src\github.com\cortesi\moddwatch + +environment: + GOPATH: c:\gopath + GO15VENDOREXPERIMENT: 1 + +install: + - set PATH=%GOPATH%\bin;c:\go\bin;%PATH% + - go version + - go env + - go get -d ./... + +build_script: + - go test -race -v ./... + +test: off + +deploy: off diff --git a/vendor/github.com/cortesi/moddwatch/.travis.yml b/vendor/github.com/cortesi/moddwatch/.travis.yml new file mode 100644 index 0000000..7234acb --- /dev/null +++ b/vendor/github.com/cortesi/moddwatch/.travis.yml @@ -0,0 +1,18 @@ +language: go + +go: + - 1.9 + +os: + - linux + - osx + +install: + - go get -t -v ./... + +script: + - go test -v -race ./... + +notifications: + email: + - aldo@corte.si diff --git a/vendor/github.com/cortesi/moddwatch/Gopkg.lock b/vendor/github.com/cortesi/moddwatch/Gopkg.lock index bc9e370..efc818f 100644 --- a/vendor/github.com/cortesi/moddwatch/Gopkg.lock +++ b/vendor/github.com/cortesi/moddwatch/Gopkg.lock @@ -5,59 +5,29 @@ branch = "master" name = "github.com/bmatcuk/doublestar" packages = ["."] - revision = "4f612bd6c10e2ef68e2ea50aabc50c3681bbac86" + revision = "dd6a6f0a8cdfaaa88b08cf26cf1bc7d69003ee13" [[projects]] - branch = "master" - name = "github.com/cortesi/modd" - packages = ["utils"] - revision = "28ff53da5dceb93adc3b3401bb68a54cc0dabd48" - -[[projects]] - branch = "master" - name = "github.com/cortesi/termlog" - packages = ["."] - revision = "2ed14eb6ce62ec5bcc3fd25885a1d13d53f34fd1" - -[[projects]] - branch = "master" - name = "github.com/fatih/color" - packages = ["."] - revision = "76d423163af754ff6423d2d9be0057fbf03c57c2" - -[[projects]] - branch = "master" - name = "github.com/mattn/go-isatty" - packages = ["."] - revision = "7fcbc72f853b92b5720db4a6b8482be612daef24" + name = "github.com/google/go-cmp" + packages = ["cmp","cmp/internal/diff","cmp/internal/function","cmp/internal/value"] + revision = "8099a9787ce5dc5984ed879a3bda47dc730a8e97" + version = "v0.1.0" [[projects]] branch = "master" name = "github.com/rjeczalik/notify" packages = ["."] - revision = "5dd6205716539662f8f14ab513552b41eab69d5d" - -[[projects]] - branch = "master" - name = "github.com/shiena/ansicolor" - packages = ["."] - revision = "d445752f6f66f9cd987722f109149f6799cdf1de" - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["ssh/terminal"] - revision = "c8b9e6388ef638d5a8a9d865c634befdc46a6784" + revision = "767eb674ef14b09119b2fff3601e64558d530c47" [[projects]] branch = "master" - name = "golang.org/x/net" - packages = ["context"] - revision = "a6577fac2d73be281a500b310739095313165611" + name = "golang.org/x/sys" + packages = ["unix"] + revision = "bf42f188b9bc6f2cf5b8ee5a912ef1aedd0eba4c" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "9a197ee2bd5ee17f1536dd2f441e0aa0e79a8fdb619cc00c5db3a888100c28f4" + inputs-digest = "4242ed586f338d176fa29d8226f650a37aa03e057baf78ed65c4f6a3f251a874" solver-name = "gps-cdcl" solver-version = 1 diff --git a/vendor/github.com/cortesi/moddwatch/Gopkg.toml b/vendor/github.com/cortesi/moddwatch/Gopkg.toml index 9a08b31..92f7fc4 100644 --- a/vendor/github.com/cortesi/moddwatch/Gopkg.toml +++ b/vendor/github.com/cortesi/moddwatch/Gopkg.toml @@ -81,3 +81,7 @@ [[constraint]] branch = "master" name = "github.com/rjeczalik/notify" + +[[constraint]] + name = "github.com/google/go-cmp" + version = "0.1.0" diff --git a/vendor/github.com/cortesi/moddwatch/README.md b/vendor/github.com/cortesi/moddwatch/README.md index 6cd690c..2cc2a0b 100644 --- a/vendor/github.com/cortesi/moddwatch/README.md +++ b/vendor/github.com/cortesi/moddwatch/README.md @@ -1,2 +1,8 @@ -moddwatch watches files and directories for modifications. +[![Travis Build Status](https://travis-ci.org/cortesi/moddwatch.svg?branch=master)](https://travis-ci.org/cortesi/moddwatch) +[![Appveyor status](https://ci.appveyor.com/api/projects/status/rgdqhluxr34t9eou/branch/master?svg=true)](https://ci.appveyor.com/project/cortesi/moddwatch/branch/master) + +ModdWatch is a library for building tools that watch files and directories for +modifications. + + diff --git a/vendor/github.com/cortesi/moddwatch/filter/filter.go b/vendor/github.com/cortesi/moddwatch/filter/filter.go index 273a721..2a796cf 100644 --- a/vendor/github.com/cortesi/moddwatch/filter/filter.go +++ b/vendor/github.com/cortesi/moddwatch/filter/filter.go @@ -1,19 +1,18 @@ package filter import ( - "fmt" - "os" "path/filepath" "strings" "github.com/bmatcuk/doublestar" ) -func matchAny(path string, patterns []string) (bool, error) { +// MatchAny checks whether the given path matches any of the specified patterns. +func MatchAny(path string, patterns []string) (bool, error) { for _, pattern := range patterns { match, err := doublestar.Match(pattern, filepath.ToSlash(path)) if err != nil { - return false, fmt.Errorf("Error matching pattern '%s': %s", pattern, err) + return false, err } else if match { return true, nil } @@ -21,127 +20,53 @@ func matchAny(path string, patterns []string) (bool, error) { return false, nil } -// Determine if a file should be included, based on the given exclude paths. -func shouldInclude(file string, includePatterns []string, excludePatterns []string) (bool, error) { - include, err := matchAny(file, includePatterns) - if err != nil || include == false { - return false, err +// File determines if a path matches a set of include and exclude patterns. At +// least one include pattern and no exclude patterns must match. +func File( + path string, + includePatterns []string, + excludePatterns []string, +) (string, error) { + if excluded, err := MatchAny(path, excludePatterns); err != nil { + return "", err + } else if excluded { + return "", nil } - - exclude, err := matchAny(file, excludePatterns) - if err != nil { - return false, err - } - if exclude == true { - return false, err + if included, err := MatchAny(path, includePatterns); err != nil { + return "", err + } else if included { + return path, nil } - return true, nil + return "", nil } -// Files filters an array of files. At least ONE include pattern must match, -// and NONE of the exclude patterns must match. -func Files(files []string, includePatterns []string, excludePatterns []string) ([]string, error) { +// Files filters an array of files using filter.File. +func Files( + files []string, + includePatterns []string, + excludePatterns []string, +) ([]string, error) { ret := []string{} for _, file := range files { - ok, err := shouldInclude(file, includePatterns, excludePatterns) - if err != nil { - return files, err - } - if ok { - ret = append(ret, file) + path, err := File(file, includePatterns, excludePatterns) + if err != nil || path == "" { + continue } + ret = append(ret, path) } return ret, nil } -// BaseDir returns the base directory for a match pattern -func BaseDir(pattern string) string { +// SplitPattern splits a pattern into a root directory and a trailing pattern +// specifier. +func SplitPattern(pattern string) (string, string) { + base := pattern + trail := "" + split := strings.IndexAny(pattern, "*{}?[]") if split >= 0 { - pattern = pattern[:split] - } - dir := filepath.Dir(pattern) - return filepath.Clean(dir) -} - -// isUnder checks if directory b is under directory a. Note that arguments MUST -// be directory specifications, not files. -func isUnder(a, b string) bool { - a, err := filepath.Abs(a) - if err != nil { - return false - } - b, err = filepath.Abs(b) - if err != nil { - return false - } - if strings.HasPrefix(b, a) { - return true - } - return false -} - -// AppendBaseDirs traverses a slice of patterns, and appends them to the -// bases list. The result of the append operation is a minimal set - that -// is, paths that are redundant because an enclosing path is already included -// are removed. -func AppendBaseDirs(bases []string, patterns []string) []string { -Loop: - for _, s := range patterns { - s = BaseDir(s) - for i, e := range bases { - if isUnder(s, e) { - bases[i] = s - continue Loop - } else if isUnder(e, s) { - continue Loop - } - } - bases = append(bases, s) + base = pattern[:split] + trail = pattern[split:] } - return bases -} - -// Find all files under the root that match the specified patterns. All -// arguments and returned paths are slash-delimited. -func Find(root string, includePatterns []string, excludePatterns []string) ([]string, error) { - root = filepath.FromSlash(root) - bases := AppendBaseDirs([]string{}, includePatterns) - ret := []string{} - for _, b := range bases { - b = filepath.FromSlash(b) - err := filepath.Walk(filepath.Join(root, b), func(p string, fi os.FileInfo, err error) error { - if err != nil { - return err - } - cleanpath, err := filepath.Rel(root, p) - if err != nil { - return nil - } - cleanpath = filepath.ToSlash(cleanpath) - - excluded, err := matchAny(cleanpath, excludePatterns) - if err != nil { - return nil - } - if fi.IsDir() { - if excluded { - return filepath.SkipDir - } - } else if !excluded { - included, err := matchAny(cleanpath, includePatterns) - if err != nil { - return nil - } - if included { - ret = append(ret, cleanpath) - } - } - return nil - }) - if err != nil { - return nil, err - } - } - return ret, nil + return base, trail } diff --git a/vendor/github.com/cortesi/moddwatch/filter/filter_test.go b/vendor/github.com/cortesi/moddwatch/filter/filter_test.go index a08e8ec..e11adce 100644 --- a/vendor/github.com/cortesi/moddwatch/filter/filter_test.go +++ b/vendor/github.com/cortesi/moddwatch/filter/filter_test.go @@ -1,13 +1,10 @@ package filter import ( - "io/ioutil" - "os" + "fmt" "path/filepath" "reflect" "testing" - - "github.com/cortesi/modd/utils" ) var filterFilesTests = []struct { @@ -38,16 +35,6 @@ var filterFilesTests = []struct { []string{"main.cpp", "main.h", "bar.py"}, false, }, - // Invalid patterns won't match anything. This would trigger a warning at - // runtime. - { - []string{"*"}, - []string{"[["}, - []string{"main.cpp", "main.go", "main.h", "foo.go", "bar.py"}, - []string{"main.cpp", "main.go", "main.h", "foo.go", "bar.py"}, - true, - }, - { []string{"main.*"}, []string{"*.cpp"}, @@ -73,139 +60,40 @@ var filterFilesTests = []struct { func TestFilterFiles(t *testing.T) { for i, tt := range filterFilesTests { - result, err := Files(tt.files, tt.includes, tt.excludes) - if !tt.err && err != nil { - t.Errorf("Test %d: error %s", i, err) - } - if !reflect.DeepEqual(result, tt.expected) { - t.Errorf( - "Test %d (inc: %v, ex: %v), expected \"%v\" got \"%v\"", - i, tt.includes, tt.excludes, tt.expected, result, - ) - } + t.Run(fmt.Sprintf("%.2d", i), func(t *testing.T) { + result, err := Files(tt.files, tt.includes, tt.excludes) + if !tt.err && err != nil { + t.Errorf("Test %d: error %s", i, err) + } + if !reflect.DeepEqual(result, tt.expected) { + t.Errorf( + "Test %d (inc: %v, ex: %v), expected \"%v\" got \"%v\"", + i, tt.includes, tt.excludes, tt.expected, result, + ) + } + }) } } -var BaseDirTests = []struct { +var SplitPatternTests = []struct { pattern string expected string }{ - {"foo", "."}, - {"test/foo", "test"}, - {"test/foo*", "test"}, - {"test/*.**", "test"}, - {"**/*", "."}, - {"foo*/bar", "."}, - {"foo/**/bar", "foo"}, - {"/voing/**", "/voing"}, -} - -func TestBaseDir(t *testing.T) { - for i, tt := range BaseDirTests { - ret := BaseDir(tt.pattern) - if filepath.ToSlash(ret) != filepath.ToSlash(tt.expected) { - t.Errorf("%d: %q - Expected %q, got %q", i, tt.pattern, tt.expected, ret) - } - } -} - -var getBaseDirTests = []struct { - patterns []string - expected []string -}{ - {[]string{"foo"}, []string{"."}}, - {[]string{"foo", "bar"}, []string{"."}}, - {[]string{"foo", "bar", "/voing/**"}, []string{".", "/voing"}}, - {[]string{"foo/**", "**"}, []string{"."}}, - {[]string{"foo/**", "**", "/bar/**"}, []string{".", "/bar"}}, -} - -func TestGetBaseDirs(t *testing.T) { - for i, tt := range getBaseDirTests { - bp := []string{} - bp = AppendBaseDirs(bp, tt.patterns) - for i := range bp { - bp[i] = filepath.ToSlash(bp[i]) - } - if !reflect.DeepEqual(bp, tt.expected) { - t.Errorf("%d: %#v - Expected %#v, got %#v", i, tt.patterns, tt.expected, bp) - } - } + {"foo", "foo"}, + {"test/foo", "test/foo"}, + {"test/foo*", "test/foo"}, + {"test/*.**", "test/"}, + {"**/*", ""}, + {"foo*/bar", "foo"}, + {"foo/**/bar", "foo/"}, + {"/voing/**", "/voing/"}, } -var findTests = []struct { - include []string - exclude []string - expected []string -}{ - { - []string{"**"}, - []string{}, - []string{"a/a.test1", "a/b.test2", "b/a.test1", "b/b.test2", "x", "x.test1"}, - }, - { - []string{"**/*.test1"}, - []string{}, - []string{"a/a.test1", "b/a.test1", "x.test1"}, - }, - { - []string{"**"}, - []string{"*.test1"}, - []string{"a/a.test1", "a/b.test2", "b/a.test1", "b/b.test2", "x"}, - }, - { - []string{"**"}, - []string{"a"}, - []string{"b/a.test1", "b/b.test2", "x", "x.test1"}, - }, - { - []string{"**"}, - []string{"a/"}, - []string{"b/a.test1", "b/b.test2", "x", "x.test1"}, - }, - { - []string{"**"}, - []string{"**/*.test1", "**/*.test2"}, - []string{"x"}, - }, -} - -func TestFind(t *testing.T) { - defer utils.WithTempDir(t)() - paths := []string{ - "a/a.test1", - "a/b.test2", - "b/a.test1", - "b/b.test2", - "x", - "x.test1", - } - for _, p := range paths { - dst := filepath.Join(".", p) - err := os.MkdirAll(filepath.Dir(dst), 0777) - if err != nil { - t.Fatalf("Error creating test dir: %v", err) - } - err = ioutil.WriteFile(dst, []byte("test"), 0777) - if err != nil { - t.Fatalf("Error writing test file: %v", err) - } - } - - for i, tt := range findTests { - ret, err := Find(".", tt.include, tt.exclude) - if err != nil { - t.Fatal(err) - } - expected := tt.expected - for i := range ret { - ret[i] = filepath.ToSlash(ret[i]) - } - if !reflect.DeepEqual(ret, expected) { - t.Errorf( - "%d: %#v, %#v - Expected\n%#v\ngot:\n%#v", - i, tt.include, tt.exclude, expected, ret, - ) +func TestSplitPattern(t *testing.T) { + for i, tt := range SplitPatternTests { + bdir, _ := SplitPattern(tt.pattern) + if filepath.ToSlash(bdir) != filepath.ToSlash(tt.expected) { + t.Errorf("%d: %q - Expected %q, got %q", i, tt.pattern, tt.expected, bdir) } } } diff --git a/vendor/github.com/cortesi/moddwatch/watch.go b/vendor/github.com/cortesi/moddwatch/watch.go index ffffc9a..5c4f66e 100644 --- a/vendor/github.com/cortesi/moddwatch/watch.go +++ b/vendor/github.com/cortesi/moddwatch/watch.go @@ -6,10 +6,10 @@ import ( "path/filepath" "sort" "strings" + "sync" "time" "github.com/cortesi/moddwatch/filter" - "github.com/cortesi/termlog" "github.com/rjeczalik/notify" ) @@ -17,15 +17,6 @@ import ( // we've had a constant stream of modifications blocking us. const MaxLullWait = time.Second * 8 -// Logger receives events as "debug", and is silenced by default -var Logger = defaultLogger() - -func defaultLogger() termlog.Logger { - l := termlog.NewLog() - l.Quiet() - return l -} - // isUnder takes two absolute paths, and returns true if child is under parent. func isUnder(parent string, child string) bool { parent = filepath.ToSlash(parent) @@ -37,38 +28,24 @@ func isUnder(parent string, child string) bool { return false } -// Notify events have absolute paths. We want to normalize these so that they -// are relative to the base path. If the matching base is absolute, so is the -// returned path. -// -// bases and abspath are in the OS-native separator format, the returned path -// is slash-delimited. -func normPath(bases []string, abspath string) (string, error) { - for _, base := range bases { - base = filter.BaseDir(base) - absbase, err := filepath.Abs(base) - if isUnder(absbase, abspath) { - if err != nil { - return "", err - } - relpath, err := filepath.Rel(absbase, abspath) - if err != nil { - return "", err - } - return filepath.ToSlash(filepath.Join(base, relpath)), nil - } +func normPaths(root string, abspaths []string) ([]string, error) { + aroot, err := filepath.Abs(root) + if err != nil { + return nil, err } - return filepath.ToSlash(abspath), nil -} - -func normPaths(bases []string, abspaths []string) ([]string, error) { ret := make([]string, len(abspaths)) for i, p := range abspaths { - norm, err := normPath(bases, p) + norm, err := filepath.Abs(p) if err != nil { return nil, err } - ret[i] = norm + if isUnder(aroot, norm) { + norm, err = filepath.Rel(aroot, norm) + if err != nil { + return nil, err + } + } + ret[i] = filepath.ToSlash(norm) } return ret, nil } @@ -133,8 +110,36 @@ func (mod Mod) Empty() bool { return true } +func joinLists(a []string, b []string) []string { + m := map[string]bool{} + for _, v := range a { + m[v] = true + } + for _, v := range b { + m[v] = true + } + ret := make([]string, len(m)) + i := 0 + for k := range m { + ret[i] = k + i++ + } + sort.Strings(ret) + return ret +} + +// Join two Mods together, resulting in a new structure where each modification +// list is sorted alphabetically. +func (mod Mod) Join(b Mod) Mod { + return Mod{ + Changed: joinLists(mod.Changed, b.Changed), + Deleted: joinLists(mod.Deleted, b.Deleted), + Added: joinLists(mod.Added, b.Added), + } +} + // Filter applies a filter, returning a new Mod structure -func (mod *Mod) Filter(includes []string, excludes []string) (*Mod, error) { +func (mod Mod) Filter(root string, includes []string, excludes []string) (*Mod, error) { changed, err := filter.Files(mod.Changed, includes, excludes) if err != nil { return nil, err @@ -150,16 +155,16 @@ func (mod *Mod) Filter(includes []string, excludes []string) (*Mod, error) { return &Mod{Changed: changed, Deleted: deleted, Added: added}, nil } -func (mod *Mod) normPaths(bases []string) (*Mod, error) { - changed, err := normPaths(bases, mod.Changed) +func (mod *Mod) normPaths(root string) (*Mod, error) { + changed, err := normPaths(root, mod.Changed) if err != nil { return nil, err } - deleted, err := normPaths(bases, mod.Deleted) + deleted, err := normPaths(root, mod.Deleted) if err != nil { return nil, err } - added, err := normPaths(bases, mod.Added) + added, err := normPaths(root, mod.Added) if err != nil { return nil, err } @@ -182,8 +187,8 @@ func _keys(m map[string]bool) []string { type fset map[string]bool -func mkmod(exists existenceChecker, added fset, removed fset, changed fset, renamed fset) *Mod { - ret := &Mod{} +func mkmod(exists existenceChecker, added fset, removed fset, changed fset, renamed fset) Mod { + ret := Mod{} for k := range renamed { // If a file is moved from A to B, we'll get separate rename // events for both A and B. The only way to know if it was the @@ -251,8 +256,10 @@ func batch(lullTime time.Duration, maxTime time.Duration, exists existenceChecke for { select { case evt := <-ch: + if evt == nil { + return nil + } hadLullMod = true - Logger.SayAs("debug", "%s", evt) switch evt.Event() { case notify.Create: added[evt.Path()] = true @@ -266,55 +273,184 @@ func batch(lullTime time.Duration, maxTime time.Duration, exists existenceChecke case <-time.After(lullTime): // Have we had a lull? if hadLullMod == false { - return mkmod(exists, added, removed, changed, renamed) + m := mkmod(exists, added, removed, changed, renamed) + return &m } hadLullMod = false case <-time.After(maxTime): - return mkmod(exists, added, removed, changed, renamed) + m := mkmod(exists, added, removed, changed, renamed) + return &m } } } // Watcher is a handle that allows a Watch to be terminated type Watcher struct { - evtch chan notify.EventInfo + evtch chan notify.EventInfo + modch chan *Mod + closed bool + + sync.Mutex +} + +func (w *Watcher) send(m *Mod) { + w.Lock() + defer w.Unlock() + w.modch <- m } -// Stop watching +// Stop watching, and close the channel passed to watch. This function can +// safely be called concurrently. func (w *Watcher) Stop() { - notify.Stop(w.evtch) + w.Lock() + defer w.Unlock() + if !w.closed { + notify.Stop(w.evtch) + close(w.modch) + w.closed = true + } } -// Watch watches a set of paths. Mod structs representing a changeset are sent -// on the channel ch. +// Given a set of include patterns relative to a root, which directories do we +// need to monitor for changes? +func baseDirs(root string, includePatterns []string) []string { + root = filepath.FromSlash(root) + bases := make([]string, len(includePatterns)) + for i, v := range includePatterns { + bdir, trailer := filter.SplitPattern(v) + if !filepath.IsAbs(bdir) { + bdir = filepath.Join(root, filepath.FromSlash(bdir)) + } + if stat, err := os.Lstat(bdir); err != nil { + continue + } else { + // A symlink, so we rebase the include patterns and the base directory + if stat.Mode()&os.ModeSymlink != 0 { + lnk, err := os.Readlink(bdir) + if err != nil { + continue + } + if filepath.IsAbs(lnk) { + bdir = lnk + } else { + bdir = filepath.Join(bdir, lnk) + } + includePatterns[i] = bdir + "/" + trailer + } + } + bases[i] = bdir + } + return bases +} + +// Watch watches a set of include and exclude patterns relative to a given root. +// Mod structs representing discrete changesets are sent on the channel ch. // // Watch applies heuristics to cope with transient files and unreliable event // notifications. Modifications are batched up until there is a a lull in the -// stream of changes of duration lullTime. This lets us represent processes -// that progressively affect multiple files, like rendering, as a single -// changeset. +// stream of changes of duration lullTime. This lets us represent processes that +// progressively affect multiple files, like rendering, as a single changeset. +// +// All paths emitted are slash-delimited and normalised. If a path lies under +// the specified root, it is converted to a path relative to the root, otherwise +// the returned path is absolute. // -// All paths emitted are slash-delimited. -func Watch(paths []string, lullTime time.Duration, ch chan *Mod) (*Watcher, error) { +// Pattern syntax is as follows: +// * any sequence of non-path-separators +// ** any sequence of characters, including path separators +// ? any single non-path-separator character +// [class] any single non-path-separator character against a class +// of characters (see below) +// {alt1,...} a sequence of characters if one of the comma-separated +// alternatives matches +// +// Any character with a special meaning can be escaped with a backslash (\). +// +// Character classes support the following: +// [abc] any single character within the set +// [a-z] any single character in the range +// [^class] any single character which does not match the class +func Watch( + root string, + includes []string, + excludes []string, + lullTime time.Duration, + ch chan *Mod, +) (*Watcher, error) { evtch := make(chan notify.EventInfo, 4096) + paths := baseDirs(root, includes) for _, p := range paths { - err := notify.Watch(p, evtch, notify.All) + err := notify.Watch(filepath.Join(p, "..."), evtch, notify.All) if err != nil { notify.Stop(evtch) return nil, err } } + w := &Watcher{evtch: evtch, modch: ch} go func() { for { b := batch(lullTime, MaxLullWait, statExistenceChecker{}, evtch) - if b != nil && !b.Empty() { - ret, err := b.normPaths(paths) + if b == nil { + return + } else if !b.Empty() { + b, err := b.normPaths(root) if err != nil { - Logger.Shout("Error normalising paths: %s", err) + // FIXME: Do something more decisive + continue + } + b, err = b.Filter(root, includes, excludes) + if err != nil { + // FIXME: Do something more decisive + continue + } + if !b.Empty() { + w.send(b) } - ch <- ret } } }() - return &Watcher{evtch}, nil + return w, nil +} + +// List all files under the root that match the specified patterns. The file +// list returned is a catalogue of all files currently on disk that could occur +// in a Mod structure for a corresponding watch. +// +// All paths returned are slash-delimited and normalised. If a path lies under +// the specified root, it is converted to a path relative to the root, otherwise +// the returned path is absolute. +// +// The pattern syntax is the same as Watch. +func List(root string, includePatterns []string, excludePatterns []string) ([]string, error) { + root = filepath.FromSlash(root) + bases := baseDirs(root, includePatterns) + ret := []string{} + for _, b := range bases { + err := filepath.Walk( + b, + func(p string, fi os.FileInfo, err error) error { + if err != nil || fi.Mode()&os.ModeSymlink != 0 { + return nil + } + cleanpath, err := filter.File(p, includePatterns, excludePatterns) + if err != nil { + return nil + } + if fi.IsDir() { + m, err := filter.MatchAny(p, excludePatterns) + // We skip the dir only if it's explicitly excluded + if err != nil && !m { + return filepath.SkipDir + } + } else if cleanpath != "" { + ret = append(ret, cleanpath) + } + return nil + }, + ) + if err != nil { + return nil, err + } + } + return normPaths(root, ret) } diff --git a/vendor/github.com/cortesi/moddwatch/watch_test.go b/vendor/github.com/cortesi/moddwatch/watch_test.go index 3c6fed8..9ce3d30 100644 --- a/vendor/github.com/cortesi/moddwatch/watch_test.go +++ b/vendor/github.com/cortesi/moddwatch/watch_test.go @@ -1,15 +1,77 @@ package moddwatch import ( + "fmt" + "io/ioutil" + "net/url" "os" "path/filepath" "reflect" + "runtime" + "strings" "testing" "time" + "github.com/google/go-cmp/cmp" "github.com/rjeczalik/notify" ) +var alwaysEqual = cmp.Comparer(func(_, _ interface{}) bool { return true }) +var cmpOptions = cmp.Options{ + cmp.FilterValues( + func(x, y interface{}) bool { + vx, vy := reflect.ValueOf(x), reflect.ValueOf(y) + return (vx.IsValid() && vy.IsValid() && + vx.Type() == vy.Type()) && + (vx.Kind() == reflect.Slice || vx.Kind() == reflect.Map) && + (vx.Len() == 0 && vy.Len() == 0) + }, + alwaysEqual, + ), + cmp.FilterPath( + func(p cmp.Path) bool { + if p.String() == "URL.RawQuery" { + return true + } + return false + }, + cmp.Comparer(func(a, b interface{}) bool { + qa, _ := url.ParseQuery(a.(string)) + qb, _ := url.ParseQuery(b.(string)) + return cmp.Equal(qa, qb) + }), + ), +} + +// WithTempDir creates a temp directory, changes the current working directory +// to it, and returns a function that can be called to clean up. Use it like +// this: +// defer WithTempDir(t)() +func WithTempDir(t *testing.T) func() { + cwd, err := os.Getwd() + if err != nil { + t.Fatalf("TempDir: %v", err) + } + tmpdir, err := ioutil.TempDir("", "") + if err != nil { + t.Fatalf("TempDir: %v", err) + } + err = os.Chdir(tmpdir) + if err != nil { + t.Fatalf("Chdir: %v", err) + } + return func() { + err := os.Chdir(cwd) + if err != nil { + t.Fatalf("Chdir: %v", err) + } + err = os.RemoveAll(tmpdir) + if err != nil { + t.Fatalf("Removing tmpdir: %s", err) + } + } +} + type TEventInfo struct { event notify.Event path string @@ -113,7 +175,7 @@ func TestBatch(t *testing.T) { } ret := batch(time.Millisecond*10, MaxLullWait, tst.exists, input) if !reflect.DeepEqual(*ret, tst.expected) { - t.Errorf("Test %d: expected\n%#v\ngot\n%#v", i, tst.expected, *ret) + t.Errorf("Test %d: expected\n%#v\ngot\n%#v", i, tst.expected, ret) } } } @@ -126,26 +188,6 @@ func abs(path string) string { return filepath.ToSlash(filepath.Join(wd, path)) } -var normPathTests = []struct { - base string - abspath string - expected string -}{ - {"./tmp", abs("./tmp/bar"), "tmp/bar"}, - {abs("./tmp"), abs("./tmp/bar"), abs("tmp/bar")}, - {"tmp", abs("tmp/bar"), "tmp/bar"}, -} - -func TestNormPath(t *testing.T) { - for i, tst := range normPathTests { - expected := tst.expected - ret, err := normPath([]string{tst.base}, tst.abspath) - if err != nil || ret != expected { - t.Errorf("Test %d: expected %#v, got %#v", i, expected, ret) - } - } -} - var isUnderTests = []struct { parent string child string @@ -186,7 +228,348 @@ func TestMod(t *testing.T) { Deleted: []string{abs("rm")}, Changed: []string{abs("change")}, } - if _, err := m.normPaths([]string{"/"}); err != nil { + if _, err := m.normPaths("."); err != nil { t.Error(err) } } + +func testListBasic(t *testing.T) { + var findTests = []struct { + include []string + exclude []string + expected []string + }{ + { + []string{"**"}, + []string{}, + []string{"a/a.test1", "a/b.test2", "b/a.test1", "b/b.test2", "x", "x.test1"}, + }, + { + []string{"**/*.test1"}, + []string{}, + []string{"a/a.test1", "b/a.test1", "x.test1"}, + }, + { + []string{"**"}, + []string{"*.test1"}, + []string{"a/a.test1", "a/b.test2", "b/a.test1", "b/b.test2", "x"}, + }, + { + []string{"**"}, + []string{"a/**"}, + []string{"b/a.test1", "b/b.test2", "x", "x.test1"}, + }, + { + []string{"**"}, + []string{"a/*"}, + []string{"b/a.test1", "b/b.test2", "x", "x.test1"}, + }, + { + []string{"**"}, + []string{"**/*.test1", "**/*.test2"}, + []string{"x"}, + }, + } + + defer WithTempDir(t)() + paths := []string{ + "a/a.test1", + "a/b.test2", + "b/a.test1", + "b/b.test2", + "x", + "x.test1", + } + for _, p := range paths { + dst := filepath.Join(".", p) + err := os.MkdirAll(filepath.Dir(dst), 0777) + if err != nil { + t.Fatalf("Error creating test dir: %v", err) + } + err = ioutil.WriteFile(dst, []byte("test"), 0777) + if err != nil { + t.Fatalf("Error writing test file: %v", err) + } + } + + for i, tt := range findTests { + ret, err := List(".", tt.include, tt.exclude) + if err != nil { + t.Fatal(err) + } + expected := tt.expected + for i := range ret { + ret[i] = filepath.ToSlash(ret[i]) + } + if !reflect.DeepEqual(ret, expected) { + t.Errorf( + "%d: %#v, %#v - Expected\n%#v\ngot:\n%#v", + i, tt.include, tt.exclude, expected, ret, + ) + } + } +} + +func testList(t *testing.T) { + var findTests = []struct { + include []string + exclude []string + expected []string + }{ + { + []string{"**"}, + []string{}, + []string{"a/a.test1", "a/b.test2", "a/sub/c.test2", "b/a.test1", "b/b.test2", "x", "x.test1"}, + }, + { + []string{"**/*.test1"}, + []string{}, + []string{"a/a.test1", "b/a.test1", "x.test1"}, + }, + { + []string{"**"}, + []string{"*.test1"}, + []string{"a/a.test1", "a/b.test2", "a/sub/c.test2", "b/a.test1", "b/b.test2", "x"}, + }, + { + []string{"**"}, + []string{"a/**"}, + []string{"b/a.test1", "b/b.test2", "x", "x.test1"}, + }, + { + []string{"**"}, + []string{"a/**"}, + []string{"b/a.test1", "b/b.test2", "x", "x.test1"}, + }, + { + []string{"**"}, + []string{"**/*.test1", "**/*.test2"}, + []string{"x"}, + }, + { + []string{"a/relsymlink"}, + []string{}, + []string{}, + }, + { + []string{"a/relfilesymlink"}, + []string{}, + []string{"x"}, + }, + { + []string{"a/relsymlink/**"}, + []string{}, + []string{"b/a.test1", "b/b.test2"}, + }, + { + []string{"a/**", "a/relsymlink/**"}, + []string{}, + []string{"a/a.test1", "a/b.test2", "a/sub/c.test2", "b/a.test1", "b/b.test2"}, + }, + { + []string{"a/abssymlink/**"}, + []string{}, + []string{"b/a.test1", "b/b.test2"}, + }, + { + []string{"a/**", "a/abssymlink/**"}, + []string{}, + []string{"a/a.test1", "a/b.test2", "a/sub/c.test2", "b/a.test1", "b/b.test2"}, + }, + } + + defer WithTempDir(t)() + paths := []string{ + "a/a.test1", + "a/b.test2", + "a/sub/c.test2", + "b/a.test1", + "b/b.test2", + "x", + "x.test1", + } + for _, p := range paths { + dst := filepath.Join(".", p) + err := os.MkdirAll(filepath.Dir(dst), 0777) + if err != nil { + t.Fatalf("Error creating test dir: %v", err) + } + err = ioutil.WriteFile(dst, []byte("test"), 0777) + if err != nil { + t.Fatalf("Error writing test file: %v", err) + } + } + if err := os.Symlink("../../b", "./a/relsymlink"); err != nil { + t.Fatal(err) + return + } + if err := os.Symlink("../../x", "./a/relfilesymlink"); err != nil { + t.Fatal(err) + return + } + + sabs, err := filepath.Abs("./b") + if err != nil { + t.Fatal(err) + return + } + if err = os.Symlink(sabs, "./a/abssymlink"); err != nil { + t.Fatal(err) + return + } + + for i, tt := range findTests { + t.Run( + fmt.Sprintf("%.3d", i), + func(t *testing.T) { + ret, err := List(".", tt.include, tt.exclude) + if err != nil { + t.Fatal(err) + } + expected := tt.expected + for i := range ret { + if filepath.IsAbs(ret[i]) { + wd, err := os.Getwd() + rel, err := filepath.Rel(wd, filepath.ToSlash(ret[i])) + if err != nil { + t.Fatal(err) + return + } + ret[i] = rel + } else { + ret[i] = filepath.ToSlash(ret[i]) + } + } + if !reflect.DeepEqual(ret, expected) { + t.Errorf( + "%d: %#v, %#v - Expected\n%#v\ngot:\n%#v", + i, tt.include, tt.exclude, expected, ret, + ) + } + }, + ) + } +} + +func TestList(t *testing.T) { + testListBasic(t) + if runtime.GOOS != "windows" { + testList(t) + } +} + +const timeout = 2 * time.Second + +func touch(p string) { + p = filepath.FromSlash(p) + d := filepath.Dir(p) + err := os.MkdirAll(d, 0777) + if err != nil { + panic(err) + } + + err = ioutil.WriteFile(p, []byte("teststring"), 0777) + if err != nil { + panic(err) + } + ioutil.ReadFile(p) +} + +func events(p string) []string { + parts := []string{} + for _, p := range strings.Split(p, "\n") { + if strings.HasPrefix(p, ":") { + p = strings.TrimSpace(p) + if !strings.HasSuffix(p, ":") { + parts = append(parts, strings.TrimSpace(p)) + } + } + } + return parts +} + +func _testWatch( + t *testing.T, + modfunc func(), + includes []string, + excludes []string, + expected Mod, +) { + defer WithTempDir(t)() + + err := os.MkdirAll("a", 0777) + if err != nil { + t.Fatal(err) + } + + err = os.MkdirAll("b", 0777) + if err != nil { + t.Fatal(err) + } + + touch("a/initial") + + ch := make(chan *Mod, 1024) + cwd, err := os.Getwd() + if err != nil { + t.Fatal(err) + return + } + watcher, err := Watch( + cwd, + includes, + excludes, + time.Millisecond*200, + ch, + ) + if err != nil { + t.Fatal(err) + return + } + defer watcher.Stop() + + // There's some race condition in rjeczalik/notify. If we don't wait a bit + // here, we sometimes receive notifications for the change above even + // though we haven't started the watcher. + time.Sleep(200 * time.Millisecond) + go func() { + time.Sleep(1 * time.Second) + watcher.Stop() + }() + + go modfunc() + ret := Mod{} + for { + evt, more := <-ch + if more { + ret = ret.Join(*evt) + if cmp.Equal(ret, expected, cmpOptions) { + return + } + } else { + break + } + } + t.Errorf("Never saw expected result, did see\n%s", ret) +} + +func TestWatch(t *testing.T) { + t.Run( + "simple", + func(t *testing.T) { + _testWatch( + t, + func() { + touch("a/touched") + touch("a/initial") + }, + []string{"**"}, + []string{}, + Mod{ + Added: []string{"a/touched"}, + Changed: []string{"a/initial"}, + }, + ) + }, + ) +} diff --git a/vendor/github.com/cortesi/termlog/.travis.yml b/vendor/github.com/cortesi/termlog/.travis.yml index c41bd4f..7234acb 100644 --- a/vendor/github.com/cortesi/termlog/.travis.yml +++ b/vendor/github.com/cortesi/termlog/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - 1.6 + - 1.9 os: - linux diff --git a/vendor/github.com/cortesi/termlog/Gopkg.lock b/vendor/github.com/cortesi/termlog/Gopkg.lock new file mode 100644 index 0000000..a774172 --- /dev/null +++ b/vendor/github.com/cortesi/termlog/Gopkg.lock @@ -0,0 +1,45 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + name = "github.com/fatih/color" + packages = ["."] + revision = "5df930a27be2502f99b292b7cc09ebad4d0891f4" + +[[projects]] + name = "github.com/mattn/go-colorable" + packages = ["."] + revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072" + version = "v0.0.9" + +[[projects]] + name = "github.com/mattn/go-isatty" + packages = ["."] + revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" + version = "v0.0.3" + +[[projects]] + branch = "master" + name = "golang.org/x/crypto" + packages = ["ssh/terminal"] + revision = "9f005a07e0d31d45e6656d241bb5c0f2efd4bc94" + +[[projects]] + branch = "master" + name = "golang.org/x/net" + packages = ["context"] + revision = "9dfe39835686865bff950a07b394c12a98ddc811" + +[[projects]] + branch = "master" + name = "golang.org/x/sys" + packages = ["unix","windows"] + revision = "bf42f188b9bc6f2cf5b8ee5a912ef1aedd0eba4c" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "99c988cf1bb2e9e603ebabb0a557c703abebe4cd15550c94eecc0eed309e0da6" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/cortesi/termlog/Gopkg.toml b/vendor/github.com/cortesi/termlog/Gopkg.toml new file mode 100644 index 0000000..b3475cd --- /dev/null +++ b/vendor/github.com/cortesi/termlog/Gopkg.toml @@ -0,0 +1,34 @@ + +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + + +[[constraint]] + name = "github.com/fatih/color" + branch = "master" + +[[constraint]] + branch = "master" + name = "golang.org/x/crypto" + +[[constraint]] + branch = "master" + name = "golang.org/x/net" diff --git a/vendor/github.com/dustin/go-humanize/README.markdown b/vendor/github.com/dustin/go-humanize/README.markdown index f69d3c8..91b4ae5 100644 --- a/vendor/github.com/dustin/go-humanize/README.markdown +++ b/vendor/github.com/dustin/go-humanize/README.markdown @@ -88,5 +88,37 @@ Example: humanize.SI(0.00000000223, "M") // 2.23 nM ``` +## English-specific functions + +The following functions are in the `humanize/english` subpackage. + +### Plurals + +Simple English pluralization + +```go +english.PluralWord(1, "object", "") // object +english.PluralWord(42, "object", "") // objects +english.PluralWord(2, "bus", "") // buses +english.PluralWord(99, "locus", "loci") // loci + +english.Plural(1, "object", "") // 1 object +english.Plural(42, "object", "") // 42 objects +english.Plural(2, "bus", "") // 2 buses +english.Plural(99, "locus", "loci") // 99 loci +``` + +### Word series + +Format comma-separated words lists with conjuctions: + +```go +english.WordSeries([]string{"foo"}, "and") // foo +english.WordSeries([]string{"foo", "bar"}, "and") // foo and bar +english.WordSeries([]string{"foo", "bar", "baz"}, "and") // foo, bar and baz + +english.OxfordWordSeries([]string{"foo", "bar", "baz"}, "and") // foo, bar, and baz +``` + [odisc]: https://groups.google.com/d/topic/golang-nuts/l8NhI74jl-4/discussion [sinotation]: http://en.wikipedia.org/wiki/Metric_prefix diff --git a/vendor/github.com/dustin/go-humanize/comma.go b/vendor/github.com/dustin/go-humanize/comma.go index eb285cb..13611aa 100644 --- a/vendor/github.com/dustin/go-humanize/comma.go +++ b/vendor/github.com/dustin/go-humanize/comma.go @@ -15,7 +15,7 @@ import ( func Comma(v int64) string { sign := "" - // minin64 can't be negated to a usable value, so it has to be special cased. + // Min int64 can't be negated to a usable value, so it has to be special cased. if v == math.MinInt64 { return "-9,223,372,036,854,775,808" } diff --git a/vendor/github.com/dustin/go-humanize/english/words.go b/vendor/github.com/dustin/go-humanize/english/words.go new file mode 100644 index 0000000..26e9918 --- /dev/null +++ b/vendor/github.com/dustin/go-humanize/english/words.go @@ -0,0 +1,96 @@ +// Package english provides utilities to generate more user-friendly English output. +package english + +import ( + "fmt" + "strings" +) + +// These are included because they are common technical terms. +var specialPlurals = map[string]string{ + "index": "indices", + "matrix": "matrices", + "vertex": "vertices", +} + +var sibilantEndings = []string{"s", "sh", "tch", "x"} + +var isVowel = map[byte]bool{ + 'A': true, 'E': true, 'I': true, 'O': true, 'U': true, + 'a': true, 'e': true, 'i': true, 'o': true, 'u': true, +} + +// PluralWord builds the plural form of an English word. +// The simple English rules of regular pluralization will be used +// if the plural form is an empty string (i.e. not explicitly given). +// The special cases are not guaranteed to work for strings outside ASCII. +func PluralWord(quantity int, singular, plural string) string { + if quantity == 1 { + return singular + } + if plural != "" { + return plural + } + if plural = specialPlurals[singular]; plural != "" { + return plural + } + + // We need to guess what the English plural might be. Keep this + // function simple! It doesn't need to know about every possiblity; + // only regular rules and the most common special cases. + // + // Reference: http://en.wikipedia.org/wiki/English_plural + + for _, ending := range sibilantEndings { + if strings.HasSuffix(singular, ending) { + return singular + "es" + } + } + l := len(singular) + if l >= 2 && singular[l-1] == 'o' && !isVowel[singular[l-2]] { + return singular + "es" + } + if l >= 2 && singular[l-1] == 'y' && !isVowel[singular[l-2]] { + return singular[:l-1] + "ies" + } + + return singular + "s" +} + +// Plural formats an integer and a string into a single pluralized string. +// The simple English rules of regular pluralization will be used +// if the plural form is an empty string (i.e. not explicitly given). +func Plural(quantity int, singular, plural string) string { + return fmt.Sprintf("%d %s", quantity, PluralWord(quantity, singular, plural)) +} + +// WordSeries converts a list of words into a word series in English. +// It returns a string containing all the given words separated by commas, +// the coordinating conjunction, and a serial comma, as appropriate. +func WordSeries(words []string, conjunction string) string { + switch len(words) { + case 0: + return "" + case 1: + return words[0] + default: + return fmt.Sprintf("%s %s %s", strings.Join(words[:len(words)-1], ", "), conjunction, words[len(words)-1]) + } +} + +// OxfordWordSeries converts a list of words into a word series in English, +// using an Oxford comma (https://en.wikipedia.org/wiki/Serial_comma). It +// returns a string containing all the given words separated by commas, the +// coordinating conjunction, and a serial comma, as appropriate. +func OxfordWordSeries(words []string, conjunction string) string { + switch len(words) { + case 0: + return "" + case 1: + return words[0] + case 2: + return strings.Join(words, fmt.Sprintf(" %s ", conjunction)) + default: + return fmt.Sprintf("%s, %s %s", strings.Join(words[:len(words)-1], ", "), conjunction, words[len(words)-1]) + } +} diff --git a/vendor/github.com/dustin/go-humanize/english/words_test.go b/vendor/github.com/dustin/go-humanize/english/words_test.go new file mode 100644 index 0000000..3c1d7be --- /dev/null +++ b/vendor/github.com/dustin/go-humanize/english/words_test.go @@ -0,0 +1,94 @@ +package english + +import ( + "testing" +) + +func TestPluralWord(t *testing.T) { + tests := []struct { + n int + singular, plural string + want string + }{ + {0, "object", "", "objects"}, + {1, "object", "", "object"}, + {-1, "object", "", "objects"}, + {42, "object", "", "objects"}, + {2, "vax", "vaxen", "vaxen"}, + + // special cases + {2, "index", "", "indices"}, + + // ending in a sibilant sound + {2, "bus", "", "buses"}, + {2, "bush", "", "bushes"}, + {2, "watch", "", "watches"}, + {2, "box", "", "boxes"}, + + // ending with 'o' preceded by a consonant + {2, "hero", "", "heroes"}, + + // ending with 'y' preceded by a consonant + {2, "lady", "", "ladies"}, + {2, "day", "", "days"}, + } + for _, tt := range tests { + if got := PluralWord(tt.n, tt.singular, tt.plural); got != tt.want { + t.Errorf("PluralWord(%d, %q, %q)=%q; want: %q", tt.n, tt.singular, tt.plural, got, tt.want) + } + } +} + +func TestPlural(t *testing.T) { + tests := []struct { + n int + singular, plural string + want string + }{ + {1, "object", "", "1 object"}, + {42, "object", "", "42 objects"}, + } + for _, tt := range tests { + if got := Plural(tt.n, tt.singular, tt.plural); got != tt.want { + t.Errorf("Plural(%d, %q, %q)=%q; want: %q", tt.n, tt.singular, tt.plural, got, tt.want) + } + } +} + +func TestWordSeries(t *testing.T) { + tests := []struct { + words []string + conjunction string + want string + }{ + {[]string{}, "and", ""}, + {[]string{"foo"}, "and", "foo"}, + {[]string{"foo", "bar"}, "and", "foo and bar"}, + {[]string{"foo", "bar", "baz"}, "and", "foo, bar and baz"}, + {[]string{"foo", "bar", "baz"}, "or", "foo, bar or baz"}, + } + for _, tt := range tests { + if got := WordSeries(tt.words, tt.conjunction); got != tt.want { + t.Errorf("WordSeries(%q, %q)=%q; want: %q", tt.words, tt.conjunction, got, tt.want) + } + } +} + +func TestOxfordWordSeries(t *testing.T) { + tests := []struct { + words []string + conjunction string + want string + }{ + {[]string{}, "and", ""}, + {[]string{"foo"}, "and", "foo"}, + {[]string{"foo", "bar"}, "and", "foo and bar"}, + {[]string{"foo", "bar", "baz"}, "and", "foo, bar, and baz"}, + {[]string{"foo", "bar", "baz"}, "or", "foo, bar, or baz"}, + } + for _, tt := range tests { + if got := OxfordWordSeries(tt.words, tt.conjunction); got != tt.want { + t.Errorf("OxfordWordSeries(%q, %q)=%q; want: %q", tt.words, tt.conjunction, got, tt.want) + } + } +} diff --git a/vendor/github.com/dustin/go-humanize/times.go b/vendor/github.com/dustin/go-humanize/times.go index b311f11..dd3fbf5 100644 --- a/vendor/github.com/dustin/go-humanize/times.go +++ b/vendor/github.com/dustin/go-humanize/times.go @@ -91,7 +91,7 @@ func CustomRelTime(a, b time.Time, albl, blbl string, magnitudes []RelTimeMagnit } n := sort.Search(len(magnitudes), func(i int) bool { - return magnitudes[i].D >= diff + return magnitudes[i].D > diff }) if n >= len(magnitudes) { diff --git a/vendor/github.com/dustin/go-humanize/times_test.go b/vendor/github.com/dustin/go-humanize/times_test.go index c90a71b..b1ab8bf 100644 --- a/vendor/github.com/dustin/go-humanize/times_test.go +++ b/vendor/github.com/dustin/go-humanize/times_test.go @@ -37,6 +37,17 @@ func TestPast(t *testing.T) { }.validate(t) } +func TestReltimeOffbyone(t *testing.T) { + testList{ + {"1w-1", RelTime(time.Unix(0, 0), time.Unix(7*24*60*60, -1), "ago", ""), "6 days ago"}, + {"1w±0", RelTime(time.Unix(0, 0), time.Unix(7*24*60*60, 0), "ago", ""), "1 week ago"}, + {"1w+1", RelTime(time.Unix(0, 0), time.Unix(7*24*60*60, 1), "ago", ""), "1 week ago"}, + {"2w-1", RelTime(time.Unix(0, 0), time.Unix(14*24*60*60, -1), "ago", ""), "1 week ago"}, + {"2w±0", RelTime(time.Unix(0, 0), time.Unix(14*24*60*60, 0), "ago", ""), "2 weeks ago"}, + {"2w+1", RelTime(time.Unix(0, 0), time.Unix(14*24*60*60, 1), "ago", ""), "2 weeks ago"}, + }.validate(t) +} + func TestFuture(t *testing.T) { // Add a little time so that these things properly line up in // the future. diff --git a/vendor/github.com/fatih/color/.travis.yml b/vendor/github.com/fatih/color/.travis.yml index 57b4b57..95f8a1f 100644 --- a/vendor/github.com/fatih/color/.travis.yml +++ b/vendor/github.com/fatih/color/.travis.yml @@ -1,5 +1,5 @@ language: go go: - - 1.6 + - 1.8.x - tip diff --git a/vendor/github.com/fatih/color/README.md b/vendor/github.com/fatih/color/README.md index 623baf3..3fc9544 100644 --- a/vendor/github.com/fatih/color/README.md +++ b/vendor/github.com/fatih/color/README.md @@ -1,4 +1,4 @@ -# Color [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/fatih/color) [![Build Status](http://img.shields.io/travis/fatih/color.svg?style=flat-square)](https://travis-ci.org/fatih/color) +# Color [![GoDoc](https://godoc.org/github.com/fatih/color?status.svg)](https://godoc.org/github.com/fatih/color) [![Build Status](https://img.shields.io/travis/fatih/color.svg?style=flat-square)](https://travis-ci.org/fatih/color) @@ -8,7 +8,7 @@ has support for Windows too! The API can be used in several ways, pick one that suits you. -![Color](http://i.imgur.com/c1JI0lA.png) +![Color](https://i.imgur.com/c1JI0lA.png) ## Install @@ -129,13 +129,15 @@ defer color.Unset() // Use it in your function fmt.Println("All text will now be bold magenta.") ``` -### Disable color +### Disable/Enable color + +There might be a case where you want to explicitly disable/enable color output. the +`go-isatty` package will automatically disable color output for non-tty output streams +(for example if the output were piped directly to `less`) -There might be a case where you want to disable color output (for example to -pipe the standard output of your app to somewhere else). `Color` has support to -disable colors both globally and for single color definition. For example -suppose you have a CLI app and a `--no-color` bool flag. You can easily disable -the color output with: +`Color` has support to disable/enable colors both globally and for single color +definitions. For example suppose you have a CLI app and a `--no-color` bool flag. You +can easily disable the color output with: ```go diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go index 7b5f314..b1f591d 100644 --- a/vendor/github.com/fatih/color/color.go +++ b/vendor/github.com/fatih/color/color.go @@ -341,7 +341,7 @@ func (c *Color) SprintlnFunc() func(a ...interface{}) string { } } -// sequence returns a formated SGR sequence to be plugged into a "\x1b[...m" +// sequence returns a formatted SGR sequence to be plugged into a "\x1b[...m" // an example output might be: "1;36" -> bold cyan func (c *Color) sequence() string { format := make([]string, len(c.params)) diff --git a/vendor/golang.org/x/crypto/blake2s/blake2s_test.go b/vendor/golang.org/x/crypto/blake2s/blake2s_test.go index 938fef3..cfeb18b 100644 --- a/vendor/golang.org/x/crypto/blake2s/blake2s_test.go +++ b/vendor/golang.org/x/crypto/blake2s/blake2s_test.go @@ -185,7 +185,7 @@ func testHashes2X(t *testing.T) { if n, err := h.Read(result[:]); err != nil { t.Fatalf("#unknown length: error from Read: %v", err) } else if n != len(result) { - t.Fatalf("#unknown length: Read returned %d bytes, want %d: %v", n, len(result)) + t.Fatalf("#unknown length: Read returned %d bytes, want %d", n, len(result)) } const expected = "2a9a6977d915a2c4dd07dbcafe1918bf1682e56d9c8e567ecd19bfd7cd93528833c764d12b34a5e2a219c9fd463dab45e972c5574d73f45de5b2e23af72530d8" diff --git a/vendor/golang.org/x/crypto/ocsp/ocsp_test.go b/vendor/golang.org/x/crypto/ocsp/ocsp_test.go index df674b3..1fadfec 100644 --- a/vendor/golang.org/x/crypto/ocsp/ocsp_test.go +++ b/vendor/golang.org/x/crypto/ocsp/ocsp_test.go @@ -43,11 +43,11 @@ func TestOCSPDecode(t *testing.T) { } if !reflect.DeepEqual(resp.ThisUpdate, expected.ThisUpdate) { - t.Errorf("resp.ThisUpdate: got %d, want %d", resp.ThisUpdate, expected.ThisUpdate) + t.Errorf("resp.ThisUpdate: got %v, want %v", resp.ThisUpdate, expected.ThisUpdate) } if !reflect.DeepEqual(resp.NextUpdate, expected.NextUpdate) { - t.Errorf("resp.NextUpdate: got %d, want %d", resp.NextUpdate, expected.NextUpdate) + t.Errorf("resp.NextUpdate: got %v, want %v", resp.NextUpdate, expected.NextUpdate) } if resp.Status != expected.Status { @@ -268,15 +268,15 @@ func TestOCSPResponse(t *testing.T) { } if !reflect.DeepEqual(resp.ThisUpdate, template.ThisUpdate) { - t.Errorf("resp.ThisUpdate: got %d, want %d", resp.ThisUpdate, template.ThisUpdate) + t.Errorf("resp.ThisUpdate: got %v, want %v", resp.ThisUpdate, template.ThisUpdate) } if !reflect.DeepEqual(resp.NextUpdate, template.NextUpdate) { - t.Errorf("resp.NextUpdate: got %d, want %d", resp.NextUpdate, template.NextUpdate) + t.Errorf("resp.NextUpdate: got %v, want %v", resp.NextUpdate, template.NextUpdate) } if !reflect.DeepEqual(resp.RevokedAt, template.RevokedAt) { - t.Errorf("resp.RevokedAt: got %d, want %d", resp.RevokedAt, template.RevokedAt) + t.Errorf("resp.RevokedAt: got %v, want %v", resp.RevokedAt, template.RevokedAt) } if !reflect.DeepEqual(resp.Extensions, template.ExtraExtensions) { diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go index 22bb30c..aed2b1f 100644 --- a/vendor/golang.org/x/crypto/ssh/cipher.go +++ b/vendor/golang.org/x/crypto/ssh/cipher.go @@ -304,7 +304,7 @@ type gcmCipher struct { buf []byte } -func newGCMCipher(iv, key, macKey []byte) (packetCipher, error) { +func newGCMCipher(iv, key []byte) (packetCipher, error) { c, err := aes.NewCipher(key) if err != nil { return nil, err diff --git a/vendor/golang.org/x/crypto/ssh/client.go b/vendor/golang.org/x/crypto/ssh/client.go index a7e3263..6fd1994 100644 --- a/vendor/golang.org/x/crypto/ssh/client.go +++ b/vendor/golang.org/x/crypto/ssh/client.go @@ -9,6 +9,7 @@ import ( "errors" "fmt" "net" + "os" "sync" "time" ) @@ -187,6 +188,10 @@ func Dial(network, addr string, config *ClientConfig) (*Client, error) { // net.Conn underlying the the SSH connection. type HostKeyCallback func(hostname string, remote net.Addr, key PublicKey) error +// BannerCallback is the function type used for treat the banner sent by +// the server. A BannerCallback receives the message sent by the remote server. +type BannerCallback func(message string) error + // A ClientConfig structure is used to configure a Client. It must not be // modified after having been passed to an SSH function. type ClientConfig struct { @@ -209,6 +214,12 @@ type ClientConfig struct { // FixedHostKey can be used for simplistic host key checks. HostKeyCallback HostKeyCallback + // BannerCallback is called during the SSH dance to display a custom + // server's message. The client configuration can supply this callback to + // handle it as wished. The function BannerDisplayStderr can be used for + // simplistic display on Stderr. + BannerCallback BannerCallback + // ClientVersion contains the version identification string that will // be used for the connection. If empty, a reasonable default is used. ClientVersion string @@ -255,3 +266,13 @@ func FixedHostKey(key PublicKey) HostKeyCallback { hk := &fixedHostKey{key} return hk.check } + +// BannerDisplayStderr returns a function that can be used for +// ClientConfig.BannerCallback to display banners on os.Stderr. +func BannerDisplayStderr() BannerCallback { + return func(banner string) error { + _, err := os.Stderr.WriteString(banner) + + return err + } +} diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go index 3acd8d4..a1252cb 100644 --- a/vendor/golang.org/x/crypto/ssh/client_auth.go +++ b/vendor/golang.org/x/crypto/ssh/client_auth.go @@ -283,7 +283,9 @@ func confirmKeyAck(key PublicKey, c packetConn) (bool, error) { } switch packet[0] { case msgUserAuthBanner: - // TODO(gpaul): add callback to present the banner to the user + if err := handleBannerResponse(c, packet); err != nil { + return false, err + } case msgUserAuthPubKeyOk: var msg userAuthPubKeyOkMsg if err := Unmarshal(packet, &msg); err != nil { @@ -325,7 +327,9 @@ func handleAuthResponse(c packetConn) (bool, []string, error) { switch packet[0] { case msgUserAuthBanner: - // TODO: add callback to present the banner to the user + if err := handleBannerResponse(c, packet); err != nil { + return false, nil, err + } case msgUserAuthFailure: var msg userAuthFailureMsg if err := Unmarshal(packet, &msg); err != nil { @@ -340,6 +344,24 @@ func handleAuthResponse(c packetConn) (bool, []string, error) { } } +func handleBannerResponse(c packetConn, packet []byte) error { + var msg userAuthBannerMsg + if err := Unmarshal(packet, &msg); err != nil { + return err + } + + transport, ok := c.(*handshakeTransport) + if !ok { + return nil + } + + if transport.bannerCallback != nil { + return transport.bannerCallback(msg.Message) + } + + return nil +} + // KeyboardInteractiveChallenge should print questions, optionally // disabling echoing (e.g. for passwords), and return all the answers. // Challenge may be called multiple times in a single session. After @@ -385,7 +407,9 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe // like handleAuthResponse, but with less options. switch packet[0] { case msgUserAuthBanner: - // TODO: Print banners during userauth. + if err := handleBannerResponse(c, packet); err != nil { + return false, nil, err + } continue case msgUserAuthInfoRequest: // OK diff --git a/vendor/golang.org/x/crypto/ssh/client_test.go b/vendor/golang.org/x/crypto/ssh/client_test.go index ccf5607..9dbe042 100644 --- a/vendor/golang.org/x/crypto/ssh/client_test.go +++ b/vendor/golang.org/x/crypto/ssh/client_test.go @@ -79,3 +79,41 @@ func TestHostKeyCheck(t *testing.T) { } } } + +func TestBannerCallback(t *testing.T) { + c1, c2, err := netPipe() + if err != nil { + t.Fatalf("netPipe: %v", err) + } + defer c1.Close() + defer c2.Close() + + serverConf := &ServerConfig{ + NoClientAuth: true, + BannerCallback: func(conn ConnMetadata) string { + return "Hello World" + }, + } + serverConf.AddHostKey(testSigners["rsa"]) + go NewServerConn(c1, serverConf) + + var receivedBanner string + clientConf := ClientConfig{ + User: "user", + HostKeyCallback: InsecureIgnoreHostKey(), + BannerCallback: func(message string) error { + receivedBanner = message + return nil + }, + } + + _, _, _, err = NewClientConn(c2, "", &clientConf) + if err != nil { + t.Fatal(err) + } + + expected := "Hello World" + if receivedBanner != expected { + t.Fatalf("got %s; want %s", receivedBanner, expected) + } +} diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go index 932ce83..4f7912e 100644 --- a/vendor/golang.org/x/crypto/ssh/handshake.go +++ b/vendor/golang.org/x/crypto/ssh/handshake.go @@ -78,6 +78,11 @@ type handshakeTransport struct { dialAddress string remoteAddr net.Addr + // bannerCallback is non-empty if we are the client and it has been set in + // ClientConfig. In that case it is called during the user authentication + // dance to handle a custom server's message. + bannerCallback BannerCallback + // Algorithms agreed in the last key exchange. algorithms *algorithms @@ -120,6 +125,7 @@ func newClientTransport(conn keyingTransport, clientVersion, serverVersion []byt t.dialAddress = dialAddr t.remoteAddr = addr t.hostKeyCallback = config.HostKeyCallback + t.bannerCallback = config.BannerCallback if config.HostKeyAlgorithms != nil { t.hostKeyAlgorithms = config.HostKeyAlgorithms } else { diff --git a/vendor/golang.org/x/crypto/ssh/messages.go b/vendor/golang.org/x/crypto/ssh/messages.go index e6ecd3a..c96e1be 100644 --- a/vendor/golang.org/x/crypto/ssh/messages.go +++ b/vendor/golang.org/x/crypto/ssh/messages.go @@ -23,10 +23,6 @@ const ( msgUnimplemented = 3 msgDebug = 4 msgNewKeys = 21 - - // Standard authentication messages - msgUserAuthSuccess = 52 - msgUserAuthBanner = 53 ) // SSH messages: @@ -137,6 +133,18 @@ type userAuthFailureMsg struct { PartialSuccess bool } +// See RFC 4252, section 5.1 +const msgUserAuthSuccess = 52 + +// See RFC 4252, section 5.4 +const msgUserAuthBanner = 53 + +type userAuthBannerMsg struct { + Message string `sshtype:"53"` + // unused, but required to allow message parsing + Language string +} + // See RFC 4256, section 3.2 const msgUserAuthInfoRequest = 60 const msgUserAuthInfoResponse = 61 diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index 8a78b7c..148d2cb 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -95,6 +95,10 @@ type ServerConfig struct { // Note that RFC 4253 section 4.2 requires that this string start with // "SSH-2.0-". ServerVersion string + + // BannerCallback, if present, is called and the return string is sent to + // the client after key exchange completed but before authentication. + BannerCallback func(conn ConnMetadata) string } // AddHostKey adds a private key as a host key. If an existing host @@ -343,6 +347,19 @@ userAuthLoop: } s.user = userAuthReq.User + + if authFailures == 0 && config.BannerCallback != nil { + msg := config.BannerCallback(s) + if msg != "" { + bannerMsg := &userAuthBannerMsg{ + Message: msg, + } + if err := s.transport.writePacket(Marshal(bannerMsg)); err != nil { + return nil, err + } + } + } + perms = nil authErr := errors.New("no auth passed yet") diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util.go b/vendor/golang.org/x/crypto/ssh/terminal/util.go index e7404ff..02dad48 100644 --- a/vendor/golang.org/x/crypto/ssh/terminal/util.go +++ b/vendor/golang.org/x/crypto/ssh/terminal/util.go @@ -17,44 +17,41 @@ package terminal // import "golang.org/x/crypto/ssh/terminal" import ( - "syscall" - "unsafe" - "golang.org/x/sys/unix" ) // State contains the state of a terminal. type State struct { - termios syscall.Termios + termios unix.Termios } // IsTerminal returns true if the given file descriptor is a terminal. func IsTerminal(fd int) bool { - var termios syscall.Termios - _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) - return err == 0 + _, 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) { - var oldState State - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { + termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios) + if err != nil { return nil, err } - newState := oldState.termios + oldState := State{termios: *termios} + // This attempts to replicate the behaviour documented for cfmakeraw in // the termios(3) manpage. - newState.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | syscall.ICRNL | syscall.IXON - newState.Oflag &^= syscall.OPOST - newState.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.IEXTEN - newState.Cflag &^= syscall.CSIZE | syscall.PARENB - newState.Cflag |= syscall.CS8 - newState.Cc[unix.VMIN] = 1 - newState.Cc[unix.VTIME] = 0 - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { + 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 } @@ -64,59 +61,55 @@ func MakeRaw(fd int) (*State, error) { // 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 oldState State - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState.termios)), 0, 0, 0); err != 0 { + termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios) + if err != nil { return nil, err } - return &oldState, nil + 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 { - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&state.termios)), 0, 0, 0); err != 0 { - return err - } - return nil + return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios) } // GetSize returns the dimensions of the given terminal. func GetSize(fd int) (width, height int, err error) { - var dimensions [4]uint16 - - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&dimensions)), 0, 0, 0); err != 0 { + ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ) + if err != nil { return -1, -1, err } - return int(dimensions[1]), int(dimensions[0]), nil + 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 syscall.Read(int(r), buf) + 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) { - var oldState syscall.Termios - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0); err != 0 { + termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios) + if err != nil { return nil, err } - newState := oldState - newState.Lflag &^= syscall.ECHO - newState.Lflag |= syscall.ICANON | syscall.ISIG - newState.Iflag |= syscall.ICRNL - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { + 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 func() { - syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(&oldState)), 0, 0, 0) + unix.IoctlSetTermios(fd, ioctlWriteTermios, termios) }() return readPasswordLine(passwordReader(fd)) diff --git a/vendor/golang.org/x/crypto/ssh/test/banner_test.go b/vendor/golang.org/x/crypto/ssh/test/banner_test.go new file mode 100644 index 0000000..f1ad469 --- /dev/null +++ b/vendor/golang.org/x/crypto/ssh/test/banner_test.go @@ -0,0 +1,33 @@ +// 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 test + +import ( + "testing" + +) + +func TestBannerCallbackAgainstOpenSSH(t *testing.T) { + server := newServer(t) + defer server.Shutdown() + + clientConf := clientConfig() + + var receivedBanner string + clientConf.BannerCallback = func(message string) error { + receivedBanner = message + return nil + } + + conn := server.Dial(clientConf) + defer conn.Close() + + expected := "Server Banner" + if receivedBanner != expected { + t.Fatalf("got %v; want %v", receivedBanner, expected) + } +} diff --git a/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go b/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go index e673536..6b1e0ff 100644 --- a/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go +++ b/vendor/golang.org/x/crypto/ssh/test/test_unix_test.go @@ -27,6 +27,7 @@ import ( const sshd_config = ` Protocol 2 +Banner {{.Dir}}/banner HostKey {{.Dir}}/id_rsa HostKey {{.Dir}}/id_dsa HostKey {{.Dir}}/id_ecdsa @@ -256,6 +257,8 @@ func newServer(t *testing.T) *server { } f.Close() + writeFile(filepath.Join(dir, "banner"), []byte("Server Banner")) + for k, v := range testdata.PEMBytes { filename := "id_" + k writeFile(filepath.Join(dir, filename), v) diff --git a/vendor/golang.org/x/crypto/ssh/transport.go b/vendor/golang.org/x/crypto/ssh/transport.go index f9780e0..ab2b887 100644 --- a/vendor/golang.org/x/crypto/ssh/transport.go +++ b/vendor/golang.org/x/crypto/ssh/transport.go @@ -254,7 +254,7 @@ func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (pac iv, key, macKey := generateKeys(d, algs, kex) if algs.Cipher == gcmCipherID { - return newGCMCipher(iv, key, macKey) + return newGCMCipher(iv, key) } if algs.Cipher == aes128cbcID { diff --git a/vendor/golang.org/x/net/html/doc.go b/vendor/golang.org/x/net/html/doc.go index 94f4968..822ed42 100644 --- a/vendor/golang.org/x/net/html/doc.go +++ b/vendor/golang.org/x/net/html/doc.go @@ -49,18 +49,18 @@ call to Next. For example, to extract an HTML page's anchor text: for { tt := z.Next() switch tt { - case ErrorToken: + case html.ErrorToken: return z.Err() - case TextToken: + case html.TextToken: if depth > 0 { // emitBytes should copy the []byte it receives, // if it doesn't process it immediately. emitBytes(z.Text()) } - case StartTagToken, EndTagToken: + case html.StartTagToken, html.EndTagToken: tn, _ := z.TagName() if len(tn) == 1 && tn[0] == 'a' { - if tt == StartTagToken { + if tt == html.StartTagToken { depth++ } else { depth-- diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index d790c3b..3e705a0 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -220,12 +220,15 @@ func ConfigureServer(s *http.Server, conf *Server) error { } else if s.TLSConfig.CipherSuites != nil { // If they already provided a CipherSuite list, return // an error if it has a bad order or is missing - // ECDHE_RSA_WITH_AES_128_GCM_SHA256. - const requiredCipher = tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + // ECDHE_RSA_WITH_AES_128_GCM_SHA256 or ECDHE_ECDSA_WITH_AES_128_GCM_SHA256. haveRequired := false sawBad := false for i, cs := range s.TLSConfig.CipherSuites { - if cs == requiredCipher { + switch cs { + case tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + // Alternative MTI cipher to not discourage ECDSA-only servers. + // See http://golang.org/cl/30721 for further information. + tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: haveRequired = true } if isBadCipher(cs) { @@ -235,7 +238,7 @@ func ConfigureServer(s *http.Server, conf *Server) error { } } if !haveRequired { - return fmt.Errorf("http2: TLSConfig.CipherSuites is missing HTTP/2-required TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256") + return fmt.Errorf("http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher.") } } diff --git a/vendor/golang.org/x/net/http2/server_test.go b/vendor/golang.org/x/net/http2/server_test.go index d06fdea..91db6a2 100644 --- a/vendor/golang.org/x/net/http2/server_test.go +++ b/vendor/golang.org/x/net/http2/server_test.go @@ -3189,12 +3189,18 @@ func TestConfigureServer(t *testing.T) { CipherSuites: []uint16{tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}, }, }, + { + name: "just the alternative required cipher suite", + tlsConfig: &tls.Config{ + CipherSuites: []uint16{tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256}, + }, + }, { name: "missing required cipher suite", tlsConfig: &tls.Config{ CipherSuites: []uint16{tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384}, }, - wantErr: "is missing HTTP/2-required TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + wantErr: "is missing an HTTP/2-required AES_128_GCM_SHA256 cipher.", }, { name: "required after bad", diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 5760b35..4392a09 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -274,6 +274,13 @@ func (cs *clientStream) checkResetOrDone() error { } } +func (cs *clientStream) getStartedWrite() bool { + cc := cs.cc + cc.mu.Lock() + defer cc.mu.Unlock() + return cs.startedWrite +} + func (cs *clientStream) abortRequestBodyWrite(err error) { if err == nil { panic("nil error") @@ -349,14 +356,9 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res return nil, err } traceGotConn(req, cc) - res, err := cc.RoundTrip(req) + res, gotErrAfterReqBodyWrite, err := cc.roundTrip(req) if err != nil && retry <= 6 { - afterBodyWrite := false - if e, ok := err.(afterReqBodyWriteError); ok { - err = e - afterBodyWrite = true - } - if req, err = shouldRetryRequest(req, err, afterBodyWrite); err == nil { + if req, err = shouldRetryRequest(req, err, gotErrAfterReqBodyWrite); err == nil { // After the first retry, do exponential backoff with 10% jitter. if retry == 0 { continue @@ -394,16 +396,6 @@ var ( errClientConnGotGoAway = errors.New("http2: Transport received Server's graceful shutdown GOAWAY") ) -// afterReqBodyWriteError is a wrapper around errors returned by ClientConn.RoundTrip. -// It is used to signal that err happened after part of Request.Body was sent to the server. -type afterReqBodyWriteError struct { - err error -} - -func (e afterReqBodyWriteError) Error() string { - return e.err.Error() + "; some request body already written" -} - // shouldRetryRequest is called by RoundTrip when a request fails to get // response headers. It is always called with a non-nil error. // It returns either a request to retry (either the same request, or a @@ -752,8 +744,13 @@ func actualContentLength(req *http.Request) int64 { } func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { + resp, _, err := cc.roundTrip(req) + return resp, err +} + +func (cc *ClientConn) roundTrip(req *http.Request) (res *http.Response, gotErrAfterReqBodyWrite bool, err error) { if err := checkConnHeaders(req); err != nil { - return nil, err + return nil, false, err } if cc.idleTimer != nil { cc.idleTimer.Stop() @@ -761,14 +758,14 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { trailers, err := commaSeparatedTrailers(req) if err != nil { - return nil, err + return nil, false, err } hasTrailers := trailers != "" cc.mu.Lock() if err := cc.awaitOpenSlotForRequest(req); err != nil { cc.mu.Unlock() - return nil, err + return nil, false, err } body := req.Body @@ -802,7 +799,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { hdrs, err := cc.encodeHeaders(req, requestedGzip, trailers, contentLen) if err != nil { cc.mu.Unlock() - return nil, err + return nil, false, err } cs := cc.newStream() @@ -828,7 +825,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { // Don't bother sending a RST_STREAM (our write already failed; // no need to keep writing) traceWroteRequest(cs.trace, werr) - return nil, werr + return nil, false, werr } var respHeaderTimer <-chan time.Time @@ -847,7 +844,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { bodyWritten := false ctx := reqContext(req) - handleReadLoopResponse := func(re resAndError) (*http.Response, error) { + handleReadLoopResponse := func(re resAndError) (*http.Response, bool, error) { res := re.res if re.err != nil || res.StatusCode > 299 { // On error or status code 3xx, 4xx, 5xx, etc abort any @@ -863,18 +860,12 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { cs.abortRequestBodyWrite(errStopReqBodyWrite) } if re.err != nil { - cc.mu.Lock() - afterBodyWrite := cs.startedWrite - cc.mu.Unlock() cc.forgetStreamID(cs.ID) - if afterBodyWrite { - return nil, afterReqBodyWriteError{re.err} - } - return nil, re.err + return nil, cs.getStartedWrite(), re.err } res.Request = req res.TLS = cc.tlsState - return res, nil + return res, false, nil } for { @@ -889,7 +880,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) } cc.forgetStreamID(cs.ID) - return nil, errTimeout + return nil, cs.getStartedWrite(), errTimeout case <-ctx.Done(): if !hasBody || bodyWritten { cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) @@ -898,7 +889,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) } cc.forgetStreamID(cs.ID) - return nil, ctx.Err() + return nil, cs.getStartedWrite(), ctx.Err() case <-req.Cancel: if !hasBody || bodyWritten { cc.writeStreamReset(cs.ID, ErrCodeCancel, nil) @@ -907,12 +898,12 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { cs.abortRequestBodyWrite(errStopReqBodyWriteAndCancel) } cc.forgetStreamID(cs.ID) - return nil, errRequestCanceled + return nil, cs.getStartedWrite(), errRequestCanceled case <-cs.peerReset: // processResetStream already removed the // stream from the streams map; no need for // forgetStreamID. - return nil, cs.resetErr + return nil, cs.getStartedWrite(), cs.resetErr case err := <-bodyWriter.resc: // Prefer the read loop's response, if available. Issue 16102. select { @@ -921,7 +912,7 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) { default: } if err != nil { - return nil, err + return nil, cs.getStartedWrite(), err } bodyWritten = true if d := cc.responseHeaderTimeout(); d != 0 { @@ -1920,11 +1911,11 @@ func (rl *clientConnReadLoop) endStreamError(cs *clientStream, err error) { err = io.EOF code = cs.copyTrailers } - cs.bufPipe.closeWithErrorAndCode(err, code) - delete(rl.activeRes, cs.ID) if isConnectionCloseRequest(cs.req) { rl.closeWhenIdle = true } + cs.bufPipe.closeWithErrorAndCode(err, code) + delete(rl.activeRes, cs.ID) select { case cs.resc <- resAndError{err: err}: diff --git a/vendor/golang.org/x/net/http2/transport_test.go b/vendor/golang.org/x/net/http2/transport_test.go index 3925c0b..30d7b5d 100644 --- a/vendor/golang.org/x/net/http2/transport_test.go +++ b/vendor/golang.org/x/net/http2/transport_test.go @@ -3097,6 +3097,34 @@ func TestTransportCancelDataResponseRace(t *testing.T) { } } +// Issue 21316: It should be safe to reuse an http.Request after the +// request has completed. +func TestTransportNoRaceOnRequestObjectAfterRequestComplete(t *testing.T) { + st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(200) + io.WriteString(w, "body") + }, optOnlyServer) + defer st.Close() + + tr := &Transport{TLSClientConfig: tlsConfigInsecure} + defer tr.CloseIdleConnections() + + req, _ := http.NewRequest("GET", st.ts.URL, nil) + resp, err := tr.RoundTrip(req) + if err != nil { + t.Fatal(err) + } + if _, err = io.Copy(ioutil.Discard, resp.Body); err != nil { + t.Fatalf("error reading response body: %v", err) + } + if err := resp.Body.Close(); err != nil { + t.Fatalf("error closing response body: %v", err) + } + + // This access of req.Header should not race with code in the transport. + req.Header = http.Header{} +} + func TestTransportRetryAfterGOAWAY(t *testing.T) { var dialer struct { sync.Mutex diff --git a/vendor/golang.org/x/net/idna/idna.go b/vendor/golang.org/x/net/idna/idna.go index 7d328fc..346fe44 100644 --- a/vendor/golang.org/x/net/idna/idna.go +++ b/vendor/golang.org/x/net/idna/idna.go @@ -309,7 +309,7 @@ func (p *Profile) process(s string, toASCII bool) (string, error) { for ; len(s) > 0 && s[0] == '.'; s = s[1:] { } } - // TODO: allow for a quick check the tables data. + // TODO: allow for a quick check of the tables data. // It seems like we should only create this error on ToASCII, but the // UTS 46 conformance tests suggests we should always check this. if err == nil && p.verifyDNSLength && s == "" { @@ -405,6 +405,9 @@ func validateRegistration(p *Profile, s string) (idem string, bidi bool, err err } for i := 0; i < len(s); { v, sz := trie.lookupString(s[i:]) + if sz == 0 { + return s, bidi, runeError(utf8.RuneError) + } bidi = bidi || info(v).isBidi(s[i:]) // Copy bytes not copied so far. switch p.simplify(info(v).category()) { @@ -446,6 +449,15 @@ func validateAndMap(p *Profile, s string) (vm string, bidi bool, err error) { var combinedInfoBits info for i := 0; i < len(s); { v, sz := trie.lookupString(s[i:]) + if sz == 0 { + b = append(b, s[k:i]...) + b = append(b, "\ufffd"...) + k = len(s) + if err == nil { + err = runeError(utf8.RuneError) + } + break + } combinedInfoBits |= info(v) bidi = bidi || info(v).isBidi(s[i:]) start := i @@ -584,6 +596,9 @@ func validateFromPunycode(p *Profile, s string) error { // loop. for i := 0; i < len(s); { v, sz := trie.lookupString(s[i:]) + if sz == 0 { + return runeError(utf8.RuneError) + } if c := p.simplify(info(v).category()); c != valid && c != deviation { return &labelError{s, "V6"} } diff --git a/vendor/golang.org/x/sys/unix/file_unix.go b/vendor/golang.org/x/sys/unix/file_unix.go deleted file mode 100644 index 47f6a83..0000000 --- a/vendor/golang.org/x/sys/unix/file_unix.go +++ /dev/null @@ -1,27 +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 - -import ( - "os" - "syscall" -) - -// FIXME: unexported function from os -// syscallMode returns the syscall-specific mode bits from Go's portable mode bits. -func syscallMode(i os.FileMode) (o uint32) { - o |= uint32(i.Perm()) - if i&os.ModeSetuid != 0 { - o |= syscall.S_ISUID - } - if i&os.ModeSetgid != 0 { - o |= syscall.S_ISGID - } - if i&os.ModeSticky != 0 { - o |= syscall.S_ISVTX - } - // No mapping for Go's ModeTemporary (plan9 only). - return -} diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 9a799b2..2a44da5 100755 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -38,6 +38,8 @@ includes_Darwin=' #define _DARWIN_C_SOURCE #define KERNEL #define _DARWIN_USE_64_BIT_INODE +#include +#include #include #include #include @@ -46,6 +48,7 @@ includes_Darwin=' #include #include #include +#include #include #include #include @@ -384,7 +387,9 @@ ccflags="$@" $2 == "SOMAXCONN" || $2 == "NAME_MAX" || $2 == "IFNAMSIZ" || - $2 ~ /^CTL_(MAXNAME|NET|QUERY)$/ || + $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)/ || @@ -419,10 +424,13 @@ ccflags="$@" $2 ~ /^SECCOMP_MODE_/ || $2 ~ /^SPLICE_/ || $2 ~ /^(VM|VMADDR)_/ || + $2 ~ /^IOCTL_VM_SOCKETS_/ || $2 ~ /^(TASKSTATS|TS)_/ || $2 ~ /^GENL_/ || $2 ~ /^UTIME_/ || $2 ~ /^XATTR_(CREATE|REPLACE)/ || + $2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ || + $2 ~ /^FSOPT_/ || $2 ~ /^WDIOC_/ || $2 !~ "WMESGLEN" && $2 ~ /^W[A-Z0-9]+$/ || diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 4119edd..47b0598 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -570,7 +570,12 @@ func UtimesNano(path string, ts []Timespec) error { if len(ts) != 2 { return EINVAL } - err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) + // Darwin setattrlist can set nanosecond timestamps + err := setattrlistTimes(path, ts, 0) + if err != ENOSYS { + return err + } + err = utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) if err != ENOSYS { return err } @@ -590,6 +595,10 @@ func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error { if len(ts) != 2 { return EINVAL } + err := setattrlistTimes(path, ts, flags) + if err != ENOSYS { + return err + } return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags) } diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd_test.go b/vendor/golang.org/x/sys/unix/syscall_bsd_test.go index d8085a0..c3a75eb 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd_test.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd_test.go @@ -60,3 +60,11 @@ func TestSysctlRaw(t *testing.T) { t.Fatal(err) } } + +func TestSysctlUint32(t *testing.T) { + maxproc, err := unix.SysctlUint32("kern.maxproc") + if err != nil { + t.Fatal(err) + } + t.Logf("kern.maxproc: %v", maxproc) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index f6a8fcc..d6c472a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -187,6 +187,37 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { return } +func setattrlistTimes(path string, times []Timespec, flags int) error { + _p0, err := BytePtrFromString(path) + if err != nil { + return err + } + + var attrList attrList + attrList.bitmapCount = ATTR_BIT_MAP_COUNT + attrList.CommonAttr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME + + // order is mtime, atime: the opposite of Chtimes + attributes := [2]Timespec{times[1], times[0]} + options := 0 + if flags&AT_SYMLINK_NOFOLLOW != 0 { + options |= FSOPT_NOFOLLOW + } + _, _, e1 := Syscall6( + SYS_SETATTRLIST, + uintptr(unsafe.Pointer(_p0)), + uintptr(unsafe.Pointer(&attrList)), + uintptr(unsafe.Pointer(&attributes)), + uintptr(unsafe.Sizeof(attributes)), + uintptr(options), + 0, + ) + if e1 != 0 { + return e1 + } + return nil +} + func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error { // Darwin doesn't support SYS_UTIMENSAT return ENOSYS @@ -239,6 +270,52 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { return &value, err } +func Uname(uname *Utsname) error { + mib := []_C_int{CTL_KERN, KERN_OSTYPE} + n := unsafe.Sizeof(uname.Sysname) + if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil { + return err + } + + mib = []_C_int{CTL_KERN, KERN_HOSTNAME} + n = unsafe.Sizeof(uname.Nodename) + if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil { + return err + } + + mib = []_C_int{CTL_KERN, KERN_OSRELEASE} + n = unsafe.Sizeof(uname.Release) + if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil { + return err + } + + mib = []_C_int{CTL_KERN, KERN_VERSION} + n = unsafe.Sizeof(uname.Version) + if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil { + return err + } + + // The version might have newlines or tabs in it, convert them to + // spaces. + for i, b := range uname.Version { + if b == '\n' || b == '\t' { + if i == len(uname.Version)-1 { + uname.Version[i] = 0 + } else { + uname.Version[i] = ' ' + } + } + } + + mib = []_C_int{CTL_HW, HW_MACHINE} + n = unsafe.Sizeof(uname.Machine) + if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil { + return err + } + + return nil +} + /* * Exposed directly */ diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index fee0683..49c65ea 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -125,6 +125,50 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { return } +func setattrlistTimes(path string, times []Timespec, flags int) error { + // used on Darwin for UtimesNano + return ENOSYS +} + +//sys ioctl(fd int, req uint, arg uintptr) (err error) + +// ioctl itself should not be exposed directly, but additional get/set +// functions for specific types are permissible. + +// IoctlSetInt performs an ioctl operation which sets an integer value +// on fd, using the specified request number. +func IoctlSetInt(fd int, req uint, value int) error { + return ioctl(fd, req, uintptr(value)) +} + +func IoctlSetWinsize(fd int, req uint, value *Winsize) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(value))) +} + +func IoctlSetTermios(fd int, req uint, value *Termios) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(value))) +} + +// IoctlGetInt performs an ioctl operation which gets an integer value +// from fd, using the specified request number. +func IoctlGetInt(fd int, req uint) (int, error) { + var value int + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return value, err +} + +func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { + var value Winsize + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return &value, err +} + +func IoctlGetTermios(fd int, req uint) (*Termios, error) { + var value Termios + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return &value, err +} + /* * Exposed directly */ @@ -225,7 +269,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { // Getlogin // Sigpending // Sigaltstack -// Ioctl // Reboot // Execve // Vfork diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 8f7ab16..a82ce12 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -120,6 +120,11 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { return } +func setattrlistTimes(path string, times []Timespec, flags int) error { + // used on Darwin for UtimesNano + return ENOSYS +} + // Derive extattr namespace and attribute name func xattrnamespace(fullattr string) (ns int, attr string, err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index b98a7e1..9098661 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -1125,6 +1125,10 @@ func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) { return ptracePoke(PTRACE_POKEDATA, PTRACE_PEEKDATA, pid, addr, data) } +func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) { + return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data) +} + func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) { return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_test.go b/vendor/golang.org/x/sys/unix/syscall_linux_test.go index f7f5f4a..84c69d2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_test.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_test.go @@ -178,7 +178,7 @@ func TestGetrlimit(t *testing.T) { } func TestSelect(t *testing.T) { - _, err := unix.Select(0, nil, nil, nil, &unix.Timeval{0, 0}) + _, err := unix.Select(0, nil, nil, nil, &unix.Timeval{Sec: 0, Usec: 0}) if err != nil { t.Fatalf("Select: %v", err) } diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 1caa5b3..9146809 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -55,7 +55,6 @@ func sysctlNodes(mib []_C_int) (nodes []Sysctlnode, err error) { } func nametomib(name string) (mib []_C_int, err error) { - // Split name into components. var parts []string last := 0 @@ -124,6 +123,50 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e return -1, ENOSYS } +func setattrlistTimes(path string, times []Timespec, flags int) error { + // used on Darwin for UtimesNano + return ENOSYS +} + +//sys ioctl(fd int, req uint, arg uintptr) (err error) + +// ioctl itself should not be exposed directly, but additional get/set +// functions for specific types are permissible. + +// IoctlSetInt performs an ioctl operation which sets an integer value +// on fd, using the specified request number. +func IoctlSetInt(fd int, req uint, value int) error { + return ioctl(fd, req, uintptr(value)) +} + +func IoctlSetWinsize(fd int, req uint, value *Winsize) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(value))) +} + +func IoctlSetTermios(fd int, req uint, value *Termios) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(value))) +} + +// IoctlGetInt performs an ioctl operation which gets an integer value +// from fd, using the specified request number. +func IoctlGetInt(fd int, req uint) (int, error) { + var value int + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return value, err +} + +func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { + var value Winsize + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return &value, err +} + +func IoctlGetTermios(fd int, req uint) (*Termios, error) { + var value Termios + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return &value, err +} + /* * Exposed directly */ @@ -384,7 +427,6 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e // getitimer // getvfsstat // getxattr -// ioctl // ktrace // lchflags // lchmod diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 03a0fac..b98cd07 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -13,6 +13,7 @@ package unix import ( + "sort" "syscall" "unsafe" ) @@ -32,23 +33,11 @@ type SockaddrDatalink struct { func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func nametomib(name string) (mib []_C_int, err error) { - - // Perform lookup via a binary search - left := 0 - right := len(sysctlMib) - 1 - for { - idx := left + (right-left)/2 - switch { - case name == sysctlMib[idx].ctlname: - return sysctlMib[idx].ctloid, nil - case name > sysctlMib[idx].ctlname: - left = idx + 1 - default: - right = idx - 1 - } - if left > right { - break - } + i := sort.Search(len(sysctlMib), func(i int) bool { + return sysctlMib[i].ctlname >= name + }) + if i < len(sysctlMib) && sysctlMib[i].ctlname == name { + return sysctlMib[i].ctloid, nil } return nil, EINVAL } @@ -102,6 +91,50 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { return } +func setattrlistTimes(path string, times []Timespec, flags int) error { + // used on Darwin for UtimesNano + return ENOSYS +} + +//sys ioctl(fd int, req uint, arg uintptr) (err error) + +// ioctl itself should not be exposed directly, but additional get/set +// functions for specific types are permissible. + +// IoctlSetInt performs an ioctl operation which sets an integer value +// on fd, using the specified request number. +func IoctlSetInt(fd int, req uint, value int) error { + return ioctl(fd, req, uintptr(value)) +} + +func IoctlSetWinsize(fd int, req uint, value *Winsize) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(value))) +} + +func IoctlSetTermios(fd int, req uint, value *Termios) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(value))) +} + +// IoctlGetInt performs an ioctl operation which gets an integer value +// from fd, using the specified request number. +func IoctlGetInt(fd int, req uint) (int, error) { + var value int + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return value, err +} + +func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { + var value Winsize + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return &value, err +} + +func IoctlGetTermios(fd int, req uint) (*Termios, error) { + var value Termios + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return &value, err +} + /* * Exposed directly */ @@ -222,7 +255,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { // getresuid // getrtable // getthrid -// ioctl // ktrace // lfs_bmapv // lfs_markv diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_test.go b/vendor/golang.org/x/sys/unix/syscall_unix_test.go index 8512dd0..d0a09ce 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_test.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_test.go @@ -138,6 +138,9 @@ func TestPassFD(t *testing.T) { uc.Close() }) _, oobn, _, _, err := uc.ReadMsgUnix(buf, oob) + if err != nil { + t.Fatalf("ReadMsgUnix: %v", err) + } closeUnix.Stop() scms, err := unix.ParseSocketControlMessage(oob[:oobn]) @@ -335,6 +338,9 @@ func TestDup(t *testing.T) { t.Fatalf("Write to dup2 fd failed: %v", err) } _, err = unix.Seek(f, 0, 0) + if err != nil { + t.Fatalf("Seek failed: %v", err) + } _, err = unix.Read(f, b2) if err != nil { t.Fatalf("Read back failed: %v", err) diff --git a/vendor/golang.org/x/sys/unix/types_darwin.go b/vendor/golang.org/x/sys/unix/types_darwin.go index 3a938ac..46b9908 100644 --- a/vendor/golang.org/x/sys/unix/types_darwin.go +++ b/vendor/golang.org/x/sys/unix/types_darwin.go @@ -39,6 +39,7 @@ package unix #include #include #include +#include #include #include #include @@ -270,3 +271,7 @@ const ( POLLWRBAND = C.POLLWRBAND POLLWRNORM = C.POLLWRNORM ) + +// uname + +type Utsname C.struct_utsname diff --git a/vendor/golang.org/x/sys/unix/types_dragonfly.go b/vendor/golang.org/x/sys/unix/types_dragonfly.go index 78ce32a..46d7da9 100644 --- a/vendor/golang.org/x/sys/unix/types_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/types_dragonfly.go @@ -242,6 +242,8 @@ type BpfHdr C.struct_bpf_hdr type Termios C.struct_termios +type Winsize C.struct_winsize + // fchmodat-like syscalls. const ( diff --git a/vendor/golang.org/x/sys/unix/types_netbsd.go b/vendor/golang.org/x/sys/unix/types_netbsd.go index 9097245..7ff50bc 100644 --- a/vendor/golang.org/x/sys/unix/types_netbsd.go +++ b/vendor/golang.org/x/sys/unix/types_netbsd.go @@ -228,6 +228,8 @@ type BpfTimeval C.struct_bpf_timeval type Termios C.struct_termios +type Winsize C.struct_winsize + // fchmodat-like syscalls. const ( diff --git a/vendor/golang.org/x/sys/unix/types_openbsd.go b/vendor/golang.org/x/sys/unix/types_openbsd.go index 44ea7c0..837b514 100644 --- a/vendor/golang.org/x/sys/unix/types_openbsd.go +++ b/vendor/golang.org/x/sys/unix/types_openbsd.go @@ -244,6 +244,8 @@ type BpfTimeval C.struct_bpf_timeval type Termios C.struct_termios +type Winsize C.struct_winsize + // fchmodat-like syscalls. const ( diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go index 1c68758..dcba884 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go @@ -49,6 +49,86 @@ const ( AF_UNSPEC = 0x0 AF_UTUN = 0x26 ALTWERASE = 0x200 + ATTR_BIT_MAP_COUNT = 0x5 + ATTR_CMN_ACCESSMASK = 0x20000 + ATTR_CMN_ACCTIME = 0x1000 + ATTR_CMN_ADDEDTIME = 0x10000000 + ATTR_CMN_BKUPTIME = 0x2000 + ATTR_CMN_CHGTIME = 0x800 + ATTR_CMN_CRTIME = 0x200 + ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 + ATTR_CMN_DEVID = 0x2 + ATTR_CMN_DOCUMENT_ID = 0x100000 + ATTR_CMN_ERROR = 0x20000000 + ATTR_CMN_EXTENDED_SECURITY = 0x400000 + ATTR_CMN_FILEID = 0x2000000 + ATTR_CMN_FLAGS = 0x40000 + ATTR_CMN_FNDRINFO = 0x4000 + ATTR_CMN_FSID = 0x4 + ATTR_CMN_FULLPATH = 0x8000000 + ATTR_CMN_GEN_COUNT = 0x80000 + ATTR_CMN_GRPID = 0x10000 + ATTR_CMN_GRPUUID = 0x1000000 + ATTR_CMN_MODTIME = 0x400 + ATTR_CMN_NAME = 0x1 + ATTR_CMN_NAMEDATTRCOUNT = 0x80000 + ATTR_CMN_NAMEDATTRLIST = 0x100000 + ATTR_CMN_OBJID = 0x20 + ATTR_CMN_OBJPERMANENTID = 0x40 + ATTR_CMN_OBJTAG = 0x10 + ATTR_CMN_OBJTYPE = 0x8 + ATTR_CMN_OWNERID = 0x8000 + ATTR_CMN_PARENTID = 0x4000000 + ATTR_CMN_PAROBJID = 0x80 + ATTR_CMN_RETURNED_ATTRS = 0x80000000 + ATTR_CMN_SCRIPT = 0x100 + ATTR_CMN_SETMASK = 0x41c7ff00 + ATTR_CMN_USERACCESS = 0x200000 + ATTR_CMN_UUID = 0x800000 + ATTR_CMN_VALIDMASK = 0xffffffff + ATTR_CMN_VOLSETMASK = 0x6700 + ATTR_FILE_ALLOCSIZE = 0x4 + ATTR_FILE_CLUMPSIZE = 0x10 + ATTR_FILE_DATAALLOCSIZE = 0x400 + ATTR_FILE_DATAEXTENTS = 0x800 + ATTR_FILE_DATALENGTH = 0x200 + ATTR_FILE_DEVTYPE = 0x20 + ATTR_FILE_FILETYPE = 0x40 + ATTR_FILE_FORKCOUNT = 0x80 + ATTR_FILE_FORKLIST = 0x100 + ATTR_FILE_IOBLOCKSIZE = 0x8 + ATTR_FILE_LINKCOUNT = 0x1 + ATTR_FILE_RSRCALLOCSIZE = 0x2000 + ATTR_FILE_RSRCEXTENTS = 0x4000 + ATTR_FILE_RSRCLENGTH = 0x1000 + ATTR_FILE_SETMASK = 0x20 + ATTR_FILE_TOTALSIZE = 0x2 + ATTR_FILE_VALIDMASK = 0x37ff + ATTR_VOL_ALLOCATIONCLUMP = 0x40 + ATTR_VOL_ATTRIBUTES = 0x40000000 + ATTR_VOL_CAPABILITIES = 0x20000 + ATTR_VOL_DIRCOUNT = 0x400 + ATTR_VOL_ENCODINGSUSED = 0x10000 + ATTR_VOL_FILECOUNT = 0x200 + ATTR_VOL_FSTYPE = 0x1 + ATTR_VOL_INFO = 0x80000000 + ATTR_VOL_IOBLOCKSIZE = 0x80 + ATTR_VOL_MAXOBJCOUNT = 0x800 + ATTR_VOL_MINALLOCATION = 0x20 + ATTR_VOL_MOUNTEDDEVICE = 0x8000 + ATTR_VOL_MOUNTFLAGS = 0x4000 + ATTR_VOL_MOUNTPOINT = 0x1000 + ATTR_VOL_NAME = 0x2000 + ATTR_VOL_OBJCOUNT = 0x100 + ATTR_VOL_QUOTA_SIZE = 0x10000000 + ATTR_VOL_RESERVED_SIZE = 0x20000000 + ATTR_VOL_SETMASK = 0x80002000 + ATTR_VOL_SIGNATURE = 0x2 + ATTR_VOL_SIZE = 0x4 + ATTR_VOL_SPACEAVAIL = 0x10 + ATTR_VOL_SPACEFREE = 0x8 + ATTR_VOL_UUID = 0x40000 + ATTR_VOL_VALIDMASK = 0xf007ffff B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 @@ -169,6 +249,8 @@ const ( CSTOP = 0x13 CSTOPB = 0x400 CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 DLT_A429 = 0xb8 @@ -390,6 +472,11 @@ const ( FF1 = 0x4000 FFDLY = 0x4000 FLUSHO = 0x800000 + FSOPT_ATTR_CMN_EXTENDED = 0x20 + FSOPT_NOFOLLOW = 0x1 + FSOPT_NOINMEMUPDATE = 0x2 + FSOPT_PACK_INVAL_ATTRS = 0x8 + FSOPT_REPORT_FULLSIZE = 0x4 F_ADDFILESIGS = 0x3d F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 F_ADDFILESIGS_RETURN = 0x61 @@ -425,6 +512,7 @@ const ( F_PATHPKG_CHECK = 0x34 F_PEOFPOSMODE = 0x3 F_PREALLOCATE = 0x2a + F_PUNCHHOLE = 0x63 F_RDADVISE = 0x2c F_RDAHEAD = 0x2d F_RDLCK = 0x1 @@ -441,10 +529,12 @@ const ( F_SINGLE_WRITER = 0x4c F_THAW_FS = 0x36 F_TRANSCODEKEY = 0x4b + F_TRIM_ACTIVE_FILE = 0x64 F_UNLCK = 0x2 F_VOLPOSMODE = 0x4 F_WRLCK = 0x3 HUPCL = 0x4000 + HW_MACHINE = 0x1 ICANON = 0x100 ICMP6_FILTER = 0x12 ICRNL = 0x100 @@ -681,6 +771,7 @@ const ( IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOW_ECN_MASK = 0x300 IPV6_FRAGTTL = 0x3c IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f @@ -771,6 +862,7 @@ const ( IP_RECVOPTS = 0x5 IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x1b IP_RECVTTL = 0x18 IP_RETOPTS = 0x8 IP_RF = 0x8000 @@ -789,6 +881,10 @@ const ( IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 48f63d4..1a51c96 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -49,6 +49,86 @@ const ( AF_UNSPEC = 0x0 AF_UTUN = 0x26 ALTWERASE = 0x200 + ATTR_BIT_MAP_COUNT = 0x5 + ATTR_CMN_ACCESSMASK = 0x20000 + ATTR_CMN_ACCTIME = 0x1000 + ATTR_CMN_ADDEDTIME = 0x10000000 + ATTR_CMN_BKUPTIME = 0x2000 + ATTR_CMN_CHGTIME = 0x800 + ATTR_CMN_CRTIME = 0x200 + ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 + ATTR_CMN_DEVID = 0x2 + ATTR_CMN_DOCUMENT_ID = 0x100000 + ATTR_CMN_ERROR = 0x20000000 + ATTR_CMN_EXTENDED_SECURITY = 0x400000 + ATTR_CMN_FILEID = 0x2000000 + ATTR_CMN_FLAGS = 0x40000 + ATTR_CMN_FNDRINFO = 0x4000 + ATTR_CMN_FSID = 0x4 + ATTR_CMN_FULLPATH = 0x8000000 + ATTR_CMN_GEN_COUNT = 0x80000 + ATTR_CMN_GRPID = 0x10000 + ATTR_CMN_GRPUUID = 0x1000000 + ATTR_CMN_MODTIME = 0x400 + ATTR_CMN_NAME = 0x1 + ATTR_CMN_NAMEDATTRCOUNT = 0x80000 + ATTR_CMN_NAMEDATTRLIST = 0x100000 + ATTR_CMN_OBJID = 0x20 + ATTR_CMN_OBJPERMANENTID = 0x40 + ATTR_CMN_OBJTAG = 0x10 + ATTR_CMN_OBJTYPE = 0x8 + ATTR_CMN_OWNERID = 0x8000 + ATTR_CMN_PARENTID = 0x4000000 + ATTR_CMN_PAROBJID = 0x80 + ATTR_CMN_RETURNED_ATTRS = 0x80000000 + ATTR_CMN_SCRIPT = 0x100 + ATTR_CMN_SETMASK = 0x41c7ff00 + ATTR_CMN_USERACCESS = 0x200000 + ATTR_CMN_UUID = 0x800000 + ATTR_CMN_VALIDMASK = 0xffffffff + ATTR_CMN_VOLSETMASK = 0x6700 + ATTR_FILE_ALLOCSIZE = 0x4 + ATTR_FILE_CLUMPSIZE = 0x10 + ATTR_FILE_DATAALLOCSIZE = 0x400 + ATTR_FILE_DATAEXTENTS = 0x800 + ATTR_FILE_DATALENGTH = 0x200 + ATTR_FILE_DEVTYPE = 0x20 + ATTR_FILE_FILETYPE = 0x40 + ATTR_FILE_FORKCOUNT = 0x80 + ATTR_FILE_FORKLIST = 0x100 + ATTR_FILE_IOBLOCKSIZE = 0x8 + ATTR_FILE_LINKCOUNT = 0x1 + ATTR_FILE_RSRCALLOCSIZE = 0x2000 + ATTR_FILE_RSRCEXTENTS = 0x4000 + ATTR_FILE_RSRCLENGTH = 0x1000 + ATTR_FILE_SETMASK = 0x20 + ATTR_FILE_TOTALSIZE = 0x2 + ATTR_FILE_VALIDMASK = 0x37ff + ATTR_VOL_ALLOCATIONCLUMP = 0x40 + ATTR_VOL_ATTRIBUTES = 0x40000000 + ATTR_VOL_CAPABILITIES = 0x20000 + ATTR_VOL_DIRCOUNT = 0x400 + ATTR_VOL_ENCODINGSUSED = 0x10000 + ATTR_VOL_FILECOUNT = 0x200 + ATTR_VOL_FSTYPE = 0x1 + ATTR_VOL_INFO = 0x80000000 + ATTR_VOL_IOBLOCKSIZE = 0x80 + ATTR_VOL_MAXOBJCOUNT = 0x800 + ATTR_VOL_MINALLOCATION = 0x20 + ATTR_VOL_MOUNTEDDEVICE = 0x8000 + ATTR_VOL_MOUNTFLAGS = 0x4000 + ATTR_VOL_MOUNTPOINT = 0x1000 + ATTR_VOL_NAME = 0x2000 + ATTR_VOL_OBJCOUNT = 0x100 + ATTR_VOL_QUOTA_SIZE = 0x10000000 + ATTR_VOL_RESERVED_SIZE = 0x20000000 + ATTR_VOL_SETMASK = 0x80002000 + ATTR_VOL_SIGNATURE = 0x2 + ATTR_VOL_SIZE = 0x4 + ATTR_VOL_SPACEAVAIL = 0x10 + ATTR_VOL_SPACEFREE = 0x8 + ATTR_VOL_UUID = 0x40000 + ATTR_VOL_VALIDMASK = 0xf007ffff B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 @@ -169,6 +249,8 @@ const ( CSTOP = 0x13 CSTOPB = 0x400 CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 DLT_A429 = 0xb8 @@ -390,6 +472,11 @@ const ( FF1 = 0x4000 FFDLY = 0x4000 FLUSHO = 0x800000 + FSOPT_ATTR_CMN_EXTENDED = 0x20 + FSOPT_NOFOLLOW = 0x1 + FSOPT_NOINMEMUPDATE = 0x2 + FSOPT_PACK_INVAL_ATTRS = 0x8 + FSOPT_REPORT_FULLSIZE = 0x4 F_ADDFILESIGS = 0x3d F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 F_ADDFILESIGS_RETURN = 0x61 @@ -425,6 +512,7 @@ const ( F_PATHPKG_CHECK = 0x34 F_PEOFPOSMODE = 0x3 F_PREALLOCATE = 0x2a + F_PUNCHHOLE = 0x63 F_RDADVISE = 0x2c F_RDAHEAD = 0x2d F_RDLCK = 0x1 @@ -441,10 +529,12 @@ const ( F_SINGLE_WRITER = 0x4c F_THAW_FS = 0x36 F_TRANSCODEKEY = 0x4b + F_TRIM_ACTIVE_FILE = 0x64 F_UNLCK = 0x2 F_VOLPOSMODE = 0x4 F_WRLCK = 0x3 HUPCL = 0x4000 + HW_MACHINE = 0x1 ICANON = 0x100 ICMP6_FILTER = 0x12 ICRNL = 0x100 @@ -681,6 +771,7 @@ const ( IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOW_ECN_MASK = 0x300 IPV6_FRAGTTL = 0x3c IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f @@ -771,6 +862,7 @@ const ( IP_RECVOPTS = 0x5 IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x1b IP_RECVTTL = 0x18 IP_RETOPTS = 0x8 IP_RF = 0x8000 @@ -789,6 +881,10 @@ const ( IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go index 24cb522..fa135b1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go @@ -49,6 +49,86 @@ const ( AF_UNSPEC = 0x0 AF_UTUN = 0x26 ALTWERASE = 0x200 + ATTR_BIT_MAP_COUNT = 0x5 + ATTR_CMN_ACCESSMASK = 0x20000 + ATTR_CMN_ACCTIME = 0x1000 + ATTR_CMN_ADDEDTIME = 0x10000000 + ATTR_CMN_BKUPTIME = 0x2000 + ATTR_CMN_CHGTIME = 0x800 + ATTR_CMN_CRTIME = 0x200 + ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 + ATTR_CMN_DEVID = 0x2 + ATTR_CMN_DOCUMENT_ID = 0x100000 + ATTR_CMN_ERROR = 0x20000000 + ATTR_CMN_EXTENDED_SECURITY = 0x400000 + ATTR_CMN_FILEID = 0x2000000 + ATTR_CMN_FLAGS = 0x40000 + ATTR_CMN_FNDRINFO = 0x4000 + ATTR_CMN_FSID = 0x4 + ATTR_CMN_FULLPATH = 0x8000000 + ATTR_CMN_GEN_COUNT = 0x80000 + ATTR_CMN_GRPID = 0x10000 + ATTR_CMN_GRPUUID = 0x1000000 + ATTR_CMN_MODTIME = 0x400 + ATTR_CMN_NAME = 0x1 + ATTR_CMN_NAMEDATTRCOUNT = 0x80000 + ATTR_CMN_NAMEDATTRLIST = 0x100000 + ATTR_CMN_OBJID = 0x20 + ATTR_CMN_OBJPERMANENTID = 0x40 + ATTR_CMN_OBJTAG = 0x10 + ATTR_CMN_OBJTYPE = 0x8 + ATTR_CMN_OWNERID = 0x8000 + ATTR_CMN_PARENTID = 0x4000000 + ATTR_CMN_PAROBJID = 0x80 + ATTR_CMN_RETURNED_ATTRS = 0x80000000 + ATTR_CMN_SCRIPT = 0x100 + ATTR_CMN_SETMASK = 0x41c7ff00 + ATTR_CMN_USERACCESS = 0x200000 + ATTR_CMN_UUID = 0x800000 + ATTR_CMN_VALIDMASK = 0xffffffff + ATTR_CMN_VOLSETMASK = 0x6700 + ATTR_FILE_ALLOCSIZE = 0x4 + ATTR_FILE_CLUMPSIZE = 0x10 + ATTR_FILE_DATAALLOCSIZE = 0x400 + ATTR_FILE_DATAEXTENTS = 0x800 + ATTR_FILE_DATALENGTH = 0x200 + ATTR_FILE_DEVTYPE = 0x20 + ATTR_FILE_FILETYPE = 0x40 + ATTR_FILE_FORKCOUNT = 0x80 + ATTR_FILE_FORKLIST = 0x100 + ATTR_FILE_IOBLOCKSIZE = 0x8 + ATTR_FILE_LINKCOUNT = 0x1 + ATTR_FILE_RSRCALLOCSIZE = 0x2000 + ATTR_FILE_RSRCEXTENTS = 0x4000 + ATTR_FILE_RSRCLENGTH = 0x1000 + ATTR_FILE_SETMASK = 0x20 + ATTR_FILE_TOTALSIZE = 0x2 + ATTR_FILE_VALIDMASK = 0x37ff + ATTR_VOL_ALLOCATIONCLUMP = 0x40 + ATTR_VOL_ATTRIBUTES = 0x40000000 + ATTR_VOL_CAPABILITIES = 0x20000 + ATTR_VOL_DIRCOUNT = 0x400 + ATTR_VOL_ENCODINGSUSED = 0x10000 + ATTR_VOL_FILECOUNT = 0x200 + ATTR_VOL_FSTYPE = 0x1 + ATTR_VOL_INFO = 0x80000000 + ATTR_VOL_IOBLOCKSIZE = 0x80 + ATTR_VOL_MAXOBJCOUNT = 0x800 + ATTR_VOL_MINALLOCATION = 0x20 + ATTR_VOL_MOUNTEDDEVICE = 0x8000 + ATTR_VOL_MOUNTFLAGS = 0x4000 + ATTR_VOL_MOUNTPOINT = 0x1000 + ATTR_VOL_NAME = 0x2000 + ATTR_VOL_OBJCOUNT = 0x100 + ATTR_VOL_QUOTA_SIZE = 0x10000000 + ATTR_VOL_RESERVED_SIZE = 0x20000000 + ATTR_VOL_SETMASK = 0x80002000 + ATTR_VOL_SIGNATURE = 0x2 + ATTR_VOL_SIZE = 0x4 + ATTR_VOL_SPACEAVAIL = 0x10 + ATTR_VOL_SPACEFREE = 0x8 + ATTR_VOL_UUID = 0x40000 + ATTR_VOL_VALIDMASK = 0xf007ffff B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 @@ -169,6 +249,8 @@ const ( CSTOP = 0x13 CSTOPB = 0x400 CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 DLT_A429 = 0xb8 @@ -390,6 +472,11 @@ const ( FF1 = 0x4000 FFDLY = 0x4000 FLUSHO = 0x800000 + FSOPT_ATTR_CMN_EXTENDED = 0x20 + FSOPT_NOFOLLOW = 0x1 + FSOPT_NOINMEMUPDATE = 0x2 + FSOPT_PACK_INVAL_ATTRS = 0x8 + FSOPT_REPORT_FULLSIZE = 0x4 F_ADDFILESIGS = 0x3d F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 F_ADDFILESIGS_RETURN = 0x61 @@ -425,6 +512,7 @@ const ( F_PATHPKG_CHECK = 0x34 F_PEOFPOSMODE = 0x3 F_PREALLOCATE = 0x2a + F_PUNCHHOLE = 0x63 F_RDADVISE = 0x2c F_RDAHEAD = 0x2d F_RDLCK = 0x1 @@ -441,10 +529,12 @@ const ( F_SINGLE_WRITER = 0x4c F_THAW_FS = 0x36 F_TRANSCODEKEY = 0x4b + F_TRIM_ACTIVE_FILE = 0x64 F_UNLCK = 0x2 F_VOLPOSMODE = 0x4 F_WRLCK = 0x3 HUPCL = 0x4000 + HW_MACHINE = 0x1 ICANON = 0x100 ICMP6_FILTER = 0x12 ICRNL = 0x100 @@ -681,6 +771,7 @@ const ( IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOW_ECN_MASK = 0x300 IPV6_FRAGTTL = 0x3c IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f @@ -771,6 +862,7 @@ const ( IP_RECVOPTS = 0x5 IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x1b IP_RECVTTL = 0x18 IP_RETOPTS = 0x8 IP_RF = 0x8000 @@ -789,6 +881,10 @@ const ( IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index cc8cc5b..6419c65 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -49,6 +49,86 @@ const ( AF_UNSPEC = 0x0 AF_UTUN = 0x26 ALTWERASE = 0x200 + ATTR_BIT_MAP_COUNT = 0x5 + ATTR_CMN_ACCESSMASK = 0x20000 + ATTR_CMN_ACCTIME = 0x1000 + ATTR_CMN_ADDEDTIME = 0x10000000 + ATTR_CMN_BKUPTIME = 0x2000 + ATTR_CMN_CHGTIME = 0x800 + ATTR_CMN_CRTIME = 0x200 + ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 + ATTR_CMN_DEVID = 0x2 + ATTR_CMN_DOCUMENT_ID = 0x100000 + ATTR_CMN_ERROR = 0x20000000 + ATTR_CMN_EXTENDED_SECURITY = 0x400000 + ATTR_CMN_FILEID = 0x2000000 + ATTR_CMN_FLAGS = 0x40000 + ATTR_CMN_FNDRINFO = 0x4000 + ATTR_CMN_FSID = 0x4 + ATTR_CMN_FULLPATH = 0x8000000 + ATTR_CMN_GEN_COUNT = 0x80000 + ATTR_CMN_GRPID = 0x10000 + ATTR_CMN_GRPUUID = 0x1000000 + ATTR_CMN_MODTIME = 0x400 + ATTR_CMN_NAME = 0x1 + ATTR_CMN_NAMEDATTRCOUNT = 0x80000 + ATTR_CMN_NAMEDATTRLIST = 0x100000 + ATTR_CMN_OBJID = 0x20 + ATTR_CMN_OBJPERMANENTID = 0x40 + ATTR_CMN_OBJTAG = 0x10 + ATTR_CMN_OBJTYPE = 0x8 + ATTR_CMN_OWNERID = 0x8000 + ATTR_CMN_PARENTID = 0x4000000 + ATTR_CMN_PAROBJID = 0x80 + ATTR_CMN_RETURNED_ATTRS = 0x80000000 + ATTR_CMN_SCRIPT = 0x100 + ATTR_CMN_SETMASK = 0x41c7ff00 + ATTR_CMN_USERACCESS = 0x200000 + ATTR_CMN_UUID = 0x800000 + ATTR_CMN_VALIDMASK = 0xffffffff + ATTR_CMN_VOLSETMASK = 0x6700 + ATTR_FILE_ALLOCSIZE = 0x4 + ATTR_FILE_CLUMPSIZE = 0x10 + ATTR_FILE_DATAALLOCSIZE = 0x400 + ATTR_FILE_DATAEXTENTS = 0x800 + ATTR_FILE_DATALENGTH = 0x200 + ATTR_FILE_DEVTYPE = 0x20 + ATTR_FILE_FILETYPE = 0x40 + ATTR_FILE_FORKCOUNT = 0x80 + ATTR_FILE_FORKLIST = 0x100 + ATTR_FILE_IOBLOCKSIZE = 0x8 + ATTR_FILE_LINKCOUNT = 0x1 + ATTR_FILE_RSRCALLOCSIZE = 0x2000 + ATTR_FILE_RSRCEXTENTS = 0x4000 + ATTR_FILE_RSRCLENGTH = 0x1000 + ATTR_FILE_SETMASK = 0x20 + ATTR_FILE_TOTALSIZE = 0x2 + ATTR_FILE_VALIDMASK = 0x37ff + ATTR_VOL_ALLOCATIONCLUMP = 0x40 + ATTR_VOL_ATTRIBUTES = 0x40000000 + ATTR_VOL_CAPABILITIES = 0x20000 + ATTR_VOL_DIRCOUNT = 0x400 + ATTR_VOL_ENCODINGSUSED = 0x10000 + ATTR_VOL_FILECOUNT = 0x200 + ATTR_VOL_FSTYPE = 0x1 + ATTR_VOL_INFO = 0x80000000 + ATTR_VOL_IOBLOCKSIZE = 0x80 + ATTR_VOL_MAXOBJCOUNT = 0x800 + ATTR_VOL_MINALLOCATION = 0x20 + ATTR_VOL_MOUNTEDDEVICE = 0x8000 + ATTR_VOL_MOUNTFLAGS = 0x4000 + ATTR_VOL_MOUNTPOINT = 0x1000 + ATTR_VOL_NAME = 0x2000 + ATTR_VOL_OBJCOUNT = 0x100 + ATTR_VOL_QUOTA_SIZE = 0x10000000 + ATTR_VOL_RESERVED_SIZE = 0x20000000 + ATTR_VOL_SETMASK = 0x80002000 + ATTR_VOL_SIGNATURE = 0x2 + ATTR_VOL_SIZE = 0x4 + ATTR_VOL_SPACEAVAIL = 0x10 + ATTR_VOL_SPACEFREE = 0x8 + ATTR_VOL_UUID = 0x40000 + ATTR_VOL_VALIDMASK = 0xf007ffff B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 @@ -169,6 +249,8 @@ const ( CSTOP = 0x13 CSTOPB = 0x400 CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 DLT_A429 = 0xb8 @@ -390,6 +472,11 @@ const ( FF1 = 0x4000 FFDLY = 0x4000 FLUSHO = 0x800000 + FSOPT_ATTR_CMN_EXTENDED = 0x20 + FSOPT_NOFOLLOW = 0x1 + FSOPT_NOINMEMUPDATE = 0x2 + FSOPT_PACK_INVAL_ATTRS = 0x8 + FSOPT_REPORT_FULLSIZE = 0x4 F_ADDFILESIGS = 0x3d F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 F_ADDFILESIGS_RETURN = 0x61 @@ -425,6 +512,7 @@ const ( F_PATHPKG_CHECK = 0x34 F_PEOFPOSMODE = 0x3 F_PREALLOCATE = 0x2a + F_PUNCHHOLE = 0x63 F_RDADVISE = 0x2c F_RDAHEAD = 0x2d F_RDLCK = 0x1 @@ -441,10 +529,12 @@ const ( F_SINGLE_WRITER = 0x4c F_THAW_FS = 0x36 F_TRANSCODEKEY = 0x4b + F_TRIM_ACTIVE_FILE = 0x64 F_UNLCK = 0x2 F_VOLPOSMODE = 0x4 F_WRLCK = 0x3 HUPCL = 0x4000 + HW_MACHINE = 0x1 ICANON = 0x100 ICMP6_FILTER = 0x12 ICRNL = 0x100 @@ -681,6 +771,7 @@ const ( IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOW_ECN_MASK = 0x300 IPV6_FRAGTTL = 0x3c IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f @@ -771,6 +862,7 @@ const ( IP_RECVOPTS = 0x5 IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x1b IP_RECVTTL = 0x18 IP_RETOPTS = 0x8 IP_RF = 0x8000 @@ -789,6 +881,10 @@ const ( IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index bb8a772..8947248 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index cf0b224..4083cb2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 57cfcf3..27d3835 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index b6e5b09..69ad314 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -625,6 +625,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 0113e1f..d131a4c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 6857657..62dd203 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 14f7e0e..dc8e56e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index f795862..9067662 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 2544c4b..f6ca82c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 133bdf5..ddd2562 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index b921fb1..fc304a6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -623,6 +623,7 @@ const ( IN_OPEN = 0x20 IN_Q_OVERFLOW = 0x4000 IN_UNMOUNT = 0x2000 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IPPROTO_AH = 0x33 IPPROTO_BEETPH = 0x5e IPPROTO_COMP = 0x6c diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go index 9fb1b31..763ae4f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go @@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Madvise(b []byte, behav int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { @@ -408,17 +419,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index 1e0fb46..d6808e0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Madvise(b []byte, behav int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { @@ -408,17 +419,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go index e1026a8..6ae95e6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go @@ -221,7 +221,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } @@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Madvise(b []byte, behav int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { @@ -408,17 +419,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 37fb210..ca6a7ea 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -266,6 +266,17 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Madvise(b []byte, behav int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { @@ -408,17 +419,6 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index 7576147..2ed340f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -423,6 +423,16 @@ func extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index cfdea85..04a1ace 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -406,6 +406,16 @@ func getdents(fd int, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index 244a3c7..079824a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -406,6 +406,16 @@ func getdents(fd int, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index e891adc..05f8b49 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -406,6 +406,16 @@ func getdents(fd int, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index f48beb0..3b55544 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -404,6 +404,16 @@ func getdents(fd int, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 44a3faf..cdaf4ef 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -404,6 +404,16 @@ func getdents(fd int, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index 1563752..6c4dc8a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -404,6 +404,16 @@ func getdents(fd int, buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go index 2786773..d1d36da 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go @@ -1,5 +1,5 @@ -// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/syscall.h -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT +// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h +// Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,darwin @@ -121,13 +121,15 @@ const ( SYS_CSOPS = 169 SYS_CSOPS_AUDITTOKEN = 170 SYS_WAITID = 173 + SYS_KDEBUG_TYPEFILTER = 177 + SYS_KDEBUG_TRACE_STRING = 178 SYS_KDEBUG_TRACE64 = 179 SYS_KDEBUG_TRACE = 180 SYS_SETGID = 181 SYS_SETEGID = 182 SYS_SETEUID = 183 SYS_SIGRETURN = 184 - SYS_CHUD = 185 + SYS_THREAD_SELFCOUNTS = 186 SYS_FDATASYNC = 187 SYS_STAT = 188 SYS_FSTAT = 189 @@ -278,7 +280,6 @@ const ( SYS_KQUEUE = 362 SYS_KEVENT = 363 SYS_LCHOWN = 364 - SYS_STACK_SNAPSHOT = 365 SYS_BSDTHREAD_REGISTER = 366 SYS_WORKQ_OPEN = 367 SYS_WORKQ_KERNRETURN = 368 @@ -287,6 +288,8 @@ const ( SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 SYS_THREAD_SELFID = 372 SYS_LEDGER = 373 + SYS_KEVENT_QOS = 374 + SYS_KEVENT_ID = 375 SYS___MAC_EXECVE = 380 SYS___MAC_SYSCALL = 381 SYS___MAC_GET_FILE = 382 @@ -298,11 +301,8 @@ const ( SYS___MAC_GET_FD = 388 SYS___MAC_SET_FD = 389 SYS___MAC_GET_PID = 390 - SYS___MAC_GET_LCID = 391 - SYS___MAC_GET_LCTX = 392 - SYS___MAC_SET_LCTX = 393 - SYS_SETLCID = 394 - SYS_GETLCID = 395 + SYS_PSELECT = 394 + SYS_PSELECT_NOCANCEL = 395 SYS_READ_NOCANCEL = 396 SYS_WRITE_NOCANCEL = 397 SYS_OPEN_NOCANCEL = 398 @@ -351,6 +351,7 @@ const ( SYS_GUARDED_CLOSE_NP = 442 SYS_GUARDED_KQUEUE_NP = 443 SYS_CHANGE_FDGUARD_NP = 444 + SYS_USRCTL = 445 SYS_PROC_RLIMIT_CONTROL = 446 SYS_CONNECTX = 447 SYS_DISCONNECTX = 448 @@ -367,6 +368,7 @@ const ( SYS_COALITION_INFO = 459 SYS_NECP_MATCH_POLICY = 460 SYS_GETATTRLISTBULK = 461 + SYS_CLONEFILEAT = 462 SYS_OPENAT = 463 SYS_OPENAT_NOCANCEL = 464 SYS_RENAMEAT = 465 @@ -392,7 +394,43 @@ const ( SYS_GUARDED_WRITE_NP = 485 SYS_GUARDED_PWRITE_NP = 486 SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAME_EXT = 488 + SYS_RENAMEATX_NP = 488 SYS_MREMAP_ENCRYPTED = 489 - SYS_MAXSYSCALL = 490 + SYS_NETAGENT_TRIGGER = 490 + SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 + SYS_MICROSTACKSHOT = 492 + SYS_GRAB_PGO_DATA = 493 + SYS_PERSONA = 494 + SYS_WORK_INTERVAL_CTL = 499 + SYS_GETENTROPY = 500 + SYS_NECP_OPEN = 501 + SYS_NECP_CLIENT_ACTION = 502 + SYS___NEXUS_OPEN = 503 + SYS___NEXUS_REGISTER = 504 + SYS___NEXUS_DEREGISTER = 505 + SYS___NEXUS_CREATE = 506 + SYS___NEXUS_DESTROY = 507 + SYS___NEXUS_GET_OPT = 508 + SYS___NEXUS_SET_OPT = 509 + SYS___CHANNEL_OPEN = 510 + SYS___CHANNEL_GET_INFO = 511 + SYS___CHANNEL_SYNC = 512 + SYS___CHANNEL_GET_OPT = 513 + SYS___CHANNEL_SET_OPT = 514 + SYS_ULOCK_WAIT = 515 + SYS_ULOCK_WAKE = 516 + SYS_FCLONEFILEAT = 517 + SYS_FS_SNAPSHOT = 518 + SYS_TERMINATE_WITH_PAYLOAD = 520 + SYS_ABORT_WITH_PAYLOAD = 521 + SYS_NECP_SESSION_OPEN = 522 + SYS_NECP_SESSION_ACTION = 523 + SYS_SETATTRLISTAT = 524 + SYS_NET_QOS_GUIDELINE = 525 + SYS_FMOUNT = 526 + SYS_NTP_ADJTIME = 527 + SYS_NTP_GETTIME = 528 + SYS_OS_FAULT_WITH_PAYLOAD = 529 + SYS_MAXSYSCALL = 530 + SYS_INVALID = 63 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index 09de240..e35de41 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -1,5 +1,5 @@ -// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/sys/syscall.h -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT +// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h +// Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,darwin @@ -121,13 +121,15 @@ const ( SYS_CSOPS = 169 SYS_CSOPS_AUDITTOKEN = 170 SYS_WAITID = 173 + SYS_KDEBUG_TYPEFILTER = 177 + SYS_KDEBUG_TRACE_STRING = 178 SYS_KDEBUG_TRACE64 = 179 SYS_KDEBUG_TRACE = 180 SYS_SETGID = 181 SYS_SETEGID = 182 SYS_SETEUID = 183 SYS_SIGRETURN = 184 - SYS_CHUD = 185 + SYS_THREAD_SELFCOUNTS = 186 SYS_FDATASYNC = 187 SYS_STAT = 188 SYS_FSTAT = 189 @@ -278,7 +280,6 @@ const ( SYS_KQUEUE = 362 SYS_KEVENT = 363 SYS_LCHOWN = 364 - SYS_STACK_SNAPSHOT = 365 SYS_BSDTHREAD_REGISTER = 366 SYS_WORKQ_OPEN = 367 SYS_WORKQ_KERNRETURN = 368 @@ -287,6 +288,8 @@ const ( SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 SYS_THREAD_SELFID = 372 SYS_LEDGER = 373 + SYS_KEVENT_QOS = 374 + SYS_KEVENT_ID = 375 SYS___MAC_EXECVE = 380 SYS___MAC_SYSCALL = 381 SYS___MAC_GET_FILE = 382 @@ -298,11 +301,8 @@ const ( SYS___MAC_GET_FD = 388 SYS___MAC_SET_FD = 389 SYS___MAC_GET_PID = 390 - SYS___MAC_GET_LCID = 391 - SYS___MAC_GET_LCTX = 392 - SYS___MAC_SET_LCTX = 393 - SYS_SETLCID = 394 - SYS_GETLCID = 395 + SYS_PSELECT = 394 + SYS_PSELECT_NOCANCEL = 395 SYS_READ_NOCANCEL = 396 SYS_WRITE_NOCANCEL = 397 SYS_OPEN_NOCANCEL = 398 @@ -351,6 +351,7 @@ const ( SYS_GUARDED_CLOSE_NP = 442 SYS_GUARDED_KQUEUE_NP = 443 SYS_CHANGE_FDGUARD_NP = 444 + SYS_USRCTL = 445 SYS_PROC_RLIMIT_CONTROL = 446 SYS_CONNECTX = 447 SYS_DISCONNECTX = 448 @@ -367,6 +368,7 @@ const ( SYS_COALITION_INFO = 459 SYS_NECP_MATCH_POLICY = 460 SYS_GETATTRLISTBULK = 461 + SYS_CLONEFILEAT = 462 SYS_OPENAT = 463 SYS_OPENAT_NOCANCEL = 464 SYS_RENAMEAT = 465 @@ -392,7 +394,43 @@ const ( SYS_GUARDED_WRITE_NP = 485 SYS_GUARDED_PWRITE_NP = 486 SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAME_EXT = 488 + SYS_RENAMEATX_NP = 488 SYS_MREMAP_ENCRYPTED = 489 - SYS_MAXSYSCALL = 490 + SYS_NETAGENT_TRIGGER = 490 + SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 + SYS_MICROSTACKSHOT = 492 + SYS_GRAB_PGO_DATA = 493 + SYS_PERSONA = 494 + SYS_WORK_INTERVAL_CTL = 499 + SYS_GETENTROPY = 500 + SYS_NECP_OPEN = 501 + SYS_NECP_CLIENT_ACTION = 502 + SYS___NEXUS_OPEN = 503 + SYS___NEXUS_REGISTER = 504 + SYS___NEXUS_DEREGISTER = 505 + SYS___NEXUS_CREATE = 506 + SYS___NEXUS_DESTROY = 507 + SYS___NEXUS_GET_OPT = 508 + SYS___NEXUS_SET_OPT = 509 + SYS___CHANNEL_OPEN = 510 + SYS___CHANNEL_GET_INFO = 511 + SYS___CHANNEL_SYNC = 512 + SYS___CHANNEL_GET_OPT = 513 + SYS___CHANNEL_SET_OPT = 514 + SYS_ULOCK_WAIT = 515 + SYS_ULOCK_WAKE = 516 + SYS_FCLONEFILEAT = 517 + SYS_FS_SNAPSHOT = 518 + SYS_TERMINATE_WITH_PAYLOAD = 520 + SYS_ABORT_WITH_PAYLOAD = 521 + SYS_NECP_SESSION_OPEN = 522 + SYS_NECP_SESSION_ACTION = 523 + SYS_SETATTRLISTAT = 524 + SYS_NET_QOS_GUIDELINE = 525 + SYS_FMOUNT = 526 + SYS_NTP_ADJTIME = 527 + SYS_NTP_GETTIME = 528 + SYS_OS_FAULT_WITH_PAYLOAD = 529 + SYS_MAXSYSCALL = 530 + SYS_INVALID = 63 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go index 41cb6ed..f2df27d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go @@ -1,4 +1,4 @@ -// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/include/sys/syscall.h +// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,darwin @@ -129,6 +129,7 @@ const ( SYS_SETEGID = 182 SYS_SETEUID = 183 SYS_SIGRETURN = 184 + SYS_THREAD_SELFCOUNTS = 186 SYS_FDATASYNC = 187 SYS_STAT = 188 SYS_FSTAT = 189 @@ -288,6 +289,7 @@ const ( SYS_THREAD_SELFID = 372 SYS_LEDGER = 373 SYS_KEVENT_QOS = 374 + SYS_KEVENT_ID = 375 SYS___MAC_EXECVE = 380 SYS___MAC_SYSCALL = 381 SYS___MAC_GET_FILE = 382 @@ -421,6 +423,14 @@ const ( SYS_FS_SNAPSHOT = 518 SYS_TERMINATE_WITH_PAYLOAD = 520 SYS_ABORT_WITH_PAYLOAD = 521 - SYS_MAXSYSCALL = 522 + SYS_NECP_SESSION_OPEN = 522 + SYS_NECP_SESSION_ACTION = 523 + SYS_SETATTRLISTAT = 524 + SYS_NET_QOS_GUIDELINE = 525 + SYS_FMOUNT = 526 + SYS_NTP_ADJTIME = 527 + SYS_NTP_GETTIME = 528 + SYS_OS_FAULT_WITH_PAYLOAD = 529 + SYS_MAXSYSCALL = 530 SYS_INVALID = 63 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go index 075816c..9694630 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go @@ -1,4 +1,4 @@ -// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/include/sys/syscall.h +// mksysnum_darwin.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm64,darwin @@ -129,6 +129,7 @@ const ( SYS_SETEGID = 182 SYS_SETEUID = 183 SYS_SIGRETURN = 184 + SYS_THREAD_SELFCOUNTS = 186 SYS_FDATASYNC = 187 SYS_STAT = 188 SYS_FSTAT = 189 @@ -288,6 +289,7 @@ const ( SYS_THREAD_SELFID = 372 SYS_LEDGER = 373 SYS_KEVENT_QOS = 374 + SYS_KEVENT_ID = 375 SYS___MAC_EXECVE = 380 SYS___MAC_SYSCALL = 381 SYS___MAC_GET_FILE = 382 @@ -421,6 +423,14 @@ const ( SYS_FS_SNAPSHOT = 518 SYS_TERMINATE_WITH_PAYLOAD = 520 SYS_ABORT_WITH_PAYLOAD = 521 - SYS_MAXSYSCALL = 522 + SYS_NECP_SESSION_OPEN = 522 + SYS_NECP_SESSION_ACTION = 523 + SYS_SETATTRLISTAT = 524 + SYS_NET_QOS_GUIDELINE = 525 + SYS_FMOUNT = 526 + SYS_NTP_ADJTIME = 527 + SYS_NTP_GETTIME = 528 + SYS_OS_FAULT_WITH_PAYLOAD = 529 + SYS_MAXSYSCALL = 530 SYS_INVALID = 63 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go index 4667c7b..bc4bc89 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go @@ -479,3 +479,11 @@ const ( POLLWRBAND = 0x100 POLLWRNORM = 0x4 ) + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 3f33b18..d8abcab 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -489,3 +489,11 @@ const ( POLLWRBAND = 0x100 POLLWRNORM = 0x4 ) + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go index 463a28b..9749c9f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go @@ -480,3 +480,11 @@ const ( POLLWRBAND = 0x100 POLLWRNORM = 0x4 ) + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 1ec20a0..810b0bd 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -489,3 +489,11 @@ const ( POLLWRBAND = 0x100 POLLWRNORM = 0x4 ) + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index ab515c3..1ca0e3e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -442,6 +442,13 @@ type Termios struct { Ospeed uint32 } +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + const ( AT_FDCWD = 0xfffafdcd AT_SYMLINK_NOFOLLOW = 0x1 diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index dfe446b..e16c05a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -382,6 +382,13 @@ type Termios struct { Ospeed int32 } +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x200 diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index 1498c23..9c37435 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -389,6 +389,13 @@ type Termios struct { Ospeed int32 } +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x200 diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index d6711ce..1329423 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -387,6 +387,13 @@ type Termios struct { Ospeed int32 } +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x200 diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index af295c3..2cf08bf 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -440,6 +440,13 @@ type Termios struct { Ospeed int32 } +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x2 diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index ae153e7..7cfc61f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -447,6 +447,13 @@ type Termios struct { Ospeed int32 } +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x2 diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index 35bb619..842c59c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -433,6 +433,13 @@ type Termios struct { Ospeed int32 } +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + const ( AT_FDCWD = -0x64 AT_SYMLINK_NOFOLLOW = 0x2 diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index bb778db..f48fec6 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -796,6 +796,75 @@ func ConnectEx(fd Handle, sa Sockaddr, sendBuf *byte, sendDataLen uint32, bytesS return connectEx(fd, ptr, n, sendBuf, sendDataLen, bytesSent, overlapped) } +var sendRecvMsgFunc struct { + once sync.Once + sendAddr uintptr + recvAddr uintptr + err error +} + +func loadWSASendRecvMsg() error { + sendRecvMsgFunc.once.Do(func() { + var s Handle + s, sendRecvMsgFunc.err = Socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) + if sendRecvMsgFunc.err != nil { + return + } + defer CloseHandle(s) + var n uint32 + sendRecvMsgFunc.err = WSAIoctl(s, + SIO_GET_EXTENSION_FUNCTION_POINTER, + (*byte)(unsafe.Pointer(&WSAID_WSARECVMSG)), + uint32(unsafe.Sizeof(WSAID_WSARECVMSG)), + (*byte)(unsafe.Pointer(&sendRecvMsgFunc.recvAddr)), + uint32(unsafe.Sizeof(sendRecvMsgFunc.recvAddr)), + &n, nil, 0) + if sendRecvMsgFunc.err != nil { + return + } + sendRecvMsgFunc.err = WSAIoctl(s, + SIO_GET_EXTENSION_FUNCTION_POINTER, + (*byte)(unsafe.Pointer(&WSAID_WSASENDMSG)), + uint32(unsafe.Sizeof(WSAID_WSASENDMSG)), + (*byte)(unsafe.Pointer(&sendRecvMsgFunc.sendAddr)), + uint32(unsafe.Sizeof(sendRecvMsgFunc.sendAddr)), + &n, nil, 0) + }) + return sendRecvMsgFunc.err +} + +func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlapped *Overlapped, croutine *byte) error { + err := loadWSASendRecvMsg() + if err != nil { + return err + } + r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.sendAddr, 6, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(flags), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if r1 == socket_error { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return err +} + +func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overlapped, croutine *byte) error { + err := loadWSASendRecvMsg() + if err != nil { + return err + } + r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.recvAddr, 5, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(bytesReceived)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0) + if r1 == socket_error { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return err +} + // Invented structures to support what package os expects. type Rusage struct { CreationTime Filetime diff --git a/vendor/golang.org/x/sys/windows/syscall_windows_test.go b/vendor/golang.org/x/sys/windows/syscall_windows_test.go index 0f73c11..9c7133c 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows_test.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows_test.go @@ -81,7 +81,7 @@ func TestFormatMessage(t *testing.T) { buf := make([]uint16, 300) _, err = windows.FormatMessage(flags, uintptr(dll.Handle), uint32(errno), 0, buf, nil) if err != nil { - t.Fatal("FormatMessage for handle=%x and errno=%x failed: %v", dll.Handle, errno, err) + t.Fatalf("FormatMessage for handle=%x and errno=%x failed: %v", dll.Handle, errno, err) } } diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 0229f79..78b714c 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -29,6 +29,7 @@ const ( ERROR_NOT_FOUND syscall.Errno = 1168 ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 WSAEACCES syscall.Errno = 10013 + WSAEMSGSIZE syscall.Errno = 10040 WSAECONNRESET syscall.Errno = 10054 ) @@ -567,6 +568,16 @@ const ( IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_DONTROUTE = 0x4 + MSG_WAITALL = 0x8 + + MSG_TRUNC = 0x0100 + MSG_CTRUNC = 0x0200 + MSG_BCAST = 0x0400 + MSG_MCAST = 0x0800 + SOMAXCONN = 0x7fffffff TCP_NODELAY = 1 @@ -584,6 +595,15 @@ type WSABuf struct { Buf *byte } +type WSAMsg struct { + Name *syscall.RawSockaddrAny + Namelen int32 + Buffers *WSABuf + BufferCount uint32 + Control WSABuf + Flags uint32 +} + // Invented values to support what package os expects. const ( S_IFMT = 0x1f000 @@ -1011,6 +1031,20 @@ var WSAID_CONNECTEX = GUID{ [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}, } +var WSAID_WSASENDMSG = GUID{ + 0xa441e712, + 0x754f, + 0x43ca, + [8]byte{0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d}, +} + +var WSAID_WSARECVMSG = GUID{ + 0xf689d7c8, + 0x6f1f, + 0x436b, + [8]byte{0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22}, +} + const ( FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1 FILE_SKIP_SET_EVENT_ON_HANDLE = 2 diff --git a/watch.go b/watch.go index ff13db0..211e1f8 100644 --- a/watch.go +++ b/watch.go @@ -1,6 +1,7 @@ package devd import ( + "os" "time" "github.com/cortesi/devd/livereload" @@ -12,22 +13,28 @@ const batchTime = time.Millisecond * 200 // Watch watches an endpoint for changes, if it supports them. func (r Route) Watch(ch chan []string, excludePatterns []string, log termlog.Logger) error { + wd, err := os.Getwd() + if err != nil { + return err + } switch r.Endpoint.(type) { case *filesystemEndpoint: ep := *r.Endpoint.(*filesystemEndpoint) modchan := make(chan *moddwatch.Mod, 1) - _, err := moddwatch.Watch([]string{ep.Root + "/..."}, batchTime, modchan) + _, err := moddwatch.Watch( + wd, + []string{ep.Root + "/..."}, + excludePatterns, + batchTime, + modchan, + ) if err != nil { return err } go func() { for mod := range modchan { - filteredMod, err := mod.Filter([]string{"**/*"}, excludePatterns) - if err != nil { - log.Shout("Error filtering watches: %s", err) - } - if !filteredMod.Empty() { - ch <- filteredMod.All() + if !mod.Empty() { + ch <- mod.All() } } }() @@ -37,21 +44,27 @@ func (r Route) Watch(ch chan []string, excludePatterns []string, log termlog.Log // WatchPaths watches a set of paths, and broadcasts changes through reloader. func WatchPaths(paths, excludePatterns []string, reloader livereload.Reloader, log termlog.Logger) error { + wd, err := os.Getwd() + if err != nil { + return err + } ch := make(chan []string, 1) for _, path := range paths { modchan := make(chan *moddwatch.Mod, 1) - _, err := moddwatch.Watch([]string{path}, batchTime, modchan) + _, err := moddwatch.Watch( + wd, + []string{path}, + excludePatterns, + batchTime, + modchan, + ) if err != nil { return err } go func() { for mod := range modchan { - filteredMod, err := mod.Filter([]string{"**/*"}, excludePatterns) - if err != nil { - log.Shout("Error filtering watches: %s", err) - } - if !filteredMod.Empty() { - ch <- filteredMod.All() + if !mod.Empty() { + ch <- mod.All() } } }()