` + haystack[match.Start():match.End()] + `<\a>`, true
-})
-```
-
-Search for matches one at a time via the iterator
-
-```go
-iter := ac.Iter(haystack)
-
-for next := iter.Next(); next != nil; next = iter.Next() {
- ...
-}
-```
-
-It's plenty fast but if you want to use it in parallel, that is also possible.
-
-Memory consumption won't increase because the read-only automaton is not actually copied, only the counters are.
-
-The magic line is `ac := ac`
-
-```go
-var w sync.WaitGroup
-
-w.Add(50)
-for i := 0; i < 50; i++ {
- go func() {
- ac := ac
- matches := ac.FindAll(haystack)
- println(len(matches))
- w.Done()
- }()
-}
-w.Wait()
-```
diff --git a/vendor/github.com/petar-dambovaliev/aho-corasick/ahocorasick.go b/vendor/github.com/petar-dambovaliev/aho-corasick/ahocorasick.go
deleted file mode 100644
index 445a7f96c..000000000
--- a/vendor/github.com/petar-dambovaliev/aho-corasick/ahocorasick.go
+++ /dev/null
@@ -1,384 +0,0 @@
-package aho_corasick
-
-import (
- "strings"
- "sync"
- "unicode"
-)
-
-type findIter struct {
- fsm imp
- prestate *prefilterState
- haystack []byte
- pos int
- matchOnlyWholeWords bool
-}
-
-// Iter is an iterator over matches found on the current haystack
-// it gives the user more granular control. You can chose how many and what kind of matches you need.
-type Iter interface {
- Next() *Match
-}
-
-// Next gives a pointer to the next match yielded by the iterator or nil, if there is none
-func (f *findIter) Next() *Match {
- if f.pos > len(f.haystack) {
- return nil
- }
-
- result := f.fsm.FindAtNoState(f.prestate, f.haystack, f.pos)
-
- if result == nil {
- return nil
- }
-
- if result.end == f.pos {
- f.pos += 1
- } else {
- f.pos = result.end
- }
-
- if f.matchOnlyWholeWords {
- if result.Start()-1 >= 0 && (unicode.IsLetter(rune(f.haystack[result.Start()-1])) || unicode.IsDigit(rune(f.haystack[result.Start()-1]))) {
- return f.Next()
- }
- if result.end < len(f.haystack) && (unicode.IsLetter(rune(f.haystack[result.end])) || unicode.IsDigit(rune(f.haystack[result.end]))) {
- return f.Next()
- }
- }
-
- return result
-}
-
-type overlappingIter struct {
- fsm imp
- prestate *prefilterState
- haystack []byte
- pos int
- stateID stateID
- matchIndex int
- matchOnlyWholeWords bool
-}
-
-func (f *overlappingIter) Next() *Match {
- if f.pos > len(f.haystack) {
- return nil
- }
-
- result := f.fsm.OverlappingFindAt(f.prestate, f.haystack, f.pos, &f.stateID, &f.matchIndex)
-
- if result == nil {
- return nil
- }
-
- f.pos = result.End()
-
- if f.matchOnlyWholeWords {
- if result.Start()-1 >= 0 && (unicode.IsLetter(rune(f.haystack[result.Start()-1])) || unicode.IsDigit(rune(f.haystack[result.Start()-1]))) {
- return f.Next()
- }
- if result.end < len(f.haystack) && (unicode.IsLetter(rune(f.haystack[result.end])) || unicode.IsDigit(rune(f.haystack[result.end]))) {
- return f.Next()
- }
- }
-
- return result
-}
-
-func newOverlappingIter(ac AhoCorasick, haystack []byte) overlappingIter {
- prestate := prefilterState{
- skips: 0,
- skipped: 0,
- maxMatchLen: ac.i.MaxPatternLen(),
- inert: false,
- lastScanAt: 0,
- }
- return overlappingIter{
- fsm: ac.i,
- prestate: &prestate,
- haystack: haystack,
- pos: 0,
- stateID: ac.i.StartState(),
- matchIndex: 0,
- matchOnlyWholeWords: ac.matchOnlyWholeWords,
- }
-}
-
-// make sure the AhoCorasick data structure implements the Finder interface
-var _ Finder = (*AhoCorasick)(nil)
-
-// AhoCorasick is the main data structure that does most of the work
-type AhoCorasick struct {
- i imp
- matchKind matchKind
- matchOnlyWholeWords bool
-}
-
-func (ac AhoCorasick) PatternCount() int {
- return ac.i.PatternCount()
-}
-
-// Iter gives an iterator over the built patterns
-func (ac AhoCorasick) Iter(haystack string) Iter {
- return ac.IterByte([]byte(haystack))
-}
-
-// IterByte gives an iterator over the built patterns
-func (ac AhoCorasick) IterByte(haystack []byte) Iter {
- prestate := &prefilterState{
- skips: 0,
- skipped: 0,
- maxMatchLen: ac.i.MaxPatternLen(),
- inert: false,
- lastScanAt: 0,
- }
-
- return &findIter{
- fsm: ac.i,
- prestate: prestate,
- haystack: haystack,
- pos: 0,
- matchOnlyWholeWords: ac.matchOnlyWholeWords,
- }
-}
-
-// Iter gives an iterator over the built patterns with overlapping matches
-func (ac AhoCorasick) IterOverlapping(haystack string) Iter {
- return ac.IterOverlappingByte([]byte(haystack))
-}
-
-// IterOverlappingByte gives an iterator over the built patterns with overlapping matches
-func (ac AhoCorasick) IterOverlappingByte(haystack []byte) Iter {
- if ac.matchKind != StandardMatch {
- panic("only StandardMatch allowed for overlapping matches")
- }
- i := newOverlappingIter(ac, haystack)
- return &i
-}
-
-var pool = sync.Pool{
- New: func() interface{} {
- return strings.Builder{}
- },
-}
-
-type Replacer struct {
- finder Finder
-}
-
-func NewReplacer(finder Finder) Replacer {
- return Replacer{finder: finder}
-}
-
-// ReplaceAllFunc replaces the matches found in the haystack according to the user provided function
-// it gives fine grained control over what is replaced.
-// A user can chose to stop the replacing process early by returning false in the lambda
-// In that case, everything from that point will be kept as the original haystack
-func (r Replacer) ReplaceAllFunc(haystack string, f func(match Match) (string, bool)) string {
- matches := r.finder.FindAll(haystack)
-
- if len(matches) == 0 {
- return haystack
- }
-
- replaceWith := make([]string, 0)
-
- for _, match := range matches {
- rw, ok := f(match)
- if !ok {
- break
- }
- replaceWith = append(replaceWith, rw)
- }
-
- str := pool.Get().(strings.Builder)
-
- defer func() {
- str.Reset()
- pool.Put(str)
- }()
-
- start := 0
-
- for i, match := range matches {
- if i >= len(replaceWith) {
- str.WriteString(haystack[start:])
- return str.String()
- }
- str.WriteString(haystack[start:match.Start()])
- str.WriteString(replaceWith[i])
- start = match.Start() + match.len
- }
-
- if start-1 < len(haystack) {
- str.WriteString(haystack[start:])
- }
-
- return str.String()
-}
-
-// ReplaceAll replaces the matches found in the haystack according to the user provided slice `replaceWith`
-// It panics, if `replaceWith` has length different from the patterns that it was built with
-func (r Replacer) ReplaceAll(haystack string, replaceWith []string) string {
- if len(replaceWith) != r.finder.PatternCount() {
- panic("replaceWith needs to have the same length as the pattern count")
- }
-
- return r.ReplaceAllFunc(haystack, func(match Match) (string, bool) {
- return replaceWith[match.pattern], true
- })
-}
-
-type Finder interface {
- FindAll(haystack string) []Match
- PatternCount() int
-}
-
-// FindAll returns the matches found in the haystack
-func (ac AhoCorasick) FindAll(haystack string) []Match {
- iter := ac.Iter(haystack)
- matches := make([]Match, 0)
-
- for {
- next := iter.Next()
- if next == nil {
- break
- }
-
- matches = append(matches, *next)
- }
-
- return matches
-}
-
-// AhoCorasickBuilder defines a set of options applied before the patterns are built
-type AhoCorasickBuilder struct {
- dfaBuilder *iDFABuilder
- nfaBuilder *iNFABuilder
- dfa bool
- matchOnlyWholeWords bool
-}
-
-// Opts defines a set of options applied before the patterns are built
-type Opts struct {
- AsciiCaseInsensitive bool
- MatchOnlyWholeWords bool
- MatchKind matchKind
- DFA bool
-}
-
-// NewAhoCorasickBuilder creates a new AhoCorasickBuilder based on Opts
-func NewAhoCorasickBuilder(o Opts) AhoCorasickBuilder {
- return AhoCorasickBuilder{
- dfaBuilder: newDFABuilder(),
- nfaBuilder: newNFABuilder(o.MatchKind, o.AsciiCaseInsensitive),
- dfa: o.DFA,
- matchOnlyWholeWords: o.MatchOnlyWholeWords,
- }
-}
-
-// Build builds a (non)deterministic finite automata from the user provided patterns
-func (a *AhoCorasickBuilder) Build(patterns []string) AhoCorasick {
- bytePatterns := make([][]byte, len(patterns))
- for pati, pat := range patterns {
- bytePatterns[pati] = []byte(pat)
- }
-
- return a.BuildByte(bytePatterns)
-}
-
-// BuildByte builds a (non)deterministic finite automata from the user provided patterns
-func (a *AhoCorasickBuilder) BuildByte(patterns [][]byte) AhoCorasick {
- nfa := a.nfaBuilder.build(patterns)
- match_kind := nfa.matchKind
-
- if a.dfa {
- dfa := a.dfaBuilder.build(nfa)
- return AhoCorasick{dfa, match_kind, a.matchOnlyWholeWords}
- }
-
- return AhoCorasick{nfa, match_kind, a.matchOnlyWholeWords}
-}
-
-type imp interface {
- MatchKind() *matchKind
- StartState() stateID
- MaxPatternLen() int
- PatternCount() int
- Prefilter() prefilter
- UsePrefilter() bool
- OverlappingFindAt(prestate *prefilterState, haystack []byte, at int, state_id *stateID, match_index *int) *Match
- EarliestFindAt(prestate *prefilterState, haystack []byte, at int, state_id *stateID) *Match
- FindAtNoState(prestate *prefilterState, haystack []byte, at int) *Match
-}
-
-type matchKind int
-
-const (
- // Use standard match semantics, which support overlapping matches. When
- // used with non-overlapping matches, matches are reported as they are seen.
- StandardMatch matchKind = iota
- // Use leftmost-first match semantics, which reports leftmost matches.
- // When there are multiple possible leftmost matches, the match
- // corresponding to the pattern that appeared earlier when constructing
- // the automaton is reported.
- // This does **not** support overlapping matches or stream searching
- LeftMostFirstMatch
- // Use leftmost-longest match semantics, which reports leftmost matches.
- // When there are multiple possible leftmost matches, the longest match is chosen.
- LeftMostLongestMatch
-)
-
-func (m matchKind) supportsOverlapping() bool {
- return m.isStandard()
-}
-
-func (m matchKind) supportsStream() bool {
- return m.isStandard()
-}
-
-func (m matchKind) isStandard() bool {
- return m == StandardMatch
-}
-
-func (m matchKind) isLeftmost() bool {
- return m == LeftMostFirstMatch || m == LeftMostLongestMatch
-}
-
-func (m matchKind) isLeftmostFirst() bool {
- return m == LeftMostFirstMatch
-}
-
-// A representation of a match reported by an Aho-Corasick automaton.
-//
-// A match has two essential pieces of information: the identifier of the
-// pattern that matched, along with the start and end offsets of the match
-// in the haystack.
-type Match struct {
- pattern int
- len int
- end int
-}
-
-// Pattern returns the index of the pattern in the slice of the patterns provided by the user that
-// was matched
-func (m *Match) Pattern() int {
- return m.pattern
-}
-
-// End gives the index of the last character of this match inside the haystack
-func (m *Match) End() int {
- return m.end
-}
-
-// Start gives the index of the first character of this match inside the haystack
-func (m *Match) Start() int {
- return m.end - m.len
-}
-
-type stateID uint
-
-const (
- failedStateID stateID = 0
- deadStateID stateID = 1
-)
diff --git a/vendor/github.com/petar-dambovaliev/aho-corasick/automaton.go b/vendor/github.com/petar-dambovaliev/aho-corasick/automaton.go
deleted file mode 100644
index 2404cccbf..000000000
--- a/vendor/github.com/petar-dambovaliev/aho-corasick/automaton.go
+++ /dev/null
@@ -1,222 +0,0 @@
-package aho_corasick
-
-type automaton interface {
- Repr() *iRepr
- MatchKind() *matchKind
- Anchored() bool
- Prefilter() prefilter
- StartState() stateID
- IsValid(stateID) bool
- IsMatchState(stateID) bool
- IsMatchOrDeadState(stateID) bool
- GetMatch(stateID, int, int) *Match
- MatchCount(stateID) int
- NextState(stateID, byte) stateID
- NextStateNoFail(stateID, byte) stateID
- StandardFindAt(*prefilterState, []byte, int, *stateID) *Match
- StandardFindAtImp(*prefilterState, prefilter, []byte, int, *stateID) *Match
- LeftmostFindAt(*prefilterState, []byte, int, *stateID) *Match
- LeftmostFindAtImp(*prefilterState, prefilter, []byte, int, *stateID) *Match
- LeftmostFindAtNoState(*prefilterState, []byte, int) *Match
- LeftmostFindAtNoStateImp(*prefilterState, prefilter, []byte, int) *Match
- OverlappingFindAt(*prefilterState, []byte, int, *stateID, *int) *Match
- EarliestFindAt(*prefilterState, []byte, int, *stateID) *Match
- FindAt(*prefilterState, []byte, int, *stateID) *Match
- FindAtNoState(*prefilterState, []byte, int) *Match
-}
-
-func isMatchOrDeadState(a automaton, si stateID) bool {
- return si == deadStateID || a.IsMatchState(si)
-}
-
-func standardFindAt(a automaton, prestate *prefilterState, haystack []byte, at int, sID *stateID) *Match {
- pre := a.Prefilter()
- return a.StandardFindAtImp(prestate, pre, haystack, at, sID)
-}
-
-func standardFindAtImp(a automaton, prestate *prefilterState, prefilter prefilter, haystack []byte, at int, sID *stateID) *Match {
- for at < len(haystack) {
- if prefilter != nil {
- startState := a.StartState()
- if prestate.IsEffective(at) && sID == &startState {
- c, ttype := nextPrefilter(prestate, prefilter, haystack, at)
- switch ttype {
- case noneCandidate:
- return nil
- case possibleStartOfMatchCandidate:
- i := c.(int)
- at = i
- }
- }
- }
- *sID = a.NextStateNoFail(*sID, haystack[at])
- at += 1
-
- if a.IsMatchOrDeadState(*sID) {
- if *sID == deadStateID {
- return nil
- } else {
- return a.GetMatch(*sID, 0, at)
- }
- }
- }
- return nil
-}
-
-func leftmostFindAt(a automaton, prestate *prefilterState, haystack []byte, at int, sID *stateID) *Match {
- prefilter := a.Prefilter()
- return a.LeftmostFindAtImp(prestate, prefilter, haystack, at, sID)
-}
-
-func leftmostFindAtImp(a automaton, prestate *prefilterState, prefilter prefilter, haystack []byte, at int, sID *stateID) *Match {
- if a.Anchored() && at > 0 && *sID == a.StartState() {
- return nil
- }
- lastMatch := a.GetMatch(*sID, 0, at)
-
- for at < len(haystack) {
- if prefilter != nil {
- startState := a.StartState()
- if prestate.IsEffective(at) && sID == &startState {
- c, ttype := nextPrefilter(prestate, prefilter, haystack, at)
- switch ttype {
- case noneCandidate:
- return nil
- case possibleStartOfMatchCandidate:
- i := c.(int)
- at = i
- }
- }
- }
-
- *sID = a.NextStateNoFail(*sID, haystack[at])
- at += 1
-
- if a.IsMatchOrDeadState(*sID) {
- if *sID == deadStateID {
- return lastMatch
- } else {
- a.GetMatch(*sID, 0, at)
- }
- }
- }
-
- return lastMatch
-}
-
-func leftmostFindAtNoState(a automaton, prestate *prefilterState, haystack []byte, at int) *Match {
- return leftmostFindAtNoStateImp(a, prestate, a.Prefilter(), haystack, at)
-}
-
-func leftmostFindAtNoStateImp(a automaton, prestate *prefilterState, prefilter prefilter, haystack []byte, at int) *Match {
- if a.Anchored() && at > 0 {
- return nil
- }
- if prefilter != nil && !prefilter.ReportsFalsePositives() {
- c, ttype := prefilter.NextCandidate(prestate, haystack, at)
- switch ttype {
- case noneCandidate:
- return nil
- case matchCandidate:
- m := c.(*Match)
- return m
- }
- }
-
- stateID := a.StartState()
- lastMatch := a.GetMatch(stateID, 0, at)
-
- for at < len(haystack) {
- if prefilter != nil && prestate.IsEffective(at) && stateID == a.StartState() {
- c, ttype := prefilter.NextCandidate(prestate, haystack, at)
- switch ttype {
- case noneCandidate:
- return nil
- case matchCandidate:
- m := c.(*Match)
- return m
- case possibleStartOfMatchCandidate:
- i := c.(int)
- at = i
- }
- }
-
- stateID = a.NextStateNoFail(stateID, haystack[at])
- at += 1
-
- if a.IsMatchOrDeadState(stateID) {
- if stateID == deadStateID {
- return lastMatch
- }
- lastMatch = a.GetMatch(stateID, 0, at)
- }
- }
-
- return lastMatch
-}
-
-func overlappingFindAt(a automaton, prestate *prefilterState, haystack []byte, at int, id *stateID, matchIndex *int) *Match {
- if a.Anchored() && at > 0 && *id == a.StartState() {
- return nil
- }
-
- matchCount := a.MatchCount(*id)
-
- if *matchIndex < matchCount {
- result := a.GetMatch(*id, *matchIndex, at)
- *matchIndex += 1
- return result
- }
-
- *matchIndex = 0
- match := a.StandardFindAt(prestate, haystack, at, id)
-
- if match == nil {
- return nil
- }
-
- *matchIndex = 1
- return match
-}
-
-func earliestFindAt(a automaton, prestate *prefilterState, haystack []byte, at int, id *stateID) *Match {
- if *id == a.StartState() {
- if a.Anchored() && at > 0 {
- return nil
- }
- match := a.GetMatch(*id, 0, at)
- if match != nil {
- return match
- }
- }
- return a.StandardFindAt(prestate, haystack, at, id)
-}
-
-func findAt(a automaton, prestate *prefilterState, haystack []byte, at int, id *stateID) *Match {
- kind := a.MatchKind()
- if kind == nil {
- return nil
- }
- switch *kind {
- case StandardMatch:
- return a.EarliestFindAt(prestate, haystack, at, id)
- case LeftMostFirstMatch, LeftMostLongestMatch:
- return a.LeftmostFindAt(prestate, haystack, at, id)
- }
- return nil
-}
-
-func findAtNoState(a automaton, prestate *prefilterState, haystack []byte, at int) *Match {
- kind := a.MatchKind()
- if kind == nil {
- return nil
- }
- switch *kind {
- case StandardMatch:
- state := a.StartState()
- return a.EarliestFindAt(prestate, haystack, at, &state)
- case LeftMostFirstMatch, LeftMostLongestMatch:
- return a.LeftmostFindAtNoState(prestate, haystack, at)
- }
- return nil
-}
diff --git a/vendor/github.com/petar-dambovaliev/aho-corasick/byte_frequencies.go b/vendor/github.com/petar-dambovaliev/aho-corasick/byte_frequencies.go
deleted file mode 100644
index 8a45609c6..000000000
--- a/vendor/github.com/petar-dambovaliev/aho-corasick/byte_frequencies.go
+++ /dev/null
@@ -1,260 +0,0 @@
-package aho_corasick
-
-var byteFrequencies = [256]byte{
- 55, // '\x00'
- 52, // '\x01'
- 51, // '\x02'
- 50, // '\x03'
- 49, // '\x04'
- 48, // '\x05'
- 47, // '\x06'
- 46, // '\x07'
- 45, // '\x08'
- 103, // '\t'
- 242, // '\n'
- 66, // '\x0b'
- 67, // '\x0c'
- 229, // '\r'
- 44, // '\x0e'
- 43, // '\x0f'
- 42, // '\x10'
- 41, // '\x11'
- 40, // '\x12'
- 39, // '\x13'
- 38, // '\x14'
- 37, // '\x15'
- 36, // '\x16'
- 35, // '\x17'
- 34, // '\x18'
- 33, // '\x19'
- 56, // '\x1a'
- 32, // '\x1b'
- 31, // '\x1c'
- 30, // '\x1d'
- 29, // '\x1e'
- 28, // '\x1f'
- 255, // ' '
- 148, // '!'
- 164, // '"'
- 149, // '#'
- 136, // '$'
- 160, // '%'
- 155, // '&'
- 173, // "'"
- 221, // '('
- 222, // ')'
- 134, // '*'
- 122, // '+'
- 232, // ','
- 202, // '-'
- 215, // '.'
- 224, // '/'
- 208, // '0'
- 220, // '1'
- 204, // '2'
- 187, // '3'
- 183, // '4'
- 179, // '5'
- 177, // '6'
- 168, // '7'
- 178, // '8'
- 200, // '9'
- 226, // ':'
- 195, // ';'
- 154, // '<'
- 184, // '='
- 174, // '>'
- 126, // '?'
- 120, // '@'
- 191, // 'A'
- 157, // 'B'
- 194, // 'C'
- 170, // 'D'
- 189, // 'E'
- 162, // 'F'
- 161, // 'G'
- 150, // 'H'
- 193, // 'I'
- 142, // 'J'
- 137, // 'K'
- 171, // 'L'
- 176, // 'M'
- 185, // 'N'
- 167, // 'O'
- 186, // 'P'
- 112, // 'Q'
- 175, // 'R'
- 192, // 'S'
- 188, // 'T'
- 156, // 'U'
- 140, // 'V'
- 143, // 'W'
- 123, // 'X'
- 133, // 'Y'
- 128, // 'Z'
- 147, // '['
- 138, // '\\'
- 146, // ']'
- 114, // '^'
- 223, // '_'
- 151, // '`'
- 249, // 'a'
- 216, // 'b'
- 238, // 'c'
- 236, // 'd'
- 253, // 'e'
- 227, // 'f'
- 218, // 'g'
- 230, // 'h'
- 247, // 'i'
- 135, // 'j'
- 180, // 'k'
- 241, // 'l'
- 233, // 'm'
- 246, // 'n'
- 244, // 'o'
- 231, // 'p'
- 139, // 'q'
- 245, // 'r'
- 243, // 's'
- 251, // 't'
- 235, // 'u'
- 201, // 'v'
- 196, // 'w'
- 240, // 'x'
- 214, // 'y'
- 152, // 'z'
- 182, // '{'
- 205, // '|'
- 181, // '}'
- 127, // '~'
- 27, // '\x7f'
- 212, // '\x80'
- 211, // '\x81'
- 210, // '\x82'
- 213, // '\x83'
- 228, // '\x84'
- 197, // '\x85'
- 169, // '\x86'
- 159, // '\x87'
- 131, // '\x88'
- 172, // '\x89'
- 105, // '\x8a'
- 80, // '\x8b'
- 98, // '\x8c'
- 96, // '\x8d'
- 97, // '\x8e'
- 81, // '\x8f'
- 207, // '\x90'
- 145, // '\x91'
- 116, // '\x92'
- 115, // '\x93'
- 144, // '\x94'
- 130, // '\x95'
- 153, // '\x96'
- 121, // '\x97'
- 107, // '\x98'
- 132, // '\x99'
- 109, // '\x9a'
- 110, // '\x9b'
- 124, // '\x9c'
- 111, // '\x9d'
- 82, // '\x9e'
- 108, // '\x9f'
- 118, // '\xa0'
- 141, // '¡'
- 113, // '¢'
- 129, // '£'
- 119, // '¤'
- 125, // '¥'
- 165, // '¦'
- 117, // '§'
- 92, // '¨'
- 106, // '©'
- 83, // 'ª'
- 72, // '«'
- 99, // '¬'
- 93, // '\xad'
- 65, // '®'
- 79, // '¯'
- 166, // '°'
- 237, // '±'
- 163, // '²'
- 199, // '³'
- 190, // '´'
- 225, // 'µ'
- 209, // '¶'
- 203, // '·'
- 198, // '¸'
- 217, // '¹'
- 219, // 'º'
- 206, // '»'
- 234, // '¼'
- 248, // '½'
- 158, // '¾'
- 239, // '¿'
- 255, // 'À'
- 255, // 'Á'
- 255, // 'Â'
- 255, // 'Ã'
- 255, // 'Ä'
- 255, // 'Å'
- 255, // 'Æ'
- 255, // 'Ç'
- 255, // 'È'
- 255, // 'É'
- 255, // 'Ê'
- 255, // 'Ë'
- 255, // 'Ì'
- 255, // 'Í'
- 255, // 'Î'
- 255, // 'Ï'
- 255, // 'Ð'
- 255, // 'Ñ'
- 255, // 'Ò'
- 255, // 'Ó'
- 255, // 'Ô'
- 255, // 'Õ'
- 255, // 'Ö'
- 255, // '×'
- 255, // 'Ø'
- 255, // 'Ù'
- 255, // 'Ú'
- 255, // 'Û'
- 255, // 'Ü'
- 255, // 'Ý'
- 255, // 'Þ'
- 255, // 'ß'
- 255, // 'à'
- 255, // 'á'
- 255, // 'â'
- 255, // 'ã'
- 255, // 'ä'
- 255, // 'å'
- 255, // 'æ'
- 255, // 'ç'
- 255, // 'è'
- 255, // 'é'
- 255, // 'ê'
- 255, // 'ë'
- 255, // 'ì'
- 255, // 'í'
- 255, // 'î'
- 255, // 'ï'
- 255, // 'ð'
- 255, // 'ñ'
- 255, // 'ò'
- 255, // 'ó'
- 255, // 'ô'
- 255, // 'õ'
- 255, // 'ö'
- 255, // '÷'
- 255, // 'ø'
- 255, // 'ù'
- 255, // 'ú'
- 255, // 'û'
- 255, // 'ü'
- 255, // 'ý'
- 255, // 'þ'
- 255, // 'ÿ'
-}
diff --git a/vendor/github.com/petar-dambovaliev/aho-corasick/classes.go b/vendor/github.com/petar-dambovaliev/aho-corasick/classes.go
deleted file mode 100644
index c942c023a..000000000
--- a/vendor/github.com/petar-dambovaliev/aho-corasick/classes.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package aho_corasick
-
-import (
- "math"
-)
-
-type byteClassRepresentatives struct {
- classes *byteClasses
- bbyte int
- lastClass *byte
-}
-
-func (b *byteClassRepresentatives) next() *byte {
- for b.bbyte < 256 {
- bbyte := byte(b.bbyte)
- class := b.classes.bytes[bbyte]
- b.bbyte += 1
-
- if b.lastClass == nil || *b.lastClass != class {
- c := class
- b.lastClass = &c
- return &bbyte
- }
- }
- return nil
-}
-
-type byteClassBuilder []bool
-
-func (b byteClassBuilder) setRange(start, end byte) {
- if start > 0 {
- b[int(start)-1] = true
- }
- b[int(end)] = true
-}
-
-func (b byteClassBuilder) build() byteClasses {
- var classes byteClasses
- var class byte
- i := 0
- for {
- classes.bytes[byte(i)] = class
- if i >= 255 {
- break
- }
- if b[i] {
- if class+1 > math.MaxUint8 {
- panic("shit happens")
- }
- class += 1
- }
- i += 1
- }
- return classes
-}
-
-func newByteClassBuilder() byteClassBuilder {
- return make([]bool, 256)
-}
-
-type byteClasses struct {
- bytes [256]byte
-}
-
-func singletons() byteClasses {
- var bc byteClasses
- for i := range bc.bytes {
- bc.bytes[i] = byte(i)
- }
- return bc
-}
-
-func (b byteClasses) alphabetLen() int {
- return int(b.bytes[255]) + 1
-}
-
-func (b byteClasses) isSingleton() bool {
- return b.alphabetLen() == 256
-}
diff --git a/vendor/github.com/petar-dambovaliev/aho-corasick/dfa.go b/vendor/github.com/petar-dambovaliev/aho-corasick/dfa.go
deleted file mode 100644
index c42423599..000000000
--- a/vendor/github.com/petar-dambovaliev/aho-corasick/dfa.go
+++ /dev/null
@@ -1,731 +0,0 @@
-package aho_corasick
-
-import (
- "unsafe"
-)
-
-type iDFA struct {
- atom automaton
-}
-
-func (d iDFA) MatchKind() *matchKind {
- return d.atom.MatchKind()
-}
-
-func (d iDFA) StartState() stateID {
- return d.atom.StartState()
-}
-
-func (d iDFA) MaxPatternLen() int {
- return d.atom.Repr().max_pattern_len
-}
-
-func (d iDFA) PatternCount() int {
- return d.atom.Repr().pattern_count
-}
-
-func (d iDFA) Prefilter() prefilter {
- return d.atom.Prefilter()
-}
-
-func (d iDFA) UsePrefilter() bool {
- p := d.Prefilter()
- if p == nil {
- return false
- }
- return !p.LooksForNonStartOfMatch()
-}
-
-func (d iDFA) OverlappingFindAt(prestate *prefilterState, haystack []byte, at int, state_id *stateID, match_index *int) *Match {
- return overlappingFindAt(d.atom, prestate, haystack, at, state_id, match_index)
-}
-
-func (d iDFA) EarliestFindAt(prestate *prefilterState, haystack []byte, at int, state_id *stateID) *Match {
- return earliestFindAt(d.atom, prestate, haystack, at, state_id)
-}
-
-func (d iDFA) FindAtNoState(prestate *prefilterState, haystack []byte, at int) *Match {
- return findAtNoState(d.atom, prestate, haystack, at)
-}
-
-func (n iDFA) LeftmostFindAtNoState(prestate *prefilterState, haystack []byte, at int) *Match {
- return leftmostFindAtNoState(n.atom, prestate, haystack, at)
-}
-
-type iDFABuilder struct {
- premultiply bool
- byte_classes bool
-}
-
-func (d *iDFABuilder) build(nfa *iNFA) iDFA {
- var byteClasses byteClasses
- if d.byte_classes {
- byteClasses = nfa.byteClasses
- } else {
- byteClasses = singletons()
- }
-
- alphabet_len := byteClasses.alphabetLen()
- trans := make([]stateID, alphabet_len*len(nfa.states))
- for i := range trans {
- trans[i] = failedStateID
- }
-
- matches := make([][]pattern, len(nfa.states))
- var p prefilter
-
- if nfa.prefil != nil {
- p = nfa.prefil.clone()
- }
-
- rep := iRepr{
- match_kind: nfa.matchKind,
- anchored: nfa.anchored,
- premultiplied: false,
- start_id: nfa.startID,
- max_pattern_len: nfa.maxPatternLen,
- pattern_count: nfa.patternCount,
- state_count: len(nfa.states),
- max_match: failedStateID,
- heap_bytes: 0,
- prefilter: p,
- byte_classes: byteClasses,
- trans: trans,
- matches: matches,
- }
-
- for id := 0; id < len(nfa.states); id += 1 {
- rep.matches[id] = append(rep.matches[id], nfa.states[id].matches...)
- fail := nfa.states[id].fail
-
- nfa.iterAllTransitions(&byteClasses, stateID(id), func(tr *next) {
- if tr.id == failedStateID {
- tr.id = nfaNextStateMemoized(nfa, &rep, stateID(id), fail, tr.key)
- }
- rep.setNextState(stateID(id), tr.key, tr.id)
- })
-
- }
-
- rep.shuffleMatchStates()
- rep.calculateSize()
-
- if d.premultiply {
- rep.premultiply()
- if byteClasses.isSingleton() {
- return iDFA{&iPremultiplied{rep}}
- } else {
- return iDFA{&iPremultipliedByteClass{&rep}}
- }
- }
- if byteClasses.isSingleton() {
- return iDFA{&iStandard{rep}}
- }
- return iDFA{&iByteClass{&rep}}
-}
-
-type iByteClass struct {
- repr *iRepr
-}
-
-func (p iByteClass) FindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return findAtNoState(p, prefilterState, bytes, i)
-}
-
-func (p iByteClass) Repr() *iRepr {
- return p.repr
-}
-
-func (p iByteClass) MatchKind() *matchKind {
- return &p.repr.match_kind
-}
-
-func (p iByteClass) Anchored() bool {
- return p.repr.anchored
-}
-
-func (p iByteClass) Prefilter() prefilter {
- return p.repr.prefilter
-}
-
-func (p iByteClass) StartState() stateID {
- return p.repr.start_id
-}
-
-func (b iByteClass) IsValid(id stateID) bool {
- return int(id) < b.repr.state_count
-}
-
-func (b iByteClass) IsMatchState(id stateID) bool {
- return b.repr.isMatchState(id)
-}
-
-func (b iByteClass) IsMatchOrDeadState(id stateID) bool {
- return b.repr.isMatchStateOrDeadState(id)
-}
-
-func (b iByteClass) GetMatch(id stateID, i int, i2 int) *Match {
- return b.repr.GetMatch(id, i, i2)
-}
-
-func (b iByteClass) MatchCount(id stateID) int {
- return b.repr.MatchCount(id)
-}
-
-func (b iByteClass) NextState(id stateID, b2 byte) stateID {
- alphabet_len := b.repr.byte_classes.alphabetLen()
- input := b.repr.byte_classes.bytes[b2]
- o := int(id)*alphabet_len + int(input)
- return b.repr.trans[o]
-}
-
-func (p iByteClass) NextStateNoFail(id stateID, b byte) stateID {
- next := p.NextState(id, b)
- if next == failedStateID {
- panic("automaton should never return fail_id for next state")
- }
- return next
-}
-
-func (p iByteClass) StandardFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return standardFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iByteClass) StandardFindAtImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return standardFindAtImp(&p, prefilterState, prefilter, bytes, i, id)
-}
-
-func (p iByteClass) LeftmostFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iByteClass) LeftmostFindAtImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAtImp(&p, prefilterState, prefilter, bytes, i, id)
-}
-
-func (p iByteClass) LeftmostFindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return leftmostFindAtNoState(&p, prefilterState, bytes, i)
-}
-
-func (p iByteClass) LeftmostFindAtNoStateImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int) *Match {
- return leftmostFindAtNoStateImp(&p, prefilterState, prefilter, bytes, i)
-}
-
-func (p iByteClass) OverlappingFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID, i2 *int) *Match {
- return overlappingFindAt(&p, prefilterState, bytes, i, id, i2)
-}
-
-func (p iByteClass) EarliestFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return earliestFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iByteClass) FindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return findAt(&p, prefilterState, bytes, i, id)
-}
-
-type iPremultipliedByteClass struct {
- repr *iRepr
-}
-
-func (p iPremultipliedByteClass) FindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return findAtNoState(p, prefilterState, bytes, i)
-}
-
-func (p iPremultipliedByteClass) Repr() *iRepr {
- return p.repr
-}
-
-func (p iPremultipliedByteClass) MatchKind() *matchKind {
- return &p.repr.match_kind
-}
-
-func (p iPremultipliedByteClass) Anchored() bool {
- return p.repr.anchored
-}
-
-func (p iPremultipliedByteClass) Prefilter() prefilter {
- return p.repr.prefilter
-}
-
-func (p iPremultipliedByteClass) StartState() stateID {
- return p.repr.start_id
-}
-
-func (p iPremultipliedByteClass) IsValid(id stateID) bool {
- return (int(id) / p.repr.alphabetLen()) < p.repr.state_count
-}
-
-func (p iPremultipliedByteClass) IsMatchState(id stateID) bool {
- return p.repr.isMatchState(id)
-}
-
-func (p iPremultipliedByteClass) IsMatchOrDeadState(id stateID) bool {
- return p.repr.isMatchStateOrDeadState(id)
-}
-
-func (p iPremultipliedByteClass) GetMatch(id stateID, match_index int, end int) *Match {
- if id > p.repr.max_match {
- return nil
- }
-
- m := p.repr.matches[int(id)/p.repr.alphabetLen()][match_index]
- return &Match{
- pattern: m.PatternID,
- len: m.PatternLength,
- end: end,
- }
-}
-
-func (p iPremultipliedByteClass) MatchCount(id stateID) int {
- o := int(id) / p.repr.alphabetLen()
- return len(p.repr.matches[o])
-}
-
-func (p iPremultipliedByteClass) NextState(id stateID, b byte) stateID {
- input := p.repr.byte_classes.bytes[b]
- o := int(id) + int(input)
- return p.repr.trans[o]
-}
-
-//todo this leaks garbage
-func (p iPremultipliedByteClass) NextStateNoFail(id stateID, b byte) stateID {
- next := p.NextState(id, b)
- if next == failedStateID {
- panic("automaton should never return fail_id for next state")
- }
- return next
-}
-
-func (p iPremultipliedByteClass) StandardFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return standardFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iPremultipliedByteClass) StandardFindAtImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return standardFindAtImp(&p, prefilterState, prefilter, bytes, i, id)
-}
-
-func (p iPremultipliedByteClass) LeftmostFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iPremultipliedByteClass) LeftmostFindAtImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAtImp(&p, prefilterState, prefilter, bytes, i, id)
-}
-
-func (p iPremultipliedByteClass) LeftmostFindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return leftmostFindAtNoState(&p, prefilterState, bytes, i)
-}
-
-func (p iPremultipliedByteClass) LeftmostFindAtNoStateImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int) *Match {
- return leftmostFindAtNoStateImp(&p, prefilterState, prefilter, bytes, i)
-}
-
-func (p iPremultipliedByteClass) OverlappingFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID, i2 *int) *Match {
- return overlappingFindAt(&p, prefilterState, bytes, i, id, i2)
-}
-
-func (p iPremultipliedByteClass) EarliestFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return earliestFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iPremultipliedByteClass) FindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return findAt(&p, prefilterState, bytes, i, id)
-}
-
-type iPremultiplied struct {
- repr iRepr
-}
-
-func (p iPremultiplied) FindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return findAtNoState(p, prefilterState, bytes, i)
-}
-
-func (p iPremultiplied) Repr() *iRepr {
- return &p.repr
-}
-
-func (p iPremultiplied) MatchKind() *matchKind {
- return &p.repr.match_kind
-}
-
-func (p iPremultiplied) Anchored() bool {
- return p.repr.anchored
-}
-
-func (p iPremultiplied) Prefilter() prefilter {
- return p.repr.prefilter
-}
-
-func (p iPremultiplied) StartState() stateID {
- return p.repr.start_id
-}
-
-func (p iPremultiplied) IsValid(id stateID) bool {
- return int(id)/256 < p.repr.state_count
-}
-
-func (p iPremultiplied) IsMatchState(id stateID) bool {
- return p.repr.isMatchState(id)
-}
-
-func (p iPremultiplied) IsMatchOrDeadState(id stateID) bool {
- return p.repr.isMatchStateOrDeadState(id)
-}
-
-func (p iPremultiplied) GetMatch(id stateID, match_index int, end int) *Match {
- if id > p.repr.max_match {
- return nil
- }
- m := p.repr.matches[int(id)/256][match_index]
- return &Match{
- pattern: m.PatternID,
- len: m.PatternLength,
- end: end,
- }
-}
-
-func (p iPremultiplied) MatchCount(id stateID) int {
- return len(p.repr.matches[int(id)/256])
-}
-
-func (p iPremultiplied) NextState(id stateID, b byte) stateID {
- o := int(id) + int(b)
- return p.repr.trans[o]
-}
-
-func (p iPremultiplied) NextStateNoFail(id stateID, b byte) stateID {
- next := p.NextState(id, b)
- if next == failedStateID {
- panic("automaton should never return fail_id for next state")
- }
- return next
-}
-
-func (p iPremultiplied) StandardFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return standardFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iPremultiplied) StandardFindAtImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return standardFindAtImp(&p, prefilterState, prefilter, bytes, i, id)
-}
-
-func (p iPremultiplied) LeftmostFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iPremultiplied) LeftmostFindAtImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAtImp(&p, prefilterState, prefilter, bytes, i, id)
-}
-
-func (p iPremultiplied) LeftmostFindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return leftmostFindAtNoState(&p, prefilterState, bytes, i)
-}
-
-func (p iPremultiplied) LeftmostFindAtNoStateImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int) *Match {
- return leftmostFindAtNoStateImp(&p, prefilterState, prefilter, bytes, i)
-}
-
-func (p iPremultiplied) OverlappingFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID, i2 *int) *Match {
- return overlappingFindAt(&p, prefilterState, bytes, i, id, i2)
-}
-
-func (p iPremultiplied) EarliestFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return earliestFindAt(&p, prefilterState, bytes, i, id)
-}
-
-func (p iPremultiplied) FindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return findAt(&p, prefilterState, bytes, i, id)
-}
-
-func nfaNextStateMemoized(nfa *iNFA, dfa *iRepr, populating stateID, current stateID, input byte) stateID {
- for {
- if current < populating {
- return dfa.nextState(current, input)
- }
-
- next := nfa.states[current].nextState(input)
-
- if next != failedStateID {
- return next
- }
- current = nfa.states[current].fail
- }
-}
-
-func newDFABuilder() *iDFABuilder {
- return &iDFABuilder{
- premultiply: true,
- byte_classes: true,
- }
-}
-
-type iStandard struct {
- repr iRepr
-}
-
-func (p iStandard) FindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return findAtNoState(&p, prefilterState, bytes, i)
-}
-
-func (p iStandard) Repr() *iRepr {
- return &p.repr
-}
-
-func (s *iStandard) MatchKind() *matchKind {
- return &s.repr.match_kind
-}
-
-func (s *iStandard) Anchored() bool {
- return s.repr.anchored
-}
-
-func (s *iStandard) Prefilter() prefilter {
- return s.repr.prefilter
-}
-
-func (s *iStandard) StartState() stateID {
- return s.repr.start_id
-}
-
-func (s *iStandard) IsValid(id stateID) bool {
- return int(id) < s.repr.state_count
-}
-
-func (s *iStandard) IsMatchState(id stateID) bool {
- return s.repr.isMatchState(id)
-}
-
-func (s *iStandard) IsMatchOrDeadState(id stateID) bool {
- return s.repr.isMatchStateOrDeadState(id)
-}
-
-func (s *iStandard) GetMatch(id stateID, match_index int, end int) *Match {
- return s.repr.GetMatch(id, match_index, end)
-}
-
-func (s *iStandard) MatchCount(id stateID) int {
- return s.repr.MatchCount(id)
-}
-
-func (s *iStandard) NextState(current stateID, input byte) stateID {
- o := int(current)*256 + int(input)
- return s.repr.trans[o]
-}
-
-func (s *iStandard) NextStateNoFail(id stateID, b byte) stateID {
- next := s.NextState(id, b)
- if next == failedStateID {
- panic("automaton should never return fail_id for next state")
- }
- return next
-}
-
-func (s *iStandard) StandardFindAt(state *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return standardFindAt(s, state, bytes, i, id)
-}
-
-func (s *iStandard) StandardFindAtImp(state *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return standardFindAtImp(s, state, prefilter, bytes, i, id)
-}
-
-func (s *iStandard) LeftmostFindAt(state *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAt(s, state, bytes, i, id)
-}
-
-func (s *iStandard) LeftmostFindAtImp(state *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAtImp(s, state, prefilter, bytes, i, id)
-}
-
-func (s *iStandard) LeftmostFindAtNoState(state *prefilterState, bytes []byte, i int) *Match {
- return leftmostFindAtNoState(s, state, bytes, i)
-}
-
-func (s *iStandard) LeftmostFindAtNoStateImp(state *prefilterState, prefilter prefilter, bytes []byte, i int) *Match {
- return leftmostFindAtNoStateImp(s, state, prefilter, bytes, i)
-}
-
-func (s *iStandard) OverlappingFindAt(state *prefilterState, bytes []byte, i int, id *stateID, i2 *int) *Match {
- return overlappingFindAt(s, state, bytes, i, id, i2)
-}
-
-func (s *iStandard) EarliestFindAt(state *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return earliestFindAt(s, state, bytes, i, id)
-}
-
-func (s *iStandard) FindAt(state *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return findAt(s, state, bytes, i, id)
-}
-
-type iRepr struct {
- match_kind matchKind
- anchored bool
- premultiplied bool
- start_id stateID
- max_pattern_len int
- pattern_count int
- state_count int
- max_match stateID
- heap_bytes int
- prefilter prefilter
- byte_classes byteClasses
- trans []stateID
- matches [][]pattern
-}
-
-func (r *iRepr) premultiply() {
- if r.premultiplied || r.state_count <= 1 {
- return
- }
- alpha_len := r.alphabetLen()
-
- for id := 2; id < r.state_count; id++ {
- offset := id * alpha_len
- slice := r.trans[offset : offset+alpha_len]
- for i := range slice {
- if slice[i] == deadStateID {
- continue
- }
- slice[i] = stateID(int(slice[i]) * alpha_len)
- }
- }
- r.premultiplied = true
- r.start_id = stateID(int(r.start_id) * alpha_len)
- r.max_match = stateID(int(r.max_match) * alpha_len)
-}
-
-func (r *iRepr) setNextState(from stateID, b byte, to stateID) {
- alphabet_len := r.alphabetLen()
- b = r.byte_classes.bytes[b]
- r.trans[int(from)*alphabet_len+int(b)] = to
-}
-
-func (r *iRepr) alphabetLen() int {
- return r.byte_classes.alphabetLen()
-}
-
-func (r *iRepr) nextState(from stateID, b byte) stateID {
- alphabet_len := r.alphabetLen()
- b = r.byte_classes.bytes[b]
- return r.trans[int(from)*alphabet_len+int(b)]
-}
-
-func (r *iRepr) isMatchState(id stateID) bool {
- return id <= r.max_match && id > deadStateID
-}
-
-func (r *iRepr) isMatchStateOrDeadState(id stateID) bool {
- return id <= r.max_match
-}
-
-func (r *iRepr) GetMatch(id stateID, match_index int, end int) *Match {
- i := int(id)
- if id > r.max_match {
- return nil
- }
- if i > len(r.matches) {
- return nil
- }
- matches := r.matches[int(id)]
- if match_index > len(matches) {
- return nil
- }
- pattern := matches[match_index]
-
- return &Match{
- pattern: pattern.PatternID,
- len: pattern.PatternLength,
- end: end,
- }
-}
-
-func (r *iRepr) MatchCount(id stateID) int {
- return len(r.matches[id])
-}
-
-func (r *iRepr) swapStates(id1 stateID, id2 stateID) {
- if r.premultiplied {
- panic("cannot shuffle match states of premultiplied iDFA")
- }
-
- o1 := int(id1) * r.alphabetLen()
- o2 := int(id2) * r.alphabetLen()
-
- for b := 0; b < r.alphabetLen(); b++ {
- r.trans[o1+b], r.trans[o2+b] = r.trans[o2+b], r.trans[o1+b]
- }
- r.matches[int(id1)], r.matches[int(id2)] = r.matches[int(id2)], r.matches[int(id1)]
-}
-
-func (r *iRepr) calculateSize() {
- intSize := int(unsafe.Sizeof(stateID(1)))
- size := (len(r.trans) * intSize) + (len(r.matches) * (intSize * 3))
-
- for _, state_matches := range r.matches {
- size += len(state_matches) * (intSize * 2)
- }
- var hb int
- if r.prefilter != nil {
- hb = r.prefilter.HeapBytes()
- }
- size += hb
- r.heap_bytes = size
-}
-
-func (r *iRepr) shuffleMatchStates() {
- if r.premultiplied {
- panic("cannot shuffle match states of premultiplied iDFA")
- }
-
- if r.state_count <= 1 {
- return
- }
-
- first_non_match := int(r.start_id)
- for first_non_match < r.state_count && len(r.matches[first_non_match]) > 0 {
- first_non_match += 1
- }
- swaps := make([]stateID, r.state_count)
-
- for i := range swaps {
- swaps[i] = failedStateID
- }
-
- cur := r.state_count - 1
-
- for cur > first_non_match {
- if len(r.matches[cur]) > 0 {
- r.swapStates(stateID(cur), stateID(first_non_match))
- swaps[cur] = stateID(first_non_match)
- swaps[first_non_match] = stateID(cur)
-
- first_non_match += 1
- for first_non_match < cur && len(r.matches[first_non_match]) > 0 {
- first_non_match += 1
- }
- }
- cur -= 1
- }
-
- for id := 0; id < r.state_count; id++ {
- alphabet_len := r.alphabetLen()
- offset := id * alphabet_len
-
- slice := r.trans[offset : offset+alphabet_len]
-
- for i := range slice {
- if swaps[slice[i]] != failedStateID {
- slice[i] = swaps[slice[i]]
- }
- }
- }
-
- if swaps[r.start_id] != failedStateID {
- r.start_id = swaps[r.start_id]
- }
- r.max_match = stateID(first_non_match - 1)
-}
-
-type pattern struct {
- PatternID int
- PatternLength int
-}
diff --git a/vendor/github.com/petar-dambovaliev/aho-corasick/nfa.go b/vendor/github.com/petar-dambovaliev/aho-corasick/nfa.go
deleted file mode 100644
index c111ade0d..000000000
--- a/vendor/github.com/petar-dambovaliev/aho-corasick/nfa.go
+++ /dev/null
@@ -1,830 +0,0 @@
-package aho_corasick
-
-import (
- "sort"
- "unsafe"
-)
-
-type iNFA struct {
- matchKind matchKind
- startID stateID
- maxPatternLen int
- patternCount int
- heapBytes int
- prefil prefilter
- anchored bool
- byteClasses byteClasses
- states []state
-}
-
-func (n *iNFA) FindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return findAtNoState(n, prefilterState, bytes, i)
-}
-
-func (n *iNFA) Repr() *iRepr {
- return nil
-}
-
-func (n *iNFA) MatchKind() *matchKind {
- return &n.matchKind
-}
-
-func (n *iNFA) Anchored() bool {
- return n.anchored
-}
-
-func (n *iNFA) Prefilter() prefilter {
- return n.prefil
-}
-
-func (n *iNFA) StartState() stateID {
- return n.startID
-}
-
-func (n *iNFA) IsValid(id stateID) bool {
- return int(id) < len(n.states)
-}
-
-func (n *iNFA) IsMatchState(id stateID) bool {
- return n.state(id).isMatch()
-}
-
-func (n *iNFA) IsMatchOrDeadState(id stateID) bool {
- return isMatchOrDeadState(n, id)
-}
-
-func (n *iNFA) MatchCount(id stateID) int {
- return len(n.states[id].matches)
-}
-
-func (n *iNFA) NextState(id stateID, b byte) stateID {
- for {
- state := n.states[id]
- next := state.nextState(b)
- if next != failedStateID {
- return next
- }
- id = state.fail
- }
-}
-
-func (n *iNFA) NextStateNoFail(id stateID, b byte) stateID {
- next := n.NextState(id, b)
- if next == failedStateID {
- panic("automaton should never return fail_id for next state")
- }
- return next
-}
-
-func (n *iNFA) StandardFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return standardFindAt(n, prefilterState, bytes, i, id)
-}
-
-func (n *iNFA) StandardFindAtImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return standardFindAtImp(n, prefilterState, prefilter, bytes, i, id)
-}
-
-func (n *iNFA) LeftmostFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAt(n, prefilterState, bytes, i, id)
-}
-
-func (n *iNFA) LeftmostFindAtImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int, id *stateID) *Match {
- return leftmostFindAtImp(n, prefilterState, prefilter, bytes, i, id)
-}
-
-func (n *iNFA) LeftmostFindAtNoState(prefilterState *prefilterState, bytes []byte, i int) *Match {
- return leftmostFindAtNoState(n, prefilterState, bytes, i)
-}
-
-func (n *iNFA) LeftmostFindAtNoStateImp(prefilterState *prefilterState, prefilter prefilter, bytes []byte, i int) *Match {
- return leftmostFindAtNoStateImp(n, prefilterState, prefilter, bytes, i)
-}
-
-func (n *iNFA) OverlappingFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID, i2 *int) *Match {
- return overlappingFindAt(n, prefilterState, bytes, i, id, i2)
-}
-
-func (n *iNFA) EarliestFindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return earliestFindAt(n, prefilterState, bytes, i, id)
-}
-
-func (n *iNFA) FindAt(prefilterState *prefilterState, bytes []byte, i int, id *stateID) *Match {
- return findAt(n, prefilterState, bytes, i, id)
-}
-
-func (n *iNFA) MaxPatternLen() int {
- return n.maxPatternLen
-}
-
-func (n *iNFA) PatternCount() int {
- return n.patternCount
-}
-
-func (n *iNFA) UsePrefilter() bool {
- p := n.Prefilter()
- if p == nil {
- return false
- }
- return !p.LooksForNonStartOfMatch()
-}
-
-func (n *iNFA) GetMatch(id stateID, matchIndex int, end int) *Match {
- if int(id) >= len(n.states) {
- return nil
- }
- state := n.states[id]
- if matchIndex >= len(state.matches) {
- return nil
- }
- pat := state.matches[matchIndex]
- return &Match{
- pattern: pat.PatternID,
- len: pat.PatternLength,
- end: end,
- }
-}
-
-func (n *iNFA) addDenseState(depth int) stateID {
- d := newDense()
- trans := transitions{dense: &d}
- id := stateID(len(n.states))
-
- fail := n.startID
-
- if n.anchored {
- fail = deadStateID
- }
-
- n.states = append(n.states, state{
- trans: trans,
- fail: fail,
- matches: nil,
- depth: depth,
- })
- return id
-}
-
-func (n *iNFA) addSparseState(depth int) stateID {
- trans := transitions{sparse: &sparse{inner: nil}}
- id := stateID(len(n.states))
-
- fail := n.startID
-
- if n.anchored {
- fail = deadStateID
- }
-
- n.states = append(n.states, state{
- trans: trans,
- fail: fail,
- matches: nil,
- depth: depth,
- })
- return id
-}
-
-func (n *iNFA) state(id stateID) *state {
- return &n.states[int(id)]
-}
-
-type compiler struct {
- builder iNFABuilder
- prefilter prefilterBuilder
- nfa iNFA
- byteclassBuilder byteClassBuilder
-}
-
-func (c *compiler) compile(patterns [][]byte) *iNFA {
- c.addState(0)
- c.addState(0)
- c.addState(0)
-
- c.buildTrie(patterns)
-
- c.addStartStateLoop()
- c.addDeadStateLoop()
-
- if !c.builder.anchored {
- if c.builder.matchKind.isLeftmost() {
- c.fillFailureTransitionsLeftmost()
- } else {
- c.fillFailureTransitionsStandard()
- }
- }
- c.closeStartStateLoop()
-
- c.nfa.byteClasses = c.byteclassBuilder.build()
- if !c.builder.anchored {
- c.nfa.prefil = c.prefilter.build()
- }
- c.calculateSize()
-
- return &c.nfa
-}
-
-func (c *compiler) calculateSize() {
- var size int
- for _, state := range c.nfa.states {
- size += state.heapBytes()
- }
-
- c.nfa.heapBytes = size
-}
-
-func (c *compiler) closeStartStateLoop() {
- if c.builder.anchored || (c.builder.matchKind.isLeftmost() && c.nfa.state(c.nfa.startID).isMatch()) {
- startId := c.nfa.startID
- start := c.nfa.state(startId)
-
- for b := 0; b < 256; b++ {
- if start.nextState(byte(b)) == startId {
- start.setNextState(byte(b), deadStateID)
- }
- }
- }
-}
-
-type queuedState struct {
- id stateID
- matchAtDepth *int
-}
-
-func startQueuedState(nfa *iNFA) queuedState {
- var matchAtDepth *int
- if nfa.states[nfa.startID].isMatch() {
- r := 0
- matchAtDepth = &r
- }
- return queuedState{id: nfa.startID, matchAtDepth: matchAtDepth}
-}
-
-func (q *queuedState) nextQueuedState(nfa *iNFA, id stateID) queuedState {
- nextMatchAtDepth := q.nextMatchAtDepth(nfa, id)
- return queuedState{id, nextMatchAtDepth}
-}
-
-func (q *queuedState) nextMatchAtDepth(
- nfa *iNFA,
- next stateID,
-) *int {
- switch q.matchAtDepth {
- case nil:
- if !nfa.state(next).isMatch() {
- return nil
- }
- default:
- return q.matchAtDepth
- }
-
- depth := nfa.state(next).depth - *nfa.state(next).getLongestMatch() + 1
- return &depth
-}
-
-func (c *compiler) fillFailureTransitionsStandard() {
- queue := make([]stateID, 0)
- seen := c.queuedSet()
-
- for b := 0; b < 256; b++ {
- next := c.nfa.state(c.nfa.startID).nextState(byte(b))
- if next != c.nfa.startID {
- if !seen.contains(next) {
- queue = append(queue, next)
- seen.insert(next)
- }
- }
- }
-
- for len(queue) > 0 {
- id := queue[0]
- queue = queue[1:]
- it := newIterTransitions(&c.nfa, id)
-
- for next := it.next(); next != nil; next = it.next() {
- if seen.contains(next.id) {
- continue
- }
- queue = append(queue, next.id)
- seen.insert(next.id)
-
- fail := it.nfa.state(id).fail
- for it.nfa.state(fail).nextState(next.key) == failedStateID {
- fail = it.nfa.state(fail).fail
- }
- fail = it.nfa.state(fail).nextState(next.key)
- it.nfa.state(next.id).fail = fail
- it.nfa.copyMatches(fail, next.id)
- }
- it.nfa.copyEmptyMatches(id)
- }
-}
-
-func (c *compiler) fillFailureTransitionsLeftmost() {
- queue := make([]queuedState, 0)
- seen := c.queuedSet()
- start := startQueuedState(&c.nfa)
-
- for b := 0; b < 256; b++ {
- nextId := c.nfa.state(c.nfa.startID).nextState(byte(b))
- if nextId != start.id {
- next := start.nextQueuedState(&c.nfa, nextId)
- if !seen.contains(next.id) {
- queue = append(queue, next)
- seen.insert(next.id)
- }
- if c.nfa.state(nextId).isMatch() {
- c.nfa.state(nextId).fail = deadStateID
- }
- }
- }
-
- for len(queue) > 0 {
- item := queue[0]
- queue = queue[1:]
- anyTrans := false
- it := newIterTransitions(&c.nfa, item.id)
- tr := it.next()
- for tr != nil {
- anyTrans = true
- next := item.nextQueuedState(it.nfa, tr.id)
- if seen.contains(next.id) {
- tr = it.next()
- continue
- }
- queue = append(queue, next)
- seen.insert(next.id)
-
- fail := it.nfa.state(item.id).fail
- for it.nfa.state(fail).nextState(tr.key) == failedStateID {
- fail = it.nfa.state(fail).fail
- }
- fail = it.nfa.state(fail).nextState(tr.key)
-
- if next.matchAtDepth != nil {
- failDepth := it.nfa.state(fail).depth
- nextDepth := it.nfa.state(next.id).depth
- if nextDepth-*next.matchAtDepth+1 > failDepth {
- it.nfa.state(next.id).fail = deadStateID
- tr = it.next()
- continue
- }
-
- if start.id == it.nfa.state(next.id).fail {
- panic("states that are match states or follow match states should never have a failure transition back to the start state in leftmost searching")
- }
- }
- it.nfa.state(next.id).fail = fail
- it.nfa.copyMatches(fail, next.id)
- tr = it.next()
- }
- if !anyTrans && it.nfa.state(item.id).isMatch() {
- it.nfa.state(item.id).fail = deadStateID
- }
- }
-}
-
-func (n *iNFA) copyEmptyMatches(dst stateID) {
- n.copyMatches(n.startID, dst)
-}
-
-func (n *iNFA) copyMatches(src stateID, dst stateID) {
- srcState, dstState := n.getTwo(src, dst)
- dstState.matches = append(dstState.matches, srcState.matches...)
-}
-
-func (n *iNFA) getTwo(i stateID, j stateID) (*state, *state) {
- if i == j {
- panic("src and dst should not be equal")
- }
-
- if i < j {
- before, after := n.states[0:j], n.states[j:]
- return &before[i], &after[0]
- }
-
- before, after := n.states[0:i], n.states[i:]
- return &after[0], &before[j]
-}
-
-func (n *iNFA) iterAllTransitions(byteClasses *byteClasses, id stateID, f func(tr *next)) {
- n.states[id].trans.iterAll(byteClasses, f)
-}
-
-func newIterTransitions(nfa *iNFA, stateId stateID) iterTransitions {
- return iterTransitions{
- nfa: nfa,
- stateId: stateId,
- cur: 0,
- }
-}
-
-type iterTransitions struct {
- nfa *iNFA
- stateId stateID
- cur int
-}
-
-type next struct {
- key byte
- id stateID
-}
-
-func (i *iterTransitions) next() *next {
- sparse := i.nfa.states[int(i.stateId)].trans.sparse
- if sparse != nil {
- if i.cur >= len(sparse.inner) {
- return nil
- }
- ii := i.cur
- i.cur += 1
- return &next{
- key: sparse.inner[ii].b,
- id: sparse.inner[ii].s,
- }
- }
-
- dense := i.nfa.states[int(i.stateId)].trans.dense
- for i.cur < len(dense.inner) {
- if i.cur >= 256 {
- panic("There are always exactly 255 transitions in dense repr")
- }
-
- b := byte(i.cur)
- id := dense.inner[b]
- i.cur += 1
- if id != failedStateID {
- return &next{
- key: b,
- id: id,
- }
- }
- }
- return nil
-}
-
-type queuedSet struct {
- set map[stateID]struct{}
- ind int
-}
-
-func newInertQueuedSet() queuedSet {
- return queuedSet{
- set: make(map[stateID]struct{}),
- ind: 0,
- }
-}
-
-func (q *queuedSet) contains(s stateID) bool {
- _, ok := q.set[s]
- return ok
-}
-
-func (q *queuedSet) insert(s stateID) {
- q.set[s] = struct{}{}
-}
-
-func newActiveQueuedSet() queuedSet {
- return queuedSet{
- set: make(map[stateID]struct{}, 0),
- ind: 0,
- }
-}
-
-func (c *compiler) queuedSet() queuedSet {
- if c.builder.asciiCaseInsensitive {
- return newActiveQueuedSet()
- }
- return newInertQueuedSet()
-}
-
-func (c *compiler) addStartStateLoop() {
- startId := c.nfa.startID
- start := c.nfa.state(startId)
- for b := 0; b < 256; b++ {
- if start.nextState(byte(b)) == failedStateID {
- start.setNextState(byte(b), startId)
- }
- }
-}
-
-func (c *compiler) addDeadStateLoop() {
- dead := c.nfa.state(deadStateID)
- for b := 0; b < 256; b++ {
- dead.setNextState(byte(b), deadStateID)
- }
-}
-
-func max(a, b int) int {
- if a > b {
- return a
- }
- return b
-}
-
-func (c *compiler) buildTrie(patterns [][]byte) {
-
-Patterns:
- for pati, pat := range patterns {
- c.nfa.maxPatternLen = max(c.nfa.maxPatternLen, len(pat))
- c.nfa.patternCount += 1
-
- prev := c.nfa.startID
- sawMatch := false
-
- for depth, b := range pat {
- sawMatch = sawMatch || c.nfa.state(prev).isMatch()
- if c.builder.matchKind.isLeftmostFirst() && sawMatch {
- continue Patterns
- }
-
- c.byteclassBuilder.setRange(b, b)
-
- if c.builder.asciiCaseInsensitive {
- b := oppositeAsciiCase(b)
- c.byteclassBuilder.setRange(b, b)
- }
-
- next := c.nfa.state(prev).nextState(b)
-
- if next != failedStateID {
- prev = next
- } else {
- next := c.addState(depth + 1)
- c.nfa.state(prev).setNextState(b, next)
- if c.builder.asciiCaseInsensitive {
- b := oppositeAsciiCase(b)
- c.nfa.state(prev).setNextState(b, next)
- }
- prev = next
- }
- }
- c.nfa.state(prev).addMatch(pati, len(pat))
-
- if c.builder.prefilter {
- c.prefilter.add(pat)
- }
- }
-}
-
-const asciiCaseMask byte = 0b0010_0000
-
-func toAsciiLowercase(b byte) byte {
- return b | (1 * asciiCaseMask)
-}
-
-func toAsciiUpper(b byte) byte {
- b &= ^(1 * asciiCaseMask)
- return b
-}
-
-func oppositeAsciiCase(b byte) byte {
- if 'A' <= b && b <= 'Z' {
- return toAsciiLowercase(b)
- } else if 'a' <= b && b <= 'z' {
- return toAsciiUpper(b)
- }
- return b
-}
-
-func (c *compiler) addState(depth int) stateID {
- if depth < c.builder.denseDepth {
- return c.nfa.addDenseState(depth)
-
- }
- return c.nfa.addSparseState(depth)
-}
-
-func newCompiler(builder iNFABuilder) compiler {
- p := newPrefilterBuilder(builder.asciiCaseInsensitive)
-
- return compiler{
- builder: builder,
- prefilter: p,
- nfa: iNFA{
- matchKind: builder.matchKind,
- startID: 2,
- maxPatternLen: 0,
- patternCount: 0,
- heapBytes: 0,
- prefil: nil,
- anchored: builder.anchored,
- byteClasses: singletons(),
- states: nil,
- },
- byteclassBuilder: newByteClassBuilder(),
- }
-}
-
-type iNFABuilder struct {
- denseDepth int
- matchKind matchKind
- prefilter bool
- anchored bool
- asciiCaseInsensitive bool
-}
-
-func newNFABuilder(kind matchKind, asciiCaseInsensitive bool) *iNFABuilder {
- return &iNFABuilder{
- denseDepth: 2,
- matchKind: kind,
- prefilter: true,
- anchored: false,
- asciiCaseInsensitive: asciiCaseInsensitive,
- }
-}
-
-func (b *iNFABuilder) build(patterns [][]byte) *iNFA {
- c := newCompiler(*b)
- return c.compile(patterns)
-}
-
-type state struct {
- trans transitions
- fail stateID
- matches []pattern
- depth int
-}
-
-func (s *state) heapBytes() int {
- var i int
- intSize := int(unsafe.Sizeof(i))
- return s.trans.heapBytes() + (len(s.matches) * (intSize * 2))
-}
-
-func (s *state) addMatch(patternID, patternLength int) {
- s.matches = append(s.matches, pattern{
- PatternID: patternID,
- PatternLength: patternLength,
- })
-}
-
-func (s *state) isMatch() bool {
- return len(s.matches) > 0
-}
-
-func (s *state) getLongestMatch() *int {
- if len(s.matches) == 0 {
- return nil
- }
- longest := s.matches[0].PatternLength
- return &longest
-}
-
-func (s *state) nextState(input byte) stateID {
- return s.trans.nextState(input)
-}
-
-func (s *state) setNextState(input byte, next stateID) {
- s.trans.setNextState(input, next)
-}
-
-type transitions struct {
- sparse *sparse
- dense *dense
-}
-
-func sparseIter(trans []innerSparse, f func(*next)) {
- var byte16 uint16
-
- for _, tr := range trans {
- for byte16 < uint16(tr.b) {
- f(&next{
- key: byte(byte16),
- id: failedStateID,
- })
- byte16 += 1
- }
- f(&next{
- key: tr.b,
- id: tr.s,
- })
- byte16 += 1
- }
-
- for b := byte16; b < 256; b++ {
- f(&next{
- key: byte(b),
- id: failedStateID,
- })
- }
-}
-
-func (t *transitions) iterAll(byteClasses *byteClasses, f func(tr *next)) {
- if byteClasses.isSingleton() {
- if t.sparse != nil {
- sparseIter(t.sparse.inner, f)
- }
-
- if t.dense != nil {
- for b := 0; b < 256; b++ {
- f(&next{
- key: byte(b),
- id: t.dense.inner[b],
- })
- }
- }
- } else {
- if t.sparse != nil {
- var lastClass *byte
-
- sparseIter(t.sparse.inner, func(n *next) {
- class := byteClasses.bytes[n.key]
-
- if lastClass == nil || *lastClass != class {
- cc := class
- lastClass = &cc
- f(n)
- }
- })
- }
-
- if t.dense != nil {
- bcr := byteClassRepresentatives{
- classes: byteClasses,
- bbyte: 0,
- lastClass: nil,
- }
-
- for n := bcr.next(); n != nil; n = bcr.next() {
- f(&next{
- key: *n,
- id: t.dense.inner[*n],
- })
- }
- }
- }
-
-}
-
-func (t *transitions) heapBytes() int {
- var i int
- intSize := int(unsafe.Sizeof(i))
- if t.sparse != nil {
- return len(t.sparse.inner) * (2 * intSize)
- }
- return len(t.dense.inner) * intSize
-}
-
-func (t *transitions) nextState(input byte) stateID {
- if t.sparse != nil {
- for _, sp := range t.sparse.inner {
- if sp.b == input {
- return sp.s
- }
- }
- return failedStateID
- }
- return t.dense.inner[input]
-}
-
-func (t *transitions) setNextState(input byte, next stateID) {
- if t.sparse != nil {
- idx := sort.Search(len(t.sparse.inner), func(i int) bool {
- return t.sparse.inner[i].b >= input
- })
-
- if idx < len(t.sparse.inner) && t.sparse.inner[idx].b == input {
- t.sparse.inner[idx].s = next
- } else {
- if len(t.sparse.inner) > 0 {
- is := innerSparse{
- b: input,
- s: next,
- }
- if idx == len(t.sparse.inner) {
- t.sparse.inner = append(t.sparse.inner, is)
- } else {
- t.sparse.inner = append(
- t.sparse.inner[:idx+1],
- t.sparse.inner[idx:]...)
- t.sparse.inner[idx] = is
- }
- } else {
- t.sparse.inner = []innerSparse{
- {
- b: input,
- s: next,
- },
- }
- }
- }
- return
- }
- t.dense.inner[int(input)] = next
-}
-
-func newDense() dense {
- return dense{inner: make([]stateID, 256)}
-}
-
-type dense struct {
- inner []stateID
-}
-
-type innerSparse struct {
- b byte
- s stateID
-}
-
-type sparse struct {
- inner []innerSparse
-}
diff --git a/vendor/github.com/petar-dambovaliev/aho-corasick/prefilter.go b/vendor/github.com/petar-dambovaliev/aho-corasick/prefilter.go
deleted file mode 100644
index 54fea3228..000000000
--- a/vendor/github.com/petar-dambovaliev/aho-corasick/prefilter.go
+++ /dev/null
@@ -1,601 +0,0 @@
-package aho_corasick
-
-import (
- "math"
-)
-
-type startBytesThree struct {
- byte1 byte
- byte2 byte
- byte3 byte
-}
-
-func (s startBytesThree) NextCandidate(_ *prefilterState, haystack []byte, at int) (interface{}, candidateType) {
- for i, b := range haystack[at:] {
- if s.byte1 == b || s.byte2 == b || s.byte3 == b {
- return at + i, possibleStartOfMatchCandidate
- }
- }
- return nil, noneCandidate
-}
-
-func (s startBytesThree) HeapBytes() int {
- return 0
-}
-
-func (s startBytesThree) ReportsFalsePositives() bool {
- return true
-}
-
-func (s startBytesThree) LooksForNonStartOfMatch() bool {
- return false
-}
-
-func (s *startBytesThree) clone() prefilter {
- if s == nil {
- return nil
- }
- u := *s
- return &u
-}
-
-type startBytesTwo struct {
- byte1 byte
- byte2 byte
-}
-
-func (s startBytesTwo) NextCandidate(_ *prefilterState, haystack []byte, at int) (interface{}, candidateType) {
- for i, b := range haystack[at:] {
- if s.byte1 == b || s.byte2 == b {
- return at + i, possibleStartOfMatchCandidate
- }
- }
- return nil, noneCandidate
-}
-
-func (s startBytesTwo) HeapBytes() int {
- return 0
-}
-
-func (s startBytesTwo) ReportsFalsePositives() bool {
- return true
-}
-
-func (s startBytesTwo) LooksForNonStartOfMatch() bool {
- return false
-}
-
-func (s *startBytesTwo) clone() prefilter {
- if s == nil {
- return nil
- }
- u := *s
- return &u
-}
-
-type startBytesOne struct {
- byte1 byte
-}
-
-func (s startBytesOne) NextCandidate(_ *prefilterState, haystack []byte, at int) (interface{}, candidateType) {
- for i, b := range haystack[at:] {
- if s.byte1 == b {
- return at + i, possibleStartOfMatchCandidate
- }
- }
- return nil, noneCandidate
-}
-
-func (s startBytesOne) HeapBytes() int {
- return 0
-}
-
-func (s startBytesOne) ReportsFalsePositives() bool {
- return true
-}
-
-func (s startBytesOne) LooksForNonStartOfMatch() bool {
- return false
-}
-
-func (s *startBytesOne) clone() prefilter {
- if s == nil {
- return nil
- }
- u := *s
- return &u
-}
-
-type byteSet [256]bool
-
-func (b *byteSet) contains(bb byte) bool {
- return b[int(bb)]
-}
-
-func (b *byteSet) insert(bb byte) bool {
- n := !b.contains(bb)
- b[int(bb)] = true
- return n
-}
-
-type rareByteOffset struct {
- max byte
-}
-
-type rareByteOffsets struct {
- rbo [256]rareByteOffset
-}
-
-func (r *rareByteOffsets) set(b byte, off rareByteOffset) {
- m := byte(max(int(r.rbo[int(b)].max), int(off.max)))
- r.rbo[int(b)].max = m
-}
-
-type prefilterBuilder struct {
- count int
- asciiCaseInsensitive bool
- startBytes startBytesBuilder
- rareBytes rareBytesBuilder
-}
-
-func (p *prefilterBuilder) build() prefilter {
- startBytes := p.startBytes.build()
- rareBytes := p.rareBytes.build()
-
- switch true {
- case startBytes != nil && rareBytes != nil:
- hasFewerBytes := p.startBytes.count < p.rareBytes.count
-
- hasRarerBytes := p.startBytes.rankSum <= p.rareBytes.rankSum+50
- if hasFewerBytes || hasRarerBytes {
- return startBytes
- } else {
- return rareBytes
- }
- case startBytes != nil:
- return startBytes
- case rareBytes != nil:
- return rareBytes
- case p.asciiCaseInsensitive:
- return nil
- default:
- return nil
- }
-}
-
-func (p *prefilterBuilder) add(bytes []byte) {
- p.count += 1
- p.startBytes.add(bytes)
- p.rareBytes.add(bytes)
-}
-
-func newPrefilterBuilder(asciiCaseInsensitive bool) prefilterBuilder {
- return prefilterBuilder{
- count: 0,
- asciiCaseInsensitive: asciiCaseInsensitive,
- startBytes: newStartBytesBuilder(asciiCaseInsensitive),
- rareBytes: newRareBytesBuilder(asciiCaseInsensitive),
- }
-}
-
-type rareBytesBuilder struct {
- asciiCaseInsensitive bool
- rareSet byteSet
- byteOffsets rareByteOffsets
- available bool
- count int
- rankSum uint16
-}
-
-type rareBytesOne struct {
- byte1 byte
- offset rareByteOffset
-}
-
-func (r rareBytesOne) NextCandidate(state *prefilterState, haystack []byte, at int) (interface{}, candidateType) {
- for i, b := range haystack[at:] {
- if r.byte1 == b {
- pos := at + i
- state.lastScanAt = pos
- r := pos - int(r.offset.max)
- if r < 0 {
- r = 0
- }
-
- if at > r {
- r = at
- }
- return r, possibleStartOfMatchCandidate
- }
- }
- return nil, noneCandidate
-}
-
-func (r rareBytesOne) HeapBytes() int {
- return 0
-}
-
-func (r rareBytesOne) ReportsFalsePositives() bool {
- return true
-}
-
-func (r rareBytesOne) LooksForNonStartOfMatch() bool {
- return true
-}
-
-func (r *rareBytesOne) clone() prefilter {
- if r == nil {
- return nil
- }
- u := *r
- return &u
-}
-
-type rareBytesTwo struct {
- offsets rareByteOffsets
- byte1 byte
- byte2 byte
-}
-
-func (r rareBytesTwo) NextCandidate(state *prefilterState, haystack []byte, at int) (interface{}, candidateType) {
- for i, b := range haystack[at:] {
- if r.byte1 == b || r.byte2 == b {
- pos := at + i
- state.updateAt(pos)
- r := pos - int(r.offsets.rbo[haystack[pos]].max)
- if r < 0 {
- r = 0
- }
-
- if at > r {
- r = at
- }
- return r, possibleStartOfMatchCandidate
- }
- }
- return nil, noneCandidate
-}
-
-func (r rareBytesTwo) HeapBytes() int {
- return 0
-}
-
-func (r rareBytesTwo) ReportsFalsePositives() bool {
- return true
-}
-
-func (r rareBytesTwo) LooksForNonStartOfMatch() bool {
- return true
-}
-
-func (r *rareBytesTwo) clone() prefilter {
- if r == nil {
- return nil
- }
- u := *r
- return &u
-}
-
-type rareBytesThree struct {
- offsets rareByteOffsets
- byte1 byte
- byte2 byte
- byte3 byte
-}
-
-func (r rareBytesThree) NextCandidate(state *prefilterState, haystack []byte, at int) (interface{}, candidateType) {
- for i, b := range haystack[at:] {
- if r.byte1 == b || r.byte2 == b || r.byte3 == b {
- pos := at + i
- state.updateAt(pos)
- r := pos - int(r.offsets.rbo[haystack[pos]].max)
- if r < 0 {
- r = 0
- }
-
- if at > r {
- r = at
- }
- return r, possibleStartOfMatchCandidate
- }
- }
- return nil, noneCandidate
-}
-
-func (r rareBytesThree) HeapBytes() int {
- return 0
-}
-
-func (r rareBytesThree) ReportsFalsePositives() bool {
- return true
-}
-
-func (r rareBytesThree) LooksForNonStartOfMatch() bool {
- return true
-}
-
-func (r *rareBytesThree) clone() prefilter {
- if r == nil {
- return nil
- }
- u := *r
- return &u
-}
-
-func (r *rareBytesBuilder) build() prefilter {
- if !r.available || r.count > 3 {
- return nil
- }
- var length int
- bytes := [3]byte{}
-
- for b := 0; b <= 255; b++ {
- if r.rareSet.contains(byte(b)) {
- bytes[length] = byte(b)
- length += 1
- }
- }
-
- switch length {
- case 0:
- return nil
- case 1:
- return &rareBytesOne{
- byte1: bytes[0],
- offset: r.byteOffsets.rbo[bytes[0]],
- }
- case 2:
- return &rareBytesTwo{
- offsets: r.byteOffsets,
- byte1: bytes[0],
- byte2: bytes[1],
- }
- case 3:
- return &rareBytesThree{
- offsets: r.byteOffsets,
- byte1: bytes[0],
- byte2: bytes[1],
- byte3: bytes[2],
- }
- default:
- return nil
- }
-}
-
-func (r *rareBytesBuilder) add(bytes []byte) {
- if !r.available {
- return
- }
-
- if r.count > 3 {
- r.available = false
- return
- }
-
- if len(bytes) >= 256 {
- r.available = false
- return
- }
-
- if len(bytes) == 0 {
- return
- }
-
- rarest1, rarest2 := bytes[0], freqRank(bytes[0])
- found := false
-
- for pos, b := range bytes {
- r.setOffset(pos, b)
- if found {
- continue
- }
- if r.rareSet.contains(b) {
- found = true
- }
- rank := freqRank(b)
- if rank < rarest2 {
- rarest1 = b
- rarest2 = rank
- }
-
- if !found {
- r.addRareByte(rarest1)
- }
- }
-}
-
-func (r *rareBytesBuilder) addRareByte(b byte) {
- r.addOneRareByte(b)
- if r.asciiCaseInsensitive {
- r.addOneRareByte(oppositeAsciiCase(b))
- }
-}
-
-func (r *rareBytesBuilder) addOneRareByte(b byte) {
- if r.rareSet.insert(b) {
- r.count += 1
- r.rankSum += uint16(freqRank(b))
- }
-}
-
-func newRareByteOffset(i int) rareByteOffset {
- if i > math.MaxUint8 {
- return rareByteOffset{max: 0}
- }
- b := byte(i)
- return rareByteOffset{max: b}
-}
-
-func (r *rareBytesBuilder) setOffset(pos int, b byte) {
- offset := newRareByteOffset(pos)
- r.byteOffsets.set(b, offset)
-
- if r.asciiCaseInsensitive {
- r.byteOffsets.set(oppositeAsciiCase(b), offset)
- }
-}
-
-func newRareBytesBuilder(asciiCaseInsensitive bool) rareBytesBuilder {
- return rareBytesBuilder{
- asciiCaseInsensitive: asciiCaseInsensitive,
- rareSet: byteSet{},
- byteOffsets: rareByteOffsets{},
- available: true,
- count: 0,
- rankSum: 0,
- }
-}
-
-type startBytesBuilder struct {
- asciiCaseInsensitive bool
- byteset []bool
- count int
- rankSum uint16
-}
-
-func (s *startBytesBuilder) build() prefilter {
- if s.count > 3 {
- return nil
- }
- var length int
- bytes := [3]byte{}
-
- for b := 0; b < 256; b++ {
- //todo case insensitive is not set in byteset
- if !s.byteset[b] {
- continue
- }
- if b > 0x7F {
- return nil
- }
- bytes[length] = byte(b)
- length += 1
- }
-
- switch length {
- case 0:
- return nil
- case 1:
- return &startBytesOne{byte1: bytes[0]}
- case 2:
- return &startBytesTwo{
- byte1: bytes[0],
- byte2: bytes[1],
- }
- case 3:
- return &startBytesThree{
- byte1: bytes[0],
- byte2: bytes[1],
- byte3: bytes[2],
- }
- default:
- return nil
- }
-}
-
-func (s *startBytesBuilder) add(bytes []byte) {
- if s.count > 3 || len(bytes) == 0 {
- return
- }
-
- b := bytes[0]
-
- s.addOneByte(b)
- if s.asciiCaseInsensitive {
- s.addOneByte(oppositeAsciiCase(b))
- }
-}
-
-func (s *startBytesBuilder) addOneByte(b byte) {
- if !s.byteset[int(b)] {
- s.byteset[int(b)] = true
- s.count += 1
- s.rankSum += uint16(freqRank(b))
- }
-}
-
-func freqRank(b byte) byte {
- return byteFrequencies[int(b)]
-}
-
-func newStartBytesBuilder(asciiCaseInsensitive bool) startBytesBuilder {
- return startBytesBuilder{
- asciiCaseInsensitive: asciiCaseInsensitive,
- byteset: make([]bool, 256),
- count: 0,
- rankSum: 0,
- }
-}
-
-const minSkips int = 40
-const minAvgFactor int = 2
-
-type prefilterState struct {
- skips int
- skipped int
- maxMatchLen int
- inert bool
- lastScanAt int
-}
-
-func (p *prefilterState) updateAt(at int) {
- if at > p.lastScanAt {
- p.lastScanAt = at
- }
-}
-
-func (p *prefilterState) IsEffective(at int) bool {
- if p.inert || at < p.lastScanAt {
- return false
- }
-
- if p.skips < minSkips {
- return true
- }
-
- minAvg := minAvgFactor * p.maxMatchLen
-
- if p.skipped >= minAvg*p.skips {
- return true
- }
-
- p.inert = true
- return false
-}
-
-func (p *prefilterState) updateSkippedBytes(skipped int) {
- p.skips += 1
- p.skipped += skipped
-}
-
-type candidateType uint
-
-const (
- noneCandidate candidateType = iota
- matchCandidate
- possibleStartOfMatchCandidate
-)
-
-type prefilter interface {
- NextCandidate(state *prefilterState, haystack []byte, at int) (interface{}, candidateType)
- HeapBytes() int
- ReportsFalsePositives() bool
- LooksForNonStartOfMatch() bool
- clone() prefilter
-}
-
-func nextPrefilter(state *prefilterState, prefilter prefilter, haystack []byte, at int) (interface{}, candidateType) {
- cand, ttype := prefilter.NextCandidate(state, haystack, at)
-
- switch ttype {
- case noneCandidate:
- state.updateSkippedBytes(len(haystack) - at)
- case matchCandidate:
- m := cand.(*Match)
- state.updateSkippedBytes(m.Start() - at)
- case possibleStartOfMatchCandidate:
- i := cand.(int)
- state.updateSkippedBytes(i - at)
- }
- return cand, ttype
-}
diff --git a/vendor/github.com/pjbgf/sha1cd/Dockerfile.arm b/vendor/github.com/pjbgf/sha1cd/Dockerfile.arm
deleted file mode 100644
index 99761296f..000000000
--- a/vendor/github.com/pjbgf/sha1cd/Dockerfile.arm
+++ /dev/null
@@ -1,23 +0,0 @@
-FROM golang:1.20@sha256:2edf6aab2d57644f3fe7407132a0d1770846867465a39c2083770cf62734b05d
-
-ENV GOOS=linux
-ENV GOARCH=arm
-ENV CGO_ENABLED=1
-ENV CC=arm-linux-gnueabihf-gcc
-ENV PATH="/go/bin/${GOOS}_${GOARCH}:${PATH}"
-ENV PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig
-
-RUN dpkg --add-architecture armhf \
- && apt update \
- && apt install -y --no-install-recommends \
- upx \
- gcc-arm-linux-gnueabihf \
- libc6-dev-armhf-cross \
- pkg-config \
- && rm -rf /var/lib/apt/lists/*
-
-COPY . /src/workdir
-
-WORKDIR /src/workdir
-
-RUN go build ./...
diff --git a/vendor/github.com/pjbgf/sha1cd/Dockerfile.arm64 b/vendor/github.com/pjbgf/sha1cd/Dockerfile.arm64
deleted file mode 100644
index 66bd09474..000000000
--- a/vendor/github.com/pjbgf/sha1cd/Dockerfile.arm64
+++ /dev/null
@@ -1,23 +0,0 @@
-FROM golang:1.20@sha256:2edf6aab2d57644f3fe7407132a0d1770846867465a39c2083770cf62734b05d
-
-ENV GOOS=linux
-ENV GOARCH=arm64
-ENV CGO_ENABLED=1
-ENV CC=aarch64-linux-gnu-gcc
-ENV PATH="/go/bin/${GOOS}_${GOARCH}:${PATH}"
-ENV PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig
-
-# install build & runtime dependencies
-RUN dpkg --add-architecture arm64 \
- && apt update \
- && apt install -y --no-install-recommends \
- gcc-aarch64-linux-gnu \
- libc6-dev-arm64-cross \
- pkg-config \
- && rm -rf /var/lib/apt/lists/*
-
-COPY . /src/workdir
-
-WORKDIR /src/workdir
-
-RUN go build ./...
diff --git a/vendor/github.com/pjbgf/sha1cd/LICENSE b/vendor/github.com/pjbgf/sha1cd/LICENSE
deleted file mode 100644
index 261eeb9e9..000000000
--- a/vendor/github.com/pjbgf/sha1cd/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/pjbgf/sha1cd/Makefile b/vendor/github.com/pjbgf/sha1cd/Makefile
deleted file mode 100644
index b24f2cbad..000000000
--- a/vendor/github.com/pjbgf/sha1cd/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-FUZZ_TIME ?= 1m
-
-export CGO_ENABLED := 1
-
-.PHONY: test
-test:
- go test ./...
-
-.PHONY: bench
-bench:
- go test -benchmem -run=^$$ -bench ^Benchmark ./...
-
-.PHONY: fuzz
-fuzz:
- go test -tags gofuzz -fuzz=. -fuzztime=$(FUZZ_TIME) ./test/
-
-# Cross build project in arm/v7.
-build-arm:
- docker build -t sha1cd-arm -f Dockerfile.arm .
- docker run --rm sha1cd-arm
-
-# Cross build project in arm64.
-build-arm64:
- docker build -t sha1cd-arm64 -f Dockerfile.arm64 .
- docker run --rm sha1cd-arm64
-
-# Build with cgo disabled.
-build-nocgo:
- CGO_ENABLED=0 go build ./cgo
-
-# Run cross-compilation to assure supported architectures.
-cross-build: build-arm build-arm64 build-nocgo
-
-generate:
- go run sha1cdblock_amd64_asm.go -out sha1cdblock_amd64.s
- sed -i 's;&\samd64;&\n// +build !noasm,gc,amd64;g' sha1cdblock_amd64.s
-
-verify: generate
- git diff --exit-code
- go vet ./...
diff --git a/vendor/github.com/pjbgf/sha1cd/README.md b/vendor/github.com/pjbgf/sha1cd/README.md
deleted file mode 100644
index 378cf78cf..000000000
--- a/vendor/github.com/pjbgf/sha1cd/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# sha1cd
-
-A Go implementation of SHA1 with counter-cryptanalysis, which detects
-collision attacks.
-
-The `cgo/lib` code is a carbon copy of the [original code], based on
-the award winning [white paper] by Marc Stevens.
-
-The Go implementation is largely based off Go's generic sha1.
-At present no SIMD optimisations have been implemented.
-
-## Usage
-
-`sha1cd` can be used as a drop-in replacement for `crypto/sha1`:
-
-```golang
-import "github.com/pjbgf/sha1cd"
-
-func test(){
- data := []byte("data to be sha1 hashed")
- h := sha1cd.Sum(data)
- fmt.Printf("hash: %q\n", hex.EncodeToString(h))
-}
-```
-
-To obtain information as to whether a collision was found, use the
-func `CollisionResistantSum`.
-
-```golang
-import "github.com/pjbgf/sha1cd"
-
-func test(){
- data := []byte("data to be sha1 hashed")
- h, col := sha1cd.CollisionResistantSum(data)
- if col {
- fmt.Println("collision found!")
- }
- fmt.Printf("hash: %q", hex.EncodeToString(h))
-}
-```
-
-Note that the algorithm will automatically avoid collision, by
-extending the SHA1 to 240-steps, instead of 80 when a collision
-attempt is detected. Therefore, inputs that contains the unavoidable
-bit conditions will yield a different hash from `sha1cd`, when compared
-with results using `crypto/sha1`. Valid inputs will have matching the outputs.
-
-## References
-- https://shattered.io/
-- https://github.com/cr-marcstevens/sha1collisiondetection
-- https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/Secure-Hashing#shavs
-
-## Use of the Original Implementation
-- https://github.com/git/git/commit/28dc98e343ca4eb370a29ceec4c19beac9b5c01e
-- https://github.com/libgit2/libgit2/pull/4136
-
-[original code]: https://github.com/cr-marcstevens/sha1collisiondetection
-[white paper]: https://marc-stevens.nl/research/papers/C13-S.pdf
diff --git a/vendor/github.com/pjbgf/sha1cd/detection.go b/vendor/github.com/pjbgf/sha1cd/detection.go
deleted file mode 100644
index a1458748c..000000000
--- a/vendor/github.com/pjbgf/sha1cd/detection.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package sha1cd
-
-import "hash"
-
-type CollisionResistantHash interface {
- // CollisionResistantSum extends on Sum by returning an additional boolean
- // which indicates whether a collision was found during the hashing process.
- CollisionResistantSum(b []byte) ([]byte, bool)
-
- hash.Hash
-}
diff --git a/vendor/github.com/pjbgf/sha1cd/internal/const.go b/vendor/github.com/pjbgf/sha1cd/internal/const.go
deleted file mode 100644
index 944a131d3..000000000
--- a/vendor/github.com/pjbgf/sha1cd/internal/const.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package shared
-
-const (
- // Constants for the SHA-1 hash function.
- K0 = 0x5A827999
- K1 = 0x6ED9EBA1
- K2 = 0x8F1BBCDC
- K3 = 0xCA62C1D6
-
- // Initial values for the buffer variables: h0, h1, h2, h3, h4.
- Init0 = 0x67452301
- Init1 = 0xEFCDAB89
- Init2 = 0x98BADCFE
- Init3 = 0x10325476
- Init4 = 0xC3D2E1F0
-
- // Initial values for the temporary variables (ihvtmp0, ihvtmp1, ihvtmp2, ihvtmp3, ihvtmp4) during the SHA recompression step.
- InitTmp0 = 0xD5
- InitTmp1 = 0x394
- InitTmp2 = 0x8152A8
- InitTmp3 = 0x0
- InitTmp4 = 0xA7ECE0
-
- // SHA1 contains 2 buffers, each based off 5 32-bit words.
- WordBuffers = 5
-
- // The output of SHA1 is 20 bytes (160 bits).
- Size = 20
-
- // Rounds represents the number of steps required to process each chunk.
- Rounds = 80
-
- // SHA1 processes the input data in chunks. Each chunk contains 64 bytes.
- Chunk = 64
-
- // The number of pre-step compression state to store.
- // Currently there are 3 pre-step compression states required: 0, 58, 65.
- PreStepState = 3
-
- Magic = "shacd\x01"
- MarshaledSize = len(Magic) + 5*4 + Chunk + 8
-)
diff --git a/vendor/github.com/pjbgf/sha1cd/sha1cd.go b/vendor/github.com/pjbgf/sha1cd/sha1cd.go
deleted file mode 100644
index a69e480ee..000000000
--- a/vendor/github.com/pjbgf/sha1cd/sha1cd.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package sha1cd implements collision detection based on the whitepaper
-// Counter-cryptanalysis from Marc Stevens. The original ubc implementation
-// was done by Marc Stevens and Dan Shumow, and can be found at:
-// https://github.com/cr-marcstevens/sha1collisiondetection
-package sha1cd
-
-// This SHA1 implementation is based on Go's generic SHA1.
-// Original: https://github.com/golang/go/blob/master/src/crypto/sha1/sha1.go
-
-import (
- "crypto"
- "encoding/binary"
- "errors"
- "hash"
-
- shared "github.com/pjbgf/sha1cd/internal"
-)
-
-func init() {
- crypto.RegisterHash(crypto.SHA1, New)
-}
-
-// The size of a SHA-1 checksum in bytes.
-const Size = shared.Size
-
-// The blocksize of SHA-1 in bytes.
-const BlockSize = shared.Chunk
-
-// digest represents the partial evaluation of a checksum.
-type digest struct {
- h [shared.WordBuffers]uint32
- x [shared.Chunk]byte
- nx int
- len uint64
-
- // col defines whether a collision has been found.
- col bool
- blockFunc func(dig *digest, p []byte)
-}
-
-func (d *digest) MarshalBinary() ([]byte, error) {
- b := make([]byte, 0, shared.MarshaledSize)
- b = append(b, shared.Magic...)
- b = appendUint32(b, d.h[0])
- b = appendUint32(b, d.h[1])
- b = appendUint32(b, d.h[2])
- b = appendUint32(b, d.h[3])
- b = appendUint32(b, d.h[4])
- b = append(b, d.x[:d.nx]...)
- b = b[:len(b)+len(d.x)-d.nx] // already zero
- b = appendUint64(b, d.len)
- return b, nil
-}
-
-func appendUint32(b []byte, v uint32) []byte {
- return append(b,
- byte(v>>24),
- byte(v>>16),
- byte(v>>8),
- byte(v),
- )
-}
-
-func appendUint64(b []byte, v uint64) []byte {
- return append(b,
- byte(v>>56),
- byte(v>>48),
- byte(v>>40),
- byte(v>>32),
- byte(v>>24),
- byte(v>>16),
- byte(v>>8),
- byte(v),
- )
-}
-
-func (d *digest) UnmarshalBinary(b []byte) error {
- if len(b) < len(shared.Magic) || string(b[:len(shared.Magic)]) != shared.Magic {
- return errors.New("crypto/sha1: invalid hash state identifier")
- }
- if len(b) != shared.MarshaledSize {
- return errors.New("crypto/sha1: invalid hash state size")
- }
- b = b[len(shared.Magic):]
- b, d.h[0] = consumeUint32(b)
- b, d.h[1] = consumeUint32(b)
- b, d.h[2] = consumeUint32(b)
- b, d.h[3] = consumeUint32(b)
- b, d.h[4] = consumeUint32(b)
- b = b[copy(d.x[:], b):]
- b, d.len = consumeUint64(b)
- d.nx = int(d.len % shared.Chunk)
- return nil
-}
-
-func consumeUint64(b []byte) ([]byte, uint64) {
- _ = b[7]
- x := uint64(b[7]) | uint64(b[6])<<8 | uint64(b[shared.WordBuffers])<<16 | uint64(b[4])<<24 |
- uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
- return b[8:], x
-}
-
-func consumeUint32(b []byte) ([]byte, uint32) {
- _ = b[3]
- x := uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24
- return b[4:], x
-}
-
-func (d *digest) Reset() {
- d.h[0] = shared.Init0
- d.h[1] = shared.Init1
- d.h[2] = shared.Init2
- d.h[3] = shared.Init3
- d.h[4] = shared.Init4
- d.nx = 0
- d.len = 0
-
- d.col = false
-}
-
-// New returns a new hash.Hash computing the SHA1 checksum. The Hash also
-// implements encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to
-// marshal and unmarshal the internal state of the hash.
-func New() hash.Hash {
- d := new(digest)
-
- d.blockFunc = block
- d.Reset()
- return d
-}
-
-// NewGeneric is equivalent to New but uses the Go generic implementation,
-// avoiding any processor-specific optimizations.
-func NewGeneric() hash.Hash {
- d := new(digest)
-
- d.blockFunc = blockGeneric
- d.Reset()
- return d
-}
-
-func (d *digest) Size() int { return Size }
-
-func (d *digest) BlockSize() int { return BlockSize }
-
-func (d *digest) Write(p []byte) (nn int, err error) {
- if len(p) == 0 {
- return
- }
-
- nn = len(p)
- d.len += uint64(nn)
- if d.nx > 0 {
- n := copy(d.x[d.nx:], p)
- d.nx += n
- if d.nx == shared.Chunk {
- d.blockFunc(d, d.x[:])
- d.nx = 0
- }
- p = p[n:]
- }
- if len(p) >= shared.Chunk {
- n := len(p) &^ (shared.Chunk - 1)
- d.blockFunc(d, p[:n])
- p = p[n:]
- }
- if len(p) > 0 {
- d.nx = copy(d.x[:], p)
- }
- return
-}
-
-func (d *digest) Sum(in []byte) []byte {
- // Make a copy of d so that caller can keep writing and summing.
- d0 := *d
- hash := d0.checkSum()
- return append(in, hash[:]...)
-}
-
-func (d *digest) checkSum() [Size]byte {
- len := d.len
- // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
- var tmp [64]byte
- tmp[0] = 0x80
- if len%64 < 56 {
- d.Write(tmp[0 : 56-len%64])
- } else {
- d.Write(tmp[0 : 64+56-len%64])
- }
-
- // Length in bits.
- len <<= 3
- binary.BigEndian.PutUint64(tmp[:], len)
- d.Write(tmp[0:8])
-
- if d.nx != 0 {
- panic("d.nx != 0")
- }
-
- var digest [Size]byte
-
- binary.BigEndian.PutUint32(digest[0:], d.h[0])
- binary.BigEndian.PutUint32(digest[4:], d.h[1])
- binary.BigEndian.PutUint32(digest[8:], d.h[2])
- binary.BigEndian.PutUint32(digest[12:], d.h[3])
- binary.BigEndian.PutUint32(digest[16:], d.h[4])
-
- return digest
-}
-
-// Sum returns the SHA-1 checksum of the data.
-func Sum(data []byte) ([Size]byte, bool) {
- d := New().(*digest)
- d.Write(data)
- return d.checkSum(), d.col
-}
-
-func (d *digest) CollisionResistantSum(in []byte) ([]byte, bool) {
- // Make a copy of d so that caller can keep writing and summing.
- d0 := *d
- hash := d0.checkSum()
- return append(in, hash[:]...), d0.col
-}
diff --git a/vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.go b/vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.go
deleted file mode 100644
index 95e083084..000000000
--- a/vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.go
+++ /dev/null
@@ -1,50 +0,0 @@
-//go:build !noasm && gc && amd64
-// +build !noasm,gc,amd64
-
-package sha1cd
-
-import (
- "math"
- "unsafe"
-
- shared "github.com/pjbgf/sha1cd/internal"
-)
-
-type sliceHeader struct {
- base uintptr
- len int
- cap int
-}
-
-// blockAMD64 hashes the message p into the current state in dig.
-// Both m1 and cs are used to store intermediate results which are used by the collision detection logic.
-//
-//go:noescape
-func blockAMD64(dig *digest, p sliceHeader, m1 []uint32, cs [][5]uint32)
-
-func block(dig *digest, p []byte) {
- m1 := [shared.Rounds]uint32{}
- cs := [shared.PreStepState][shared.WordBuffers]uint32{}
-
- for len(p) >= shared.Chunk {
- // Only send a block to be processed, as the collission detection
- // works on a block by block basis.
- ips := sliceHeader{
- base: uintptr(unsafe.Pointer(&p[0])),
- len: int(math.Min(float64(len(p)), float64(shared.Chunk))),
- cap: shared.Chunk,
- }
-
- blockAMD64(dig, ips, m1[:], cs[:])
-
- col := checkCollision(m1, cs, dig.h)
- if col {
- dig.col = true
-
- blockAMD64(dig, ips, m1[:], cs[:])
- blockAMD64(dig, ips, m1[:], cs[:])
- }
-
- p = p[shared.Chunk:]
- }
-}
diff --git a/vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.s b/vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.s
deleted file mode 100644
index 86f9821ca..000000000
--- a/vendor/github.com/pjbgf/sha1cd/sha1cdblock_amd64.s
+++ /dev/null
@@ -1,2274 +0,0 @@
-// Code generated by command: go run sha1cdblock_amd64_asm.go -out sha1cdblock_amd64.s. DO NOT EDIT.
-
-//go:build !noasm && gc && amd64
-// +build !noasm,gc,amd64
-
-#include "textflag.h"
-
-// func blockAMD64(dig *digest, p []byte, m1 []uint32, cs [][5]uint32)
-TEXT ·blockAMD64(SB), NOSPLIT, $64-80
- MOVQ dig+0(FP), R8
- MOVQ p_base+8(FP), DI
- MOVQ p_len+16(FP), DX
- SHRQ $+6, DX
- SHLQ $+6, DX
- LEAQ (DI)(DX*1), SI
-
- // Load h0, h1, h2, h3, h4.
- MOVL (R8), AX
- MOVL 4(R8), BX
- MOVL 8(R8), CX
- MOVL 12(R8), DX
- MOVL 16(R8), BP
-
- // len(p) >= chunk
- CMPQ DI, SI
- JEQ end
-
-loop:
- // Initialize registers a, b, c, d, e.
- MOVL AX, R10
- MOVL BX, R11
- MOVL CX, R12
- MOVL DX, R13
- MOVL BP, R14
-
- // ROUND1 (steps 0-15)
- // Load cs
- MOVQ cs_base+56(FP), R8
- MOVL R10, (R8)
- MOVL R11, 4(R8)
- MOVL R12, 8(R8)
- MOVL R13, 12(R8)
- MOVL R14, 16(R8)
-
- // ROUND1(0)
- // LOAD
- MOVL (DI), R9
- BSWAPL R9
- MOVL R9, (SP)
-
- // FUNC1
- MOVL R13, R15
- XORL R12, R15
- ANDL R11, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 1518500249(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL (SP), R9
- MOVL R9, (R8)
-
- // ROUND1(1)
- // LOAD
- MOVL 4(DI), R9
- BSWAPL R9
- MOVL R9, 4(SP)
-
- // FUNC1
- MOVL R12, R15
- XORL R11, R15
- ANDL R10, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 1518500249(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 4(SP), R9
- MOVL R9, 4(R8)
-
- // ROUND1(2)
- // LOAD
- MOVL 8(DI), R9
- BSWAPL R9
- MOVL R9, 8(SP)
-
- // FUNC1
- MOVL R11, R15
- XORL R10, R15
- ANDL R14, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 1518500249(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 8(SP), R9
- MOVL R9, 8(R8)
-
- // ROUND1(3)
- // LOAD
- MOVL 12(DI), R9
- BSWAPL R9
- MOVL R9, 12(SP)
-
- // FUNC1
- MOVL R10, R15
- XORL R14, R15
- ANDL R13, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 1518500249(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 12(SP), R9
- MOVL R9, 12(R8)
-
- // ROUND1(4)
- // LOAD
- MOVL 16(DI), R9
- BSWAPL R9
- MOVL R9, 16(SP)
-
- // FUNC1
- MOVL R14, R15
- XORL R13, R15
- ANDL R12, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 1518500249(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 16(SP), R9
- MOVL R9, 16(R8)
-
- // ROUND1(5)
- // LOAD
- MOVL 20(DI), R9
- BSWAPL R9
- MOVL R9, 20(SP)
-
- // FUNC1
- MOVL R13, R15
- XORL R12, R15
- ANDL R11, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 1518500249(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 20(SP), R9
- MOVL R9, 20(R8)
-
- // ROUND1(6)
- // LOAD
- MOVL 24(DI), R9
- BSWAPL R9
- MOVL R9, 24(SP)
-
- // FUNC1
- MOVL R12, R15
- XORL R11, R15
- ANDL R10, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 1518500249(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 24(SP), R9
- MOVL R9, 24(R8)
-
- // ROUND1(7)
- // LOAD
- MOVL 28(DI), R9
- BSWAPL R9
- MOVL R9, 28(SP)
-
- // FUNC1
- MOVL R11, R15
- XORL R10, R15
- ANDL R14, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 1518500249(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 28(SP), R9
- MOVL R9, 28(R8)
-
- // ROUND1(8)
- // LOAD
- MOVL 32(DI), R9
- BSWAPL R9
- MOVL R9, 32(SP)
-
- // FUNC1
- MOVL R10, R15
- XORL R14, R15
- ANDL R13, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 1518500249(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 32(SP), R9
- MOVL R9, 32(R8)
-
- // ROUND1(9)
- // LOAD
- MOVL 36(DI), R9
- BSWAPL R9
- MOVL R9, 36(SP)
-
- // FUNC1
- MOVL R14, R15
- XORL R13, R15
- ANDL R12, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 1518500249(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 36(SP), R9
- MOVL R9, 36(R8)
-
- // ROUND1(10)
- // LOAD
- MOVL 40(DI), R9
- BSWAPL R9
- MOVL R9, 40(SP)
-
- // FUNC1
- MOVL R13, R15
- XORL R12, R15
- ANDL R11, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 1518500249(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 40(SP), R9
- MOVL R9, 40(R8)
-
- // ROUND1(11)
- // LOAD
- MOVL 44(DI), R9
- BSWAPL R9
- MOVL R9, 44(SP)
-
- // FUNC1
- MOVL R12, R15
- XORL R11, R15
- ANDL R10, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 1518500249(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 44(SP), R9
- MOVL R9, 44(R8)
-
- // ROUND1(12)
- // LOAD
- MOVL 48(DI), R9
- BSWAPL R9
- MOVL R9, 48(SP)
-
- // FUNC1
- MOVL R11, R15
- XORL R10, R15
- ANDL R14, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 1518500249(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 48(SP), R9
- MOVL R9, 48(R8)
-
- // ROUND1(13)
- // LOAD
- MOVL 52(DI), R9
- BSWAPL R9
- MOVL R9, 52(SP)
-
- // FUNC1
- MOVL R10, R15
- XORL R14, R15
- ANDL R13, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 1518500249(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 52(SP), R9
- MOVL R9, 52(R8)
-
- // ROUND1(14)
- // LOAD
- MOVL 56(DI), R9
- BSWAPL R9
- MOVL R9, 56(SP)
-
- // FUNC1
- MOVL R14, R15
- XORL R13, R15
- ANDL R12, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 1518500249(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 56(SP), R9
- MOVL R9, 56(R8)
-
- // ROUND1(15)
- // LOAD
- MOVL 60(DI), R9
- BSWAPL R9
- MOVL R9, 60(SP)
-
- // FUNC1
- MOVL R13, R15
- XORL R12, R15
- ANDL R11, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 1518500249(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 60(SP), R9
- MOVL R9, 60(R8)
-
- // ROUND1x (steps 16-19) - same as ROUND1 but with no data load.
- // ROUND1x(16)
- // SHUFFLE
- MOVL (SP), R9
- XORL 52(SP), R9
- XORL 32(SP), R9
- XORL 8(SP), R9
- ROLL $+1, R9
- MOVL R9, (SP)
-
- // FUNC1
- MOVL R12, R15
- XORL R11, R15
- ANDL R10, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 1518500249(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL (SP), R9
- MOVL R9, 64(R8)
-
- // ROUND1x(17)
- // SHUFFLE
- MOVL 4(SP), R9
- XORL 56(SP), R9
- XORL 36(SP), R9
- XORL 12(SP), R9
- ROLL $+1, R9
- MOVL R9, 4(SP)
-
- // FUNC1
- MOVL R11, R15
- XORL R10, R15
- ANDL R14, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 1518500249(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 4(SP), R9
- MOVL R9, 68(R8)
-
- // ROUND1x(18)
- // SHUFFLE
- MOVL 8(SP), R9
- XORL 60(SP), R9
- XORL 40(SP), R9
- XORL 16(SP), R9
- ROLL $+1, R9
- MOVL R9, 8(SP)
-
- // FUNC1
- MOVL R10, R15
- XORL R14, R15
- ANDL R13, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 1518500249(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 8(SP), R9
- MOVL R9, 72(R8)
-
- // ROUND1x(19)
- // SHUFFLE
- MOVL 12(SP), R9
- XORL (SP), R9
- XORL 44(SP), R9
- XORL 20(SP), R9
- ROLL $+1, R9
- MOVL R9, 12(SP)
-
- // FUNC1
- MOVL R14, R15
- XORL R13, R15
- ANDL R12, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 1518500249(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 12(SP), R9
- MOVL R9, 76(R8)
-
- // ROUND2 (steps 20-39)
- // ROUND2(20)
- // SHUFFLE
- MOVL 16(SP), R9
- XORL 4(SP), R9
- XORL 48(SP), R9
- XORL 24(SP), R9
- ROLL $+1, R9
- MOVL R9, 16(SP)
-
- // FUNC2
- MOVL R11, R15
- XORL R12, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 1859775393(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 16(SP), R9
- MOVL R9, 80(R8)
-
- // ROUND2(21)
- // SHUFFLE
- MOVL 20(SP), R9
- XORL 8(SP), R9
- XORL 52(SP), R9
- XORL 28(SP), R9
- ROLL $+1, R9
- MOVL R9, 20(SP)
-
- // FUNC2
- MOVL R10, R15
- XORL R11, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 1859775393(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 20(SP), R9
- MOVL R9, 84(R8)
-
- // ROUND2(22)
- // SHUFFLE
- MOVL 24(SP), R9
- XORL 12(SP), R9
- XORL 56(SP), R9
- XORL 32(SP), R9
- ROLL $+1, R9
- MOVL R9, 24(SP)
-
- // FUNC2
- MOVL R14, R15
- XORL R10, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 1859775393(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 24(SP), R9
- MOVL R9, 88(R8)
-
- // ROUND2(23)
- // SHUFFLE
- MOVL 28(SP), R9
- XORL 16(SP), R9
- XORL 60(SP), R9
- XORL 36(SP), R9
- ROLL $+1, R9
- MOVL R9, 28(SP)
-
- // FUNC2
- MOVL R13, R15
- XORL R14, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 1859775393(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 28(SP), R9
- MOVL R9, 92(R8)
-
- // ROUND2(24)
- // SHUFFLE
- MOVL 32(SP), R9
- XORL 20(SP), R9
- XORL (SP), R9
- XORL 40(SP), R9
- ROLL $+1, R9
- MOVL R9, 32(SP)
-
- // FUNC2
- MOVL R12, R15
- XORL R13, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 1859775393(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 32(SP), R9
- MOVL R9, 96(R8)
-
- // ROUND2(25)
- // SHUFFLE
- MOVL 36(SP), R9
- XORL 24(SP), R9
- XORL 4(SP), R9
- XORL 44(SP), R9
- ROLL $+1, R9
- MOVL R9, 36(SP)
-
- // FUNC2
- MOVL R11, R15
- XORL R12, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 1859775393(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 36(SP), R9
- MOVL R9, 100(R8)
-
- // ROUND2(26)
- // SHUFFLE
- MOVL 40(SP), R9
- XORL 28(SP), R9
- XORL 8(SP), R9
- XORL 48(SP), R9
- ROLL $+1, R9
- MOVL R9, 40(SP)
-
- // FUNC2
- MOVL R10, R15
- XORL R11, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 1859775393(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 40(SP), R9
- MOVL R9, 104(R8)
-
- // ROUND2(27)
- // SHUFFLE
- MOVL 44(SP), R9
- XORL 32(SP), R9
- XORL 12(SP), R9
- XORL 52(SP), R9
- ROLL $+1, R9
- MOVL R9, 44(SP)
-
- // FUNC2
- MOVL R14, R15
- XORL R10, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 1859775393(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 44(SP), R9
- MOVL R9, 108(R8)
-
- // ROUND2(28)
- // SHUFFLE
- MOVL 48(SP), R9
- XORL 36(SP), R9
- XORL 16(SP), R9
- XORL 56(SP), R9
- ROLL $+1, R9
- MOVL R9, 48(SP)
-
- // FUNC2
- MOVL R13, R15
- XORL R14, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 1859775393(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 48(SP), R9
- MOVL R9, 112(R8)
-
- // ROUND2(29)
- // SHUFFLE
- MOVL 52(SP), R9
- XORL 40(SP), R9
- XORL 20(SP), R9
- XORL 60(SP), R9
- ROLL $+1, R9
- MOVL R9, 52(SP)
-
- // FUNC2
- MOVL R12, R15
- XORL R13, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 1859775393(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 52(SP), R9
- MOVL R9, 116(R8)
-
- // ROUND2(30)
- // SHUFFLE
- MOVL 56(SP), R9
- XORL 44(SP), R9
- XORL 24(SP), R9
- XORL (SP), R9
- ROLL $+1, R9
- MOVL R9, 56(SP)
-
- // FUNC2
- MOVL R11, R15
- XORL R12, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 1859775393(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 56(SP), R9
- MOVL R9, 120(R8)
-
- // ROUND2(31)
- // SHUFFLE
- MOVL 60(SP), R9
- XORL 48(SP), R9
- XORL 28(SP), R9
- XORL 4(SP), R9
- ROLL $+1, R9
- MOVL R9, 60(SP)
-
- // FUNC2
- MOVL R10, R15
- XORL R11, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 1859775393(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 60(SP), R9
- MOVL R9, 124(R8)
-
- // ROUND2(32)
- // SHUFFLE
- MOVL (SP), R9
- XORL 52(SP), R9
- XORL 32(SP), R9
- XORL 8(SP), R9
- ROLL $+1, R9
- MOVL R9, (SP)
-
- // FUNC2
- MOVL R14, R15
- XORL R10, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 1859775393(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL (SP), R9
- MOVL R9, 128(R8)
-
- // ROUND2(33)
- // SHUFFLE
- MOVL 4(SP), R9
- XORL 56(SP), R9
- XORL 36(SP), R9
- XORL 12(SP), R9
- ROLL $+1, R9
- MOVL R9, 4(SP)
-
- // FUNC2
- MOVL R13, R15
- XORL R14, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 1859775393(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 4(SP), R9
- MOVL R9, 132(R8)
-
- // ROUND2(34)
- // SHUFFLE
- MOVL 8(SP), R9
- XORL 60(SP), R9
- XORL 40(SP), R9
- XORL 16(SP), R9
- ROLL $+1, R9
- MOVL R9, 8(SP)
-
- // FUNC2
- MOVL R12, R15
- XORL R13, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 1859775393(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 8(SP), R9
- MOVL R9, 136(R8)
-
- // ROUND2(35)
- // SHUFFLE
- MOVL 12(SP), R9
- XORL (SP), R9
- XORL 44(SP), R9
- XORL 20(SP), R9
- ROLL $+1, R9
- MOVL R9, 12(SP)
-
- // FUNC2
- MOVL R11, R15
- XORL R12, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 1859775393(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 12(SP), R9
- MOVL R9, 140(R8)
-
- // ROUND2(36)
- // SHUFFLE
- MOVL 16(SP), R9
- XORL 4(SP), R9
- XORL 48(SP), R9
- XORL 24(SP), R9
- ROLL $+1, R9
- MOVL R9, 16(SP)
-
- // FUNC2
- MOVL R10, R15
- XORL R11, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 1859775393(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 16(SP), R9
- MOVL R9, 144(R8)
-
- // ROUND2(37)
- // SHUFFLE
- MOVL 20(SP), R9
- XORL 8(SP), R9
- XORL 52(SP), R9
- XORL 28(SP), R9
- ROLL $+1, R9
- MOVL R9, 20(SP)
-
- // FUNC2
- MOVL R14, R15
- XORL R10, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 1859775393(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 20(SP), R9
- MOVL R9, 148(R8)
-
- // ROUND2(38)
- // SHUFFLE
- MOVL 24(SP), R9
- XORL 12(SP), R9
- XORL 56(SP), R9
- XORL 32(SP), R9
- ROLL $+1, R9
- MOVL R9, 24(SP)
-
- // FUNC2
- MOVL R13, R15
- XORL R14, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 1859775393(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 24(SP), R9
- MOVL R9, 152(R8)
-
- // ROUND2(39)
- // SHUFFLE
- MOVL 28(SP), R9
- XORL 16(SP), R9
- XORL 60(SP), R9
- XORL 36(SP), R9
- ROLL $+1, R9
- MOVL R9, 28(SP)
-
- // FUNC2
- MOVL R12, R15
- XORL R13, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 1859775393(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 28(SP), R9
- MOVL R9, 156(R8)
-
- // ROUND3 (steps 40-59)
- // ROUND3(40)
- // SHUFFLE
- MOVL 32(SP), R9
- XORL 20(SP), R9
- XORL (SP), R9
- XORL 40(SP), R9
- ROLL $+1, R9
- MOVL R9, 32(SP)
-
- // FUNC3
- MOVL R11, R8
- ORL R12, R8
- ANDL R13, R8
- MOVL R11, R15
- ANDL R12, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 2400959708(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 32(SP), R9
- MOVL R9, 160(R8)
-
- // ROUND3(41)
- // SHUFFLE
- MOVL 36(SP), R9
- XORL 24(SP), R9
- XORL 4(SP), R9
- XORL 44(SP), R9
- ROLL $+1, R9
- MOVL R9, 36(SP)
-
- // FUNC3
- MOVL R10, R8
- ORL R11, R8
- ANDL R12, R8
- MOVL R10, R15
- ANDL R11, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 2400959708(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 36(SP), R9
- MOVL R9, 164(R8)
-
- // ROUND3(42)
- // SHUFFLE
- MOVL 40(SP), R9
- XORL 28(SP), R9
- XORL 8(SP), R9
- XORL 48(SP), R9
- ROLL $+1, R9
- MOVL R9, 40(SP)
-
- // FUNC3
- MOVL R14, R8
- ORL R10, R8
- ANDL R11, R8
- MOVL R14, R15
- ANDL R10, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 2400959708(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 40(SP), R9
- MOVL R9, 168(R8)
-
- // ROUND3(43)
- // SHUFFLE
- MOVL 44(SP), R9
- XORL 32(SP), R9
- XORL 12(SP), R9
- XORL 52(SP), R9
- ROLL $+1, R9
- MOVL R9, 44(SP)
-
- // FUNC3
- MOVL R13, R8
- ORL R14, R8
- ANDL R10, R8
- MOVL R13, R15
- ANDL R14, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 2400959708(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 44(SP), R9
- MOVL R9, 172(R8)
-
- // ROUND3(44)
- // SHUFFLE
- MOVL 48(SP), R9
- XORL 36(SP), R9
- XORL 16(SP), R9
- XORL 56(SP), R9
- ROLL $+1, R9
- MOVL R9, 48(SP)
-
- // FUNC3
- MOVL R12, R8
- ORL R13, R8
- ANDL R14, R8
- MOVL R12, R15
- ANDL R13, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 2400959708(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 48(SP), R9
- MOVL R9, 176(R8)
-
- // ROUND3(45)
- // SHUFFLE
- MOVL 52(SP), R9
- XORL 40(SP), R9
- XORL 20(SP), R9
- XORL 60(SP), R9
- ROLL $+1, R9
- MOVL R9, 52(SP)
-
- // FUNC3
- MOVL R11, R8
- ORL R12, R8
- ANDL R13, R8
- MOVL R11, R15
- ANDL R12, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 2400959708(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 52(SP), R9
- MOVL R9, 180(R8)
-
- // ROUND3(46)
- // SHUFFLE
- MOVL 56(SP), R9
- XORL 44(SP), R9
- XORL 24(SP), R9
- XORL (SP), R9
- ROLL $+1, R9
- MOVL R9, 56(SP)
-
- // FUNC3
- MOVL R10, R8
- ORL R11, R8
- ANDL R12, R8
- MOVL R10, R15
- ANDL R11, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 2400959708(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 56(SP), R9
- MOVL R9, 184(R8)
-
- // ROUND3(47)
- // SHUFFLE
- MOVL 60(SP), R9
- XORL 48(SP), R9
- XORL 28(SP), R9
- XORL 4(SP), R9
- ROLL $+1, R9
- MOVL R9, 60(SP)
-
- // FUNC3
- MOVL R14, R8
- ORL R10, R8
- ANDL R11, R8
- MOVL R14, R15
- ANDL R10, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 2400959708(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 60(SP), R9
- MOVL R9, 188(R8)
-
- // ROUND3(48)
- // SHUFFLE
- MOVL (SP), R9
- XORL 52(SP), R9
- XORL 32(SP), R9
- XORL 8(SP), R9
- ROLL $+1, R9
- MOVL R9, (SP)
-
- // FUNC3
- MOVL R13, R8
- ORL R14, R8
- ANDL R10, R8
- MOVL R13, R15
- ANDL R14, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 2400959708(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL (SP), R9
- MOVL R9, 192(R8)
-
- // ROUND3(49)
- // SHUFFLE
- MOVL 4(SP), R9
- XORL 56(SP), R9
- XORL 36(SP), R9
- XORL 12(SP), R9
- ROLL $+1, R9
- MOVL R9, 4(SP)
-
- // FUNC3
- MOVL R12, R8
- ORL R13, R8
- ANDL R14, R8
- MOVL R12, R15
- ANDL R13, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 2400959708(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 4(SP), R9
- MOVL R9, 196(R8)
-
- // ROUND3(50)
- // SHUFFLE
- MOVL 8(SP), R9
- XORL 60(SP), R9
- XORL 40(SP), R9
- XORL 16(SP), R9
- ROLL $+1, R9
- MOVL R9, 8(SP)
-
- // FUNC3
- MOVL R11, R8
- ORL R12, R8
- ANDL R13, R8
- MOVL R11, R15
- ANDL R12, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 2400959708(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 8(SP), R9
- MOVL R9, 200(R8)
-
- // ROUND3(51)
- // SHUFFLE
- MOVL 12(SP), R9
- XORL (SP), R9
- XORL 44(SP), R9
- XORL 20(SP), R9
- ROLL $+1, R9
- MOVL R9, 12(SP)
-
- // FUNC3
- MOVL R10, R8
- ORL R11, R8
- ANDL R12, R8
- MOVL R10, R15
- ANDL R11, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 2400959708(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 12(SP), R9
- MOVL R9, 204(R8)
-
- // ROUND3(52)
- // SHUFFLE
- MOVL 16(SP), R9
- XORL 4(SP), R9
- XORL 48(SP), R9
- XORL 24(SP), R9
- ROLL $+1, R9
- MOVL R9, 16(SP)
-
- // FUNC3
- MOVL R14, R8
- ORL R10, R8
- ANDL R11, R8
- MOVL R14, R15
- ANDL R10, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 2400959708(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 16(SP), R9
- MOVL R9, 208(R8)
-
- // ROUND3(53)
- // SHUFFLE
- MOVL 20(SP), R9
- XORL 8(SP), R9
- XORL 52(SP), R9
- XORL 28(SP), R9
- ROLL $+1, R9
- MOVL R9, 20(SP)
-
- // FUNC3
- MOVL R13, R8
- ORL R14, R8
- ANDL R10, R8
- MOVL R13, R15
- ANDL R14, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 2400959708(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 20(SP), R9
- MOVL R9, 212(R8)
-
- // ROUND3(54)
- // SHUFFLE
- MOVL 24(SP), R9
- XORL 12(SP), R9
- XORL 56(SP), R9
- XORL 32(SP), R9
- ROLL $+1, R9
- MOVL R9, 24(SP)
-
- // FUNC3
- MOVL R12, R8
- ORL R13, R8
- ANDL R14, R8
- MOVL R12, R15
- ANDL R13, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 2400959708(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 24(SP), R9
- MOVL R9, 216(R8)
-
- // ROUND3(55)
- // SHUFFLE
- MOVL 28(SP), R9
- XORL 16(SP), R9
- XORL 60(SP), R9
- XORL 36(SP), R9
- ROLL $+1, R9
- MOVL R9, 28(SP)
-
- // FUNC3
- MOVL R11, R8
- ORL R12, R8
- ANDL R13, R8
- MOVL R11, R15
- ANDL R12, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 2400959708(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 28(SP), R9
- MOVL R9, 220(R8)
-
- // ROUND3(56)
- // SHUFFLE
- MOVL 32(SP), R9
- XORL 20(SP), R9
- XORL (SP), R9
- XORL 40(SP), R9
- ROLL $+1, R9
- MOVL R9, 32(SP)
-
- // FUNC3
- MOVL R10, R8
- ORL R11, R8
- ANDL R12, R8
- MOVL R10, R15
- ANDL R11, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 2400959708(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 32(SP), R9
- MOVL R9, 224(R8)
-
- // ROUND3(57)
- // SHUFFLE
- MOVL 36(SP), R9
- XORL 24(SP), R9
- XORL 4(SP), R9
- XORL 44(SP), R9
- ROLL $+1, R9
- MOVL R9, 36(SP)
-
- // FUNC3
- MOVL R14, R8
- ORL R10, R8
- ANDL R11, R8
- MOVL R14, R15
- ANDL R10, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 2400959708(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 36(SP), R9
- MOVL R9, 228(R8)
-
- // Load cs
- MOVQ cs_base+56(FP), R8
- MOVL R12, 20(R8)
- MOVL R13, 24(R8)
- MOVL R14, 28(R8)
- MOVL R10, 32(R8)
- MOVL R11, 36(R8)
-
- // ROUND3(58)
- // SHUFFLE
- MOVL 40(SP), R9
- XORL 28(SP), R9
- XORL 8(SP), R9
- XORL 48(SP), R9
- ROLL $+1, R9
- MOVL R9, 40(SP)
-
- // FUNC3
- MOVL R13, R8
- ORL R14, R8
- ANDL R10, R8
- MOVL R13, R15
- ANDL R14, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 2400959708(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 40(SP), R9
- MOVL R9, 232(R8)
-
- // ROUND3(59)
- // SHUFFLE
- MOVL 44(SP), R9
- XORL 32(SP), R9
- XORL 12(SP), R9
- XORL 52(SP), R9
- ROLL $+1, R9
- MOVL R9, 44(SP)
-
- // FUNC3
- MOVL R12, R8
- ORL R13, R8
- ANDL R14, R8
- MOVL R12, R15
- ANDL R13, R15
- ORL R8, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 2400959708(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 44(SP), R9
- MOVL R9, 236(R8)
-
- // ROUND4 (steps 60-79)
- // ROUND4(60)
- // SHUFFLE
- MOVL 48(SP), R9
- XORL 36(SP), R9
- XORL 16(SP), R9
- XORL 56(SP), R9
- ROLL $+1, R9
- MOVL R9, 48(SP)
-
- // FUNC2
- MOVL R11, R15
- XORL R12, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 3395469782(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 48(SP), R9
- MOVL R9, 240(R8)
-
- // ROUND4(61)
- // SHUFFLE
- MOVL 52(SP), R9
- XORL 40(SP), R9
- XORL 20(SP), R9
- XORL 60(SP), R9
- ROLL $+1, R9
- MOVL R9, 52(SP)
-
- // FUNC2
- MOVL R10, R15
- XORL R11, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 3395469782(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 52(SP), R9
- MOVL R9, 244(R8)
-
- // ROUND4(62)
- // SHUFFLE
- MOVL 56(SP), R9
- XORL 44(SP), R9
- XORL 24(SP), R9
- XORL (SP), R9
- ROLL $+1, R9
- MOVL R9, 56(SP)
-
- // FUNC2
- MOVL R14, R15
- XORL R10, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 3395469782(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 56(SP), R9
- MOVL R9, 248(R8)
-
- // ROUND4(63)
- // SHUFFLE
- MOVL 60(SP), R9
- XORL 48(SP), R9
- XORL 28(SP), R9
- XORL 4(SP), R9
- ROLL $+1, R9
- MOVL R9, 60(SP)
-
- // FUNC2
- MOVL R13, R15
- XORL R14, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 3395469782(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 60(SP), R9
- MOVL R9, 252(R8)
-
- // ROUND4(64)
- // SHUFFLE
- MOVL (SP), R9
- XORL 52(SP), R9
- XORL 32(SP), R9
- XORL 8(SP), R9
- ROLL $+1, R9
- MOVL R9, (SP)
-
- // FUNC2
- MOVL R12, R15
- XORL R13, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 3395469782(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL (SP), R9
- MOVL R9, 256(R8)
-
- // Load cs
- MOVQ cs_base+56(FP), R8
- MOVL R10, 40(R8)
- MOVL R11, 44(R8)
- MOVL R12, 48(R8)
- MOVL R13, 52(R8)
- MOVL R14, 56(R8)
-
- // ROUND4(65)
- // SHUFFLE
- MOVL 4(SP), R9
- XORL 56(SP), R9
- XORL 36(SP), R9
- XORL 12(SP), R9
- ROLL $+1, R9
- MOVL R9, 4(SP)
-
- // FUNC2
- MOVL R11, R15
- XORL R12, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 3395469782(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 4(SP), R9
- MOVL R9, 260(R8)
-
- // ROUND4(66)
- // SHUFFLE
- MOVL 8(SP), R9
- XORL 60(SP), R9
- XORL 40(SP), R9
- XORL 16(SP), R9
- ROLL $+1, R9
- MOVL R9, 8(SP)
-
- // FUNC2
- MOVL R10, R15
- XORL R11, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 3395469782(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 8(SP), R9
- MOVL R9, 264(R8)
-
- // ROUND4(67)
- // SHUFFLE
- MOVL 12(SP), R9
- XORL (SP), R9
- XORL 44(SP), R9
- XORL 20(SP), R9
- ROLL $+1, R9
- MOVL R9, 12(SP)
-
- // FUNC2
- MOVL R14, R15
- XORL R10, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 3395469782(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 12(SP), R9
- MOVL R9, 268(R8)
-
- // ROUND4(68)
- // SHUFFLE
- MOVL 16(SP), R9
- XORL 4(SP), R9
- XORL 48(SP), R9
- XORL 24(SP), R9
- ROLL $+1, R9
- MOVL R9, 16(SP)
-
- // FUNC2
- MOVL R13, R15
- XORL R14, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 3395469782(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 16(SP), R9
- MOVL R9, 272(R8)
-
- // ROUND4(69)
- // SHUFFLE
- MOVL 20(SP), R9
- XORL 8(SP), R9
- XORL 52(SP), R9
- XORL 28(SP), R9
- ROLL $+1, R9
- MOVL R9, 20(SP)
-
- // FUNC2
- MOVL R12, R15
- XORL R13, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 3395469782(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 20(SP), R9
- MOVL R9, 276(R8)
-
- // ROUND4(70)
- // SHUFFLE
- MOVL 24(SP), R9
- XORL 12(SP), R9
- XORL 56(SP), R9
- XORL 32(SP), R9
- ROLL $+1, R9
- MOVL R9, 24(SP)
-
- // FUNC2
- MOVL R11, R15
- XORL R12, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 3395469782(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 24(SP), R9
- MOVL R9, 280(R8)
-
- // ROUND4(71)
- // SHUFFLE
- MOVL 28(SP), R9
- XORL 16(SP), R9
- XORL 60(SP), R9
- XORL 36(SP), R9
- ROLL $+1, R9
- MOVL R9, 28(SP)
-
- // FUNC2
- MOVL R10, R15
- XORL R11, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 3395469782(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 28(SP), R9
- MOVL R9, 284(R8)
-
- // ROUND4(72)
- // SHUFFLE
- MOVL 32(SP), R9
- XORL 20(SP), R9
- XORL (SP), R9
- XORL 40(SP), R9
- ROLL $+1, R9
- MOVL R9, 32(SP)
-
- // FUNC2
- MOVL R14, R15
- XORL R10, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 3395469782(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 32(SP), R9
- MOVL R9, 288(R8)
-
- // ROUND4(73)
- // SHUFFLE
- MOVL 36(SP), R9
- XORL 24(SP), R9
- XORL 4(SP), R9
- XORL 44(SP), R9
- ROLL $+1, R9
- MOVL R9, 36(SP)
-
- // FUNC2
- MOVL R13, R15
- XORL R14, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 3395469782(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 36(SP), R9
- MOVL R9, 292(R8)
-
- // ROUND4(74)
- // SHUFFLE
- MOVL 40(SP), R9
- XORL 28(SP), R9
- XORL 8(SP), R9
- XORL 48(SP), R9
- ROLL $+1, R9
- MOVL R9, 40(SP)
-
- // FUNC2
- MOVL R12, R15
- XORL R13, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 3395469782(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 40(SP), R9
- MOVL R9, 296(R8)
-
- // ROUND4(75)
- // SHUFFLE
- MOVL 44(SP), R9
- XORL 32(SP), R9
- XORL 12(SP), R9
- XORL 52(SP), R9
- ROLL $+1, R9
- MOVL R9, 44(SP)
-
- // FUNC2
- MOVL R11, R15
- XORL R12, R15
- XORL R13, R15
-
- // MIX
- ROLL $+30, R11
- ADDL R15, R14
- MOVL R10, R8
- ROLL $+5, R8
- LEAL 3395469782(R14)(R9*1), R14
- ADDL R8, R14
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 44(SP), R9
- MOVL R9, 300(R8)
-
- // ROUND4(76)
- // SHUFFLE
- MOVL 48(SP), R9
- XORL 36(SP), R9
- XORL 16(SP), R9
- XORL 56(SP), R9
- ROLL $+1, R9
- MOVL R9, 48(SP)
-
- // FUNC2
- MOVL R10, R15
- XORL R11, R15
- XORL R12, R15
-
- // MIX
- ROLL $+30, R10
- ADDL R15, R13
- MOVL R14, R8
- ROLL $+5, R8
- LEAL 3395469782(R13)(R9*1), R13
- ADDL R8, R13
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 48(SP), R9
- MOVL R9, 304(R8)
-
- // ROUND4(77)
- // SHUFFLE
- MOVL 52(SP), R9
- XORL 40(SP), R9
- XORL 20(SP), R9
- XORL 60(SP), R9
- ROLL $+1, R9
- MOVL R9, 52(SP)
-
- // FUNC2
- MOVL R14, R15
- XORL R10, R15
- XORL R11, R15
-
- // MIX
- ROLL $+30, R14
- ADDL R15, R12
- MOVL R13, R8
- ROLL $+5, R8
- LEAL 3395469782(R12)(R9*1), R12
- ADDL R8, R12
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 52(SP), R9
- MOVL R9, 308(R8)
-
- // ROUND4(78)
- // SHUFFLE
- MOVL 56(SP), R9
- XORL 44(SP), R9
- XORL 24(SP), R9
- XORL (SP), R9
- ROLL $+1, R9
- MOVL R9, 56(SP)
-
- // FUNC2
- MOVL R13, R15
- XORL R14, R15
- XORL R10, R15
-
- // MIX
- ROLL $+30, R13
- ADDL R15, R11
- MOVL R12, R8
- ROLL $+5, R8
- LEAL 3395469782(R11)(R9*1), R11
- ADDL R8, R11
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 56(SP), R9
- MOVL R9, 312(R8)
-
- // ROUND4(79)
- // SHUFFLE
- MOVL 60(SP), R9
- XORL 48(SP), R9
- XORL 28(SP), R9
- XORL 4(SP), R9
- ROLL $+1, R9
- MOVL R9, 60(SP)
-
- // FUNC2
- MOVL R12, R15
- XORL R13, R15
- XORL R14, R15
-
- // MIX
- ROLL $+30, R12
- ADDL R15, R10
- MOVL R11, R8
- ROLL $+5, R8
- LEAL 3395469782(R10)(R9*1), R10
- ADDL R8, R10
-
- // Load m1
- MOVQ m1_base+32(FP), R8
- MOVL 60(SP), R9
- MOVL R9, 316(R8)
-
- // Add registers to temp hash.
- ADDL R10, AX
- ADDL R11, BX
- ADDL R12, CX
- ADDL R13, DX
- ADDL R14, BP
- ADDQ $+64, DI
- CMPQ DI, SI
- JB loop
-
-end:
- MOVQ dig+0(FP), SI
- MOVL AX, (SI)
- MOVL BX, 4(SI)
- MOVL CX, 8(SI)
- MOVL DX, 12(SI)
- MOVL BP, 16(SI)
- RET
diff --git a/vendor/github.com/pjbgf/sha1cd/sha1cdblock_generic.go b/vendor/github.com/pjbgf/sha1cd/sha1cdblock_generic.go
deleted file mode 100644
index ba8b96e87..000000000
--- a/vendor/github.com/pjbgf/sha1cd/sha1cdblock_generic.go
+++ /dev/null
@@ -1,268 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Originally from: https://github.com/go/blob/master/src/crypto/sha1/sha1block.go
-// It has been modified to support collision detection.
-
-package sha1cd
-
-import (
- "fmt"
- "math/bits"
-
- shared "github.com/pjbgf/sha1cd/internal"
- "github.com/pjbgf/sha1cd/ubc"
-)
-
-// blockGeneric is a portable, pure Go version of the SHA-1 block step.
-// It's used by sha1block_generic.go and tests.
-func blockGeneric(dig *digest, p []byte) {
- var w [16]uint32
-
- // cs stores the pre-step compression state for only the steps required for the
- // collision detection, which are 0, 58 and 65.
- // Refer to ubc/const.go for more details.
- cs := [shared.PreStepState][shared.WordBuffers]uint32{}
-
- h0, h1, h2, h3, h4 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4]
- for len(p) >= shared.Chunk {
- m1 := [shared.Rounds]uint32{}
- hi := 1
-
- // Collision attacks are thwarted by hashing a detected near-collision block 3 times.
- // Think of it as extending SHA-1 from 80-steps to 240-steps for such blocks:
- // The best collision attacks against SHA-1 have complexity about 2^60,
- // thus for 240-steps an immediate lower-bound for the best cryptanalytic attacks would be 2^180.
- // An attacker would be better off using a generic birthday search of complexity 2^80.
- rehash:
- a, b, c, d, e := h0, h1, h2, h3, h4
-
- // Each of the four 20-iteration rounds
- // differs only in the computation of f and
- // the choice of K (K0, K1, etc).
- i := 0
-
- // Store pre-step compression state for the collision detection.
- cs[0] = [shared.WordBuffers]uint32{a, b, c, d, e}
-
- for ; i < 16; i++ {
- // load step
- j := i * 4
- w[i] = uint32(p[j])<<24 | uint32(p[j+1])<<16 | uint32(p[j+2])<<8 | uint32(p[j+3])
-
- f := b&c | (^b)&d
- t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K0
- a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d
-
- // Store compression state for the collision detection.
- m1[i] = w[i&0xf]
- }
- for ; i < 20; i++ {
- tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
- w[i&0xf] = tmp<<1 | tmp>>(32-1)
-
- f := b&c | (^b)&d
- t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K0
- a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d
-
- // Store compression state for the collision detection.
- m1[i] = w[i&0xf]
- }
- for ; i < 40; i++ {
- tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
- w[i&0xf] = tmp<<1 | tmp>>(32-1)
-
- f := b ^ c ^ d
- t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K1
- a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d
-
- // Store compression state for the collision detection.
- m1[i] = w[i&0xf]
- }
- for ; i < 60; i++ {
- if i == 58 {
- // Store pre-step compression state for the collision detection.
- cs[1] = [shared.WordBuffers]uint32{a, b, c, d, e}
- }
-
- tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
- w[i&0xf] = tmp<<1 | tmp>>(32-1)
-
- f := ((b | c) & d) | (b & c)
- t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K2
- a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d
-
- // Store compression state for the collision detection.
- m1[i] = w[i&0xf]
- }
- for ; i < 80; i++ {
- if i == 65 {
- // Store pre-step compression state for the collision detection.
- cs[2] = [shared.WordBuffers]uint32{a, b, c, d, e}
- }
-
- tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf]
- w[i&0xf] = tmp<<1 | tmp>>(32-1)
-
- f := b ^ c ^ d
- t := bits.RotateLeft32(a, 5) + f + e + w[i&0xf] + shared.K3
- a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d
-
- // Store compression state for the collision detection.
- m1[i] = w[i&0xf]
- }
-
- h0 += a
- h1 += b
- h2 += c
- h3 += d
- h4 += e
-
- if hi == 2 {
- hi++
- goto rehash
- }
-
- if hi == 1 {
- col := checkCollision(m1, cs, [shared.WordBuffers]uint32{h0, h1, h2, h3, h4})
- if col {
- dig.col = true
- hi++
- goto rehash
- }
- }
-
- p = p[shared.Chunk:]
- }
-
- dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4] = h0, h1, h2, h3, h4
-}
-
-func checkCollision(
- m1 [shared.Rounds]uint32,
- cs [shared.PreStepState][shared.WordBuffers]uint32,
- state [shared.WordBuffers]uint32) bool {
-
- if mask := ubc.CalculateDvMask(m1); mask != 0 {
- dvs := ubc.SHA1_dvs()
-
- for i := 0; dvs[i].DvType != 0; i++ {
- if (mask & ((uint32)(1) << uint32(dvs[i].MaskB))) != 0 {
- var csState [shared.WordBuffers]uint32
- switch dvs[i].TestT {
- case 58:
- csState = cs[1]
- case 65:
- csState = cs[2]
- case 0:
- csState = cs[0]
- default:
- panic(fmt.Sprintf("dvs data is trying to use a testT that isn't available: %d", dvs[i].TestT))
- }
-
- col := hasCollided(
- dvs[i].TestT, // testT is the step number
- // m2 is a secondary message created XORing with
- // ubc's DM prior to the SHA recompression step.
- m1, dvs[i].Dm,
- csState,
- state)
-
- if col {
- return true
- }
- }
- }
- }
- return false
-}
-
-func hasCollided(step uint32, m1, dm [shared.Rounds]uint32,
- state [shared.WordBuffers]uint32, h [shared.WordBuffers]uint32) bool {
- // Intermediary Hash Value.
- ihv := [shared.WordBuffers]uint32{}
-
- a, b, c, d, e := state[0], state[1], state[2], state[3], state[4]
-
- // Walk backwards from current step to undo previous compression.
- // The existing collision detection does not have dvs higher than 65,
- // start value of i accordingly.
- for i := uint32(64); i >= 60; i-- {
- a, b, c, d, e = b, c, d, e, a
- if step > i {
- b = bits.RotateLeft32(b, -30)
- f := b ^ c ^ d
- e -= bits.RotateLeft32(a, 5) + f + shared.K3 + (m1[i] ^ dm[i]) // m2 = m1 ^ dm.
- }
- }
- for i := uint32(59); i >= 40; i-- {
- a, b, c, d, e = b, c, d, e, a
- if step > i {
- b = bits.RotateLeft32(b, -30)
- f := ((b | c) & d) | (b & c)
- e -= bits.RotateLeft32(a, 5) + f + shared.K2 + (m1[i] ^ dm[i])
- }
- }
- for i := uint32(39); i >= 20; i-- {
- a, b, c, d, e = b, c, d, e, a
- if step > i {
- b = bits.RotateLeft32(b, -30)
- f := b ^ c ^ d
- e -= bits.RotateLeft32(a, 5) + f + shared.K1 + (m1[i] ^ dm[i])
- }
- }
- for i := uint32(20); i > 0; i-- {
- j := i - 1
- a, b, c, d, e = b, c, d, e, a
- if step > j {
- b = bits.RotateLeft32(b, -30) // undo the rotate left
- f := b&c | (^b)&d
- // subtract from e
- e -= bits.RotateLeft32(a, 5) + f + shared.K0 + (m1[j] ^ dm[j])
- }
- }
-
- ihv[0] = a
- ihv[1] = b
- ihv[2] = c
- ihv[3] = d
- ihv[4] = e
- a = state[0]
- b = state[1]
- c = state[2]
- d = state[3]
- e = state[4]
-
- // Recompress blocks based on the current step.
- // The existing collision detection does not have dvs below 58, so they have been removed
- // from the source code. If new dvs are added which target rounds below 40, that logic
- // will need to be readded here.
- for i := uint32(40); i < 60; i++ {
- if step <= i {
- f := ((b | c) & d) | (b & c)
- t := bits.RotateLeft32(a, 5) + f + e + shared.K2 + (m1[i] ^ dm[i])
- a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d
- }
- }
- for i := uint32(60); i < 80; i++ {
- if step <= i {
- f := b ^ c ^ d
- t := bits.RotateLeft32(a, 5) + f + e + shared.K3 + (m1[i] ^ dm[i])
- a, b, c, d, e = t, a, bits.RotateLeft32(b, 30), c, d
- }
- }
-
- ihv[0] += a
- ihv[1] += b
- ihv[2] += c
- ihv[3] += d
- ihv[4] += e
-
- if ((ihv[0] ^ h[0]) | (ihv[1] ^ h[1]) |
- (ihv[2] ^ h[2]) | (ihv[3] ^ h[3]) | (ihv[4] ^ h[4])) == 0 {
- return true
- }
-
- return false
-}
diff --git a/vendor/github.com/pjbgf/sha1cd/sha1cdblock_noasm.go b/vendor/github.com/pjbgf/sha1cd/sha1cdblock_noasm.go
deleted file mode 100644
index 15bae5a7e..000000000
--- a/vendor/github.com/pjbgf/sha1cd/sha1cdblock_noasm.go
+++ /dev/null
@@ -1,8 +0,0 @@
-//go:build !amd64 || noasm || !gc
-// +build !amd64 noasm !gc
-
-package sha1cd
-
-func block(dig *digest, p []byte) {
- blockGeneric(dig, p)
-}
diff --git a/vendor/github.com/pjbgf/sha1cd/ubc/check.go b/vendor/github.com/pjbgf/sha1cd/ubc/check.go
deleted file mode 100644
index 167a5558f..000000000
--- a/vendor/github.com/pjbgf/sha1cd/ubc/check.go
+++ /dev/null
@@ -1,368 +0,0 @@
-// Based on the C implementation from Marc Stevens and Dan Shumow.
-// https://github.com/cr-marcstevens/sha1collisiondetection
-
-package ubc
-
-type DvInfo struct {
- // DvType, DvK and DvB define the DV: I(K,B) or II(K,B) (see the paper).
- // https://marc-stevens.nl/research/papers/C13-S.pdf
- DvType uint32
- DvK uint32
- DvB uint32
-
- // TestT is the step to do the recompression from for collision detection.
- TestT uint32
-
- // MaskI and MaskB define the bit to check for each DV in the dvmask returned by ubc_check.
- MaskI uint32
- MaskB uint32
-
- // Dm is the expanded message block XOR-difference defined by the DV.
- Dm [80]uint32
-}
-
-// CalculateDvMask takes as input an expanded message block and verifies the unavoidable bitconditions
-// for all listed DVs. It returns a dvmask where each bit belonging to a DV is set if all
-// unavoidable bitconditions for that DV have been met.
-// Thus, one needs to do the recompression check for each DV that has its bit set.
-func CalculateDvMask(W [80]uint32) uint32 {
- mask := uint32(0xFFFFFFFF)
- mask &= (((((W[44] ^ W[45]) >> 29) & 1) - 1) | ^(DV_I_48_0_bit | DV_I_51_0_bit | DV_I_52_0_bit | DV_II_45_0_bit | DV_II_46_0_bit | DV_II_50_0_bit | DV_II_51_0_bit))
- mask &= (((((W[49] ^ W[50]) >> 29) & 1) - 1) | ^(DV_I_46_0_bit | DV_II_45_0_bit | DV_II_50_0_bit | DV_II_51_0_bit | DV_II_55_0_bit | DV_II_56_0_bit))
- mask &= (((((W[48] ^ W[49]) >> 29) & 1) - 1) | ^(DV_I_45_0_bit | DV_I_52_0_bit | DV_II_49_0_bit | DV_II_50_0_bit | DV_II_54_0_bit | DV_II_55_0_bit))
- mask &= ((((W[47] ^ (W[50] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_47_0_bit | DV_I_49_0_bit | DV_I_51_0_bit | DV_II_45_0_bit | DV_II_51_0_bit | DV_II_56_0_bit))
- mask &= (((((W[47] ^ W[48]) >> 29) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_51_0_bit | DV_II_48_0_bit | DV_II_49_0_bit | DV_II_53_0_bit | DV_II_54_0_bit))
- mask &= (((((W[46] >> 4) ^ (W[49] >> 29)) & 1) - 1) | ^(DV_I_46_0_bit | DV_I_48_0_bit | DV_I_50_0_bit | DV_I_52_0_bit | DV_II_50_0_bit | DV_II_55_0_bit))
- mask &= (((((W[46] ^ W[47]) >> 29) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_50_0_bit | DV_II_47_0_bit | DV_II_48_0_bit | DV_II_52_0_bit | DV_II_53_0_bit))
- mask &= (((((W[45] >> 4) ^ (W[48] >> 29)) & 1) - 1) | ^(DV_I_45_0_bit | DV_I_47_0_bit | DV_I_49_0_bit | DV_I_51_0_bit | DV_II_49_0_bit | DV_II_54_0_bit))
- mask &= (((((W[45] ^ W[46]) >> 29) & 1) - 1) | ^(DV_I_49_0_bit | DV_I_52_0_bit | DV_II_46_0_bit | DV_II_47_0_bit | DV_II_51_0_bit | DV_II_52_0_bit))
- mask &= (((((W[44] >> 4) ^ (W[47] >> 29)) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_I_48_0_bit | DV_I_50_0_bit | DV_II_48_0_bit | DV_II_53_0_bit))
- mask &= (((((W[43] >> 4) ^ (W[46] >> 29)) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_I_47_0_bit | DV_I_49_0_bit | DV_II_47_0_bit | DV_II_52_0_bit))
- mask &= (((((W[43] ^ W[44]) >> 29) & 1) - 1) | ^(DV_I_47_0_bit | DV_I_50_0_bit | DV_I_51_0_bit | DV_II_45_0_bit | DV_II_49_0_bit | DV_II_50_0_bit))
- mask &= (((((W[42] >> 4) ^ (W[45] >> 29)) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_I_48_0_bit | DV_I_52_0_bit | DV_II_46_0_bit | DV_II_51_0_bit))
- mask &= (((((W[41] >> 4) ^ (W[44] >> 29)) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_I_47_0_bit | DV_I_51_0_bit | DV_II_45_0_bit | DV_II_50_0_bit))
- mask &= (((((W[40] ^ W[41]) >> 29) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_47_0_bit | DV_I_48_0_bit | DV_II_46_0_bit | DV_II_47_0_bit | DV_II_56_0_bit))
- mask &= (((((W[54] ^ W[55]) >> 29) & 1) - 1) | ^(DV_I_51_0_bit | DV_II_47_0_bit | DV_II_50_0_bit | DV_II_55_0_bit | DV_II_56_0_bit))
- mask &= (((((W[53] ^ W[54]) >> 29) & 1) - 1) | ^(DV_I_50_0_bit | DV_II_46_0_bit | DV_II_49_0_bit | DV_II_54_0_bit | DV_II_55_0_bit))
- mask &= (((((W[52] ^ W[53]) >> 29) & 1) - 1) | ^(DV_I_49_0_bit | DV_II_45_0_bit | DV_II_48_0_bit | DV_II_53_0_bit | DV_II_54_0_bit))
- mask &= ((((W[50] ^ (W[53] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_50_0_bit | DV_I_52_0_bit | DV_II_46_0_bit | DV_II_48_0_bit | DV_II_54_0_bit))
- mask &= (((((W[50] ^ W[51]) >> 29) & 1) - 1) | ^(DV_I_47_0_bit | DV_II_46_0_bit | DV_II_51_0_bit | DV_II_52_0_bit | DV_II_56_0_bit))
- mask &= ((((W[49] ^ (W[52] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_49_0_bit | DV_I_51_0_bit | DV_II_45_0_bit | DV_II_47_0_bit | DV_II_53_0_bit))
- mask &= ((((W[48] ^ (W[51] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_48_0_bit | DV_I_50_0_bit | DV_I_52_0_bit | DV_II_46_0_bit | DV_II_52_0_bit))
- mask &= (((((W[42] ^ W[43]) >> 29) & 1) - 1) | ^(DV_I_46_0_bit | DV_I_49_0_bit | DV_I_50_0_bit | DV_II_48_0_bit | DV_II_49_0_bit))
- mask &= (((((W[41] ^ W[42]) >> 29) & 1) - 1) | ^(DV_I_45_0_bit | DV_I_48_0_bit | DV_I_49_0_bit | DV_II_47_0_bit | DV_II_48_0_bit))
- mask &= (((((W[40] >> 4) ^ (W[43] >> 29)) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_I_50_0_bit | DV_II_49_0_bit | DV_II_56_0_bit))
- mask &= (((((W[39] >> 4) ^ (W[42] >> 29)) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_I_49_0_bit | DV_II_48_0_bit | DV_II_55_0_bit))
-
- if (mask & (DV_I_44_0_bit | DV_I_48_0_bit | DV_II_47_0_bit | DV_II_54_0_bit | DV_II_56_0_bit)) != 0 {
- mask &= (((((W[38] >> 4) ^ (W[41] >> 29)) & 1) - 1) | ^(DV_I_44_0_bit | DV_I_48_0_bit | DV_II_47_0_bit | DV_II_54_0_bit | DV_II_56_0_bit))
- }
- mask &= (((((W[37] >> 4) ^ (W[40] >> 29)) & 1) - 1) | ^(DV_I_43_0_bit | DV_I_47_0_bit | DV_II_46_0_bit | DV_II_53_0_bit | DV_II_55_0_bit))
- if (mask & (DV_I_52_0_bit | DV_II_48_0_bit | DV_II_51_0_bit | DV_II_56_0_bit)) != 0 {
- mask &= (((((W[55] ^ W[56]) >> 29) & 1) - 1) | ^(DV_I_52_0_bit | DV_II_48_0_bit | DV_II_51_0_bit | DV_II_56_0_bit))
- }
- if (mask & (DV_I_52_0_bit | DV_II_48_0_bit | DV_II_50_0_bit | DV_II_56_0_bit)) != 0 {
- mask &= ((((W[52] ^ (W[55] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_52_0_bit | DV_II_48_0_bit | DV_II_50_0_bit | DV_II_56_0_bit))
- }
- if (mask & (DV_I_51_0_bit | DV_II_47_0_bit | DV_II_49_0_bit | DV_II_55_0_bit)) != 0 {
- mask &= ((((W[51] ^ (W[54] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_51_0_bit | DV_II_47_0_bit | DV_II_49_0_bit | DV_II_55_0_bit))
- }
- if (mask & (DV_I_48_0_bit | DV_II_47_0_bit | DV_II_52_0_bit | DV_II_53_0_bit)) != 0 {
- mask &= (((((W[51] ^ W[52]) >> 29) & 1) - 1) | ^(DV_I_48_0_bit | DV_II_47_0_bit | DV_II_52_0_bit | DV_II_53_0_bit))
- }
- if (mask & (DV_I_46_0_bit | DV_I_49_0_bit | DV_II_45_0_bit | DV_II_48_0_bit)) != 0 {
- mask &= (((((W[36] >> 4) ^ (W[40] >> 29)) & 1) - 1) | ^(DV_I_46_0_bit | DV_I_49_0_bit | DV_II_45_0_bit | DV_II_48_0_bit))
- }
- if (mask & (DV_I_52_0_bit | DV_II_48_0_bit | DV_II_49_0_bit)) != 0 {
- mask &= ((0 - (((W[53] ^ W[56]) >> 29) & 1)) | ^(DV_I_52_0_bit | DV_II_48_0_bit | DV_II_49_0_bit))
- }
- if (mask & (DV_I_50_0_bit | DV_II_46_0_bit | DV_II_47_0_bit)) != 0 {
- mask &= ((0 - (((W[51] ^ W[54]) >> 29) & 1)) | ^(DV_I_50_0_bit | DV_II_46_0_bit | DV_II_47_0_bit))
- }
- if (mask & (DV_I_49_0_bit | DV_I_51_0_bit | DV_II_45_0_bit)) != 0 {
- mask &= ((0 - (((W[50] ^ W[52]) >> 29) & 1)) | ^(DV_I_49_0_bit | DV_I_51_0_bit | DV_II_45_0_bit))
- }
- if (mask & (DV_I_48_0_bit | DV_I_50_0_bit | DV_I_52_0_bit)) != 0 {
- mask &= ((0 - (((W[49] ^ W[51]) >> 29) & 1)) | ^(DV_I_48_0_bit | DV_I_50_0_bit | DV_I_52_0_bit))
- }
- if (mask & (DV_I_47_0_bit | DV_I_49_0_bit | DV_I_51_0_bit)) != 0 {
- mask &= ((0 - (((W[48] ^ W[50]) >> 29) & 1)) | ^(DV_I_47_0_bit | DV_I_49_0_bit | DV_I_51_0_bit))
- }
- if (mask & (DV_I_46_0_bit | DV_I_48_0_bit | DV_I_50_0_bit)) != 0 {
- mask &= ((0 - (((W[47] ^ W[49]) >> 29) & 1)) | ^(DV_I_46_0_bit | DV_I_48_0_bit | DV_I_50_0_bit))
- }
- if (mask & (DV_I_45_0_bit | DV_I_47_0_bit | DV_I_49_0_bit)) != 0 {
- mask &= ((0 - (((W[46] ^ W[48]) >> 29) & 1)) | ^(DV_I_45_0_bit | DV_I_47_0_bit | DV_I_49_0_bit))
- }
- mask &= ((((W[45] ^ W[47]) & (1 << 6)) - (1 << 6)) | ^(DV_I_47_2_bit | DV_I_49_2_bit | DV_I_51_2_bit))
- if (mask & (DV_I_44_0_bit | DV_I_46_0_bit | DV_I_48_0_bit)) != 0 {
- mask &= ((0 - (((W[45] ^ W[47]) >> 29) & 1)) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_I_48_0_bit))
- }
- mask &= (((((W[44] ^ W[46]) >> 6) & 1) - 1) | ^(DV_I_46_2_bit | DV_I_48_2_bit | DV_I_50_2_bit))
- if (mask & (DV_I_43_0_bit | DV_I_45_0_bit | DV_I_47_0_bit)) != 0 {
- mask &= ((0 - (((W[44] ^ W[46]) >> 29) & 1)) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_I_47_0_bit))
- }
- mask &= ((0 - ((W[41] ^ (W[42] >> 5)) & (1 << 1))) | ^(DV_I_48_2_bit | DV_II_46_2_bit | DV_II_51_2_bit))
- mask &= ((0 - ((W[40] ^ (W[41] >> 5)) & (1 << 1))) | ^(DV_I_47_2_bit | DV_I_51_2_bit | DV_II_50_2_bit))
- if (mask & (DV_I_44_0_bit | DV_I_46_0_bit | DV_II_56_0_bit)) != 0 {
- mask &= ((0 - (((W[40] ^ W[42]) >> 4) & 1)) | ^(DV_I_44_0_bit | DV_I_46_0_bit | DV_II_56_0_bit))
- }
- mask &= ((0 - ((W[39] ^ (W[40] >> 5)) & (1 << 1))) | ^(DV_I_46_2_bit | DV_I_50_2_bit | DV_II_49_2_bit))
- if (mask & (DV_I_43_0_bit | DV_I_45_0_bit | DV_II_55_0_bit)) != 0 {
- mask &= ((0 - (((W[39] ^ W[41]) >> 4) & 1)) | ^(DV_I_43_0_bit | DV_I_45_0_bit | DV_II_55_0_bit))
- }
- if (mask & (DV_I_44_0_bit | DV_II_54_0_bit | DV_II_56_0_bit)) != 0 {
- mask &= ((0 - (((W[38] ^ W[40]) >> 4) & 1)) | ^(DV_I_44_0_bit | DV_II_54_0_bit | DV_II_56_0_bit))
- }
- if (mask & (DV_I_43_0_bit | DV_II_53_0_bit | DV_II_55_0_bit)) != 0 {
- mask &= ((0 - (((W[37] ^ W[39]) >> 4) & 1)) | ^(DV_I_43_0_bit | DV_II_53_0_bit | DV_II_55_0_bit))
- }
- mask &= ((0 - ((W[36] ^ (W[37] >> 5)) & (1 << 1))) | ^(DV_I_47_2_bit | DV_I_50_2_bit | DV_II_46_2_bit))
- if (mask & (DV_I_45_0_bit | DV_I_48_0_bit | DV_II_47_0_bit)) != 0 {
- mask &= (((((W[35] >> 4) ^ (W[39] >> 29)) & 1) - 1) | ^(DV_I_45_0_bit | DV_I_48_0_bit | DV_II_47_0_bit))
- }
- if (mask & (DV_I_48_0_bit | DV_II_48_0_bit)) != 0 {
- mask &= ((0 - ((W[63] ^ (W[64] >> 5)) & (1 << 0))) | ^(DV_I_48_0_bit | DV_II_48_0_bit))
- }
- if (mask & (DV_I_45_0_bit | DV_II_45_0_bit)) != 0 {
- mask &= ((0 - ((W[63] ^ (W[64] >> 5)) & (1 << 1))) | ^(DV_I_45_0_bit | DV_II_45_0_bit))
- }
- if (mask & (DV_I_47_0_bit | DV_II_47_0_bit)) != 0 {
- mask &= ((0 - ((W[62] ^ (W[63] >> 5)) & (1 << 0))) | ^(DV_I_47_0_bit | DV_II_47_0_bit))
- }
- if (mask & (DV_I_46_0_bit | DV_II_46_0_bit)) != 0 {
- mask &= ((0 - ((W[61] ^ (W[62] >> 5)) & (1 << 0))) | ^(DV_I_46_0_bit | DV_II_46_0_bit))
- }
- mask &= ((0 - ((W[61] ^ (W[62] >> 5)) & (1 << 2))) | ^(DV_I_46_2_bit | DV_II_46_2_bit))
- if (mask & (DV_I_45_0_bit | DV_II_45_0_bit)) != 0 {
- mask &= ((0 - ((W[60] ^ (W[61] >> 5)) & (1 << 0))) | ^(DV_I_45_0_bit | DV_II_45_0_bit))
- }
- if (mask & (DV_II_51_0_bit | DV_II_54_0_bit)) != 0 {
- mask &= (((((W[58] ^ W[59]) >> 29) & 1) - 1) | ^(DV_II_51_0_bit | DV_II_54_0_bit))
- }
- if (mask & (DV_II_50_0_bit | DV_II_53_0_bit)) != 0 {
- mask &= (((((W[57] ^ W[58]) >> 29) & 1) - 1) | ^(DV_II_50_0_bit | DV_II_53_0_bit))
- }
- if (mask & (DV_II_52_0_bit | DV_II_54_0_bit)) != 0 {
- mask &= ((((W[56] ^ (W[59] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_II_52_0_bit | DV_II_54_0_bit))
- }
- if (mask & (DV_II_51_0_bit | DV_II_52_0_bit)) != 0 {
- mask &= ((0 - (((W[56] ^ W[59]) >> 29) & 1)) | ^(DV_II_51_0_bit | DV_II_52_0_bit))
- }
- if (mask & (DV_II_49_0_bit | DV_II_52_0_bit)) != 0 {
- mask &= (((((W[56] ^ W[57]) >> 29) & 1) - 1) | ^(DV_II_49_0_bit | DV_II_52_0_bit))
- }
- if (mask & (DV_II_51_0_bit | DV_II_53_0_bit)) != 0 {
- mask &= ((((W[55] ^ (W[58] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_II_51_0_bit | DV_II_53_0_bit))
- }
- if (mask & (DV_II_50_0_bit | DV_II_52_0_bit)) != 0 {
- mask &= ((((W[54] ^ (W[57] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_II_50_0_bit | DV_II_52_0_bit))
- }
- if (mask & (DV_II_49_0_bit | DV_II_51_0_bit)) != 0 {
- mask &= ((((W[53] ^ (W[56] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_II_49_0_bit | DV_II_51_0_bit))
- }
- mask &= ((((W[51] ^ (W[50] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_50_2_bit | DV_II_46_2_bit))
- mask &= ((((W[48] ^ W[50]) & (1 << 6)) - (1 << 6)) | ^(DV_I_50_2_bit | DV_II_46_2_bit))
- if (mask & (DV_I_51_0_bit | DV_I_52_0_bit)) != 0 {
- mask &= ((0 - (((W[48] ^ W[55]) >> 29) & 1)) | ^(DV_I_51_0_bit | DV_I_52_0_bit))
- }
- mask &= ((((W[47] ^ W[49]) & (1 << 6)) - (1 << 6)) | ^(DV_I_49_2_bit | DV_I_51_2_bit))
- mask &= ((((W[48] ^ (W[47] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_47_2_bit | DV_II_51_2_bit))
- mask &= ((((W[46] ^ W[48]) & (1 << 6)) - (1 << 6)) | ^(DV_I_48_2_bit | DV_I_50_2_bit))
- mask &= ((((W[47] ^ (W[46] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_46_2_bit | DV_II_50_2_bit))
- mask &= ((0 - ((W[44] ^ (W[45] >> 5)) & (1 << 1))) | ^(DV_I_51_2_bit | DV_II_49_2_bit))
- mask &= ((((W[43] ^ W[45]) & (1 << 6)) - (1 << 6)) | ^(DV_I_47_2_bit | DV_I_49_2_bit))
- mask &= (((((W[42] ^ W[44]) >> 6) & 1) - 1) | ^(DV_I_46_2_bit | DV_I_48_2_bit))
- mask &= ((((W[43] ^ (W[42] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_II_46_2_bit | DV_II_51_2_bit))
- mask &= ((((W[42] ^ (W[41] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_51_2_bit | DV_II_50_2_bit))
- mask &= ((((W[41] ^ (W[40] >> 5)) & (1 << 1)) - (1 << 1)) | ^(DV_I_50_2_bit | DV_II_49_2_bit))
- if (mask & (DV_I_52_0_bit | DV_II_51_0_bit)) != 0 {
- mask &= ((((W[39] ^ (W[43] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_52_0_bit | DV_II_51_0_bit))
- }
- if (mask & (DV_I_51_0_bit | DV_II_50_0_bit)) != 0 {
- mask &= ((((W[38] ^ (W[42] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_51_0_bit | DV_II_50_0_bit))
- }
- if (mask & (DV_I_48_2_bit | DV_I_51_2_bit)) != 0 {
- mask &= ((0 - ((W[37] ^ (W[38] >> 5)) & (1 << 1))) | ^(DV_I_48_2_bit | DV_I_51_2_bit))
- }
- if (mask & (DV_I_50_0_bit | DV_II_49_0_bit)) != 0 {
- mask &= ((((W[37] ^ (W[41] >> 25)) & (1 << 4)) - (1 << 4)) | ^(DV_I_50_0_bit | DV_II_49_0_bit))
- }
- if (mask & (DV_II_52_0_bit | DV_II_54_0_bit)) != 0 {
- mask &= ((0 - ((W[36] ^ W[38]) & (1 << 4))) | ^(DV_II_52_0_bit | DV_II_54_0_bit))
- }
- mask &= ((0 - ((W[35] ^ (W[36] >> 5)) & (1 << 1))) | ^(DV_I_46_2_bit | DV_I_49_2_bit))
- if (mask & (DV_I_51_0_bit | DV_II_47_0_bit)) != 0 {
- mask &= ((((W[35] ^ (W[39] >> 25)) & (1 << 3)) - (1 << 3)) | ^(DV_I_51_0_bit | DV_II_47_0_bit))
- }
-
- if mask != 0 {
- if (mask & DV_I_43_0_bit) != 0 {
- if not((W[61]^(W[62]>>5))&(1<<1)) != 0 ||
- not(not((W[59]^(W[63]>>25))&(1<<5))) != 0 ||
- not((W[58]^(W[63]>>30))&(1<<0)) != 0 {
- mask &= ^DV_I_43_0_bit
- }
- }
- if (mask & DV_I_44_0_bit) != 0 {
- if not((W[62]^(W[63]>>5))&(1<<1)) != 0 ||
- not(not((W[60]^(W[64]>>25))&(1<<5))) != 0 ||
- not((W[59]^(W[64]>>30))&(1<<0)) != 0 {
- mask &= ^DV_I_44_0_bit
- }
- }
- if (mask & DV_I_46_2_bit) != 0 {
- mask &= ((^((W[40] ^ W[42]) >> 2)) | ^DV_I_46_2_bit)
- }
- if (mask & DV_I_47_2_bit) != 0 {
- if not((W[62]^(W[63]>>5))&(1<<2)) != 0 ||
- not(not((W[41]^W[43])&(1<<6))) != 0 {
- mask &= ^DV_I_47_2_bit
- }
- }
- if (mask & DV_I_48_2_bit) != 0 {
- if not((W[63]^(W[64]>>5))&(1<<2)) != 0 ||
- not(not((W[48]^(W[49]<<5))&(1<<6))) != 0 {
- mask &= ^DV_I_48_2_bit
- }
- }
- if (mask & DV_I_49_2_bit) != 0 {
- if not(not((W[49]^(W[50]<<5))&(1<<6))) != 0 ||
- not((W[42]^W[50])&(1<<1)) != 0 ||
- not(not((W[39]^(W[40]<<5))&(1<<6))) != 0 ||
- not((W[38]^W[40])&(1<<1)) != 0 {
- mask &= ^DV_I_49_2_bit
- }
- }
- if (mask & DV_I_50_0_bit) != 0 {
- mask &= (((W[36] ^ W[37]) << 7) | ^DV_I_50_0_bit)
- }
- if (mask & DV_I_50_2_bit) != 0 {
- mask &= (((W[43] ^ W[51]) << 11) | ^DV_I_50_2_bit)
- }
- if (mask & DV_I_51_0_bit) != 0 {
- mask &= (((W[37] ^ W[38]) << 9) | ^DV_I_51_0_bit)
- }
- if (mask & DV_I_51_2_bit) != 0 {
- if not(not((W[51]^(W[52]<<5))&(1<<6))) != 0 ||
- not(not((W[49]^W[51])&(1<<6))) != 0 ||
- not(not((W[37]^(W[37]>>5))&(1<<1))) != 0 ||
- not(not((W[35]^(W[39]>>25))&(1<<5))) != 0 {
- mask &= ^DV_I_51_2_bit
- }
- }
- if (mask & DV_I_52_0_bit) != 0 {
- mask &= (((W[38] ^ W[39]) << 11) | ^DV_I_52_0_bit)
- }
- if (mask & DV_II_46_2_bit) != 0 {
- mask &= (((W[47] ^ W[51]) << 17) | ^DV_II_46_2_bit)
- }
- if (mask & DV_II_48_0_bit) != 0 {
- if not(not((W[36]^(W[40]>>25))&(1<<3))) != 0 ||
- not((W[35]^(W[40]<<2))&(1<<30)) != 0 {
- mask &= ^DV_II_48_0_bit
- }
- }
- if (mask & DV_II_49_0_bit) != 0 {
- if not(not((W[37]^(W[41]>>25))&(1<<3))) != 0 ||
- not((W[36]^(W[41]<<2))&(1<<30)) != 0 {
- mask &= ^DV_II_49_0_bit
- }
- }
- if (mask & DV_II_49_2_bit) != 0 {
- if not(not((W[53]^(W[54]<<5))&(1<<6))) != 0 ||
- not(not((W[51]^W[53])&(1<<6))) != 0 ||
- not((W[50]^W[54])&(1<<1)) != 0 ||
- not(not((W[45]^(W[46]<<5))&(1<<6))) != 0 ||
- not(not((W[37]^(W[41]>>25))&(1<<5))) != 0 ||
- not((W[36]^(W[41]>>30))&(1<<0)) != 0 {
- mask &= ^DV_II_49_2_bit
- }
- }
- if (mask & DV_II_50_0_bit) != 0 {
- if not((W[55]^W[58])&(1<<29)) != 0 ||
- not(not((W[38]^(W[42]>>25))&(1<<3))) != 0 ||
- not((W[37]^(W[42]<<2))&(1<<30)) != 0 {
- mask &= ^DV_II_50_0_bit
- }
- }
- if (mask & DV_II_50_2_bit) != 0 {
- if not(not((W[54]^(W[55]<<5))&(1<<6))) != 0 ||
- not(not((W[52]^W[54])&(1<<6))) != 0 ||
- not((W[51]^W[55])&(1<<1)) != 0 ||
- not((W[45]^W[47])&(1<<1)) != 0 ||
- not(not((W[38]^(W[42]>>25))&(1<<5))) != 0 ||
- not((W[37]^(W[42]>>30))&(1<<0)) != 0 {
- mask &= ^DV_II_50_2_bit
- }
- }
- if (mask & DV_II_51_0_bit) != 0 {
- if not(not((W[39]^(W[43]>>25))&(1<<3))) != 0 ||
- not((W[38]^(W[43]<<2))&(1<<30)) != 0 {
- mask &= ^DV_II_51_0_bit
- }
- }
- if (mask & DV_II_51_2_bit) != 0 {
- if not(not((W[55]^(W[56]<<5))&(1<<6))) != 0 ||
- not(not((W[53]^W[55])&(1<<6))) != 0 ||
- not((W[52]^W[56])&(1<<1)) != 0 ||
- not((W[46]^W[48])&(1<<1)) != 0 ||
- not(not((W[39]^(W[43]>>25))&(1<<5))) != 0 ||
- not((W[38]^(W[43]>>30))&(1<<0)) != 0 {
- mask &= ^DV_II_51_2_bit
- }
- }
- if (mask & DV_II_52_0_bit) != 0 {
- if not(not((W[59]^W[60])&(1<<29))) != 0 ||
- not(not((W[40]^(W[44]>>25))&(1<<3))) != 0 ||
- not(not((W[40]^(W[44]>>25))&(1<<4))) != 0 ||
- not((W[39]^(W[44]<<2))&(1<<30)) != 0 {
- mask &= ^DV_II_52_0_bit
- }
- }
- if (mask & DV_II_53_0_bit) != 0 {
- if not((W[58]^W[61])&(1<<29)) != 0 ||
- not(not((W[57]^(W[61]>>25))&(1<<4))) != 0 ||
- not(not((W[41]^(W[45]>>25))&(1<<3))) != 0 ||
- not(not((W[41]^(W[45]>>25))&(1<<4))) != 0 {
- mask &= ^DV_II_53_0_bit
- }
- }
- if (mask & DV_II_54_0_bit) != 0 {
- if not(not((W[58]^(W[62]>>25))&(1<<4))) != 0 ||
- not(not((W[42]^(W[46]>>25))&(1<<3))) != 0 ||
- not(not((W[42]^(W[46]>>25))&(1<<4))) != 0 {
- mask &= ^DV_II_54_0_bit
- }
- }
- if (mask & DV_II_55_0_bit) != 0 {
- if not(not((W[59]^(W[63]>>25))&(1<<4))) != 0 ||
- not(not((W[57]^(W[59]>>25))&(1<<4))) != 0 ||
- not(not((W[43]^(W[47]>>25))&(1<<3))) != 0 ||
- not(not((W[43]^(W[47]>>25))&(1<<4))) != 0 {
- mask &= ^DV_II_55_0_bit
- }
- }
- if (mask & DV_II_56_0_bit) != 0 {
- if not(not((W[60]^(W[64]>>25))&(1<<4))) != 0 ||
- not(not((W[44]^(W[48]>>25))&(1<<3))) != 0 ||
- not(not((W[44]^(W[48]>>25))&(1<<4))) != 0 {
- mask &= ^DV_II_56_0_bit
- }
- }
- }
-
- return mask
-}
-
-func not(x uint32) uint32 {
- if x == 0 {
- return 1
- }
-
- return 0
-}
-
-func SHA1_dvs() []DvInfo {
- return sha1_dvs
-}
diff --git a/vendor/github.com/pjbgf/sha1cd/ubc/const.go b/vendor/github.com/pjbgf/sha1cd/ubc/const.go
deleted file mode 100644
index eac14f466..000000000
--- a/vendor/github.com/pjbgf/sha1cd/ubc/const.go
+++ /dev/null
@@ -1,624 +0,0 @@
-// Based on the C implementation from Marc Stevens and Dan Shumow.
-// https://github.com/cr-marcstevens/sha1collisiondetection
-
-package ubc
-
-const (
- CheckSize = 80
-
- DV_I_43_0_bit = (uint32)(1 << 0)
- DV_I_44_0_bit = (uint32)(1 << 1)
- DV_I_45_0_bit = (uint32)(1 << 2)
- DV_I_46_0_bit = (uint32)(1 << 3)
- DV_I_46_2_bit = (uint32)(1 << 4)
- DV_I_47_0_bit = (uint32)(1 << 5)
- DV_I_47_2_bit = (uint32)(1 << 6)
- DV_I_48_0_bit = (uint32)(1 << 7)
- DV_I_48_2_bit = (uint32)(1 << 8)
- DV_I_49_0_bit = (uint32)(1 << 9)
- DV_I_49_2_bit = (uint32)(1 << 10)
- DV_I_50_0_bit = (uint32)(1 << 11)
- DV_I_50_2_bit = (uint32)(1 << 12)
- DV_I_51_0_bit = (uint32)(1 << 13)
- DV_I_51_2_bit = (uint32)(1 << 14)
- DV_I_52_0_bit = (uint32)(1 << 15)
- DV_II_45_0_bit = (uint32)(1 << 16)
- DV_II_46_0_bit = (uint32)(1 << 17)
- DV_II_46_2_bit = (uint32)(1 << 18)
- DV_II_47_0_bit = (uint32)(1 << 19)
- DV_II_48_0_bit = (uint32)(1 << 20)
- DV_II_49_0_bit = (uint32)(1 << 21)
- DV_II_49_2_bit = (uint32)(1 << 22)
- DV_II_50_0_bit = (uint32)(1 << 23)
- DV_II_50_2_bit = (uint32)(1 << 24)
- DV_II_51_0_bit = (uint32)(1 << 25)
- DV_II_51_2_bit = (uint32)(1 << 26)
- DV_II_52_0_bit = (uint32)(1 << 27)
- DV_II_53_0_bit = (uint32)(1 << 28)
- DV_II_54_0_bit = (uint32)(1 << 29)
- DV_II_55_0_bit = (uint32)(1 << 30)
- DV_II_56_0_bit = (uint32)(1 << 31)
-)
-
-// sha1_dvs contains a list of SHA-1 Disturbance Vectors (DV) which defines the
-// unavoidable bit conditions when a collision attack is in progress.
-var sha1_dvs = []DvInfo{
- {
- DvType: 1, DvK: 43, DvB: 0, TestT: 58, MaskI: 0, MaskB: 0,
- Dm: [CheckSize]uint32{
- 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000,
- 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010,
- 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000,
- 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018,
- 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000,
- 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010,
- 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040,
- 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009,
- 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408, 0x800000e6, 0x8000004c,
- 0x00000803, 0x80000161, 0x80000599},
- }, {
- DvType: 1, DvK: 44, DvB: 0, TestT: 58, MaskI: 0, MaskB: 1,
- Dm: [CheckSize]uint32{
- 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000,
- 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000,
- 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008,
- 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010,
- 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010,
- 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000,
- 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002,
- 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103,
- 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408, 0x800000e6,
- 0x8000004c, 0x00000803, 0x80000161},
- },
- {
- DvType: 1, DvK: 45, DvB: 0, TestT: 58, MaskI: 0, MaskB: 2,
- Dm: [CheckSize]uint32{
- 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010,
- 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014,
- 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010,
- 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000,
- 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000,
- 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010,
- 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000,
- 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001,
- 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049,
- 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164, 0x00000408,
- 0x800000e6, 0x8000004c, 0x00000803},
- },
- {
- DvType: 1, DvK: 46, DvB: 0, TestT: 58, MaskI: 0, MaskB: 3,
- Dm: [CheckSize]uint32{
- 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010,
- 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010,
- 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010,
- 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000,
- 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000,
- 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000,
- 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000,
- 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020,
- 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006,
- 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164,
- 0x00000408, 0x800000e6, 0x8000004c},
- },
- {
- DvType: 1, DvK: 46, DvB: 2, TestT: 58, MaskI: 0, MaskB: 4,
- Dm: [CheckSize]uint32{
- 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000, 0x60000032, 0x60000043,
- 0x20000040, 0xe0000042, 0x60000002, 0x80000001, 0x00000020, 0x00000003,
- 0x40000052, 0x40000040, 0xe0000052, 0xa0000000, 0x80000040, 0x20000001,
- 0x20000060, 0x80000001, 0x40000042, 0xc0000043, 0x40000022, 0x00000003,
- 0x40000042, 0xc0000043, 0xc0000022, 0x00000001, 0x40000002, 0xc0000043,
- 0x40000062, 0x80000001, 0x40000042, 0x40000042, 0x40000002, 0x00000002,
- 0x00000040, 0x80000002, 0x80000000, 0x80000002, 0x80000040, 0x00000000,
- 0x80000040, 0x80000000, 0x00000040, 0x80000000, 0x00000040, 0x80000002,
- 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000101,
- 0x00000009, 0x00000012, 0x00000202, 0x0000001a, 0x00000124, 0x0000040c,
- 0x00000026, 0x0000004a, 0x0000080a, 0x00000060, 0x00000590, 0x00001020,
- 0x0000039a, 0x00000132},
- },
- {
- DvType: 1, DvK: 47, DvB: 0, TestT: 58, MaskI: 0, MaskB: 5,
- Dm: [CheckSize]uint32{
- 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c,
- 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008,
- 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010,
- 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008,
- 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000,
- 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000,
- 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010,
- 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010,
- 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002,
- 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049,
- 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018, 0x00000164,
- 0x00000408, 0x800000e6},
- },
- {
- DvType: 1, DvK: 47, DvB: 2, TestT: 58, MaskI: 0, MaskB: 6,
- Dm: [CheckSize]uint32{
- 0x20000043, 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000, 0x60000032,
- 0x60000043, 0x20000040, 0xe0000042, 0x60000002, 0x80000001, 0x00000020,
- 0x00000003, 0x40000052, 0x40000040, 0xe0000052, 0xa0000000, 0x80000040,
- 0x20000001, 0x20000060, 0x80000001, 0x40000042, 0xc0000043, 0x40000022,
- 0x00000003, 0x40000042, 0xc0000043, 0xc0000022, 0x00000001, 0x40000002,
- 0xc0000043, 0x40000062, 0x80000001, 0x40000042, 0x40000042, 0x40000002,
- 0x00000002, 0x00000040, 0x80000002, 0x80000000, 0x80000002, 0x80000040,
- 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000000, 0x00000040,
- 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009,
- 0x00000101, 0x00000009, 0x00000012, 0x00000202, 0x0000001a, 0x00000124,
- 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a, 0x00000060, 0x00000590,
- 0x00001020, 0x0000039a,
- },
- },
- {
- DvType: 1, DvK: 48, DvB: 0, TestT: 58, MaskI: 0, MaskB: 7,
- Dm: [CheckSize]uint32{
- 0xb800000a, 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000,
- 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000, 0x60000000,
- 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014, 0x28000000,
- 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010, 0xf0000010,
- 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008, 0x40000000,
- 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010, 0x90000010,
- 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000, 0xa0000000,
- 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x20000000,
- 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001,
- 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080, 0x80000006,
- 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202, 0x00000018,
- 0x00000164, 0x00000408,
- },
- },
- {
- DvType: 1, DvK: 48, DvB: 2, TestT: 58, MaskI: 0, MaskB: 8,
- Dm: [CheckSize]uint32{
- 0xe000002a, 0x20000043, 0xb0000040, 0xd0000053, 0xd0000022, 0x20000000,
- 0x60000032, 0x60000043, 0x20000040, 0xe0000042, 0x60000002, 0x80000001,
- 0x00000020, 0x00000003, 0x40000052, 0x40000040, 0xe0000052, 0xa0000000,
- 0x80000040, 0x20000001, 0x20000060, 0x80000001, 0x40000042, 0xc0000043,
- 0x40000022, 0x00000003, 0x40000042, 0xc0000043, 0xc0000022, 0x00000001,
- 0x40000002, 0xc0000043, 0x40000062, 0x80000001, 0x40000042, 0x40000042,
- 0x40000002, 0x00000002, 0x00000040, 0x80000002, 0x80000000, 0x80000002,
- 0x80000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040, 0x80000000,
- 0x00000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080, 0x00000004,
- 0x00000009, 0x00000101, 0x00000009, 0x00000012, 0x00000202, 0x0000001a,
- 0x00000124, 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a, 0x00000060,
- 0x00000590, 0x00001020},
- },
- {
- DvType: 1, DvK: 49, DvB: 0, TestT: 58, MaskI: 0, MaskB: 9,
- Dm: [CheckSize]uint32{
- 0x18000000, 0xb800000a, 0xc8000010, 0x2c000010, 0xf4000014, 0xb4000008,
- 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010, 0x98000000,
- 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010, 0xb8000014,
- 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000, 0x90000010,
- 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010, 0xb0000008,
- 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000, 0x90000010,
- 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000, 0x20000000,
- 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010,
- 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020,
- 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004, 0x80000080,
- 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012, 0x80000202,
- 0x00000018, 0x00000164},
- },
- {
- DvType: 1, DvK: 49, DvB: 2, TestT: 58, MaskI: 0, MaskB: 10,
- Dm: [CheckSize]uint32{
- 0x60000000, 0xe000002a, 0x20000043, 0xb0000040, 0xd0000053, 0xd0000022,
- 0x20000000, 0x60000032, 0x60000043, 0x20000040, 0xe0000042, 0x60000002,
- 0x80000001, 0x00000020, 0x00000003, 0x40000052, 0x40000040, 0xe0000052,
- 0xa0000000, 0x80000040, 0x20000001, 0x20000060, 0x80000001, 0x40000042,
- 0xc0000043, 0x40000022, 0x00000003, 0x40000042, 0xc0000043, 0xc0000022,
- 0x00000001, 0x40000002, 0xc0000043, 0x40000062, 0x80000001, 0x40000042,
- 0x40000042, 0x40000002, 0x00000002, 0x00000040, 0x80000002, 0x80000000,
- 0x80000002, 0x80000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040,
- 0x80000000, 0x00000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080,
- 0x00000004, 0x00000009, 0x00000101, 0x00000009, 0x00000012, 0x00000202,
- 0x0000001a, 0x00000124, 0x0000040c, 0x00000026, 0x0000004a, 0x0000080a,
- 0x00000060, 0x00000590},
- },
- {
- DvType: 1, DvK: 50, DvB: 0, TestT: 65, MaskI: 0, MaskB: 11,
- Dm: [CheckSize]uint32{
- 0x0800000c, 0x18000000, 0xb800000a, 0xc8000010, 0x2c000010, 0xf4000014,
- 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010, 0xb8000010,
- 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014, 0x10000010,
- 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018, 0x60000000,
- 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010, 0xf0000010,
- 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018, 0x60000000,
- 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010, 0xa0000000,
- 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010, 0x20000000,
- 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000, 0x20000000,
- 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
- 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002, 0x80000004,
- 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009, 0x80000012,
- 0x80000202, 0x00000018,
- },
- },
- {
- DvType: 1, DvK: 50, DvB: 2, TestT: 65, MaskI: 0, MaskB: 12,
- Dm: [CheckSize]uint32{
- 0x20000030, 0x60000000, 0xe000002a, 0x20000043, 0xb0000040, 0xd0000053,
- 0xd0000022, 0x20000000, 0x60000032, 0x60000043, 0x20000040, 0xe0000042,
- 0x60000002, 0x80000001, 0x00000020, 0x00000003, 0x40000052, 0x40000040,
- 0xe0000052, 0xa0000000, 0x80000040, 0x20000001, 0x20000060, 0x80000001,
- 0x40000042, 0xc0000043, 0x40000022, 0x00000003, 0x40000042, 0xc0000043,
- 0xc0000022, 0x00000001, 0x40000002, 0xc0000043, 0x40000062, 0x80000001,
- 0x40000042, 0x40000042, 0x40000002, 0x00000002, 0x00000040, 0x80000002,
- 0x80000000, 0x80000002, 0x80000040, 0x00000000, 0x80000040, 0x80000000,
- 0x00000040, 0x80000000, 0x00000040, 0x80000002, 0x00000000, 0x80000000,
- 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
- 0x00000080, 0x00000004, 0x00000009, 0x00000101, 0x00000009, 0x00000012,
- 0x00000202, 0x0000001a, 0x00000124, 0x0000040c, 0x00000026, 0x0000004a,
- 0x0000080a, 0x00000060},
- },
- {
- DvType: 1, DvK: 51, DvB: 0, TestT: 65, MaskI: 0, MaskB: 13,
- Dm: [CheckSize]uint32{
- 0xe8000000, 0x0800000c, 0x18000000, 0xb800000a, 0xc8000010, 0x2c000010,
- 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010, 0x08000010,
- 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000, 0x90000014,
- 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000, 0x08000018,
- 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000, 0x90000010,
- 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010, 0x90000018,
- 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000, 0x00000010,
- 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000, 0x20000010,
- 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000, 0x00000000,
- 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040, 0x40000002,
- 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103, 0x80000009,
- 0x80000012, 0x80000202},
- },
- {
- DvType: 1, DvK: 51, DvB: 2, TestT: 65, MaskI: 0, MaskB: 14,
- Dm: [CheckSize]uint32{
- 0xa0000003, 0x20000030, 0x60000000, 0xe000002a, 0x20000043, 0xb0000040,
- 0xd0000053, 0xd0000022, 0x20000000, 0x60000032, 0x60000043, 0x20000040,
- 0xe0000042, 0x60000002, 0x80000001, 0x00000020, 0x00000003, 0x40000052,
- 0x40000040, 0xe0000052, 0xa0000000, 0x80000040, 0x20000001, 0x20000060,
- 0x80000001, 0x40000042, 0xc0000043, 0x40000022, 0x00000003, 0x40000042,
- 0xc0000043, 0xc0000022, 0x00000001, 0x40000002, 0xc0000043, 0x40000062,
- 0x80000001, 0x40000042, 0x40000042, 0x40000002, 0x00000002, 0x00000040,
- 0x80000002, 0x80000000, 0x80000002, 0x80000040, 0x00000000, 0x80000040,
- 0x80000000, 0x00000040, 0x80000000, 0x00000040, 0x80000002, 0x00000000,
- 0x80000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000101, 0x00000009,
- 0x00000012, 0x00000202, 0x0000001a, 0x00000124, 0x0000040c, 0x00000026,
- 0x0000004a, 0x0000080a},
- },
- {
- DvType: 1, DvK: 52, DvB: 0, TestT: 65, MaskI: 0, MaskB: 15,
- Dm: [CheckSize]uint32{
- 0x04000010, 0xe8000000, 0x0800000c, 0x18000000, 0xb800000a, 0xc8000010,
- 0x2c000010, 0xf4000014, 0xb4000008, 0x08000000, 0x9800000c, 0xd8000010,
- 0x08000010, 0xb8000010, 0x98000000, 0x60000000, 0x00000008, 0xc0000000,
- 0x90000014, 0x10000010, 0xb8000014, 0x28000000, 0x20000010, 0x48000000,
- 0x08000018, 0x60000000, 0x90000010, 0xf0000010, 0x90000008, 0xc0000000,
- 0x90000010, 0xf0000010, 0xb0000008, 0x40000000, 0x90000000, 0xf0000010,
- 0x90000018, 0x60000000, 0x90000010, 0x90000010, 0x90000000, 0x80000000,
- 0x00000010, 0xa0000000, 0x20000000, 0xa0000000, 0x20000010, 0x00000000,
- 0x20000010, 0x20000000, 0x00000010, 0x20000000, 0x00000010, 0xa0000000,
- 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000040,
- 0x40000002, 0x80000004, 0x80000080, 0x80000006, 0x00000049, 0x00000103,
- 0x80000009, 0x80000012},
- },
- {
- DvType: 2, DvK: 45, DvB: 0, TestT: 58, MaskI: 0, MaskB: 16,
- Dm: [CheckSize]uint32{
- 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018,
- 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014,
- 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c,
- 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000,
- 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010,
- 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000,
- 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010,
- 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010,
- 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022,
- 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089,
- 0x00000014, 0x8000024b, 0x0000011b, 0x8000016d, 0x8000041a, 0x000002e4,
- 0x80000054, 0x00000967},
- },
- {
- DvType: 2, DvK: 46, DvB: 0, TestT: 58, MaskI: 0, MaskB: 17,
- Dm: [CheckSize]uint32{
- 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004,
- 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010,
- 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010,
- 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000,
- 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000,
- 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000,
- 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000,
- 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000,
- 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000,
- 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041,
- 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107,
- 0x00000089, 0x00000014, 0x8000024b, 0x0000011b, 0x8000016d, 0x8000041a,
- 0x000002e4, 0x80000054},
- },
- {
- DvType: 2, DvK: 46, DvB: 2, TestT: 58, MaskI: 0, MaskB: 18,
- Dm: [CheckSize]uint32{
- 0x90000070, 0xb0000053, 0x30000008, 0x00000043, 0xd0000072, 0xb0000010,
- 0xf0000062, 0xc0000042, 0x00000030, 0xe0000042, 0x20000060, 0xe0000041,
- 0x20000050, 0xc0000041, 0xe0000072, 0xa0000003, 0xc0000012, 0x60000041,
- 0xc0000032, 0x20000001, 0xc0000002, 0xe0000042, 0x60000042, 0x80000002,
- 0x00000000, 0x00000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000,
- 0x80000040, 0x80000000, 0x00000040, 0x80000001, 0x00000060, 0x80000003,
- 0x40000002, 0xc0000040, 0xc0000002, 0x80000000, 0x80000000, 0x80000002,
- 0x00000040, 0x00000002, 0x80000000, 0x80000000, 0x80000000, 0x00000002,
- 0x00000040, 0x00000000, 0x80000040, 0x80000002, 0x00000000, 0x80000000,
- 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000105,
- 0x00000089, 0x00000016, 0x0000020b, 0x0000011b, 0x0000012d, 0x0000041e,
- 0x00000224, 0x00000050, 0x0000092e, 0x0000046c, 0x000005b6, 0x0000106a,
- 0x00000b90, 0x00000152},
- },
- {
- DvType: 2, DvK: 47, DvB: 0, TestT: 58, MaskI: 0, MaskB: 19,
- Dm: [CheckSize]uint32{
- 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c,
- 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018,
- 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004,
- 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010,
- 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010,
- 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018,
- 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000,
- 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000,
- 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000,
- 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002,
- 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b,
- 0x80000107, 0x00000089, 0x00000014, 0x8000024b, 0x0000011b, 0x8000016d,
- 0x8000041a, 0x000002e4},
- },
- {
- DvType: 2, DvK: 48, DvB: 0, TestT: 58, MaskI: 0, MaskB: 20,
- Dm: [CheckSize]uint32{
- 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010,
- 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010,
- 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000,
- 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010,
- 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000,
- 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000,
- 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000,
- 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000,
- 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000,
- 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001,
- 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046,
- 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b, 0x0000011b,
- 0x8000016d, 0x8000041a},
- },
- {
- DvType: 2, DvK: 49, DvB: 0, TestT: 58, MaskI: 0, MaskB: 21,
- Dm: [CheckSize]uint32{
- 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002,
- 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c,
- 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c,
- 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000,
- 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000,
- 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010,
- 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000,
- 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000,
- 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010,
- 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020,
- 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082,
- 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014, 0x8000024b,
- 0x0000011b, 0x8000016d},
- },
- {
- DvType: 2, DvK: 49, DvB: 2, TestT: 58, MaskI: 0, MaskB: 22,
- Dm: [CheckSize]uint32{
- 0xf0000010, 0xf000006a, 0x80000040, 0x90000070, 0xb0000053, 0x30000008,
- 0x00000043, 0xd0000072, 0xb0000010, 0xf0000062, 0xc0000042, 0x00000030,
- 0xe0000042, 0x20000060, 0xe0000041, 0x20000050, 0xc0000041, 0xe0000072,
- 0xa0000003, 0xc0000012, 0x60000041, 0xc0000032, 0x20000001, 0xc0000002,
- 0xe0000042, 0x60000042, 0x80000002, 0x00000000, 0x00000000, 0x80000000,
- 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000000, 0x00000040,
- 0x80000001, 0x00000060, 0x80000003, 0x40000002, 0xc0000040, 0xc0000002,
- 0x80000000, 0x80000000, 0x80000002, 0x00000040, 0x00000002, 0x80000000,
- 0x80000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040,
- 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000080,
- 0x00000004, 0x00000009, 0x00000105, 0x00000089, 0x00000016, 0x0000020b,
- 0x0000011b, 0x0000012d, 0x0000041e, 0x00000224, 0x00000050, 0x0000092e,
- 0x0000046c, 0x000005b6},
- },
- {
- DvType: 2, DvK: 50, DvB: 0, TestT: 65, MaskI: 0, MaskB: 23,
- Dm: [CheckSize]uint32{
- 0xb400001c, 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014,
- 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010,
- 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010,
- 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000,
- 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000,
- 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000,
- 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010,
- 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000,
- 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000,
- 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
- 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005,
- 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089, 0x00000014,
- 0x8000024b, 0x0000011b},
- },
- {
- DvType: 2, DvK: 50, DvB: 2, TestT: 65, MaskI: 0, MaskB: 24,
- Dm: [CheckSize]uint32{
- 0xd0000072, 0xf0000010, 0xf000006a, 0x80000040, 0x90000070, 0xb0000053,
- 0x30000008, 0x00000043, 0xd0000072, 0xb0000010, 0xf0000062, 0xc0000042,
- 0x00000030, 0xe0000042, 0x20000060, 0xe0000041, 0x20000050, 0xc0000041,
- 0xe0000072, 0xa0000003, 0xc0000012, 0x60000041, 0xc0000032, 0x20000001,
- 0xc0000002, 0xe0000042, 0x60000042, 0x80000002, 0x00000000, 0x00000000,
- 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040, 0x80000000,
- 0x00000040, 0x80000001, 0x00000060, 0x80000003, 0x40000002, 0xc0000040,
- 0xc0000002, 0x80000000, 0x80000000, 0x80000002, 0x00000040, 0x00000002,
- 0x80000000, 0x80000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000,
- 0x80000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
- 0x00000080, 0x00000004, 0x00000009, 0x00000105, 0x00000089, 0x00000016,
- 0x0000020b, 0x0000011b, 0x0000012d, 0x0000041e, 0x00000224, 0x00000050,
- 0x0000092e, 0x0000046c},
- },
- {
- DvType: 2, DvK: 51, DvB: 0, TestT: 65, MaskI: 0, MaskB: 25,
- Dm: [CheckSize]uint32{
- 0xc0000010, 0xb400001c, 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c,
- 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018,
- 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014,
- 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c,
- 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000,
- 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010,
- 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000,
- 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010,
- 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010,
- 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022,
- 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107, 0x00000089,
- 0x00000014, 0x8000024b},
- },
- {
- DvType: 2, DvK: 51, DvB: 2, TestT: 65, MaskI: 0, MaskB: 26,
- Dm: [CheckSize]uint32{
- 0x00000043, 0xd0000072, 0xf0000010, 0xf000006a, 0x80000040, 0x90000070,
- 0xb0000053, 0x30000008, 0x00000043, 0xd0000072, 0xb0000010, 0xf0000062,
- 0xc0000042, 0x00000030, 0xe0000042, 0x20000060, 0xe0000041, 0x20000050,
- 0xc0000041, 0xe0000072, 0xa0000003, 0xc0000012, 0x60000041, 0xc0000032,
- 0x20000001, 0xc0000002, 0xe0000042, 0x60000042, 0x80000002, 0x00000000,
- 0x00000000, 0x80000000, 0x00000002, 0x00000040, 0x00000000, 0x80000040,
- 0x80000000, 0x00000040, 0x80000001, 0x00000060, 0x80000003, 0x40000002,
- 0xc0000040, 0xc0000002, 0x80000000, 0x80000000, 0x80000002, 0x00000040,
- 0x00000002, 0x80000000, 0x80000000, 0x80000000, 0x00000002, 0x00000040,
- 0x00000000, 0x80000040, 0x80000002, 0x00000000, 0x80000000, 0x80000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000004, 0x00000080, 0x00000004, 0x00000009, 0x00000105, 0x00000089,
- 0x00000016, 0x0000020b, 0x0000011b, 0x0000012d, 0x0000041e, 0x00000224,
- 0x00000050, 0x0000092e},
- },
- {
- DvType: 2, DvK: 52, DvB: 0, TestT: 65, MaskI: 0, MaskB: 27,
- Dm: [CheckSize]uint32{
- 0x0c000002, 0xc0000010, 0xb400001c, 0x3c000004, 0xbc00001a, 0x20000010,
- 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004,
- 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018, 0x78000010,
- 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010,
- 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000,
- 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000,
- 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018, 0xe0000000,
- 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000, 0xa0000000,
- 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000, 0x80000000,
- 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000, 0x20000000,
- 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002, 0x40000041,
- 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b, 0x80000107,
- 0x00000089, 0x00000014},
- },
- {
- DvType: 2, DvK: 53, DvB: 0, TestT: 65, MaskI: 0, MaskB: 28,
- Dm: [CheckSize]uint32{
- 0xcc000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x3c000004, 0xbc00001a,
- 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010, 0xb400001c,
- 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010, 0x08000018,
- 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000, 0xb0000004,
- 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010, 0x98000010,
- 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000, 0x00000010,
- 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000, 0x00000018,
- 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000, 0x20000000,
- 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000, 0x20000000,
- 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000, 0x00000000,
- 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001, 0x40000002,
- 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046, 0x4000004b,
- 0x80000107, 0x00000089},
- },
- {
- DvType: 2, DvK: 54, DvB: 0, TestT: 65, MaskI: 0, MaskB: 29,
- Dm: [CheckSize]uint32{
- 0x0400001c, 0xcc000014, 0x0c000002, 0xc0000010, 0xb400001c, 0x3c000004,
- 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002, 0xc0000010,
- 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c, 0xb8000010,
- 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c, 0xe8000000,
- 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000, 0xb8000010,
- 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000, 0x80000000,
- 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010, 0x60000000,
- 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000, 0x20000000,
- 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000, 0x20000000,
- 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0xa0000000,
- 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020, 0x00000001,
- 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082, 0xc0000046,
- 0x4000004b, 0x80000107},
- },
- {
- DvType: 2, DvK: 55, DvB: 0, TestT: 65, MaskI: 0, MaskB: 30,
- Dm: [CheckSize]uint32{
- 0x00000010, 0x0400001c, 0xcc000014, 0x0c000002, 0xc0000010, 0xb400001c,
- 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014, 0x0c000002,
- 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010, 0x0000000c,
- 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010, 0xb800001c,
- 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000, 0xb0000000,
- 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000, 0x20000000,
- 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000, 0x00000010,
- 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010, 0xb0000000,
- 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000, 0x20000000,
- 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010,
- 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000020,
- 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005, 0xc0000082,
- 0xc0000046, 0x4000004b},
- },
- {
- DvType: 2, DvK: 56, DvB: 0, TestT: 65, MaskI: 0, MaskB: 31,
- Dm: [CheckSize]uint32{
- 0x2600001a, 0x00000010, 0x0400001c, 0xcc000014, 0x0c000002, 0xc0000010,
- 0xb400001c, 0x3c000004, 0xbc00001a, 0x20000010, 0x2400001c, 0xec000014,
- 0x0c000002, 0xc0000010, 0xb400001c, 0x2c000004, 0xbc000018, 0xb0000010,
- 0x0000000c, 0xb8000010, 0x08000018, 0x78000010, 0x08000014, 0x70000010,
- 0xb800001c, 0xe8000000, 0xb0000004, 0x58000010, 0xb000000c, 0x48000000,
- 0xb0000000, 0xb8000010, 0x98000010, 0xa0000000, 0x00000000, 0x00000000,
- 0x20000000, 0x80000000, 0x00000010, 0x00000000, 0x20000010, 0x20000000,
- 0x00000010, 0x60000000, 0x00000018, 0xe0000000, 0x90000000, 0x30000010,
- 0xb0000000, 0x20000000, 0x20000000, 0xa0000000, 0x00000010, 0x80000000,
- 0x20000000, 0x20000000, 0x20000000, 0x80000000, 0x00000010, 0x00000000,
- 0x20000010, 0xa0000000, 0x00000000, 0x20000000, 0x20000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
- 0x00000020, 0x00000001, 0x40000002, 0x40000041, 0x40000022, 0x80000005,
- 0xc0000082, 0xc0000046},
- },
- {
- DvType: 0, DvK: 0, DvB: 0, TestT: 0, MaskI: 0, MaskB: 0,
- Dm: [CheckSize]uint32{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0},
- },
-}
diff --git a/vendor/github.com/pjbgf/sha1cd/ubc/doc.go b/vendor/github.com/pjbgf/sha1cd/ubc/doc.go
deleted file mode 100644
index 0090e36b9..000000000
--- a/vendor/github.com/pjbgf/sha1cd/ubc/doc.go
+++ /dev/null
@@ -1,3 +0,0 @@
-// ubc package provides ways for SHA1 blocks to be checked for
-// Unavoidable Bit Conditions that arise from crypto analysis attacks.
-package ubc
diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/github.com/pmezard/go-difflib/LICENSE
deleted file mode 100644
index c67dad612..000000000
--- a/vendor/github.com/pmezard/go-difflib/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2013, Patrick Mezard
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
- The names of its contributors may not be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go
deleted file mode 100644
index 003e99fad..000000000
--- a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go
+++ /dev/null
@@ -1,772 +0,0 @@
-// Package difflib is a partial port of Python difflib module.
-//
-// It provides tools to compare sequences of strings and generate textual diffs.
-//
-// The following class and functions have been ported:
-//
-// - SequenceMatcher
-//
-// - unified_diff
-//
-// - context_diff
-//
-// Getting unified diffs was the main goal of the port. Keep in mind this code
-// is mostly suitable to output text differences in a human friendly way, there
-// are no guarantees generated diffs are consumable by patch(1).
-package difflib
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strings"
-)
-
-func min(a, b int) int {
- if a < b {
- return a
- }
- return b
-}
-
-func max(a, b int) int {
- if a > b {
- return a
- }
- return b
-}
-
-func calculateRatio(matches, length int) float64 {
- if length > 0 {
- return 2.0 * float64(matches) / float64(length)
- }
- return 1.0
-}
-
-type Match struct {
- A int
- B int
- Size int
-}
-
-type OpCode struct {
- Tag byte
- I1 int
- I2 int
- J1 int
- J2 int
-}
-
-// SequenceMatcher compares sequence of strings. The basic
-// algorithm predates, and is a little fancier than, an algorithm
-// published in the late 1980's by Ratcliff and Obershelp under the
-// hyperbolic name "gestalt pattern matching". The basic idea is to find
-// the longest contiguous matching subsequence that contains no "junk"
-// elements (R-O doesn't address junk). The same idea is then applied
-// recursively to the pieces of the sequences to the left and to the right
-// of the matching subsequence. This does not yield minimal edit
-// sequences, but does tend to yield matches that "look right" to people.
-//
-// SequenceMatcher tries to compute a "human-friendly diff" between two
-// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the
-// longest *contiguous* & junk-free matching subsequence. That's what
-// catches peoples' eyes. The Windows(tm) windiff has another interesting
-// notion, pairing up elements that appear uniquely in each sequence.
-// That, and the method here, appear to yield more intuitive difference
-// reports than does diff. This method appears to be the least vulnerable
-// to synching up on blocks of "junk lines", though (like blank lines in
-// ordinary text files, or maybe "" lines in HTML files). That may be
-// because this is the only method of the 3 that has a *concept* of
-// "junk" .
-//
-// Timing: Basic R-O is cubic time worst case and quadratic time expected
-// case. SequenceMatcher is quadratic time for the worst case and has
-// expected-case behavior dependent in a complicated way on how many
-// elements the sequences have in common; best case time is linear.
-type SequenceMatcher struct {
- a []string
- b []string
- b2j map[string][]int
- IsJunk func(string) bool
- autoJunk bool
- bJunk map[string]struct{}
- matchingBlocks []Match
- fullBCount map[string]int
- bPopular map[string]struct{}
- opCodes []OpCode
-}
-
-func NewMatcher(a, b []string) *SequenceMatcher {
- m := SequenceMatcher{autoJunk: true}
- m.SetSeqs(a, b)
- return &m
-}
-
-func NewMatcherWithJunk(a, b []string, autoJunk bool,
- isJunk func(string) bool) *SequenceMatcher {
-
- m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk}
- m.SetSeqs(a, b)
- return &m
-}
-
-// Set two sequences to be compared.
-func (m *SequenceMatcher) SetSeqs(a, b []string) {
- m.SetSeq1(a)
- m.SetSeq2(b)
-}
-
-// Set the first sequence to be compared. The second sequence to be compared is
-// not changed.
-//
-// SequenceMatcher computes and caches detailed information about the second
-// sequence, so if you want to compare one sequence S against many sequences,
-// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other
-// sequences.
-//
-// See also SetSeqs() and SetSeq2().
-func (m *SequenceMatcher) SetSeq1(a []string) {
- if &a == &m.a {
- return
- }
- m.a = a
- m.matchingBlocks = nil
- m.opCodes = nil
-}
-
-// Set the second sequence to be compared. The first sequence to be compared is
-// not changed.
-func (m *SequenceMatcher) SetSeq2(b []string) {
- if &b == &m.b {
- return
- }
- m.b = b
- m.matchingBlocks = nil
- m.opCodes = nil
- m.fullBCount = nil
- m.chainB()
-}
-
-func (m *SequenceMatcher) chainB() {
- // Populate line -> index mapping
- b2j := map[string][]int{}
- for i, s := range m.b {
- indices := b2j[s]
- indices = append(indices, i)
- b2j[s] = indices
- }
-
- // Purge junk elements
- m.bJunk = map[string]struct{}{}
- if m.IsJunk != nil {
- junk := m.bJunk
- for s, _ := range b2j {
- if m.IsJunk(s) {
- junk[s] = struct{}{}
- }
- }
- for s, _ := range junk {
- delete(b2j, s)
- }
- }
-
- // Purge remaining popular elements
- popular := map[string]struct{}{}
- n := len(m.b)
- if m.autoJunk && n >= 200 {
- ntest := n/100 + 1
- for s, indices := range b2j {
- if len(indices) > ntest {
- popular[s] = struct{}{}
- }
- }
- for s, _ := range popular {
- delete(b2j, s)
- }
- }
- m.bPopular = popular
- m.b2j = b2j
-}
-
-func (m *SequenceMatcher) isBJunk(s string) bool {
- _, ok := m.bJunk[s]
- return ok
-}
-
-// Find longest matching block in a[alo:ahi] and b[blo:bhi].
-//
-// If IsJunk is not defined:
-//
-// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
-// alo <= i <= i+k <= ahi
-// blo <= j <= j+k <= bhi
-// and for all (i',j',k') meeting those conditions,
-// k >= k'
-// i <= i'
-// and if i == i', j <= j'
-//
-// In other words, of all maximal matching blocks, return one that
-// starts earliest in a, and of all those maximal matching blocks that
-// start earliest in a, return the one that starts earliest in b.
-//
-// If IsJunk is defined, first the longest matching block is
-// determined as above, but with the additional restriction that no
-// junk element appears in the block. Then that block is extended as
-// far as possible by matching (only) junk elements on both sides. So
-// the resulting block never matches on junk except as identical junk
-// happens to be adjacent to an "interesting" match.
-//
-// If no blocks match, return (alo, blo, 0).
-func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match {
- // CAUTION: stripping common prefix or suffix would be incorrect.
- // E.g.,
- // ab
- // acab
- // Longest matching block is "ab", but if common prefix is
- // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so
- // strip, so ends up claiming that ab is changed to acab by
- // inserting "ca" in the middle. That's minimal but unintuitive:
- // "it's obvious" that someone inserted "ac" at the front.
- // Windiff ends up at the same place as diff, but by pairing up
- // the unique 'b's and then matching the first two 'a's.
- besti, bestj, bestsize := alo, blo, 0
-
- // find longest junk-free match
- // during an iteration of the loop, j2len[j] = length of longest
- // junk-free match ending with a[i-1] and b[j]
- j2len := map[int]int{}
- for i := alo; i != ahi; i++ {
- // look at all instances of a[i] in b; note that because
- // b2j has no junk keys, the loop is skipped if a[i] is junk
- newj2len := map[int]int{}
- for _, j := range m.b2j[m.a[i]] {
- // a[i] matches b[j]
- if j < blo {
- continue
- }
- if j >= bhi {
- break
- }
- k := j2len[j-1] + 1
- newj2len[j] = k
- if k > bestsize {
- besti, bestj, bestsize = i-k+1, j-k+1, k
- }
- }
- j2len = newj2len
- }
-
- // Extend the best by non-junk elements on each end. In particular,
- // "popular" non-junk elements aren't in b2j, which greatly speeds
- // the inner loop above, but also means "the best" match so far
- // doesn't contain any junk *or* popular non-junk elements.
- for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) &&
- m.a[besti-1] == m.b[bestj-1] {
- besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
- }
- for besti+bestsize < ahi && bestj+bestsize < bhi &&
- !m.isBJunk(m.b[bestj+bestsize]) &&
- m.a[besti+bestsize] == m.b[bestj+bestsize] {
- bestsize += 1
- }
-
- // Now that we have a wholly interesting match (albeit possibly
- // empty!), we may as well suck up the matching junk on each
- // side of it too. Can't think of a good reason not to, and it
- // saves post-processing the (possibly considerable) expense of
- // figuring out what to do with it. In the case of an empty
- // interesting match, this is clearly the right thing to do,
- // because no other kind of match is possible in the regions.
- for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) &&
- m.a[besti-1] == m.b[bestj-1] {
- besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
- }
- for besti+bestsize < ahi && bestj+bestsize < bhi &&
- m.isBJunk(m.b[bestj+bestsize]) &&
- m.a[besti+bestsize] == m.b[bestj+bestsize] {
- bestsize += 1
- }
-
- return Match{A: besti, B: bestj, Size: bestsize}
-}
-
-// Return list of triples describing matching subsequences.
-//
-// Each triple is of the form (i, j, n), and means that
-// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in
-// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are
-// adjacent triples in the list, and the second is not the last triple in the
-// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe
-// adjacent equal blocks.
-//
-// The last triple is a dummy, (len(a), len(b), 0), and is the only
-// triple with n==0.
-func (m *SequenceMatcher) GetMatchingBlocks() []Match {
- if m.matchingBlocks != nil {
- return m.matchingBlocks
- }
-
- var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match
- matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match {
- match := m.findLongestMatch(alo, ahi, blo, bhi)
- i, j, k := match.A, match.B, match.Size
- if match.Size > 0 {
- if alo < i && blo < j {
- matched = matchBlocks(alo, i, blo, j, matched)
- }
- matched = append(matched, match)
- if i+k < ahi && j+k < bhi {
- matched = matchBlocks(i+k, ahi, j+k, bhi, matched)
- }
- }
- return matched
- }
- matched := matchBlocks(0, len(m.a), 0, len(m.b), nil)
-
- // It's possible that we have adjacent equal blocks in the
- // matching_blocks list now.
- nonAdjacent := []Match{}
- i1, j1, k1 := 0, 0, 0
- for _, b := range matched {
- // Is this block adjacent to i1, j1, k1?
- i2, j2, k2 := b.A, b.B, b.Size
- if i1+k1 == i2 && j1+k1 == j2 {
- // Yes, so collapse them -- this just increases the length of
- // the first block by the length of the second, and the first
- // block so lengthened remains the block to compare against.
- k1 += k2
- } else {
- // Not adjacent. Remember the first block (k1==0 means it's
- // the dummy we started with), and make the second block the
- // new block to compare against.
- if k1 > 0 {
- nonAdjacent = append(nonAdjacent, Match{i1, j1, k1})
- }
- i1, j1, k1 = i2, j2, k2
- }
- }
- if k1 > 0 {
- nonAdjacent = append(nonAdjacent, Match{i1, j1, k1})
- }
-
- nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0})
- m.matchingBlocks = nonAdjacent
- return m.matchingBlocks
-}
-
-// Return list of 5-tuples describing how to turn a into b.
-//
-// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple
-// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
-// tuple preceding it, and likewise for j1 == the previous j2.
-//
-// The tags are characters, with these meanings:
-//
-// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2]
-//
-// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case.
-//
-// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case.
-//
-// 'e' (equal): a[i1:i2] == b[j1:j2]
-func (m *SequenceMatcher) GetOpCodes() []OpCode {
- if m.opCodes != nil {
- return m.opCodes
- }
- i, j := 0, 0
- matching := m.GetMatchingBlocks()
- opCodes := make([]OpCode, 0, len(matching))
- for _, m := range matching {
- // invariant: we've pumped out correct diffs to change
- // a[:i] into b[:j], and the next matching block is
- // a[ai:ai+size] == b[bj:bj+size]. So we need to pump
- // out a diff to change a[i:ai] into b[j:bj], pump out
- // the matching block, and move (i,j) beyond the match
- ai, bj, size := m.A, m.B, m.Size
- tag := byte(0)
- if i < ai && j < bj {
- tag = 'r'
- } else if i < ai {
- tag = 'd'
- } else if j < bj {
- tag = 'i'
- }
- if tag > 0 {
- opCodes = append(opCodes, OpCode{tag, i, ai, j, bj})
- }
- i, j = ai+size, bj+size
- // the list of matching blocks is terminated by a
- // sentinel with size 0
- if size > 0 {
- opCodes = append(opCodes, OpCode{'e', ai, i, bj, j})
- }
- }
- m.opCodes = opCodes
- return m.opCodes
-}
-
-// Isolate change clusters by eliminating ranges with no changes.
-//
-// Return a generator of groups with up to n lines of context.
-// Each group is in the same format as returned by GetOpCodes().
-func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
- if n < 0 {
- n = 3
- }
- codes := m.GetOpCodes()
- if len(codes) == 0 {
- codes = []OpCode{OpCode{'e', 0, 1, 0, 1}}
- }
- // Fixup leading and trailing groups if they show no changes.
- if codes[0].Tag == 'e' {
- c := codes[0]
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2}
- }
- if codes[len(codes)-1].Tag == 'e' {
- c := codes[len(codes)-1]
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)}
- }
- nn := n + n
- groups := [][]OpCode{}
- group := []OpCode{}
- for _, c := range codes {
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- // End the current group and start a new one whenever
- // there is a large range with no changes.
- if c.Tag == 'e' && i2-i1 > nn {
- group = append(group, OpCode{c.Tag, i1, min(i2, i1+n),
- j1, min(j2, j1+n)})
- groups = append(groups, group)
- group = []OpCode{}
- i1, j1 = max(i1, i2-n), max(j1, j2-n)
- }
- group = append(group, OpCode{c.Tag, i1, i2, j1, j2})
- }
- if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') {
- groups = append(groups, group)
- }
- return groups
-}
-
-// Return a measure of the sequences' similarity (float in [0,1]).
-//
-// Where T is the total number of elements in both sequences, and
-// M is the number of matches, this is 2.0*M / T.
-// Note that this is 1 if the sequences are identical, and 0 if
-// they have nothing in common.
-//
-// .Ratio() is expensive to compute if you haven't already computed
-// .GetMatchingBlocks() or .GetOpCodes(), in which case you may
-// want to try .QuickRatio() or .RealQuickRation() first to get an
-// upper bound.
-func (m *SequenceMatcher) Ratio() float64 {
- matches := 0
- for _, m := range m.GetMatchingBlocks() {
- matches += m.Size
- }
- return calculateRatio(matches, len(m.a)+len(m.b))
-}
-
-// Return an upper bound on ratio() relatively quickly.
-//
-// This isn't defined beyond that it is an upper bound on .Ratio(), and
-// is faster to compute.
-func (m *SequenceMatcher) QuickRatio() float64 {
- // viewing a and b as multisets, set matches to the cardinality
- // of their intersection; this counts the number of matches
- // without regard to order, so is clearly an upper bound
- if m.fullBCount == nil {
- m.fullBCount = map[string]int{}
- for _, s := range m.b {
- m.fullBCount[s] = m.fullBCount[s] + 1
- }
- }
-
- // avail[x] is the number of times x appears in 'b' less the
- // number of times we've seen it in 'a' so far ... kinda
- avail := map[string]int{}
- matches := 0
- for _, s := range m.a {
- n, ok := avail[s]
- if !ok {
- n = m.fullBCount[s]
- }
- avail[s] = n - 1
- if n > 0 {
- matches += 1
- }
- }
- return calculateRatio(matches, len(m.a)+len(m.b))
-}
-
-// Return an upper bound on ratio() very quickly.
-//
-// This isn't defined beyond that it is an upper bound on .Ratio(), and
-// is faster to compute than either .Ratio() or .QuickRatio().
-func (m *SequenceMatcher) RealQuickRatio() float64 {
- la, lb := len(m.a), len(m.b)
- return calculateRatio(min(la, lb), la+lb)
-}
-
-// Convert range to the "ed" format
-func formatRangeUnified(start, stop int) string {
- // Per the diff spec at http://www.unix.org/single_unix_specification/
- beginning := start + 1 // lines start numbering with one
- length := stop - start
- if length == 1 {
- return fmt.Sprintf("%d", beginning)
- }
- if length == 0 {
- beginning -= 1 // empty ranges begin at line just before the range
- }
- return fmt.Sprintf("%d,%d", beginning, length)
-}
-
-// Unified diff parameters
-type UnifiedDiff struct {
- A []string // First sequence lines
- FromFile string // First file name
- FromDate string // First file time
- B []string // Second sequence lines
- ToFile string // Second file name
- ToDate string // Second file time
- Eol string // Headers end of line, defaults to LF
- Context int // Number of context lines
-}
-
-// Compare two sequences of lines; generate the delta as a unified diff.
-//
-// Unified diffs are a compact way of showing line changes and a few
-// lines of context. The number of context lines is set by 'n' which
-// defaults to three.
-//
-// By default, the diff control lines (those with ---, +++, or @@) are
-// created with a trailing newline. This is helpful so that inputs
-// created from file.readlines() result in diffs that are suitable for
-// file.writelines() since both the inputs and outputs have trailing
-// newlines.
-//
-// For inputs that do not have trailing newlines, set the lineterm
-// argument to "" so that the output will be uniformly newline free.
-//
-// The unidiff format normally has a header for filenames and modification
-// times. Any or all of these may be specified using strings for
-// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
-// The modification times are normally expressed in the ISO 8601 format.
-func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {
- buf := bufio.NewWriter(writer)
- defer buf.Flush()
- wf := func(format string, args ...interface{}) error {
- _, err := buf.WriteString(fmt.Sprintf(format, args...))
- return err
- }
- ws := func(s string) error {
- _, err := buf.WriteString(s)
- return err
- }
-
- if len(diff.Eol) == 0 {
- diff.Eol = "\n"
- }
-
- started := false
- m := NewMatcher(diff.A, diff.B)
- for _, g := range m.GetGroupedOpCodes(diff.Context) {
- if !started {
- started = true
- fromDate := ""
- if len(diff.FromDate) > 0 {
- fromDate = "\t" + diff.FromDate
- }
- toDate := ""
- if len(diff.ToDate) > 0 {
- toDate = "\t" + diff.ToDate
- }
- if diff.FromFile != "" || diff.ToFile != "" {
- err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol)
- if err != nil {
- return err
- }
- err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol)
- if err != nil {
- return err
- }
- }
- }
- first, last := g[0], g[len(g)-1]
- range1 := formatRangeUnified(first.I1, last.I2)
- range2 := formatRangeUnified(first.J1, last.J2)
- if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil {
- return err
- }
- for _, c := range g {
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- if c.Tag == 'e' {
- for _, line := range diff.A[i1:i2] {
- if err := ws(" " + line); err != nil {
- return err
- }
- }
- continue
- }
- if c.Tag == 'r' || c.Tag == 'd' {
- for _, line := range diff.A[i1:i2] {
- if err := ws("-" + line); err != nil {
- return err
- }
- }
- }
- if c.Tag == 'r' || c.Tag == 'i' {
- for _, line := range diff.B[j1:j2] {
- if err := ws("+" + line); err != nil {
- return err
- }
- }
- }
- }
- }
- return nil
-}
-
-// Like WriteUnifiedDiff but returns the diff a string.
-func GetUnifiedDiffString(diff UnifiedDiff) (string, error) {
- w := &bytes.Buffer{}
- err := WriteUnifiedDiff(w, diff)
- return string(w.Bytes()), err
-}
-
-// Convert range to the "ed" format.
-func formatRangeContext(start, stop int) string {
- // Per the diff spec at http://www.unix.org/single_unix_specification/
- beginning := start + 1 // lines start numbering with one
- length := stop - start
- if length == 0 {
- beginning -= 1 // empty ranges begin at line just before the range
- }
- if length <= 1 {
- return fmt.Sprintf("%d", beginning)
- }
- return fmt.Sprintf("%d,%d", beginning, beginning+length-1)
-}
-
-type ContextDiff UnifiedDiff
-
-// Compare two sequences of lines; generate the delta as a context diff.
-//
-// Context diffs are a compact way of showing line changes and a few
-// lines of context. The number of context lines is set by diff.Context
-// which defaults to three.
-//
-// By default, the diff control lines (those with *** or ---) are
-// created with a trailing newline.
-//
-// For inputs that do not have trailing newlines, set the diff.Eol
-// argument to "" so that the output will be uniformly newline free.
-//
-// The context diff format normally has a header for filenames and
-// modification times. Any or all of these may be specified using
-// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate.
-// The modification times are normally expressed in the ISO 8601 format.
-// If not specified, the strings default to blanks.
-func WriteContextDiff(writer io.Writer, diff ContextDiff) error {
- buf := bufio.NewWriter(writer)
- defer buf.Flush()
- var diffErr error
- wf := func(format string, args ...interface{}) {
- _, err := buf.WriteString(fmt.Sprintf(format, args...))
- if diffErr == nil && err != nil {
- diffErr = err
- }
- }
- ws := func(s string) {
- _, err := buf.WriteString(s)
- if diffErr == nil && err != nil {
- diffErr = err
- }
- }
-
- if len(diff.Eol) == 0 {
- diff.Eol = "\n"
- }
-
- prefix := map[byte]string{
- 'i': "+ ",
- 'd': "- ",
- 'r': "! ",
- 'e': " ",
- }
-
- started := false
- m := NewMatcher(diff.A, diff.B)
- for _, g := range m.GetGroupedOpCodes(diff.Context) {
- if !started {
- started = true
- fromDate := ""
- if len(diff.FromDate) > 0 {
- fromDate = "\t" + diff.FromDate
- }
- toDate := ""
- if len(diff.ToDate) > 0 {
- toDate = "\t" + diff.ToDate
- }
- if diff.FromFile != "" || diff.ToFile != "" {
- wf("*** %s%s%s", diff.FromFile, fromDate, diff.Eol)
- wf("--- %s%s%s", diff.ToFile, toDate, diff.Eol)
- }
- }
-
- first, last := g[0], g[len(g)-1]
- ws("***************" + diff.Eol)
-
- range1 := formatRangeContext(first.I1, last.I2)
- wf("*** %s ****%s", range1, diff.Eol)
- for _, c := range g {
- if c.Tag == 'r' || c.Tag == 'd' {
- for _, cc := range g {
- if cc.Tag == 'i' {
- continue
- }
- for _, line := range diff.A[cc.I1:cc.I2] {
- ws(prefix[cc.Tag] + line)
- }
- }
- break
- }
- }
-
- range2 := formatRangeContext(first.J1, last.J2)
- wf("--- %s ----%s", range2, diff.Eol)
- for _, c := range g {
- if c.Tag == 'r' || c.Tag == 'i' {
- for _, cc := range g {
- if cc.Tag == 'd' {
- continue
- }
- for _, line := range diff.B[cc.J1:cc.J2] {
- ws(prefix[cc.Tag] + line)
- }
- }
- break
- }
- }
- }
- return diffErr
-}
-
-// Like WriteContextDiff but returns the diff a string.
-func GetContextDiffString(diff ContextDiff) (string, error) {
- w := &bytes.Buffer{}
- err := WriteContextDiff(w, diff)
- return string(w.Bytes()), err
-}
-
-// Split a string on "\n" while preserving them. The output can be used
-// as input for UnifiedDiff and ContextDiff structures.
-func SplitLines(s string) []string {
- lines := strings.SplitAfter(s, "\n")
- lines[len(lines)-1] += "\n"
- return lines
-}
diff --git a/vendor/github.com/sagikazarmark/locafero/.editorconfig b/vendor/github.com/sagikazarmark/locafero/.editorconfig
deleted file mode 100644
index 6f944f540..000000000
--- a/vendor/github.com/sagikazarmark/locafero/.editorconfig
+++ /dev/null
@@ -1,21 +0,0 @@
-root = true
-
-[*]
-charset = utf-8
-end_of_line = lf
-indent_size = 4
-indent_style = space
-insert_final_newline = true
-trim_trailing_whitespace = true
-
-[{Makefile,*.mk}]
-indent_style = tab
-
-[*.nix]
-indent_size = 2
-
-[*.go]
-indent_style = tab
-
-[{*.yml,*.yaml}]
-indent_size = 2
diff --git a/vendor/github.com/sagikazarmark/locafero/.envrc b/vendor/github.com/sagikazarmark/locafero/.envrc
deleted file mode 100644
index 3ce7171a3..000000000
--- a/vendor/github.com/sagikazarmark/locafero/.envrc
+++ /dev/null
@@ -1,4 +0,0 @@
-if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
- source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
-fi
-use flake . --impure
diff --git a/vendor/github.com/sagikazarmark/locafero/.gitignore b/vendor/github.com/sagikazarmark/locafero/.gitignore
deleted file mode 100644
index 8f07e6016..000000000
--- a/vendor/github.com/sagikazarmark/locafero/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-/.devenv/
-/.direnv/
-/.task/
-/bin/
-/build/
-/tmp/
-/var/
-/vendor/
diff --git a/vendor/github.com/sagikazarmark/locafero/.golangci.yaml b/vendor/github.com/sagikazarmark/locafero/.golangci.yaml
deleted file mode 100644
index 829de2a4a..000000000
--- a/vendor/github.com/sagikazarmark/locafero/.golangci.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-run:
- timeout: 10m
-
-linters-settings:
- gci:
- sections:
- - standard
- - default
- - prefix(github.com/sagikazarmark/locafero)
- goimports:
- local-prefixes: github.com/sagikazarmark/locafero
- misspell:
- locale: US
- nolintlint:
- allow-leading-space: false # require machine-readable nolint directives (with no leading space)
- allow-unused: false # report any unused nolint directives
- require-specific: false # don't require nolint directives to be specific about which linter is being skipped
- revive:
- confidence: 0
-
-linters:
- enable:
- - gci
- - goimports
- - misspell
- - nolintlint
- - revive
diff --git a/vendor/github.com/sagikazarmark/locafero/LICENSE b/vendor/github.com/sagikazarmark/locafero/LICENSE
deleted file mode 100644
index a70b0f296..000000000
--- a/vendor/github.com/sagikazarmark/locafero/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2023 Márk Sági-Kazár
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/github.com/sagikazarmark/locafero/README.md b/vendor/github.com/sagikazarmark/locafero/README.md
deleted file mode 100644
index a48e8e978..000000000
--- a/vendor/github.com/sagikazarmark/locafero/README.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Finder library for [Afero](https://github.com/spf13/afero)
-
-[](https://github.com/sagikazarmark/locafero/actions/workflows/ci.yaml)
-[](https://pkg.go.dev/mod/github.com/sagikazarmark/locafero)
-
-[](https://builtwithnix.org)
-
-**Finder library for [Afero](https://github.com/spf13/afero) ported from [go-finder](https://github.com/sagikazarmark/go-finder).**
-
-> [!WARNING]
-> This is an experimental library under development.
->
-> **Backwards compatibility is not guaranteed, expect breaking changes.**
-
-## Installation
-
-```shell
-go get github.com/sagikazarmark/locafero
-```
-
-## Usage
-
-Check out the [package example](https://pkg.go.dev/github.com/sagikazarmark/locafero#example-package) on go.dev.
-
-## Development
-
-**For an optimal developer experience, it is recommended to install [Nix](https://nixos.org/download.html) and [direnv](https://direnv.net/docs/installation.html).**
-
-Run the test suite:
-
-```shell
-just test
-```
-
-## License
-
-The project is licensed under the [MIT License](LICENSE).
diff --git a/vendor/github.com/sagikazarmark/locafero/file_type.go b/vendor/github.com/sagikazarmark/locafero/file_type.go
deleted file mode 100644
index 9a9b14023..000000000
--- a/vendor/github.com/sagikazarmark/locafero/file_type.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package locafero
-
-import "io/fs"
-
-// FileType represents the kind of entries [Finder] can return.
-type FileType int
-
-const (
- FileTypeAll FileType = iota
- FileTypeFile
- FileTypeDir
-)
-
-func (ft FileType) matchFileInfo(info fs.FileInfo) bool {
- switch ft {
- case FileTypeAll:
- return true
-
- case FileTypeFile:
- return !info.IsDir()
-
- case FileTypeDir:
- return info.IsDir()
-
- default:
- return false
- }
-}
diff --git a/vendor/github.com/sagikazarmark/locafero/finder.go b/vendor/github.com/sagikazarmark/locafero/finder.go
deleted file mode 100644
index 754c8b260..000000000
--- a/vendor/github.com/sagikazarmark/locafero/finder.go
+++ /dev/null
@@ -1,165 +0,0 @@
-// Package finder looks for files and directories in an {fs.Fs} filesystem.
-package locafero
-
-import (
- "errors"
- "io/fs"
- "path/filepath"
- "strings"
-
- "github.com/sourcegraph/conc/iter"
- "github.com/spf13/afero"
-)
-
-// Finder looks for files and directories in an [afero.Fs] filesystem.
-type Finder struct {
- // Paths represents a list of locations that the [Finder] will search in.
- //
- // They are essentially the root directories or starting points for the search.
- //
- // Examples:
- // - home/user
- // - etc
- Paths []string
-
- // Names are specific entries that the [Finder] will look for within the given Paths.
- //
- // It provides the capability to search for entries with depth,
- // meaning it can target deeper locations within the directory structure.
- //
- // It also supports glob syntax (as defined by [filepat.Match]), offering greater flexibility in search patterns.
- //
- // Examples:
- // - config.yaml
- // - home/*/config.yaml
- // - home/*/config.*
- Names []string
-
- // Type restricts the kind of entries returned by the [Finder].
- //
- // This parameter helps in differentiating and filtering out files from directories or vice versa.
- Type FileType
-}
-
-// Find looks for files and directories in an [afero.Fs] filesystem.
-func (f Finder) Find(fsys afero.Fs) ([]string, error) {
- // Arbitrary go routine limit (TODO: make this a parameter)
- // pool := pool.NewWithResults[[]string]().WithMaxGoroutines(5).WithErrors().WithFirstError()
-
- type searchItem struct {
- path string
- name string
- }
-
- var searchItems []searchItem
-
- for _, searchPath := range f.Paths {
- searchPath := searchPath
-
- for _, searchName := range f.Names {
- searchName := searchName
-
- searchItems = append(searchItems, searchItem{searchPath, searchName})
-
- // pool.Go(func() ([]string, error) {
- // // If the name contains any glob character, perform a glob match
- // if strings.ContainsAny(searchName, "*?[]\\^") {
- // return globWalkSearch(fsys, searchPath, searchName, f.Type)
- // }
- //
- // return statSearch(fsys, searchPath, searchName, f.Type)
- // })
- }
- }
-
- // allResults, err := pool.Wait()
- // if err != nil {
- // return nil, err
- // }
-
- allResults, err := iter.MapErr(searchItems, func(item *searchItem) ([]string, error) {
- // If the name contains any glob character, perform a glob match
- if strings.ContainsAny(item.name, "*?[]\\^") {
- return globWalkSearch(fsys, item.path, item.name, f.Type)
- }
-
- return statSearch(fsys, item.path, item.name, f.Type)
- })
- if err != nil {
- return nil, err
- }
-
- var results []string
-
- for _, r := range allResults {
- results = append(results, r...)
- }
-
- // Sort results in alphabetical order for now
- // sort.Strings(results)
-
- return results, nil
-}
-
-func globWalkSearch(fsys afero.Fs, searchPath string, searchName string, searchType FileType) ([]string, error) {
- var results []string
-
- err := afero.Walk(fsys, searchPath, func(p string, fileInfo fs.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- // Skip the root path
- if p == searchPath {
- return nil
- }
-
- var result error
-
- // Stop reading subdirectories
- // TODO: add depth detection here
- if fileInfo.IsDir() && filepath.Dir(p) == searchPath {
- result = fs.SkipDir
- }
-
- // Skip unmatching type
- if !searchType.matchFileInfo(fileInfo) {
- return result
- }
-
- match, err := filepath.Match(searchName, fileInfo.Name())
- if err != nil {
- return err
- }
-
- if match {
- results = append(results, p)
- }
-
- return result
- })
- if err != nil {
- return results, err
- }
-
- return results, nil
-}
-
-func statSearch(fsys afero.Fs, searchPath string, searchName string, searchType FileType) ([]string, error) {
- filePath := filepath.Join(searchPath, searchName)
-
- fileInfo, err := fsys.Stat(filePath)
- if errors.Is(err, fs.ErrNotExist) {
- return nil, nil
- }
- if err != nil {
- return nil, err
- }
-
- // Skip unmatching type
- if !searchType.matchFileInfo(fileInfo) {
- return nil, nil
- }
-
- return []string{filePath}, nil
-}
diff --git a/vendor/github.com/sagikazarmark/locafero/flake.lock b/vendor/github.com/sagikazarmark/locafero/flake.lock
deleted file mode 100644
index 46d28f805..000000000
--- a/vendor/github.com/sagikazarmark/locafero/flake.lock
+++ /dev/null
@@ -1,273 +0,0 @@
-{
- "nodes": {
- "devenv": {
- "inputs": {
- "flake-compat": "flake-compat",
- "nix": "nix",
- "nixpkgs": "nixpkgs",
- "pre-commit-hooks": "pre-commit-hooks"
- },
- "locked": {
- "lastModified": 1694097209,
- "narHash": "sha256-gQmBjjxeSyySjbh0yQVBKApo2KWIFqqbRUvG+Fa+QpM=",
- "owner": "cachix",
- "repo": "devenv",
- "rev": "7a8e6a91510efe89d8dcb8e43233f93e86f6b189",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "repo": "devenv",
- "type": "github"
- }
- },
- "flake-compat": {
- "flake": false,
- "locked": {
- "lastModified": 1673956053,
- "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
- "owner": "edolstra",
- "repo": "flake-compat",
- "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
- "type": "github"
- },
- "original": {
- "owner": "edolstra",
- "repo": "flake-compat",
- "type": "github"
- }
- },
- "flake-parts": {
- "inputs": {
- "nixpkgs-lib": "nixpkgs-lib"
- },
- "locked": {
- "lastModified": 1693611461,
- "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=",
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "type": "github"
- }
- },
- "flake-utils": {
- "inputs": {
- "systems": "systems"
- },
- "locked": {
- "lastModified": 1685518550,
- "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "gitignore": {
- "inputs": {
- "nixpkgs": [
- "devenv",
- "pre-commit-hooks",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1660459072,
- "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
- "owner": "hercules-ci",
- "repo": "gitignore.nix",
- "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "gitignore.nix",
- "type": "github"
- }
- },
- "lowdown-src": {
- "flake": false,
- "locked": {
- "lastModified": 1633514407,
- "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
- "owner": "kristapsdz",
- "repo": "lowdown",
- "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
- "type": "github"
- },
- "original": {
- "owner": "kristapsdz",
- "repo": "lowdown",
- "type": "github"
- }
- },
- "nix": {
- "inputs": {
- "lowdown-src": "lowdown-src",
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ],
- "nixpkgs-regression": "nixpkgs-regression"
- },
- "locked": {
- "lastModified": 1676545802,
- "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=",
- "owner": "domenkozar",
- "repo": "nix",
- "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f",
- "type": "github"
- },
- "original": {
- "owner": "domenkozar",
- "ref": "relaxed-flakes",
- "repo": "nix",
- "type": "github"
- }
- },
- "nixpkgs": {
- "locked": {
- "lastModified": 1678875422,
- "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixpkgs-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs-lib": {
- "locked": {
- "dir": "lib",
- "lastModified": 1693471703,
- "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85",
- "type": "github"
- },
- "original": {
- "dir": "lib",
- "owner": "NixOS",
- "ref": "nixos-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs-regression": {
- "locked": {
- "lastModified": 1643052045,
- "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
- "type": "github"
- }
- },
- "nixpkgs-stable": {
- "locked": {
- "lastModified": 1685801374,
- "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixos-23.05",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs_2": {
- "locked": {
- "lastModified": 1694343207,
- "narHash": "sha256-jWi7OwFxU5Owi4k2JmiL1sa/OuBCQtpaAesuj5LXC8w=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "78058d810644f5ed276804ce7ea9e82d92bee293",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixpkgs-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "pre-commit-hooks": {
- "inputs": {
- "flake-compat": [
- "devenv",
- "flake-compat"
- ],
- "flake-utils": "flake-utils",
- "gitignore": "gitignore",
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ],
- "nixpkgs-stable": "nixpkgs-stable"
- },
- "locked": {
- "lastModified": 1688056373,
- "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=",
- "owner": "cachix",
- "repo": "pre-commit-hooks.nix",
- "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "repo": "pre-commit-hooks.nix",
- "type": "github"
- }
- },
- "root": {
- "inputs": {
- "devenv": "devenv",
- "flake-parts": "flake-parts",
- "nixpkgs": "nixpkgs_2"
- }
- },
- "systems": {
- "locked": {
- "lastModified": 1681028828,
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
- "owner": "nix-systems",
- "repo": "default",
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
- "type": "github"
- },
- "original": {
- "owner": "nix-systems",
- "repo": "default",
- "type": "github"
- }
- }
- },
- "root": "root",
- "version": 7
-}
diff --git a/vendor/github.com/sagikazarmark/locafero/flake.nix b/vendor/github.com/sagikazarmark/locafero/flake.nix
deleted file mode 100644
index 209ecf286..000000000
--- a/vendor/github.com/sagikazarmark/locafero/flake.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- description = "Finder library for Afero";
-
- inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- flake-parts.url = "github:hercules-ci/flake-parts";
- devenv.url = "github:cachix/devenv";
- };
-
- outputs = inputs@{ flake-parts, ... }:
- flake-parts.lib.mkFlake { inherit inputs; } {
- imports = [
- inputs.devenv.flakeModule
- ];
-
- systems = [ "x86_64-linux" "aarch64-darwin" ];
-
- perSystem = { config, self', inputs', pkgs, system, ... }: rec {
- devenv.shells = {
- default = {
- languages = {
- go.enable = true;
- };
-
- packages = with pkgs; [
- just
-
- golangci-lint
- ];
-
- # https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
- containers = pkgs.lib.mkForce { };
- };
-
- ci = devenv.shells.default;
-
- ci_1_20 = {
- imports = [ devenv.shells.ci ];
-
- languages = {
- go.package = pkgs.go_1_20;
- };
- };
- };
- };
- };
-}
diff --git a/vendor/github.com/sagikazarmark/locafero/helpers.go b/vendor/github.com/sagikazarmark/locafero/helpers.go
deleted file mode 100644
index 05b434481..000000000
--- a/vendor/github.com/sagikazarmark/locafero/helpers.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package locafero
-
-import "fmt"
-
-// NameWithExtensions creates a list of names from a base name and a list of extensions.
-//
-// TODO: find a better name for this function.
-func NameWithExtensions(baseName string, extensions ...string) []string {
- var names []string
-
- if baseName == "" {
- return names
- }
-
- for _, ext := range extensions {
- if ext == "" {
- continue
- }
-
- names = append(names, fmt.Sprintf("%s.%s", baseName, ext))
- }
-
- return names
-}
-
-// NameWithOptionalExtensions creates a list of names from a base name and a list of extensions,
-// plus it adds the base name (without any extensions) to the end of the list.
-//
-// TODO: find a better name for this function.
-func NameWithOptionalExtensions(baseName string, extensions ...string) []string {
- var names []string
-
- if baseName == "" {
- return names
- }
-
- names = NameWithExtensions(baseName, extensions...)
- names = append(names, baseName)
-
- return names
-}
diff --git a/vendor/github.com/sagikazarmark/locafero/justfile b/vendor/github.com/sagikazarmark/locafero/justfile
deleted file mode 100644
index 00a88850c..000000000
--- a/vendor/github.com/sagikazarmark/locafero/justfile
+++ /dev/null
@@ -1,11 +0,0 @@
-default:
- just --list
-
-test:
- go test -race -v ./...
-
-lint:
- golangci-lint run
-
-fmt:
- golangci-lint run --fix
diff --git a/vendor/github.com/sagikazarmark/slog-shim/.editorconfig b/vendor/github.com/sagikazarmark/slog-shim/.editorconfig
deleted file mode 100644
index 1fb0e1bec..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/.editorconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-root = true
-
-[*]
-charset = utf-8
-end_of_line = lf
-indent_size = 4
-indent_style = space
-insert_final_newline = true
-trim_trailing_whitespace = true
-
-[*.nix]
-indent_size = 2
-
-[{Makefile,*.mk}]
-indent_style = tab
-
-[Taskfile.yaml]
-indent_size = 2
diff --git a/vendor/github.com/sagikazarmark/slog-shim/.envrc b/vendor/github.com/sagikazarmark/slog-shim/.envrc
deleted file mode 100644
index 3ce7171a3..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/.envrc
+++ /dev/null
@@ -1,4 +0,0 @@
-if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
- source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
-fi
-use flake . --impure
diff --git a/vendor/github.com/sagikazarmark/slog-shim/.gitignore b/vendor/github.com/sagikazarmark/slog-shim/.gitignore
deleted file mode 100644
index dc6d8b587..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/.devenv/
-/.direnv/
-/.task/
-/build/
diff --git a/vendor/github.com/sagikazarmark/slog-shim/LICENSE b/vendor/github.com/sagikazarmark/slog-shim/LICENSE
deleted file mode 100644
index 6a66aea5e..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/sagikazarmark/slog-shim/README.md b/vendor/github.com/sagikazarmark/slog-shim/README.md
deleted file mode 100644
index 1f5be85e1..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/README.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# [slog](https://pkg.go.dev/log/slog) shim
-
-[](https://github.com/sagikazarmark/slog-shim/actions/workflows/ci.yaml)
-[](https://pkg.go.dev/mod/github.com/sagikazarmark/slog-shim)
-
-[](https://builtwithnix.org)
-
-Go 1.21 introduced a [new structured logging package](https://golang.org/doc/go1.21#slog), `log/slog`, to the standard library.
-Although it's been eagerly anticipated by many, widespread adoption isn't expected to occur immediately,
-especially since updating to Go 1.21 is a decision that most libraries won't make overnight.
-
-Before this package was added to the standard library, there was an _experimental_ version available at [golang.org/x/exp/slog](https://pkg.go.dev/golang.org/x/exp/slog).
-While it's generally advised against using experimental packages in production,
-this one served as a sort of backport package for the last few years,
-incorporating new features before they were added to the standard library (like `slices`, `maps` or `errors`).
-
-This package serves as a bridge, helping libraries integrate slog in a backward-compatible way without having to immediately update their Go version requirement to 1.21. On Go 1.21 (and above), it acts as a drop-in replacement for `log/slog`, while below 1.21 it falls back to `golang.org/x/exp/slog`.
-
-**How does it achieve backwards compatibility?**
-
-Although there's no consensus on whether dropping support for older Go versions is considered backward compatible, a majority seems to believe it is.
-(I don't have scientific proof for this, but it's based on conversations with various individuals across different channels.)
-
-This package adheres to that interpretation of backward compatibility. On Go 1.21, the shim uses type aliases to offer the same API as `slog/log`.
-Once a library upgrades its version requirement to Go 1.21, it should be able to discard this shim and use `log/slog` directly.
-
-For older Go versions, the library might become unstable after removing the shim.
-However, since those older versions are no longer supported, the promise of backward compatibility remains intact.
-
-## Installation
-
-```shell
-go get github.com/sagikazarmark/slog-shim
-```
-
-## Usage
-
-Import this package into your library and use it in your public API:
-
-```go
-package mylib
-
-import slog "github.com/sagikazarmark/slog-shim"
-
-func New(logger *slog.Logger) MyLib {
- // ...
-}
-```
-
-When using the library, clients can either use `log/slog` (when on Go 1.21) or `golang.org/x/exp/slog` (below Go 1.21):
-
-```go
-package main
-
-import "log/slog"
-
-// OR
-
-import "golang.org/x/exp/slog"
-
-mylib.New(slog.Default())
-```
-
-**Make sure consumers are aware that your API behaves differently on different Go versions.**
-
-Once you bump your Go version requirement to Go 1.21, you can drop the shim entirely from your code:
-
-```diff
-package mylib
-
-- import slog "github.com/sagikazarmark/slog-shim"
-+ import "log/slog"
-
-func New(logger *slog.Logger) MyLib {
- // ...
-}
-```
-
-## License
-
-The project is licensed under a [BSD-style license](LICENSE).
diff --git a/vendor/github.com/sagikazarmark/slog-shim/attr.go b/vendor/github.com/sagikazarmark/slog-shim/attr.go
deleted file mode 100644
index 89608bf3a..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/attr.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.21
-
-package slog
-
-import (
- "log/slog"
- "time"
-)
-
-// An Attr is a key-value pair.
-type Attr = slog.Attr
-
-// String returns an Attr for a string value.
-func String(key, value string) Attr {
- return slog.String(key, value)
-}
-
-// Int64 returns an Attr for an int64.
-func Int64(key string, value int64) Attr {
- return slog.Int64(key, value)
-}
-
-// Int converts an int to an int64 and returns
-// an Attr with that value.
-func Int(key string, value int) Attr {
- return slog.Int(key, value)
-}
-
-// Uint64 returns an Attr for a uint64.
-func Uint64(key string, v uint64) Attr {
- return slog.Uint64(key, v)
-}
-
-// Float64 returns an Attr for a floating-point number.
-func Float64(key string, v float64) Attr {
- return slog.Float64(key, v)
-}
-
-// Bool returns an Attr for a bool.
-func Bool(key string, v bool) Attr {
- return slog.Bool(key, v)
-}
-
-// Time returns an Attr for a time.Time.
-// It discards the monotonic portion.
-func Time(key string, v time.Time) Attr {
- return slog.Time(key, v)
-}
-
-// Duration returns an Attr for a time.Duration.
-func Duration(key string, v time.Duration) Attr {
- return slog.Duration(key, v)
-}
-
-// Group returns an Attr for a Group Value.
-// The first argument is the key; the remaining arguments
-// are converted to Attrs as in [Logger.Log].
-//
-// Use Group to collect several key-value pairs under a single
-// key on a log line, or as the result of LogValue
-// in order to log a single value as multiple Attrs.
-func Group(key string, args ...any) Attr {
- return slog.Group(key, args...)
-}
-
-// Any returns an Attr for the supplied value.
-// See [Value.AnyValue] for how values are treated.
-func Any(key string, value any) Attr {
- return slog.Any(key, value)
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/attr_120.go b/vendor/github.com/sagikazarmark/slog-shim/attr_120.go
deleted file mode 100644
index b66481333..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/attr_120.go
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.21
-
-package slog
-
-import (
- "time"
-
- "golang.org/x/exp/slog"
-)
-
-// An Attr is a key-value pair.
-type Attr = slog.Attr
-
-// String returns an Attr for a string value.
-func String(key, value string) Attr {
- return slog.String(key, value)
-}
-
-// Int64 returns an Attr for an int64.
-func Int64(key string, value int64) Attr {
- return slog.Int64(key, value)
-}
-
-// Int converts an int to an int64 and returns
-// an Attr with that value.
-func Int(key string, value int) Attr {
- return slog.Int(key, value)
-}
-
-// Uint64 returns an Attr for a uint64.
-func Uint64(key string, v uint64) Attr {
- return slog.Uint64(key, v)
-}
-
-// Float64 returns an Attr for a floating-point number.
-func Float64(key string, v float64) Attr {
- return slog.Float64(key, v)
-}
-
-// Bool returns an Attr for a bool.
-func Bool(key string, v bool) Attr {
- return slog.Bool(key, v)
-}
-
-// Time returns an Attr for a time.Time.
-// It discards the monotonic portion.
-func Time(key string, v time.Time) Attr {
- return slog.Time(key, v)
-}
-
-// Duration returns an Attr for a time.Duration.
-func Duration(key string, v time.Duration) Attr {
- return slog.Duration(key, v)
-}
-
-// Group returns an Attr for a Group Value.
-// The first argument is the key; the remaining arguments
-// are converted to Attrs as in [Logger.Log].
-//
-// Use Group to collect several key-value pairs under a single
-// key on a log line, or as the result of LogValue
-// in order to log a single value as multiple Attrs.
-func Group(key string, args ...any) Attr {
- return slog.Group(key, args...)
-}
-
-// Any returns an Attr for the supplied value.
-// See [Value.AnyValue] for how values are treated.
-func Any(key string, value any) Attr {
- return slog.Any(key, value)
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/flake.lock b/vendor/github.com/sagikazarmark/slog-shim/flake.lock
deleted file mode 100644
index 7e8898e9e..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/flake.lock
+++ /dev/null
@@ -1,273 +0,0 @@
-{
- "nodes": {
- "devenv": {
- "inputs": {
- "flake-compat": "flake-compat",
- "nix": "nix",
- "nixpkgs": "nixpkgs",
- "pre-commit-hooks": "pre-commit-hooks"
- },
- "locked": {
- "lastModified": 1694097209,
- "narHash": "sha256-gQmBjjxeSyySjbh0yQVBKApo2KWIFqqbRUvG+Fa+QpM=",
- "owner": "cachix",
- "repo": "devenv",
- "rev": "7a8e6a91510efe89d8dcb8e43233f93e86f6b189",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "repo": "devenv",
- "type": "github"
- }
- },
- "flake-compat": {
- "flake": false,
- "locked": {
- "lastModified": 1673956053,
- "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
- "owner": "edolstra",
- "repo": "flake-compat",
- "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
- "type": "github"
- },
- "original": {
- "owner": "edolstra",
- "repo": "flake-compat",
- "type": "github"
- }
- },
- "flake-parts": {
- "inputs": {
- "nixpkgs-lib": "nixpkgs-lib"
- },
- "locked": {
- "lastModified": 1693611461,
- "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=",
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "type": "github"
- }
- },
- "flake-utils": {
- "inputs": {
- "systems": "systems"
- },
- "locked": {
- "lastModified": 1685518550,
- "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "gitignore": {
- "inputs": {
- "nixpkgs": [
- "devenv",
- "pre-commit-hooks",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1660459072,
- "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
- "owner": "hercules-ci",
- "repo": "gitignore.nix",
- "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "gitignore.nix",
- "type": "github"
- }
- },
- "lowdown-src": {
- "flake": false,
- "locked": {
- "lastModified": 1633514407,
- "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
- "owner": "kristapsdz",
- "repo": "lowdown",
- "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
- "type": "github"
- },
- "original": {
- "owner": "kristapsdz",
- "repo": "lowdown",
- "type": "github"
- }
- },
- "nix": {
- "inputs": {
- "lowdown-src": "lowdown-src",
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ],
- "nixpkgs-regression": "nixpkgs-regression"
- },
- "locked": {
- "lastModified": 1676545802,
- "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=",
- "owner": "domenkozar",
- "repo": "nix",
- "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f",
- "type": "github"
- },
- "original": {
- "owner": "domenkozar",
- "ref": "relaxed-flakes",
- "repo": "nix",
- "type": "github"
- }
- },
- "nixpkgs": {
- "locked": {
- "lastModified": 1678875422,
- "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixpkgs-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs-lib": {
- "locked": {
- "dir": "lib",
- "lastModified": 1693471703,
- "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85",
- "type": "github"
- },
- "original": {
- "dir": "lib",
- "owner": "NixOS",
- "ref": "nixos-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs-regression": {
- "locked": {
- "lastModified": 1643052045,
- "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
- "type": "github"
- }
- },
- "nixpkgs-stable": {
- "locked": {
- "lastModified": 1685801374,
- "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixos-23.05",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs_2": {
- "locked": {
- "lastModified": 1694345580,
- "narHash": "sha256-BbG0NUxQTz1dN/Y87yPWZc/0Kp/coJ0vM3+7sNa5kUM=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "f002de6834fdde9c864f33c1ec51da7df19cd832",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "master",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "pre-commit-hooks": {
- "inputs": {
- "flake-compat": [
- "devenv",
- "flake-compat"
- ],
- "flake-utils": "flake-utils",
- "gitignore": "gitignore",
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ],
- "nixpkgs-stable": "nixpkgs-stable"
- },
- "locked": {
- "lastModified": 1688056373,
- "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=",
- "owner": "cachix",
- "repo": "pre-commit-hooks.nix",
- "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "repo": "pre-commit-hooks.nix",
- "type": "github"
- }
- },
- "root": {
- "inputs": {
- "devenv": "devenv",
- "flake-parts": "flake-parts",
- "nixpkgs": "nixpkgs_2"
- }
- },
- "systems": {
- "locked": {
- "lastModified": 1681028828,
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
- "owner": "nix-systems",
- "repo": "default",
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
- "type": "github"
- },
- "original": {
- "owner": "nix-systems",
- "repo": "default",
- "type": "github"
- }
- }
- },
- "root": "root",
- "version": 7
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/flake.nix b/vendor/github.com/sagikazarmark/slog-shim/flake.nix
deleted file mode 100644
index 7239bbc2e..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/flake.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- inputs = {
- # nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- nixpkgs.url = "github:NixOS/nixpkgs/master";
- flake-parts.url = "github:hercules-ci/flake-parts";
- devenv.url = "github:cachix/devenv";
- };
-
- outputs = inputs@{ flake-parts, ... }:
- flake-parts.lib.mkFlake { inherit inputs; } {
- imports = [
- inputs.devenv.flakeModule
- ];
-
- systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
-
- perSystem = { config, self', inputs', pkgs, system, ... }: rec {
- devenv.shells = {
- default = {
- languages = {
- go.enable = true;
- go.package = pkgs.lib.mkDefault pkgs.go_1_21;
- };
-
- # https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
- containers = pkgs.lib.mkForce { };
- };
-
- ci = devenv.shells.default;
-
- ci_1_19 = {
- imports = [ devenv.shells.ci ];
-
- languages = {
- go.package = pkgs.go_1_19;
- };
- };
-
- ci_1_20 = {
- imports = [ devenv.shells.ci ];
-
- languages = {
- go.package = pkgs.go_1_20;
- };
- };
-
- ci_1_21 = {
- imports = [ devenv.shells.ci ];
-
- languages = {
- go.package = pkgs.go_1_21;
- };
- };
- };
- };
- };
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/handler.go b/vendor/github.com/sagikazarmark/slog-shim/handler.go
deleted file mode 100644
index f55556ae1..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/handler.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.21
-
-package slog
-
-import (
- "log/slog"
-)
-
-// A Handler handles log records produced by a Logger..
-//
-// A typical handler may print log records to standard error,
-// or write them to a file or database, or perhaps augment them
-// with additional attributes and pass them on to another handler.
-//
-// Any of the Handler's methods may be called concurrently with itself
-// or with other methods. It is the responsibility of the Handler to
-// manage this concurrency.
-//
-// Users of the slog package should not invoke Handler methods directly.
-// They should use the methods of [Logger] instead.
-type Handler = slog.Handler
-
-// HandlerOptions are options for a TextHandler or JSONHandler.
-// A zero HandlerOptions consists entirely of default values.
-type HandlerOptions = slog.HandlerOptions
-
-// Keys for "built-in" attributes.
-const (
- // TimeKey is the key used by the built-in handlers for the time
- // when the log method is called. The associated Value is a [time.Time].
- TimeKey = slog.TimeKey
- // LevelKey is the key used by the built-in handlers for the level
- // of the log call. The associated value is a [Level].
- LevelKey = slog.LevelKey
- // MessageKey is the key used by the built-in handlers for the
- // message of the log call. The associated value is a string.
- MessageKey = slog.MessageKey
- // SourceKey is the key used by the built-in handlers for the source file
- // and line of the log call. The associated value is a string.
- SourceKey = slog.SourceKey
-)
diff --git a/vendor/github.com/sagikazarmark/slog-shim/handler_120.go b/vendor/github.com/sagikazarmark/slog-shim/handler_120.go
deleted file mode 100644
index 670057573..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/handler_120.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.21
-
-package slog
-
-import (
- "golang.org/x/exp/slog"
-)
-
-// A Handler handles log records produced by a Logger..
-//
-// A typical handler may print log records to standard error,
-// or write them to a file or database, or perhaps augment them
-// with additional attributes and pass them on to another handler.
-//
-// Any of the Handler's methods may be called concurrently with itself
-// or with other methods. It is the responsibility of the Handler to
-// manage this concurrency.
-//
-// Users of the slog package should not invoke Handler methods directly.
-// They should use the methods of [Logger] instead.
-type Handler = slog.Handler
-
-// HandlerOptions are options for a TextHandler or JSONHandler.
-// A zero HandlerOptions consists entirely of default values.
-type HandlerOptions = slog.HandlerOptions
-
-// Keys for "built-in" attributes.
-const (
- // TimeKey is the key used by the built-in handlers for the time
- // when the log method is called. The associated Value is a [time.Time].
- TimeKey = slog.TimeKey
- // LevelKey is the key used by the built-in handlers for the level
- // of the log call. The associated value is a [Level].
- LevelKey = slog.LevelKey
- // MessageKey is the key used by the built-in handlers for the
- // message of the log call. The associated value is a string.
- MessageKey = slog.MessageKey
- // SourceKey is the key used by the built-in handlers for the source file
- // and line of the log call. The associated value is a string.
- SourceKey = slog.SourceKey
-)
diff --git a/vendor/github.com/sagikazarmark/slog-shim/json_handler.go b/vendor/github.com/sagikazarmark/slog-shim/json_handler.go
deleted file mode 100644
index 7c22bd81e..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/json_handler.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.21
-
-package slog
-
-import (
- "io"
- "log/slog"
-)
-
-// JSONHandler is a Handler that writes Records to an io.Writer as
-// line-delimited JSON objects.
-type JSONHandler = slog.JSONHandler
-
-// NewJSONHandler creates a JSONHandler that writes to w,
-// using the given options.
-// If opts is nil, the default options are used.
-func NewJSONHandler(w io.Writer, opts *HandlerOptions) *JSONHandler {
- return slog.NewJSONHandler(w, opts)
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/json_handler_120.go b/vendor/github.com/sagikazarmark/slog-shim/json_handler_120.go
deleted file mode 100644
index 7b14f10ba..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/json_handler_120.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.21
-
-package slog
-
-import (
- "io"
-
- "golang.org/x/exp/slog"
-)
-
-// JSONHandler is a Handler that writes Records to an io.Writer as
-// line-delimited JSON objects.
-type JSONHandler = slog.JSONHandler
-
-// NewJSONHandler creates a JSONHandler that writes to w,
-// using the given options.
-// If opts is nil, the default options are used.
-func NewJSONHandler(w io.Writer, opts *HandlerOptions) *JSONHandler {
- return slog.NewJSONHandler(w, opts)
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/level.go b/vendor/github.com/sagikazarmark/slog-shim/level.go
deleted file mode 100644
index 07288cf89..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/level.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.21
-
-package slog
-
-import (
- "log/slog"
-)
-
-// A Level is the importance or severity of a log event.
-// The higher the level, the more important or severe the event.
-type Level = slog.Level
-
-// Level numbers are inherently arbitrary,
-// but we picked them to satisfy three constraints.
-// Any system can map them to another numbering scheme if it wishes.
-//
-// First, we wanted the default level to be Info, Since Levels are ints, Info is
-// the default value for int, zero.
-//
-// Second, we wanted to make it easy to use levels to specify logger verbosity.
-// Since a larger level means a more severe event, a logger that accepts events
-// with smaller (or more negative) level means a more verbose logger. Logger
-// verbosity is thus the negation of event severity, and the default verbosity
-// of 0 accepts all events at least as severe as INFO.
-//
-// Third, we wanted some room between levels to accommodate schemes with named
-// levels between ours. For example, Google Cloud Logging defines a Notice level
-// between Info and Warn. Since there are only a few of these intermediate
-// levels, the gap between the numbers need not be large. Our gap of 4 matches
-// OpenTelemetry's mapping. Subtracting 9 from an OpenTelemetry level in the
-// DEBUG, INFO, WARN and ERROR ranges converts it to the corresponding slog
-// Level range. OpenTelemetry also has the names TRACE and FATAL, which slog
-// does not. But those OpenTelemetry levels can still be represented as slog
-// Levels by using the appropriate integers.
-//
-// Names for common levels.
-const (
- LevelDebug Level = slog.LevelDebug
- LevelInfo Level = slog.LevelInfo
- LevelWarn Level = slog.LevelWarn
- LevelError Level = slog.LevelError
-)
-
-// A LevelVar is a Level variable, to allow a Handler level to change
-// dynamically.
-// It implements Leveler as well as a Set method,
-// and it is safe for use by multiple goroutines.
-// The zero LevelVar corresponds to LevelInfo.
-type LevelVar = slog.LevelVar
-
-// A Leveler provides a Level value.
-//
-// As Level itself implements Leveler, clients typically supply
-// a Level value wherever a Leveler is needed, such as in HandlerOptions.
-// Clients who need to vary the level dynamically can provide a more complex
-// Leveler implementation such as *LevelVar.
-type Leveler = slog.Leveler
diff --git a/vendor/github.com/sagikazarmark/slog-shim/level_120.go b/vendor/github.com/sagikazarmark/slog-shim/level_120.go
deleted file mode 100644
index d3feb9420..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/level_120.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.21
-
-package slog
-
-import (
- "golang.org/x/exp/slog"
-)
-
-// A Level is the importance or severity of a log event.
-// The higher the level, the more important or severe the event.
-type Level = slog.Level
-
-// Level numbers are inherently arbitrary,
-// but we picked them to satisfy three constraints.
-// Any system can map them to another numbering scheme if it wishes.
-//
-// First, we wanted the default level to be Info, Since Levels are ints, Info is
-// the default value for int, zero.
-//
-// Second, we wanted to make it easy to use levels to specify logger verbosity.
-// Since a larger level means a more severe event, a logger that accepts events
-// with smaller (or more negative) level means a more verbose logger. Logger
-// verbosity is thus the negation of event severity, and the default verbosity
-// of 0 accepts all events at least as severe as INFO.
-//
-// Third, we wanted some room between levels to accommodate schemes with named
-// levels between ours. For example, Google Cloud Logging defines a Notice level
-// between Info and Warn. Since there are only a few of these intermediate
-// levels, the gap between the numbers need not be large. Our gap of 4 matches
-// OpenTelemetry's mapping. Subtracting 9 from an OpenTelemetry level in the
-// DEBUG, INFO, WARN and ERROR ranges converts it to the corresponding slog
-// Level range. OpenTelemetry also has the names TRACE and FATAL, which slog
-// does not. But those OpenTelemetry levels can still be represented as slog
-// Levels by using the appropriate integers.
-//
-// Names for common levels.
-const (
- LevelDebug Level = slog.LevelDebug
- LevelInfo Level = slog.LevelInfo
- LevelWarn Level = slog.LevelWarn
- LevelError Level = slog.LevelError
-)
-
-// A LevelVar is a Level variable, to allow a Handler level to change
-// dynamically.
-// It implements Leveler as well as a Set method,
-// and it is safe for use by multiple goroutines.
-// The zero LevelVar corresponds to LevelInfo.
-type LevelVar = slog.LevelVar
-
-// A Leveler provides a Level value.
-//
-// As Level itself implements Leveler, clients typically supply
-// a Level value wherever a Leveler is needed, such as in HandlerOptions.
-// Clients who need to vary the level dynamically can provide a more complex
-// Leveler implementation such as *LevelVar.
-type Leveler = slog.Leveler
diff --git a/vendor/github.com/sagikazarmark/slog-shim/logger.go b/vendor/github.com/sagikazarmark/slog-shim/logger.go
deleted file mode 100644
index e80036bec..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/logger.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.21
-
-package slog
-
-import (
- "context"
- "log"
- "log/slog"
-)
-
-// Default returns the default Logger.
-func Default() *Logger { return slog.Default() }
-
-// SetDefault makes l the default Logger.
-// After this call, output from the log package's default Logger
-// (as with [log.Print], etc.) will be logged at LevelInfo using l's Handler.
-func SetDefault(l *Logger) {
- slog.SetDefault(l)
-}
-
-// A Logger records structured information about each call to its
-// Log, Debug, Info, Warn, and Error methods.
-// For each call, it creates a Record and passes it to a Handler.
-//
-// To create a new Logger, call [New] or a Logger method
-// that begins "With".
-type Logger = slog.Logger
-
-// New creates a new Logger with the given non-nil Handler.
-func New(h Handler) *Logger {
- return slog.New(h)
-}
-
-// With calls Logger.With on the default logger.
-func With(args ...any) *Logger {
- return slog.With(args...)
-}
-
-// NewLogLogger returns a new log.Logger such that each call to its Output method
-// dispatches a Record to the specified handler. The logger acts as a bridge from
-// the older log API to newer structured logging handlers.
-func NewLogLogger(h Handler, level Level) *log.Logger {
- return slog.NewLogLogger(h, level)
-}
-
-// Debug calls Logger.Debug on the default logger.
-func Debug(msg string, args ...any) {
- slog.Debug(msg, args...)
-}
-
-// DebugContext calls Logger.DebugContext on the default logger.
-func DebugContext(ctx context.Context, msg string, args ...any) {
- slog.DebugContext(ctx, msg, args...)
-}
-
-// Info calls Logger.Info on the default logger.
-func Info(msg string, args ...any) {
- slog.Info(msg, args...)
-}
-
-// InfoContext calls Logger.InfoContext on the default logger.
-func InfoContext(ctx context.Context, msg string, args ...any) {
- slog.InfoContext(ctx, msg, args...)
-}
-
-// Warn calls Logger.Warn on the default logger.
-func Warn(msg string, args ...any) {
- slog.Warn(msg, args...)
-}
-
-// WarnContext calls Logger.WarnContext on the default logger.
-func WarnContext(ctx context.Context, msg string, args ...any) {
- slog.WarnContext(ctx, msg, args...)
-}
-
-// Error calls Logger.Error on the default logger.
-func Error(msg string, args ...any) {
- slog.Error(msg, args...)
-}
-
-// ErrorContext calls Logger.ErrorContext on the default logger.
-func ErrorContext(ctx context.Context, msg string, args ...any) {
- slog.ErrorContext(ctx, msg, args...)
-}
-
-// Log calls Logger.Log on the default logger.
-func Log(ctx context.Context, level Level, msg string, args ...any) {
- slog.Log(ctx, level, msg, args...)
-}
-
-// LogAttrs calls Logger.LogAttrs on the default logger.
-func LogAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
- slog.LogAttrs(ctx, level, msg, attrs...)
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/logger_120.go b/vendor/github.com/sagikazarmark/slog-shim/logger_120.go
deleted file mode 100644
index 97ebdd5e1..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/logger_120.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.21
-
-package slog
-
-import (
- "context"
- "log"
-
- "golang.org/x/exp/slog"
-)
-
-// Default returns the default Logger.
-func Default() *Logger { return slog.Default() }
-
-// SetDefault makes l the default Logger.
-// After this call, output from the log package's default Logger
-// (as with [log.Print], etc.) will be logged at LevelInfo using l's Handler.
-func SetDefault(l *Logger) {
- slog.SetDefault(l)
-}
-
-// A Logger records structured information about each call to its
-// Log, Debug, Info, Warn, and Error methods.
-// For each call, it creates a Record and passes it to a Handler.
-//
-// To create a new Logger, call [New] or a Logger method
-// that begins "With".
-type Logger = slog.Logger
-
-// New creates a new Logger with the given non-nil Handler.
-func New(h Handler) *Logger {
- return slog.New(h)
-}
-
-// With calls Logger.With on the default logger.
-func With(args ...any) *Logger {
- return slog.With(args...)
-}
-
-// NewLogLogger returns a new log.Logger such that each call to its Output method
-// dispatches a Record to the specified handler. The logger acts as a bridge from
-// the older log API to newer structured logging handlers.
-func NewLogLogger(h Handler, level Level) *log.Logger {
- return slog.NewLogLogger(h, level)
-}
-
-// Debug calls Logger.Debug on the default logger.
-func Debug(msg string, args ...any) {
- slog.Debug(msg, args...)
-}
-
-// DebugContext calls Logger.DebugContext on the default logger.
-func DebugContext(ctx context.Context, msg string, args ...any) {
- slog.DebugContext(ctx, msg, args...)
-}
-
-// Info calls Logger.Info on the default logger.
-func Info(msg string, args ...any) {
- slog.Info(msg, args...)
-}
-
-// InfoContext calls Logger.InfoContext on the default logger.
-func InfoContext(ctx context.Context, msg string, args ...any) {
- slog.InfoContext(ctx, msg, args...)
-}
-
-// Warn calls Logger.Warn on the default logger.
-func Warn(msg string, args ...any) {
- slog.Warn(msg, args...)
-}
-
-// WarnContext calls Logger.WarnContext on the default logger.
-func WarnContext(ctx context.Context, msg string, args ...any) {
- slog.WarnContext(ctx, msg, args...)
-}
-
-// Error calls Logger.Error on the default logger.
-func Error(msg string, args ...any) {
- slog.Error(msg, args...)
-}
-
-// ErrorContext calls Logger.ErrorContext on the default logger.
-func ErrorContext(ctx context.Context, msg string, args ...any) {
- slog.ErrorContext(ctx, msg, args...)
-}
-
-// Log calls Logger.Log on the default logger.
-func Log(ctx context.Context, level Level, msg string, args ...any) {
- slog.Log(ctx, level, msg, args...)
-}
-
-// LogAttrs calls Logger.LogAttrs on the default logger.
-func LogAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
- slog.LogAttrs(ctx, level, msg, attrs...)
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/record.go b/vendor/github.com/sagikazarmark/slog-shim/record.go
deleted file mode 100644
index 85ad1f784..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/record.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.21
-
-package slog
-
-import (
- "log/slog"
- "time"
-)
-
-// A Record holds information about a log event.
-// Copies of a Record share state.
-// Do not modify a Record after handing out a copy to it.
-// Call [NewRecord] to create a new Record.
-// Use [Record.Clone] to create a copy with no shared state.
-type Record = slog.Record
-
-// NewRecord creates a Record from the given arguments.
-// Use [Record.AddAttrs] to add attributes to the Record.
-//
-// NewRecord is intended for logging APIs that want to support a [Handler] as
-// a backend.
-func NewRecord(t time.Time, level Level, msg string, pc uintptr) Record {
- return slog.NewRecord(t, level, msg, pc)
-}
-
-// Source describes the location of a line of source code.
-type Source = slog.Source
diff --git a/vendor/github.com/sagikazarmark/slog-shim/record_120.go b/vendor/github.com/sagikazarmark/slog-shim/record_120.go
deleted file mode 100644
index c2eaf4e79..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/record_120.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.21
-
-package slog
-
-import (
- "time"
-
- "golang.org/x/exp/slog"
-)
-
-// A Record holds information about a log event.
-// Copies of a Record share state.
-// Do not modify a Record after handing out a copy to it.
-// Call [NewRecord] to create a new Record.
-// Use [Record.Clone] to create a copy with no shared state.
-type Record = slog.Record
-
-// NewRecord creates a Record from the given arguments.
-// Use [Record.AddAttrs] to add attributes to the Record.
-//
-// NewRecord is intended for logging APIs that want to support a [Handler] as
-// a backend.
-func NewRecord(t time.Time, level Level, msg string, pc uintptr) Record {
- return slog.NewRecord(t, level, msg, pc)
-}
-
-// Source describes the location of a line of source code.
-type Source = slog.Source
diff --git a/vendor/github.com/sagikazarmark/slog-shim/text_handler.go b/vendor/github.com/sagikazarmark/slog-shim/text_handler.go
deleted file mode 100644
index 45f6cfcba..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/text_handler.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.21
-
-package slog
-
-import (
- "io"
- "log/slog"
-)
-
-// TextHandler is a Handler that writes Records to an io.Writer as a
-// sequence of key=value pairs separated by spaces and followed by a newline.
-type TextHandler = slog.TextHandler
-
-// NewTextHandler creates a TextHandler that writes to w,
-// using the given options.
-// If opts is nil, the default options are used.
-func NewTextHandler(w io.Writer, opts *HandlerOptions) *TextHandler {
- return slog.NewTextHandler(w, opts)
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/text_handler_120.go b/vendor/github.com/sagikazarmark/slog-shim/text_handler_120.go
deleted file mode 100644
index a69d63cce..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/text_handler_120.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.21
-
-package slog
-
-import (
- "io"
-
- "golang.org/x/exp/slog"
-)
-
-// TextHandler is a Handler that writes Records to an io.Writer as a
-// sequence of key=value pairs separated by spaces and followed by a newline.
-type TextHandler = slog.TextHandler
-
-// NewTextHandler creates a TextHandler that writes to w,
-// using the given options.
-// If opts is nil, the default options are used.
-func NewTextHandler(w io.Writer, opts *HandlerOptions) *TextHandler {
- return slog.NewTextHandler(w, opts)
-}
diff --git a/vendor/github.com/sagikazarmark/slog-shim/value.go b/vendor/github.com/sagikazarmark/slog-shim/value.go
deleted file mode 100644
index 61173eb94..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/value.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.21
-
-package slog
-
-import (
- "log/slog"
- "time"
-)
-
-// A Value can represent any Go value, but unlike type any,
-// it can represent most small values without an allocation.
-// The zero Value corresponds to nil.
-type Value = slog.Value
-
-// Kind is the kind of a Value.
-type Kind = slog.Kind
-
-// The following list is sorted alphabetically, but it's also important that
-// KindAny is 0 so that a zero Value represents nil.
-const (
- KindAny = slog.KindAny
- KindBool = slog.KindBool
- KindDuration = slog.KindDuration
- KindFloat64 = slog.KindFloat64
- KindInt64 = slog.KindInt64
- KindString = slog.KindString
- KindTime = slog.KindTime
- KindUint64 = slog.KindUint64
- KindGroup = slog.KindGroup
- KindLogValuer = slog.KindLogValuer
-)
-
-//////////////// Constructors
-
-// StringValue returns a new Value for a string.
-func StringValue(value string) Value {
- return slog.StringValue(value)
-}
-
-// IntValue returns a Value for an int.
-func IntValue(v int) Value {
- return slog.IntValue(v)
-}
-
-// Int64Value returns a Value for an int64.
-func Int64Value(v int64) Value {
- return slog.Int64Value(v)
-}
-
-// Uint64Value returns a Value for a uint64.
-func Uint64Value(v uint64) Value {
- return slog.Uint64Value(v)
-}
-
-// Float64Value returns a Value for a floating-point number.
-func Float64Value(v float64) Value {
- return slog.Float64Value(v)
-}
-
-// BoolValue returns a Value for a bool.
-func BoolValue(v bool) Value {
- return slog.BoolValue(v)
-}
-
-// TimeValue returns a Value for a time.Time.
-// It discards the monotonic portion.
-func TimeValue(v time.Time) Value {
- return slog.TimeValue(v)
-}
-
-// DurationValue returns a Value for a time.Duration.
-func DurationValue(v time.Duration) Value {
- return slog.DurationValue(v)
-}
-
-// GroupValue returns a new Value for a list of Attrs.
-// The caller must not subsequently mutate the argument slice.
-func GroupValue(as ...Attr) Value {
- return slog.GroupValue(as...)
-}
-
-// AnyValue returns a Value for the supplied value.
-//
-// If the supplied value is of type Value, it is returned
-// unmodified.
-//
-// Given a value of one of Go's predeclared string, bool, or
-// (non-complex) numeric types, AnyValue returns a Value of kind
-// String, Bool, Uint64, Int64, or Float64. The width of the
-// original numeric type is not preserved.
-//
-// Given a time.Time or time.Duration value, AnyValue returns a Value of kind
-// KindTime or KindDuration. The monotonic time is not preserved.
-//
-// For nil, or values of all other types, including named types whose
-// underlying type is numeric, AnyValue returns a value of kind KindAny.
-func AnyValue(v any) Value {
- return slog.AnyValue(v)
-}
-
-// A LogValuer is any Go value that can convert itself into a Value for logging.
-//
-// This mechanism may be used to defer expensive operations until they are
-// needed, or to expand a single value into a sequence of components.
-type LogValuer = slog.LogValuer
diff --git a/vendor/github.com/sagikazarmark/slog-shim/value_120.go b/vendor/github.com/sagikazarmark/slog-shim/value_120.go
deleted file mode 100644
index 0f9f871ee..000000000
--- a/vendor/github.com/sagikazarmark/slog-shim/value_120.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2022 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.
-
-//go:build !go1.21
-
-package slog
-
-import (
- "time"
-
- "golang.org/x/exp/slog"
-)
-
-// A Value can represent any Go value, but unlike type any,
-// it can represent most small values without an allocation.
-// The zero Value corresponds to nil.
-type Value = slog.Value
-
-// Kind is the kind of a Value.
-type Kind = slog.Kind
-
-// The following list is sorted alphabetically, but it's also important that
-// KindAny is 0 so that a zero Value represents nil.
-const (
- KindAny = slog.KindAny
- KindBool = slog.KindBool
- KindDuration = slog.KindDuration
- KindFloat64 = slog.KindFloat64
- KindInt64 = slog.KindInt64
- KindString = slog.KindString
- KindTime = slog.KindTime
- KindUint64 = slog.KindUint64
- KindGroup = slog.KindGroup
- KindLogValuer = slog.KindLogValuer
-)
-
-//////////////// Constructors
-
-// StringValue returns a new Value for a string.
-func StringValue(value string) Value {
- return slog.StringValue(value)
-}
-
-// IntValue returns a Value for an int.
-func IntValue(v int) Value {
- return slog.IntValue(v)
-}
-
-// Int64Value returns a Value for an int64.
-func Int64Value(v int64) Value {
- return slog.Int64Value(v)
-}
-
-// Uint64Value returns a Value for a uint64.
-func Uint64Value(v uint64) Value {
- return slog.Uint64Value(v)
-}
-
-// Float64Value returns a Value for a floating-point number.
-func Float64Value(v float64) Value {
- return slog.Float64Value(v)
-}
-
-// BoolValue returns a Value for a bool.
-func BoolValue(v bool) Value {
- return slog.BoolValue(v)
-}
-
-// TimeValue returns a Value for a time.Time.
-// It discards the monotonic portion.
-func TimeValue(v time.Time) Value {
- return slog.TimeValue(v)
-}
-
-// DurationValue returns a Value for a time.Duration.
-func DurationValue(v time.Duration) Value {
- return slog.DurationValue(v)
-}
-
-// GroupValue returns a new Value for a list of Attrs.
-// The caller must not subsequently mutate the argument slice.
-func GroupValue(as ...Attr) Value {
- return slog.GroupValue(as...)
-}
-
-// AnyValue returns a Value for the supplied value.
-//
-// If the supplied value is of type Value, it is returned
-// unmodified.
-//
-// Given a value of one of Go's predeclared string, bool, or
-// (non-complex) numeric types, AnyValue returns a Value of kind
-// String, Bool, Uint64, Int64, or Float64. The width of the
-// original numeric type is not preserved.
-//
-// Given a time.Time or time.Duration value, AnyValue returns a Value of kind
-// KindTime or KindDuration. The monotonic time is not preserved.
-//
-// For nil, or values of all other types, including named types whose
-// underlying type is numeric, AnyValue returns a value of kind KindAny.
-func AnyValue(v any) Value {
- return slog.AnyValue(v)
-}
-
-// A LogValuer is any Go value that can convert itself into a Value for logging.
-//
-// This mechanism may be used to defer expensive operations until they are
-// needed, or to expand a single value into a sequence of components.
-type LogValuer = slog.LogValuer
diff --git a/vendor/github.com/sergi/go-diff/AUTHORS b/vendor/github.com/sergi/go-diff/AUTHORS
deleted file mode 100644
index 2d7bb2bf5..000000000
--- a/vendor/github.com/sergi/go-diff/AUTHORS
+++ /dev/null
@@ -1,25 +0,0 @@
-# This is the official list of go-diff authors for copyright purposes.
-# This file is distinct from the CONTRIBUTORS files.
-# See the latter for an explanation.
-
-# Names should be added to this file as
-# Name or Organization
-# The email address is not required for organizations.
-
-# Please keep the list sorted.
-
-Danny Yoo
-James Kolb
-Jonathan Amsterdam
-Markus Zimmermann
-Matt Kovars
-Örjan Persson
-Osman Masood
-Robert Carlsen
-Rory Flynn
-Sergi Mansilla
-Shatrugna Sadhu
-Shawn Smith
-Stas Maksimov
-Tor Arvid Lund
-Zac Bergquist
diff --git a/vendor/github.com/sergi/go-diff/CONTRIBUTORS b/vendor/github.com/sergi/go-diff/CONTRIBUTORS
deleted file mode 100644
index 369e3d551..000000000
--- a/vendor/github.com/sergi/go-diff/CONTRIBUTORS
+++ /dev/null
@@ -1,32 +0,0 @@
-# This is the official list of people who can contribute
-# (and typically have contributed) code to the go-diff
-# repository.
-#
-# The AUTHORS file lists the copyright holders; this file
-# lists people. For example, ACME Inc. employees would be listed here
-# but not in AUTHORS, because ACME Inc. would hold the copyright.
-#
-# When adding J Random Contributor's name to this file,
-# either J's name or J's organization's name should be
-# added to the AUTHORS file.
-#
-# Names should be added to this file like so:
-# Name
-#
-# Please keep the list sorted.
-
-Danny Yoo
-James Kolb
-Jonathan Amsterdam
-Markus Zimmermann
-Matt Kovars
-Örjan Persson
-Osman Masood
-Robert Carlsen
-Rory Flynn
-Sergi Mansilla
-Shatrugna Sadhu
-Shawn Smith
-Stas Maksimov
-Tor Arvid Lund
-Zac Bergquist
diff --git a/vendor/github.com/sergi/go-diff/LICENSE b/vendor/github.com/sergi/go-diff/LICENSE
deleted file mode 100644
index 937942c2b..000000000
--- a/vendor/github.com/sergi/go-diff/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2012-2016 The go-diff Authors. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go
deleted file mode 100644
index 915d5090d..000000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go
+++ /dev/null
@@ -1,1347 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "bytes"
- "errors"
- "fmt"
- "html"
- "math"
- "net/url"
- "regexp"
- "strconv"
- "strings"
- "time"
- "unicode/utf8"
-)
-
-// Operation defines the operation of a diff item.
-type Operation int8
-
-//go:generate stringer -type=Operation -trimprefix=Diff
-
-const (
- // DiffDelete item represents a delete diff.
- DiffDelete Operation = -1
- // DiffInsert item represents an insert diff.
- DiffInsert Operation = 1
- // DiffEqual item represents an equal diff.
- DiffEqual Operation = 0
-)
-
-// Diff represents one diff operation
-type Diff struct {
- Type Operation
- Text string
-}
-
-// splice removes amount elements from slice at index index, replacing them with elements.
-func splice(slice []Diff, index int, amount int, elements ...Diff) []Diff {
- if len(elements) == amount {
- // Easy case: overwrite the relevant items.
- copy(slice[index:], elements)
- return slice
- }
- if len(elements) < amount {
- // Fewer new items than old.
- // Copy in the new items.
- copy(slice[index:], elements)
- // Shift the remaining items left.
- copy(slice[index+len(elements):], slice[index+amount:])
- // Calculate the new end of the slice.
- end := len(slice) - amount + len(elements)
- // Zero stranded elements at end so that they can be garbage collected.
- tail := slice[end:]
- for i := range tail {
- tail[i] = Diff{}
- }
- return slice[:end]
- }
- // More new items than old.
- // Make room in slice for new elements.
- // There's probably an even more efficient way to do this,
- // but this is simple and clear.
- need := len(slice) - amount + len(elements)
- for len(slice) < need {
- slice = append(slice, Diff{})
- }
- // Shift slice elements right to make room for new elements.
- copy(slice[index+len(elements):], slice[index+amount:])
- // Copy in new elements.
- copy(slice[index:], elements)
- return slice
-}
-
-// DiffMain finds the differences between two texts.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-func (dmp *DiffMatchPatch) DiffMain(text1, text2 string, checklines bool) []Diff {
- return dmp.DiffMainRunes([]rune(text1), []rune(text2), checklines)
-}
-
-// DiffMainRunes finds the differences between two rune sequences.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-func (dmp *DiffMatchPatch) DiffMainRunes(text1, text2 []rune, checklines bool) []Diff {
- var deadline time.Time
- if dmp.DiffTimeout > 0 {
- deadline = time.Now().Add(dmp.DiffTimeout)
- }
- return dmp.diffMainRunes(text1, text2, checklines, deadline)
-}
-
-func (dmp *DiffMatchPatch) diffMainRunes(text1, text2 []rune, checklines bool, deadline time.Time) []Diff {
- if runesEqual(text1, text2) {
- var diffs []Diff
- if len(text1) > 0 {
- diffs = append(diffs, Diff{DiffEqual, string(text1)})
- }
- return diffs
- }
- // Trim off common prefix (speedup).
- commonlength := commonPrefixLength(text1, text2)
- commonprefix := text1[:commonlength]
- text1 = text1[commonlength:]
- text2 = text2[commonlength:]
-
- // Trim off common suffix (speedup).
- commonlength = commonSuffixLength(text1, text2)
- commonsuffix := text1[len(text1)-commonlength:]
- text1 = text1[:len(text1)-commonlength]
- text2 = text2[:len(text2)-commonlength]
-
- // Compute the diff on the middle block.
- diffs := dmp.diffCompute(text1, text2, checklines, deadline)
-
- // Restore the prefix and suffix.
- if len(commonprefix) != 0 {
- diffs = append([]Diff{{DiffEqual, string(commonprefix)}}, diffs...)
- }
- if len(commonsuffix) != 0 {
- diffs = append(diffs, Diff{DiffEqual, string(commonsuffix)})
- }
-
- return dmp.DiffCleanupMerge(diffs)
-}
-
-// diffCompute finds the differences between two rune slices. Assumes that the texts do not have any common prefix or suffix.
-func (dmp *DiffMatchPatch) diffCompute(text1, text2 []rune, checklines bool, deadline time.Time) []Diff {
- diffs := []Diff{}
- if len(text1) == 0 {
- // Just add some text (speedup).
- return append(diffs, Diff{DiffInsert, string(text2)})
- } else if len(text2) == 0 {
- // Just delete some text (speedup).
- return append(diffs, Diff{DiffDelete, string(text1)})
- }
-
- var longtext, shorttext []rune
- if len(text1) > len(text2) {
- longtext = text1
- shorttext = text2
- } else {
- longtext = text2
- shorttext = text1
- }
-
- if i := runesIndex(longtext, shorttext); i != -1 {
- op := DiffInsert
- // Swap insertions for deletions if diff is reversed.
- if len(text1) > len(text2) {
- op = DiffDelete
- }
- // Shorter text is inside the longer text (speedup).
- return []Diff{
- Diff{op, string(longtext[:i])},
- Diff{DiffEqual, string(shorttext)},
- Diff{op, string(longtext[i+len(shorttext):])},
- }
- } else if len(shorttext) == 1 {
- // Single character string.
- // After the previous speedup, the character can't be an equality.
- return []Diff{
- {DiffDelete, string(text1)},
- {DiffInsert, string(text2)},
- }
- // Check to see if the problem can be split in two.
- } else if hm := dmp.diffHalfMatch(text1, text2); hm != nil {
- // A half-match was found, sort out the return data.
- text1A := hm[0]
- text1B := hm[1]
- text2A := hm[2]
- text2B := hm[3]
- midCommon := hm[4]
- // Send both pairs off for separate processing.
- diffsA := dmp.diffMainRunes(text1A, text2A, checklines, deadline)
- diffsB := dmp.diffMainRunes(text1B, text2B, checklines, deadline)
- // Merge the results.
- diffs := diffsA
- diffs = append(diffs, Diff{DiffEqual, string(midCommon)})
- diffs = append(diffs, diffsB...)
- return diffs
- } else if checklines && len(text1) > 100 && len(text2) > 100 {
- return dmp.diffLineMode(text1, text2, deadline)
- }
- return dmp.diffBisect(text1, text2, deadline)
-}
-
-// diffLineMode does a quick line-level diff on both []runes, then rediff the parts for greater accuracy. This speedup can produce non-minimal diffs.
-func (dmp *DiffMatchPatch) diffLineMode(text1, text2 []rune, deadline time.Time) []Diff {
- // Scan the text on a line-by-line basis first.
- text1, text2, linearray := dmp.DiffLinesToRunes(string(text1), string(text2))
-
- diffs := dmp.diffMainRunes(text1, text2, false, deadline)
-
- // Convert the diff back to original text.
- diffs = dmp.DiffCharsToLines(diffs, linearray)
- // Eliminate freak matches (e.g. blank lines)
- diffs = dmp.DiffCleanupSemantic(diffs)
-
- // Rediff any replacement blocks, this time character-by-character.
- // Add a dummy entry at the end.
- diffs = append(diffs, Diff{DiffEqual, ""})
-
- pointer := 0
- countDelete := 0
- countInsert := 0
-
- // NOTE: Rune slices are slower than using strings in this case.
- textDelete := ""
- textInsert := ""
-
- for pointer < len(diffs) {
- switch diffs[pointer].Type {
- case DiffInsert:
- countInsert++
- textInsert += diffs[pointer].Text
- case DiffDelete:
- countDelete++
- textDelete += diffs[pointer].Text
- case DiffEqual:
- // Upon reaching an equality, check for prior redundancies.
- if countDelete >= 1 && countInsert >= 1 {
- // Delete the offending records and add the merged ones.
- diffs = splice(diffs, pointer-countDelete-countInsert,
- countDelete+countInsert)
-
- pointer = pointer - countDelete - countInsert
- a := dmp.diffMainRunes([]rune(textDelete), []rune(textInsert), false, deadline)
- for j := len(a) - 1; j >= 0; j-- {
- diffs = splice(diffs, pointer, 0, a[j])
- }
- pointer = pointer + len(a)
- }
-
- countInsert = 0
- countDelete = 0
- textDelete = ""
- textInsert = ""
- }
- pointer++
- }
-
- return diffs[:len(diffs)-1] // Remove the dummy entry at the end.
-}
-
-// DiffBisect finds the 'middle snake' of a diff, split the problem in two and return the recursively constructed diff.
-// If an invalid UTF-8 sequence is encountered, it will be replaced by the Unicode replacement character.
-// See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
-func (dmp *DiffMatchPatch) DiffBisect(text1, text2 string, deadline time.Time) []Diff {
- // Unused in this code, but retained for interface compatibility.
- return dmp.diffBisect([]rune(text1), []rune(text2), deadline)
-}
-
-// diffBisect finds the 'middle snake' of a diff, splits the problem in two and returns the recursively constructed diff.
-// See Myers's 1986 paper: An O(ND) Difference Algorithm and Its Variations.
-func (dmp *DiffMatchPatch) diffBisect(runes1, runes2 []rune, deadline time.Time) []Diff {
- // Cache the text lengths to prevent multiple calls.
- runes1Len, runes2Len := len(runes1), len(runes2)
-
- maxD := (runes1Len + runes2Len + 1) / 2
- vOffset := maxD
- vLength := 2 * maxD
-
- v1 := make([]int, vLength)
- v2 := make([]int, vLength)
- for i := range v1 {
- v1[i] = -1
- v2[i] = -1
- }
- v1[vOffset+1] = 0
- v2[vOffset+1] = 0
-
- delta := runes1Len - runes2Len
- // If the total number of characters is odd, then the front path will collide with the reverse path.
- front := (delta%2 != 0)
- // Offsets for start and end of k loop. Prevents mapping of space beyond the grid.
- k1start := 0
- k1end := 0
- k2start := 0
- k2end := 0
- for d := 0; d < maxD; d++ {
- // Bail out if deadline is reached.
- if !deadline.IsZero() && d%16 == 0 && time.Now().After(deadline) {
- break
- }
-
- // Walk the front path one step.
- for k1 := -d + k1start; k1 <= d-k1end; k1 += 2 {
- k1Offset := vOffset + k1
- var x1 int
-
- if k1 == -d || (k1 != d && v1[k1Offset-1] < v1[k1Offset+1]) {
- x1 = v1[k1Offset+1]
- } else {
- x1 = v1[k1Offset-1] + 1
- }
-
- y1 := x1 - k1
- for x1 < runes1Len && y1 < runes2Len {
- if runes1[x1] != runes2[y1] {
- break
- }
- x1++
- y1++
- }
- v1[k1Offset] = x1
- if x1 > runes1Len {
- // Ran off the right of the graph.
- k1end += 2
- } else if y1 > runes2Len {
- // Ran off the bottom of the graph.
- k1start += 2
- } else if front {
- k2Offset := vOffset + delta - k1
- if k2Offset >= 0 && k2Offset < vLength && v2[k2Offset] != -1 {
- // Mirror x2 onto top-left coordinate system.
- x2 := runes1Len - v2[k2Offset]
- if x1 >= x2 {
- // Overlap detected.
- return dmp.diffBisectSplit(runes1, runes2, x1, y1, deadline)
- }
- }
- }
- }
- // Walk the reverse path one step.
- for k2 := -d + k2start; k2 <= d-k2end; k2 += 2 {
- k2Offset := vOffset + k2
- var x2 int
- if k2 == -d || (k2 != d && v2[k2Offset-1] < v2[k2Offset+1]) {
- x2 = v2[k2Offset+1]
- } else {
- x2 = v2[k2Offset-1] + 1
- }
- var y2 = x2 - k2
- for x2 < runes1Len && y2 < runes2Len {
- if runes1[runes1Len-x2-1] != runes2[runes2Len-y2-1] {
- break
- }
- x2++
- y2++
- }
- v2[k2Offset] = x2
- if x2 > runes1Len {
- // Ran off the left of the graph.
- k2end += 2
- } else if y2 > runes2Len {
- // Ran off the top of the graph.
- k2start += 2
- } else if !front {
- k1Offset := vOffset + delta - k2
- if k1Offset >= 0 && k1Offset < vLength && v1[k1Offset] != -1 {
- x1 := v1[k1Offset]
- y1 := vOffset + x1 - k1Offset
- // Mirror x2 onto top-left coordinate system.
- x2 = runes1Len - x2
- if x1 >= x2 {
- // Overlap detected.
- return dmp.diffBisectSplit(runes1, runes2, x1, y1, deadline)
- }
- }
- }
- }
- }
- // Diff took too long and hit the deadline or number of diffs equals number of characters, no commonality at all.
- return []Diff{
- {DiffDelete, string(runes1)},
- {DiffInsert, string(runes2)},
- }
-}
-
-func (dmp *DiffMatchPatch) diffBisectSplit(runes1, runes2 []rune, x, y int,
- deadline time.Time) []Diff {
- runes1a := runes1[:x]
- runes2a := runes2[:y]
- runes1b := runes1[x:]
- runes2b := runes2[y:]
-
- // Compute both diffs serially.
- diffs := dmp.diffMainRunes(runes1a, runes2a, false, deadline)
- diffsb := dmp.diffMainRunes(runes1b, runes2b, false, deadline)
-
- return append(diffs, diffsb...)
-}
-
-// DiffLinesToChars splits two texts into a list of strings, and educes the texts to a string of hashes where each Unicode character represents one line.
-// It's slightly faster to call DiffLinesToRunes first, followed by DiffMainRunes.
-func (dmp *DiffMatchPatch) DiffLinesToChars(text1, text2 string) (string, string, []string) {
- chars1, chars2, lineArray := dmp.diffLinesToStrings(text1, text2)
- return chars1, chars2, lineArray
-}
-
-// DiffLinesToRunes splits two texts into a list of runes.
-func (dmp *DiffMatchPatch) DiffLinesToRunes(text1, text2 string) ([]rune, []rune, []string) {
- chars1, chars2, lineArray := dmp.diffLinesToStrings(text1, text2)
- return []rune(chars1), []rune(chars2), lineArray
-}
-
-// DiffCharsToLines rehydrates the text in a diff from a string of line hashes to real lines of text.
-func (dmp *DiffMatchPatch) DiffCharsToLines(diffs []Diff, lineArray []string) []Diff {
- hydrated := make([]Diff, 0, len(diffs))
- for _, aDiff := range diffs {
- runes := []rune(aDiff.Text)
- text := make([]string, len(runes))
-
- for i, r := range runes {
- text[i] = lineArray[runeToInt(r)]
- }
-
- aDiff.Text = strings.Join(text, "")
- hydrated = append(hydrated, aDiff)
- }
- return hydrated
-}
-
-// DiffCommonPrefix determines the common prefix length of two strings.
-func (dmp *DiffMatchPatch) DiffCommonPrefix(text1, text2 string) int {
- // Unused in this code, but retained for interface compatibility.
- return commonPrefixLength([]rune(text1), []rune(text2))
-}
-
-// DiffCommonSuffix determines the common suffix length of two strings.
-func (dmp *DiffMatchPatch) DiffCommonSuffix(text1, text2 string) int {
- // Unused in this code, but retained for interface compatibility.
- return commonSuffixLength([]rune(text1), []rune(text2))
-}
-
-// commonPrefixLength returns the length of the common prefix of two rune slices.
-func commonPrefixLength(text1, text2 []rune) int {
- // Linear search. See comment in commonSuffixLength.
- n := 0
- for ; n < len(text1) && n < len(text2); n++ {
- if text1[n] != text2[n] {
- return n
- }
- }
- return n
-}
-
-// commonSuffixLength returns the length of the common suffix of two rune slices.
-func commonSuffixLength(text1, text2 []rune) int {
- // Use linear search rather than the binary search discussed at https://neil.fraser.name/news/2007/10/09/.
- // See discussion at https://github.com/sergi/go-diff/issues/54.
- i1 := len(text1)
- i2 := len(text2)
- for n := 0; ; n++ {
- i1--
- i2--
- if i1 < 0 || i2 < 0 || text1[i1] != text2[i2] {
- return n
- }
- }
-}
-
-// DiffCommonOverlap determines if the suffix of one string is the prefix of another.
-func (dmp *DiffMatchPatch) DiffCommonOverlap(text1 string, text2 string) int {
- // Cache the text lengths to prevent multiple calls.
- text1Length := len(text1)
- text2Length := len(text2)
- // Eliminate the null case.
- if text1Length == 0 || text2Length == 0 {
- return 0
- }
- // Truncate the longer string.
- if text1Length > text2Length {
- text1 = text1[text1Length-text2Length:]
- } else if text1Length < text2Length {
- text2 = text2[0:text1Length]
- }
- textLength := int(math.Min(float64(text1Length), float64(text2Length)))
- // Quick check for the worst case.
- if text1 == text2 {
- return textLength
- }
-
- // Start by looking for a single character match and increase length until no match is found. Performance analysis: http://neil.fraser.name/news/2010/11/04/
- best := 0
- length := 1
- for {
- pattern := text1[textLength-length:]
- found := strings.Index(text2, pattern)
- if found == -1 {
- break
- }
- length += found
- if found == 0 || text1[textLength-length:] == text2[0:length] {
- best = length
- length++
- }
- }
-
- return best
-}
-
-// DiffHalfMatch checks whether the two texts share a substring which is at least half the length of the longer text. This speedup can produce non-minimal diffs.
-func (dmp *DiffMatchPatch) DiffHalfMatch(text1, text2 string) []string {
- // Unused in this code, but retained for interface compatibility.
- runeSlices := dmp.diffHalfMatch([]rune(text1), []rune(text2))
- if runeSlices == nil {
- return nil
- }
-
- result := make([]string, len(runeSlices))
- for i, r := range runeSlices {
- result[i] = string(r)
- }
- return result
-}
-
-func (dmp *DiffMatchPatch) diffHalfMatch(text1, text2 []rune) [][]rune {
- if dmp.DiffTimeout <= 0 {
- // Don't risk returning a non-optimal diff if we have unlimited time.
- return nil
- }
-
- var longtext, shorttext []rune
- if len(text1) > len(text2) {
- longtext = text1
- shorttext = text2
- } else {
- longtext = text2
- shorttext = text1
- }
-
- if len(longtext) < 4 || len(shorttext)*2 < len(longtext) {
- return nil // Pointless.
- }
-
- // First check if the second quarter is the seed for a half-match.
- hm1 := dmp.diffHalfMatchI(longtext, shorttext, int(float64(len(longtext)+3)/4))
-
- // Check again based on the third quarter.
- hm2 := dmp.diffHalfMatchI(longtext, shorttext, int(float64(len(longtext)+1)/2))
-
- hm := [][]rune{}
- if hm1 == nil && hm2 == nil {
- return nil
- } else if hm2 == nil {
- hm = hm1
- } else if hm1 == nil {
- hm = hm2
- } else {
- // Both matched. Select the longest.
- if len(hm1[4]) > len(hm2[4]) {
- hm = hm1
- } else {
- hm = hm2
- }
- }
-
- // A half-match was found, sort out the return data.
- if len(text1) > len(text2) {
- return hm
- }
-
- return [][]rune{hm[2], hm[3], hm[0], hm[1], hm[4]}
-}
-
-// diffHalfMatchI checks if a substring of shorttext exist within longtext such that the substring is at least half the length of longtext?
-// Returns a slice containing the prefix of longtext, the suffix of longtext, the prefix of shorttext, the suffix of shorttext and the common middle, or null if there was no match.
-func (dmp *DiffMatchPatch) diffHalfMatchI(l, s []rune, i int) [][]rune {
- var bestCommonA []rune
- var bestCommonB []rune
- var bestCommonLen int
- var bestLongtextA []rune
- var bestLongtextB []rune
- var bestShorttextA []rune
- var bestShorttextB []rune
-
- // Start with a 1/4 length substring at position i as a seed.
- seed := l[i : i+len(l)/4]
-
- for j := runesIndexOf(s, seed, 0); j != -1; j = runesIndexOf(s, seed, j+1) {
- prefixLength := commonPrefixLength(l[i:], s[j:])
- suffixLength := commonSuffixLength(l[:i], s[:j])
-
- if bestCommonLen < suffixLength+prefixLength {
- bestCommonA = s[j-suffixLength : j]
- bestCommonB = s[j : j+prefixLength]
- bestCommonLen = len(bestCommonA) + len(bestCommonB)
- bestLongtextA = l[:i-suffixLength]
- bestLongtextB = l[i+prefixLength:]
- bestShorttextA = s[:j-suffixLength]
- bestShorttextB = s[j+prefixLength:]
- }
- }
-
- if bestCommonLen*2 < len(l) {
- return nil
- }
-
- return [][]rune{
- bestLongtextA,
- bestLongtextB,
- bestShorttextA,
- bestShorttextB,
- append(bestCommonA, bestCommonB...),
- }
-}
-
-// DiffCleanupSemantic reduces the number of edits by eliminating semantically trivial equalities.
-func (dmp *DiffMatchPatch) DiffCleanupSemantic(diffs []Diff) []Diff {
- changes := false
- // Stack of indices where equalities are found.
- equalities := make([]int, 0, len(diffs))
-
- var lastequality string
- // Always equal to diffs[equalities[equalitiesLength - 1]][1]
- var pointer int // Index of current position.
- // Number of characters that changed prior to the equality.
- var lengthInsertions1, lengthDeletions1 int
- // Number of characters that changed after the equality.
- var lengthInsertions2, lengthDeletions2 int
-
- for pointer < len(diffs) {
- if diffs[pointer].Type == DiffEqual {
- // Equality found.
- equalities = append(equalities, pointer)
- lengthInsertions1 = lengthInsertions2
- lengthDeletions1 = lengthDeletions2
- lengthInsertions2 = 0
- lengthDeletions2 = 0
- lastequality = diffs[pointer].Text
- } else {
- // An insertion or deletion.
-
- if diffs[pointer].Type == DiffInsert {
- lengthInsertions2 += utf8.RuneCountInString(diffs[pointer].Text)
- } else {
- lengthDeletions2 += utf8.RuneCountInString(diffs[pointer].Text)
- }
- // Eliminate an equality that is smaller or equal to the edits on both sides of it.
- difference1 := int(math.Max(float64(lengthInsertions1), float64(lengthDeletions1)))
- difference2 := int(math.Max(float64(lengthInsertions2), float64(lengthDeletions2)))
- if utf8.RuneCountInString(lastequality) > 0 &&
- (utf8.RuneCountInString(lastequality) <= difference1) &&
- (utf8.RuneCountInString(lastequality) <= difference2) {
- // Duplicate record.
- insPoint := equalities[len(equalities)-1]
- diffs = splice(diffs, insPoint, 0, Diff{DiffDelete, lastequality})
-
- // Change second copy to insert.
- diffs[insPoint+1].Type = DiffInsert
- // Throw away the equality we just deleted.
- equalities = equalities[:len(equalities)-1]
-
- if len(equalities) > 0 {
- equalities = equalities[:len(equalities)-1]
- }
- pointer = -1
- if len(equalities) > 0 {
- pointer = equalities[len(equalities)-1]
- }
-
- lengthInsertions1 = 0 // Reset the counters.
- lengthDeletions1 = 0
- lengthInsertions2 = 0
- lengthDeletions2 = 0
- lastequality = ""
- changes = true
- }
- }
- pointer++
- }
-
- // Normalize the diff.
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
- diffs = dmp.DiffCleanupSemanticLossless(diffs)
- // Find any overlaps between deletions and insertions.
- // e.g: abcxxxxxxdef
- // -> abcxxxdef
- // e.g: xxxabcdefxxx
- // -> defxxxabc
- // Only extract an overlap if it is as big as the edit ahead or behind it.
- pointer = 1
- for pointer < len(diffs) {
- if diffs[pointer-1].Type == DiffDelete &&
- diffs[pointer].Type == DiffInsert {
- deletion := diffs[pointer-1].Text
- insertion := diffs[pointer].Text
- overlapLength1 := dmp.DiffCommonOverlap(deletion, insertion)
- overlapLength2 := dmp.DiffCommonOverlap(insertion, deletion)
- if overlapLength1 >= overlapLength2 {
- if float64(overlapLength1) >= float64(utf8.RuneCountInString(deletion))/2 ||
- float64(overlapLength1) >= float64(utf8.RuneCountInString(insertion))/2 {
-
- // Overlap found. Insert an equality and trim the surrounding edits.
- diffs = splice(diffs, pointer, 0, Diff{DiffEqual, insertion[:overlapLength1]})
- diffs[pointer-1].Text =
- deletion[0 : len(deletion)-overlapLength1]
- diffs[pointer+1].Text = insertion[overlapLength1:]
- pointer++
- }
- } else {
- if float64(overlapLength2) >= float64(utf8.RuneCountInString(deletion))/2 ||
- float64(overlapLength2) >= float64(utf8.RuneCountInString(insertion))/2 {
- // Reverse overlap found. Insert an equality and swap and trim the surrounding edits.
- overlap := Diff{DiffEqual, deletion[:overlapLength2]}
- diffs = splice(diffs, pointer, 0, overlap)
- diffs[pointer-1].Type = DiffInsert
- diffs[pointer-1].Text = insertion[0 : len(insertion)-overlapLength2]
- diffs[pointer+1].Type = DiffDelete
- diffs[pointer+1].Text = deletion[overlapLength2:]
- pointer++
- }
- }
- pointer++
- }
- pointer++
- }
-
- return diffs
-}
-
-// Define some regex patterns for matching boundaries.
-var (
- nonAlphaNumericRegex = regexp.MustCompile(`[^a-zA-Z0-9]`)
- whitespaceRegex = regexp.MustCompile(`\s`)
- linebreakRegex = regexp.MustCompile(`[\r\n]`)
- blanklineEndRegex = regexp.MustCompile(`\n\r?\n$`)
- blanklineStartRegex = regexp.MustCompile(`^\r?\n\r?\n`)
-)
-
-// diffCleanupSemanticScore computes a score representing whether the internal boundary falls on logical boundaries.
-// Scores range from 6 (best) to 0 (worst). Closure, but does not reference any external variables.
-func diffCleanupSemanticScore(one, two string) int {
- if len(one) == 0 || len(two) == 0 {
- // Edges are the best.
- return 6
- }
-
- // Each port of this function behaves slightly differently due to subtle differences in each language's definition of things like 'whitespace'. Since this function's purpose is largely cosmetic, the choice has been made to use each language's native features rather than force total conformity.
- rune1, _ := utf8.DecodeLastRuneInString(one)
- rune2, _ := utf8.DecodeRuneInString(two)
- char1 := string(rune1)
- char2 := string(rune2)
-
- nonAlphaNumeric1 := nonAlphaNumericRegex.MatchString(char1)
- nonAlphaNumeric2 := nonAlphaNumericRegex.MatchString(char2)
- whitespace1 := nonAlphaNumeric1 && whitespaceRegex.MatchString(char1)
- whitespace2 := nonAlphaNumeric2 && whitespaceRegex.MatchString(char2)
- lineBreak1 := whitespace1 && linebreakRegex.MatchString(char1)
- lineBreak2 := whitespace2 && linebreakRegex.MatchString(char2)
- blankLine1 := lineBreak1 && blanklineEndRegex.MatchString(one)
- blankLine2 := lineBreak2 && blanklineEndRegex.MatchString(two)
-
- if blankLine1 || blankLine2 {
- // Five points for blank lines.
- return 5
- } else if lineBreak1 || lineBreak2 {
- // Four points for line breaks.
- return 4
- } else if nonAlphaNumeric1 && !whitespace1 && whitespace2 {
- // Three points for end of sentences.
- return 3
- } else if whitespace1 || whitespace2 {
- // Two points for whitespace.
- return 2
- } else if nonAlphaNumeric1 || nonAlphaNumeric2 {
- // One point for non-alphanumeric.
- return 1
- }
- return 0
-}
-
-// DiffCleanupSemanticLossless looks for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary.
-// E.g: The cat came. -> The cat came.
-func (dmp *DiffMatchPatch) DiffCleanupSemanticLossless(diffs []Diff) []Diff {
- pointer := 1
-
- // Intentionally ignore the first and last element (don't need checking).
- for pointer < len(diffs)-1 {
- if diffs[pointer-1].Type == DiffEqual &&
- diffs[pointer+1].Type == DiffEqual {
-
- // This is a single edit surrounded by equalities.
- equality1 := diffs[pointer-1].Text
- edit := diffs[pointer].Text
- equality2 := diffs[pointer+1].Text
-
- // First, shift the edit as far left as possible.
- commonOffset := dmp.DiffCommonSuffix(equality1, edit)
- if commonOffset > 0 {
- commonString := edit[len(edit)-commonOffset:]
- equality1 = equality1[0 : len(equality1)-commonOffset]
- edit = commonString + edit[:len(edit)-commonOffset]
- equality2 = commonString + equality2
- }
-
- // Second, step character by character right, looking for the best fit.
- bestEquality1 := equality1
- bestEdit := edit
- bestEquality2 := equality2
- bestScore := diffCleanupSemanticScore(equality1, edit) +
- diffCleanupSemanticScore(edit, equality2)
-
- for len(edit) != 0 && len(equality2) != 0 {
- _, sz := utf8.DecodeRuneInString(edit)
- if len(equality2) < sz || edit[:sz] != equality2[:sz] {
- break
- }
- equality1 += edit[:sz]
- edit = edit[sz:] + equality2[:sz]
- equality2 = equality2[sz:]
- score := diffCleanupSemanticScore(equality1, edit) +
- diffCleanupSemanticScore(edit, equality2)
- // The >= encourages trailing rather than leading whitespace on edits.
- if score >= bestScore {
- bestScore = score
- bestEquality1 = equality1
- bestEdit = edit
- bestEquality2 = equality2
- }
- }
-
- if diffs[pointer-1].Text != bestEquality1 {
- // We have an improvement, save it back to the diff.
- if len(bestEquality1) != 0 {
- diffs[pointer-1].Text = bestEquality1
- } else {
- diffs = splice(diffs, pointer-1, 1)
- pointer--
- }
-
- diffs[pointer].Text = bestEdit
- if len(bestEquality2) != 0 {
- diffs[pointer+1].Text = bestEquality2
- } else {
- diffs = append(diffs[:pointer+1], diffs[pointer+2:]...)
- pointer--
- }
- }
- }
- pointer++
- }
-
- return diffs
-}
-
-// DiffCleanupEfficiency reduces the number of edits by eliminating operationally trivial equalities.
-func (dmp *DiffMatchPatch) DiffCleanupEfficiency(diffs []Diff) []Diff {
- changes := false
- // Stack of indices where equalities are found.
- type equality struct {
- data int
- next *equality
- }
- var equalities *equality
- // Always equal to equalities[equalitiesLength-1][1]
- lastequality := ""
- pointer := 0 // Index of current position.
- // Is there an insertion operation before the last equality.
- preIns := false
- // Is there a deletion operation before the last equality.
- preDel := false
- // Is there an insertion operation after the last equality.
- postIns := false
- // Is there a deletion operation after the last equality.
- postDel := false
- for pointer < len(diffs) {
- if diffs[pointer].Type == DiffEqual { // Equality found.
- if len(diffs[pointer].Text) < dmp.DiffEditCost &&
- (postIns || postDel) {
- // Candidate found.
- equalities = &equality{
- data: pointer,
- next: equalities,
- }
- preIns = postIns
- preDel = postDel
- lastequality = diffs[pointer].Text
- } else {
- // Not a candidate, and can never become one.
- equalities = nil
- lastequality = ""
- }
- postIns = false
- postDel = false
- } else { // An insertion or deletion.
- if diffs[pointer].Type == DiffDelete {
- postDel = true
- } else {
- postIns = true
- }
-
- // Five types to be split:
- // ABXYCD
- // AXCD
- // ABXC
- // AXCD
- // ABXC
- var sumPres int
- if preIns {
- sumPres++
- }
- if preDel {
- sumPres++
- }
- if postIns {
- sumPres++
- }
- if postDel {
- sumPres++
- }
- if len(lastequality) > 0 &&
- ((preIns && preDel && postIns && postDel) ||
- ((len(lastequality) < dmp.DiffEditCost/2) && sumPres == 3)) {
-
- insPoint := equalities.data
-
- // Duplicate record.
- diffs = splice(diffs, insPoint, 0, Diff{DiffDelete, lastequality})
-
- // Change second copy to insert.
- diffs[insPoint+1].Type = DiffInsert
- // Throw away the equality we just deleted.
- equalities = equalities.next
- lastequality = ""
-
- if preIns && preDel {
- // No changes made which could affect previous entry, keep going.
- postIns = true
- postDel = true
- equalities = nil
- } else {
- if equalities != nil {
- equalities = equalities.next
- }
- if equalities != nil {
- pointer = equalities.data
- } else {
- pointer = -1
- }
- postIns = false
- postDel = false
- }
- changes = true
- }
- }
- pointer++
- }
-
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
-
- return diffs
-}
-
-// DiffCleanupMerge reorders and merges like edit sections. Merge equalities.
-// Any edit section can move as long as it doesn't cross an equality.
-func (dmp *DiffMatchPatch) DiffCleanupMerge(diffs []Diff) []Diff {
- // Add a dummy entry at the end.
- diffs = append(diffs, Diff{DiffEqual, ""})
- pointer := 0
- countDelete := 0
- countInsert := 0
- commonlength := 0
- textDelete := []rune(nil)
- textInsert := []rune(nil)
-
- for pointer < len(diffs) {
- switch diffs[pointer].Type {
- case DiffInsert:
- countInsert++
- textInsert = append(textInsert, []rune(diffs[pointer].Text)...)
- pointer++
- break
- case DiffDelete:
- countDelete++
- textDelete = append(textDelete, []rune(diffs[pointer].Text)...)
- pointer++
- break
- case DiffEqual:
- // Upon reaching an equality, check for prior redundancies.
- if countDelete+countInsert > 1 {
- if countDelete != 0 && countInsert != 0 {
- // Factor out any common prefixies.
- commonlength = commonPrefixLength(textInsert, textDelete)
- if commonlength != 0 {
- x := pointer - countDelete - countInsert
- if x > 0 && diffs[x-1].Type == DiffEqual {
- diffs[x-1].Text += string(textInsert[:commonlength])
- } else {
- diffs = append([]Diff{{DiffEqual, string(textInsert[:commonlength])}}, diffs...)
- pointer++
- }
- textInsert = textInsert[commonlength:]
- textDelete = textDelete[commonlength:]
- }
- // Factor out any common suffixies.
- commonlength = commonSuffixLength(textInsert, textDelete)
- if commonlength != 0 {
- insertIndex := len(textInsert) - commonlength
- deleteIndex := len(textDelete) - commonlength
- diffs[pointer].Text = string(textInsert[insertIndex:]) + diffs[pointer].Text
- textInsert = textInsert[:insertIndex]
- textDelete = textDelete[:deleteIndex]
- }
- }
- // Delete the offending records and add the merged ones.
- if countDelete == 0 {
- diffs = splice(diffs, pointer-countInsert,
- countDelete+countInsert,
- Diff{DiffInsert, string(textInsert)})
- } else if countInsert == 0 {
- diffs = splice(diffs, pointer-countDelete,
- countDelete+countInsert,
- Diff{DiffDelete, string(textDelete)})
- } else {
- diffs = splice(diffs, pointer-countDelete-countInsert,
- countDelete+countInsert,
- Diff{DiffDelete, string(textDelete)},
- Diff{DiffInsert, string(textInsert)})
- }
-
- pointer = pointer - countDelete - countInsert + 1
- if countDelete != 0 {
- pointer++
- }
- if countInsert != 0 {
- pointer++
- }
- } else if pointer != 0 && diffs[pointer-1].Type == DiffEqual {
- // Merge this equality with the previous one.
- diffs[pointer-1].Text += diffs[pointer].Text
- diffs = append(diffs[:pointer], diffs[pointer+1:]...)
- } else {
- pointer++
- }
- countInsert = 0
- countDelete = 0
- textDelete = nil
- textInsert = nil
- break
- }
- }
-
- if len(diffs[len(diffs)-1].Text) == 0 {
- diffs = diffs[0 : len(diffs)-1] // Remove the dummy entry at the end.
- }
-
- // Second pass: look for single edits surrounded on both sides by equalities which can be shifted sideways to eliminate an equality. E.g: ABAC -> ABAC
- changes := false
- pointer = 1
- // Intentionally ignore the first and last element (don't need checking).
- for pointer < (len(diffs) - 1) {
- if diffs[pointer-1].Type == DiffEqual &&
- diffs[pointer+1].Type == DiffEqual {
- // This is a single edit surrounded by equalities.
- if strings.HasSuffix(diffs[pointer].Text, diffs[pointer-1].Text) {
- // Shift the edit over the previous equality.
- diffs[pointer].Text = diffs[pointer-1].Text +
- diffs[pointer].Text[:len(diffs[pointer].Text)-len(diffs[pointer-1].Text)]
- diffs[pointer+1].Text = diffs[pointer-1].Text + diffs[pointer+1].Text
- diffs = splice(diffs, pointer-1, 1)
- changes = true
- } else if strings.HasPrefix(diffs[pointer].Text, diffs[pointer+1].Text) {
- // Shift the edit over the next equality.
- diffs[pointer-1].Text += diffs[pointer+1].Text
- diffs[pointer].Text =
- diffs[pointer].Text[len(diffs[pointer+1].Text):] + diffs[pointer+1].Text
- diffs = splice(diffs, pointer+1, 1)
- changes = true
- }
- }
- pointer++
- }
-
- // If shifts were made, the diff needs reordering and another shift sweep.
- if changes {
- diffs = dmp.DiffCleanupMerge(diffs)
- }
-
- return diffs
-}
-
-// DiffXIndex returns the equivalent location in s2.
-func (dmp *DiffMatchPatch) DiffXIndex(diffs []Diff, loc int) int {
- chars1 := 0
- chars2 := 0
- lastChars1 := 0
- lastChars2 := 0
- lastDiff := Diff{}
- for i := 0; i < len(diffs); i++ {
- aDiff := diffs[i]
- if aDiff.Type != DiffInsert {
- // Equality or deletion.
- chars1 += len(aDiff.Text)
- }
- if aDiff.Type != DiffDelete {
- // Equality or insertion.
- chars2 += len(aDiff.Text)
- }
- if chars1 > loc {
- // Overshot the location.
- lastDiff = aDiff
- break
- }
- lastChars1 = chars1
- lastChars2 = chars2
- }
- if lastDiff.Type == DiffDelete {
- // The location was deleted.
- return lastChars2
- }
- // Add the remaining character length.
- return lastChars2 + (loc - lastChars1)
-}
-
-// DiffPrettyHtml converts a []Diff into a pretty HTML report.
-// It is intended as an example from which to write one's own display functions.
-func (dmp *DiffMatchPatch) DiffPrettyHtml(diffs []Diff) string {
- var buff bytes.Buffer
- for _, diff := range diffs {
- text := strings.Replace(html.EscapeString(diff.Text), "\n", "¶
", -1)
- switch diff.Type {
- case DiffInsert:
- _, _ = buff.WriteString("")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("")
- case DiffDelete:
- _, _ = buff.WriteString("")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("")
- case DiffEqual:
- _, _ = buff.WriteString("")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("")
- }
- }
- return buff.String()
-}
-
-// DiffPrettyText converts a []Diff into a colored text report.
-func (dmp *DiffMatchPatch) DiffPrettyText(diffs []Diff) string {
- var buff bytes.Buffer
- for _, diff := range diffs {
- text := diff.Text
-
- switch diff.Type {
- case DiffInsert:
- _, _ = buff.WriteString("\x1b[32m")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("\x1b[0m")
- case DiffDelete:
- _, _ = buff.WriteString("\x1b[31m")
- _, _ = buff.WriteString(text)
- _, _ = buff.WriteString("\x1b[0m")
- case DiffEqual:
- _, _ = buff.WriteString(text)
- }
- }
-
- return buff.String()
-}
-
-// DiffText1 computes and returns the source text (all equalities and deletions).
-func (dmp *DiffMatchPatch) DiffText1(diffs []Diff) string {
- //StringBuilder text = new StringBuilder()
- var text bytes.Buffer
-
- for _, aDiff := range diffs {
- if aDiff.Type != DiffInsert {
- _, _ = text.WriteString(aDiff.Text)
- }
- }
- return text.String()
-}
-
-// DiffText2 computes and returns the destination text (all equalities and insertions).
-func (dmp *DiffMatchPatch) DiffText2(diffs []Diff) string {
- var text bytes.Buffer
-
- for _, aDiff := range diffs {
- if aDiff.Type != DiffDelete {
- _, _ = text.WriteString(aDiff.Text)
- }
- }
- return text.String()
-}
-
-// DiffLevenshtein computes the Levenshtein distance that is the number of inserted, deleted or substituted characters.
-func (dmp *DiffMatchPatch) DiffLevenshtein(diffs []Diff) int {
- levenshtein := 0
- insertions := 0
- deletions := 0
-
- for _, aDiff := range diffs {
- switch aDiff.Type {
- case DiffInsert:
- insertions += utf8.RuneCountInString(aDiff.Text)
- case DiffDelete:
- deletions += utf8.RuneCountInString(aDiff.Text)
- case DiffEqual:
- // A deletion and an insertion is one substitution.
- levenshtein += max(insertions, deletions)
- insertions = 0
- deletions = 0
- }
- }
-
- levenshtein += max(insertions, deletions)
- return levenshtein
-}
-
-// DiffToDelta crushes the diff into an encoded string which describes the operations required to transform text1 into text2.
-// E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. Operations are tab-separated. Inserted text is escaped using %xx notation.
-func (dmp *DiffMatchPatch) DiffToDelta(diffs []Diff) string {
- var text bytes.Buffer
- for _, aDiff := range diffs {
- switch aDiff.Type {
- case DiffInsert:
- _, _ = text.WriteString("+")
- _, _ = text.WriteString(strings.Replace(url.QueryEscape(aDiff.Text), "+", " ", -1))
- _, _ = text.WriteString("\t")
- break
- case DiffDelete:
- _, _ = text.WriteString("-")
- _, _ = text.WriteString(strconv.Itoa(utf8.RuneCountInString(aDiff.Text)))
- _, _ = text.WriteString("\t")
- break
- case DiffEqual:
- _, _ = text.WriteString("=")
- _, _ = text.WriteString(strconv.Itoa(utf8.RuneCountInString(aDiff.Text)))
- _, _ = text.WriteString("\t")
- break
- }
- }
- delta := text.String()
- if len(delta) != 0 {
- // Strip off trailing tab character.
- delta = delta[0 : utf8.RuneCountInString(delta)-1]
- delta = unescaper.Replace(delta)
- }
- return delta
-}
-
-// DiffFromDelta given the original text1, and an encoded string which describes the operations required to transform text1 into text2, comAdde the full diff.
-func (dmp *DiffMatchPatch) DiffFromDelta(text1 string, delta string) (diffs []Diff, err error) {
- i := 0
- runes := []rune(text1)
-
- for _, token := range strings.Split(delta, "\t") {
- if len(token) == 0 {
- // Blank tokens are ok (from a trailing \t).
- continue
- }
-
- // Each token begins with a one character parameter which specifies the operation of this token (delete, insert, equality).
- param := token[1:]
-
- switch op := token[0]; op {
- case '+':
- // Decode would Diff all "+" to " "
- param = strings.Replace(param, "+", "%2b", -1)
- param, err = url.QueryUnescape(param)
- if err != nil {
- return nil, err
- }
- if !utf8.ValidString(param) {
- return nil, fmt.Errorf("invalid UTF-8 token: %q", param)
- }
-
- diffs = append(diffs, Diff{DiffInsert, param})
- case '=', '-':
- n, err := strconv.ParseInt(param, 10, 0)
- if err != nil {
- return nil, err
- } else if n < 0 {
- return nil, errors.New("Negative number in DiffFromDelta: " + param)
- }
-
- i += int(n)
- // Break out if we are out of bounds, go1.6 can't handle this very well
- if i > len(runes) {
- break
- }
- // Remember that string slicing is by byte - we want by rune here.
- text := string(runes[i-int(n) : i])
-
- if op == '=' {
- diffs = append(diffs, Diff{DiffEqual, text})
- } else {
- diffs = append(diffs, Diff{DiffDelete, text})
- }
- default:
- // Anything else is an error.
- return nil, errors.New("Invalid diff operation in DiffFromDelta: " + string(token[0]))
- }
- }
-
- if i != len(runes) {
- return nil, fmt.Errorf("Delta length (%v) is different from source text length (%v)", i, len(text1))
- }
-
- return diffs, nil
-}
-
-// diffLinesToStrings splits two texts into a list of strings. Each string represents one line.
-func (dmp *DiffMatchPatch) diffLinesToStrings(text1, text2 string) (string, string, []string) {
- // '\x00' is a valid character, but various debuggers don't like it. So we'll insert a junk entry to avoid generating a null character.
- lineArray := []string{""} // e.g. lineArray[4] == 'Hello\n'
-
- lineHash := make(map[string]int)
- //Each string has the index of lineArray which it points to
- strIndexArray1 := dmp.diffLinesToStringsMunge(text1, &lineArray, lineHash)
- strIndexArray2 := dmp.diffLinesToStringsMunge(text2, &lineArray, lineHash)
-
- return intArrayToString(strIndexArray1), intArrayToString(strIndexArray2), lineArray
-}
-
-// diffLinesToStringsMunge splits a text into an array of strings, and reduces the texts to a []string.
-func (dmp *DiffMatchPatch) diffLinesToStringsMunge(text string, lineArray *[]string, lineHash map[string]int) []uint32 {
- // Walk the text, pulling out a substring for each line. text.split('\n') would would temporarily double our memory footprint. Modifying text would create many large strings to garbage collect.
- lineStart := 0
- lineEnd := -1
- strs := []uint32{}
-
- for lineEnd < len(text)-1 {
- lineEnd = indexOf(text, "\n", lineStart)
-
- if lineEnd == -1 {
- lineEnd = len(text) - 1
- }
-
- line := text[lineStart : lineEnd+1]
- lineStart = lineEnd + 1
- lineValue, ok := lineHash[line]
-
- if ok {
- strs = append(strs, uint32(lineValue))
- } else {
- *lineArray = append(*lineArray, line)
- lineHash[line] = len(*lineArray) - 1
- strs = append(strs, uint32(len(*lineArray)-1))
- }
- }
-
- return strs
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/diffmatchpatch.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/diffmatchpatch.go
deleted file mode 100644
index d3acc32ce..000000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/diffmatchpatch.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-// Package diffmatchpatch offers robust algorithms to perform the operations required for synchronizing plain text.
-package diffmatchpatch
-
-import (
- "time"
-)
-
-// DiffMatchPatch holds the configuration for diff-match-patch operations.
-type DiffMatchPatch struct {
- // Number of seconds to map a diff before giving up (0 for infinity).
- DiffTimeout time.Duration
- // Cost of an empty edit operation in terms of edit characters.
- DiffEditCost int
- // How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match).
- MatchDistance int
- // When deleting a large block of text (over ~64 characters), how close do the contents have to be to match the expected contents. (0.0 = perfection, 1.0 = very loose). Note that MatchThreshold controls how closely the end points of a delete need to match.
- PatchDeleteThreshold float64
- // Chunk size for context length.
- PatchMargin int
- // The number of bits in an int.
- MatchMaxBits int
- // At what point is no match declared (0.0 = perfection, 1.0 = very loose).
- MatchThreshold float64
-}
-
-// New creates a new DiffMatchPatch object with default parameters.
-func New() *DiffMatchPatch {
- // Defaults.
- return &DiffMatchPatch{
- DiffTimeout: time.Second,
- DiffEditCost: 4,
- MatchThreshold: 0.5,
- MatchDistance: 1000,
- PatchDeleteThreshold: 0.5,
- PatchMargin: 4,
- MatchMaxBits: 32,
- }
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/match.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/match.go
deleted file mode 100644
index 17374e109..000000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/match.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "math"
-)
-
-// MatchMain locates the best instance of 'pattern' in 'text' near 'loc'.
-// Returns -1 if no match found.
-func (dmp *DiffMatchPatch) MatchMain(text, pattern string, loc int) int {
- // Check for null inputs not needed since null can't be passed in C#.
-
- loc = int(math.Max(0, math.Min(float64(loc), float64(len(text)))))
- if text == pattern {
- // Shortcut (potentially not guaranteed by the algorithm)
- return 0
- } else if len(text) == 0 {
- // Nothing to match.
- return -1
- } else if loc+len(pattern) <= len(text) && text[loc:loc+len(pattern)] == pattern {
- // Perfect match at the perfect spot! (Includes case of null pattern)
- return loc
- }
- // Do a fuzzy compare.
- return dmp.MatchBitap(text, pattern, loc)
-}
-
-// MatchBitap locates the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm.
-// Returns -1 if no match was found.
-func (dmp *DiffMatchPatch) MatchBitap(text, pattern string, loc int) int {
- // Initialise the alphabet.
- s := dmp.MatchAlphabet(pattern)
-
- // Highest score beyond which we give up.
- scoreThreshold := dmp.MatchThreshold
- // Is there a nearby exact match? (speedup)
- bestLoc := indexOf(text, pattern, loc)
- if bestLoc != -1 {
- scoreThreshold = math.Min(dmp.matchBitapScore(0, bestLoc, loc,
- pattern), scoreThreshold)
- // What about in the other direction? (speedup)
- bestLoc = lastIndexOf(text, pattern, loc+len(pattern))
- if bestLoc != -1 {
- scoreThreshold = math.Min(dmp.matchBitapScore(0, bestLoc, loc,
- pattern), scoreThreshold)
- }
- }
-
- // Initialise the bit arrays.
- matchmask := 1 << uint((len(pattern) - 1))
- bestLoc = -1
-
- var binMin, binMid int
- binMax := len(pattern) + len(text)
- lastRd := []int{}
- for d := 0; d < len(pattern); d++ {
- // Scan for the best match; each iteration allows for one more error. Run a binary search to determine how far from 'loc' we can stray at this error level.
- binMin = 0
- binMid = binMax
- for binMin < binMid {
- if dmp.matchBitapScore(d, loc+binMid, loc, pattern) <= scoreThreshold {
- binMin = binMid
- } else {
- binMax = binMid
- }
- binMid = (binMax-binMin)/2 + binMin
- }
- // Use the result from this iteration as the maximum for the next.
- binMax = binMid
- start := int(math.Max(1, float64(loc-binMid+1)))
- finish := int(math.Min(float64(loc+binMid), float64(len(text))) + float64(len(pattern)))
-
- rd := make([]int, finish+2)
- rd[finish+1] = (1 << uint(d)) - 1
-
- for j := finish; j >= start; j-- {
- var charMatch int
- if len(text) <= j-1 {
- // Out of range.
- charMatch = 0
- } else if _, ok := s[text[j-1]]; !ok {
- charMatch = 0
- } else {
- charMatch = s[text[j-1]]
- }
-
- if d == 0 {
- // First pass: exact match.
- rd[j] = ((rd[j+1] << 1) | 1) & charMatch
- } else {
- // Subsequent passes: fuzzy match.
- rd[j] = ((rd[j+1]<<1)|1)&charMatch | (((lastRd[j+1] | lastRd[j]) << 1) | 1) | lastRd[j+1]
- }
- if (rd[j] & matchmask) != 0 {
- score := dmp.matchBitapScore(d, j-1, loc, pattern)
- // This match will almost certainly be better than any existing match. But check anyway.
- if score <= scoreThreshold {
- // Told you so.
- scoreThreshold = score
- bestLoc = j - 1
- if bestLoc > loc {
- // When passing loc, don't exceed our current distance from loc.
- start = int(math.Max(1, float64(2*loc-bestLoc)))
- } else {
- // Already passed loc, downhill from here on in.
- break
- }
- }
- }
- }
- if dmp.matchBitapScore(d+1, loc, loc, pattern) > scoreThreshold {
- // No hope for a (better) match at greater error levels.
- break
- }
- lastRd = rd
- }
- return bestLoc
-}
-
-// matchBitapScore computes and returns the score for a match with e errors and x location.
-func (dmp *DiffMatchPatch) matchBitapScore(e, x, loc int, pattern string) float64 {
- accuracy := float64(e) / float64(len(pattern))
- proximity := math.Abs(float64(loc - x))
- if dmp.MatchDistance == 0 {
- // Dodge divide by zero error.
- if proximity == 0 {
- return accuracy
- }
-
- return 1.0
- }
- return accuracy + (proximity / float64(dmp.MatchDistance))
-}
-
-// MatchAlphabet initialises the alphabet for the Bitap algorithm.
-func (dmp *DiffMatchPatch) MatchAlphabet(pattern string) map[byte]int {
- s := map[byte]int{}
- charPattern := []byte(pattern)
- for _, c := range charPattern {
- _, ok := s[c]
- if !ok {
- s[c] = 0
- }
- }
- i := 0
-
- for _, c := range charPattern {
- value := s[c] | int(uint(1)< y {
- return x
- }
- return y
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/operation_string.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/operation_string.go
deleted file mode 100644
index 533ec0da7..000000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/operation_string.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Code generated by "stringer -type=Operation -trimprefix=Diff"; DO NOT EDIT.
-
-package diffmatchpatch
-
-import "fmt"
-
-const _Operation_name = "DeleteEqualInsert"
-
-var _Operation_index = [...]uint8{0, 6, 11, 17}
-
-func (i Operation) String() string {
- i -= -1
- if i < 0 || i >= Operation(len(_Operation_index)-1) {
- return fmt.Sprintf("Operation(%d)", i+-1)
- }
- return _Operation_name[_Operation_index[i]:_Operation_index[i+1]]
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go
deleted file mode 100644
index 0dbe3bdd7..000000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/patch.go
+++ /dev/null
@@ -1,556 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "bytes"
- "errors"
- "math"
- "net/url"
- "regexp"
- "strconv"
- "strings"
-)
-
-// Patch represents one patch operation.
-type Patch struct {
- diffs []Diff
- Start1 int
- Start2 int
- Length1 int
- Length2 int
-}
-
-// String emulates GNU diff's format.
-// Header: @@ -382,8 +481,9 @@
-// Indices are printed as 1-based, not 0-based.
-func (p *Patch) String() string {
- var coords1, coords2 string
-
- if p.Length1 == 0 {
- coords1 = strconv.Itoa(p.Start1) + ",0"
- } else if p.Length1 == 1 {
- coords1 = strconv.Itoa(p.Start1 + 1)
- } else {
- coords1 = strconv.Itoa(p.Start1+1) + "," + strconv.Itoa(p.Length1)
- }
-
- if p.Length2 == 0 {
- coords2 = strconv.Itoa(p.Start2) + ",0"
- } else if p.Length2 == 1 {
- coords2 = strconv.Itoa(p.Start2 + 1)
- } else {
- coords2 = strconv.Itoa(p.Start2+1) + "," + strconv.Itoa(p.Length2)
- }
-
- var text bytes.Buffer
- _, _ = text.WriteString("@@ -" + coords1 + " +" + coords2 + " @@\n")
-
- // Escape the body of the patch with %xx notation.
- for _, aDiff := range p.diffs {
- switch aDiff.Type {
- case DiffInsert:
- _, _ = text.WriteString("+")
- case DiffDelete:
- _, _ = text.WriteString("-")
- case DiffEqual:
- _, _ = text.WriteString(" ")
- }
-
- _, _ = text.WriteString(strings.Replace(url.QueryEscape(aDiff.Text), "+", " ", -1))
- _, _ = text.WriteString("\n")
- }
-
- return unescaper.Replace(text.String())
-}
-
-// PatchAddContext increases the context until it is unique, but doesn't let the pattern expand beyond MatchMaxBits.
-func (dmp *DiffMatchPatch) PatchAddContext(patch Patch, text string) Patch {
- if len(text) == 0 {
- return patch
- }
-
- pattern := text[patch.Start2 : patch.Start2+patch.Length1]
- padding := 0
-
- // Look for the first and last matches of pattern in text. If two different matches are found, increase the pattern length.
- for strings.Index(text, pattern) != strings.LastIndex(text, pattern) &&
- len(pattern) < dmp.MatchMaxBits-2*dmp.PatchMargin {
- padding += dmp.PatchMargin
- maxStart := max(0, patch.Start2-padding)
- minEnd := min(len(text), patch.Start2+patch.Length1+padding)
- pattern = text[maxStart:minEnd]
- }
- // Add one chunk for good luck.
- padding += dmp.PatchMargin
-
- // Add the prefix.
- prefix := text[max(0, patch.Start2-padding):patch.Start2]
- if len(prefix) != 0 {
- patch.diffs = append([]Diff{Diff{DiffEqual, prefix}}, patch.diffs...)
- }
- // Add the suffix.
- suffix := text[patch.Start2+patch.Length1 : min(len(text), patch.Start2+patch.Length1+padding)]
- if len(suffix) != 0 {
- patch.diffs = append(patch.diffs, Diff{DiffEqual, suffix})
- }
-
- // Roll back the start points.
- patch.Start1 -= len(prefix)
- patch.Start2 -= len(prefix)
- // Extend the lengths.
- patch.Length1 += len(prefix) + len(suffix)
- patch.Length2 += len(prefix) + len(suffix)
-
- return patch
-}
-
-// PatchMake computes a list of patches.
-func (dmp *DiffMatchPatch) PatchMake(opt ...interface{}) []Patch {
- if len(opt) == 1 {
- diffs, _ := opt[0].([]Diff)
- text1 := dmp.DiffText1(diffs)
- return dmp.PatchMake(text1, diffs)
- } else if len(opt) == 2 {
- text1 := opt[0].(string)
- switch t := opt[1].(type) {
- case string:
- diffs := dmp.DiffMain(text1, t, true)
- if len(diffs) > 2 {
- diffs = dmp.DiffCleanupSemantic(diffs)
- diffs = dmp.DiffCleanupEfficiency(diffs)
- }
- return dmp.PatchMake(text1, diffs)
- case []Diff:
- return dmp.patchMake2(text1, t)
- }
- } else if len(opt) == 3 {
- return dmp.PatchMake(opt[0], opt[2])
- }
- return []Patch{}
-}
-
-// patchMake2 computes a list of patches to turn text1 into text2.
-// text2 is not provided, diffs are the delta between text1 and text2.
-func (dmp *DiffMatchPatch) patchMake2(text1 string, diffs []Diff) []Patch {
- // Check for null inputs not needed since null can't be passed in C#.
- patches := []Patch{}
- if len(diffs) == 0 {
- return patches // Get rid of the null case.
- }
-
- patch := Patch{}
- charCount1 := 0 // Number of characters into the text1 string.
- charCount2 := 0 // Number of characters into the text2 string.
- // Start with text1 (prepatchText) and apply the diffs until we arrive at text2 (postpatchText). We recreate the patches one by one to determine context info.
- prepatchText := text1
- postpatchText := text1
-
- for i, aDiff := range diffs {
- if len(patch.diffs) == 0 && aDiff.Type != DiffEqual {
- // A new patch starts here.
- patch.Start1 = charCount1
- patch.Start2 = charCount2
- }
-
- switch aDiff.Type {
- case DiffInsert:
- patch.diffs = append(patch.diffs, aDiff)
- patch.Length2 += len(aDiff.Text)
- postpatchText = postpatchText[:charCount2] +
- aDiff.Text + postpatchText[charCount2:]
- case DiffDelete:
- patch.Length1 += len(aDiff.Text)
- patch.diffs = append(patch.diffs, aDiff)
- postpatchText = postpatchText[:charCount2] + postpatchText[charCount2+len(aDiff.Text):]
- case DiffEqual:
- if len(aDiff.Text) <= 2*dmp.PatchMargin &&
- len(patch.diffs) != 0 && i != len(diffs)-1 {
- // Small equality inside a patch.
- patch.diffs = append(patch.diffs, aDiff)
- patch.Length1 += len(aDiff.Text)
- patch.Length2 += len(aDiff.Text)
- }
- if len(aDiff.Text) >= 2*dmp.PatchMargin {
- // Time for a new patch.
- if len(patch.diffs) != 0 {
- patch = dmp.PatchAddContext(patch, prepatchText)
- patches = append(patches, patch)
- patch = Patch{}
- // Unlike Unidiff, our patch lists have a rolling context. http://code.google.com/p/google-diff-match-patch/wiki/Unidiff Update prepatch text & pos to reflect the application of the just completed patch.
- prepatchText = postpatchText
- charCount1 = charCount2
- }
- }
- }
-
- // Update the current character count.
- if aDiff.Type != DiffInsert {
- charCount1 += len(aDiff.Text)
- }
- if aDiff.Type != DiffDelete {
- charCount2 += len(aDiff.Text)
- }
- }
-
- // Pick up the leftover patch if not empty.
- if len(patch.diffs) != 0 {
- patch = dmp.PatchAddContext(patch, prepatchText)
- patches = append(patches, patch)
- }
-
- return patches
-}
-
-// PatchDeepCopy returns an array that is identical to a given an array of patches.
-func (dmp *DiffMatchPatch) PatchDeepCopy(patches []Patch) []Patch {
- patchesCopy := []Patch{}
- for _, aPatch := range patches {
- patchCopy := Patch{}
- for _, aDiff := range aPatch.diffs {
- patchCopy.diffs = append(patchCopy.diffs, Diff{
- aDiff.Type,
- aDiff.Text,
- })
- }
- patchCopy.Start1 = aPatch.Start1
- patchCopy.Start2 = aPatch.Start2
- patchCopy.Length1 = aPatch.Length1
- patchCopy.Length2 = aPatch.Length2
- patchesCopy = append(patchesCopy, patchCopy)
- }
- return patchesCopy
-}
-
-// PatchApply merges a set of patches onto the text. Returns a patched text, as well as an array of true/false values indicating which patches were applied.
-func (dmp *DiffMatchPatch) PatchApply(patches []Patch, text string) (string, []bool) {
- if len(patches) == 0 {
- return text, []bool{}
- }
-
- // Deep copy the patches so that no changes are made to originals.
- patches = dmp.PatchDeepCopy(patches)
-
- nullPadding := dmp.PatchAddPadding(patches)
- text = nullPadding + text + nullPadding
- patches = dmp.PatchSplitMax(patches)
-
- x := 0
- // delta keeps track of the offset between the expected and actual location of the previous patch. If there are patches expected at positions 10 and 20, but the first patch was found at 12, delta is 2 and the second patch has an effective expected position of 22.
- delta := 0
- results := make([]bool, len(patches))
- for _, aPatch := range patches {
- expectedLoc := aPatch.Start2 + delta
- text1 := dmp.DiffText1(aPatch.diffs)
- var startLoc int
- endLoc := -1
- if len(text1) > dmp.MatchMaxBits {
- // PatchSplitMax will only provide an oversized pattern in the case of a monster delete.
- startLoc = dmp.MatchMain(text, text1[:dmp.MatchMaxBits], expectedLoc)
- if startLoc != -1 {
- endLoc = dmp.MatchMain(text,
- text1[len(text1)-dmp.MatchMaxBits:], expectedLoc+len(text1)-dmp.MatchMaxBits)
- if endLoc == -1 || startLoc >= endLoc {
- // Can't find valid trailing context. Drop this patch.
- startLoc = -1
- }
- }
- } else {
- startLoc = dmp.MatchMain(text, text1, expectedLoc)
- }
- if startLoc == -1 {
- // No match found. :(
- results[x] = false
- // Subtract the delta for this failed patch from subsequent patches.
- delta -= aPatch.Length2 - aPatch.Length1
- } else {
- // Found a match. :)
- results[x] = true
- delta = startLoc - expectedLoc
- var text2 string
- if endLoc == -1 {
- text2 = text[startLoc:int(math.Min(float64(startLoc+len(text1)), float64(len(text))))]
- } else {
- text2 = text[startLoc:int(math.Min(float64(endLoc+dmp.MatchMaxBits), float64(len(text))))]
- }
- if text1 == text2 {
- // Perfect match, just shove the Replacement text in.
- text = text[:startLoc] + dmp.DiffText2(aPatch.diffs) + text[startLoc+len(text1):]
- } else {
- // Imperfect match. Run a diff to get a framework of equivalent indices.
- diffs := dmp.DiffMain(text1, text2, false)
- if len(text1) > dmp.MatchMaxBits && float64(dmp.DiffLevenshtein(diffs))/float64(len(text1)) > dmp.PatchDeleteThreshold {
- // The end points match, but the content is unacceptably bad.
- results[x] = false
- } else {
- diffs = dmp.DiffCleanupSemanticLossless(diffs)
- index1 := 0
- for _, aDiff := range aPatch.diffs {
- if aDiff.Type != DiffEqual {
- index2 := dmp.DiffXIndex(diffs, index1)
- if aDiff.Type == DiffInsert {
- // Insertion
- text = text[:startLoc+index2] + aDiff.Text + text[startLoc+index2:]
- } else if aDiff.Type == DiffDelete {
- // Deletion
- startIndex := startLoc + index2
- text = text[:startIndex] +
- text[startIndex+dmp.DiffXIndex(diffs, index1+len(aDiff.Text))-index2:]
- }
- }
- if aDiff.Type != DiffDelete {
- index1 += len(aDiff.Text)
- }
- }
- }
- }
- }
- x++
- }
- // Strip the padding off.
- text = text[len(nullPadding) : len(nullPadding)+(len(text)-2*len(nullPadding))]
- return text, results
-}
-
-// PatchAddPadding adds some padding on text start and end so that edges can match something.
-// Intended to be called only from within patchApply.
-func (dmp *DiffMatchPatch) PatchAddPadding(patches []Patch) string {
- paddingLength := dmp.PatchMargin
- nullPadding := ""
- for x := 1; x <= paddingLength; x++ {
- nullPadding += string(rune(x))
- }
-
- // Bump all the patches forward.
- for i := range patches {
- patches[i].Start1 += paddingLength
- patches[i].Start2 += paddingLength
- }
-
- // Add some padding on start of first diff.
- if len(patches[0].diffs) == 0 || patches[0].diffs[0].Type != DiffEqual {
- // Add nullPadding equality.
- patches[0].diffs = append([]Diff{Diff{DiffEqual, nullPadding}}, patches[0].diffs...)
- patches[0].Start1 -= paddingLength // Should be 0.
- patches[0].Start2 -= paddingLength // Should be 0.
- patches[0].Length1 += paddingLength
- patches[0].Length2 += paddingLength
- } else if paddingLength > len(patches[0].diffs[0].Text) {
- // Grow first equality.
- extraLength := paddingLength - len(patches[0].diffs[0].Text)
- patches[0].diffs[0].Text = nullPadding[len(patches[0].diffs[0].Text):] + patches[0].diffs[0].Text
- patches[0].Start1 -= extraLength
- patches[0].Start2 -= extraLength
- patches[0].Length1 += extraLength
- patches[0].Length2 += extraLength
- }
-
- // Add some padding on end of last diff.
- last := len(patches) - 1
- if len(patches[last].diffs) == 0 || patches[last].diffs[len(patches[last].diffs)-1].Type != DiffEqual {
- // Add nullPadding equality.
- patches[last].diffs = append(patches[last].diffs, Diff{DiffEqual, nullPadding})
- patches[last].Length1 += paddingLength
- patches[last].Length2 += paddingLength
- } else if paddingLength > len(patches[last].diffs[len(patches[last].diffs)-1].Text) {
- // Grow last equality.
- lastDiff := patches[last].diffs[len(patches[last].diffs)-1]
- extraLength := paddingLength - len(lastDiff.Text)
- patches[last].diffs[len(patches[last].diffs)-1].Text += nullPadding[:extraLength]
- patches[last].Length1 += extraLength
- patches[last].Length2 += extraLength
- }
-
- return nullPadding
-}
-
-// PatchSplitMax looks through the patches and breaks up any which are longer than the maximum limit of the match algorithm.
-// Intended to be called only from within patchApply.
-func (dmp *DiffMatchPatch) PatchSplitMax(patches []Patch) []Patch {
- patchSize := dmp.MatchMaxBits
- for x := 0; x < len(patches); x++ {
- if patches[x].Length1 <= patchSize {
- continue
- }
- bigpatch := patches[x]
- // Remove the big old patch.
- patches = append(patches[:x], patches[x+1:]...)
- x--
-
- Start1 := bigpatch.Start1
- Start2 := bigpatch.Start2
- precontext := ""
- for len(bigpatch.diffs) != 0 {
- // Create one of several smaller patches.
- patch := Patch{}
- empty := true
- patch.Start1 = Start1 - len(precontext)
- patch.Start2 = Start2 - len(precontext)
- if len(precontext) != 0 {
- patch.Length1 = len(precontext)
- patch.Length2 = len(precontext)
- patch.diffs = append(patch.diffs, Diff{DiffEqual, precontext})
- }
- for len(bigpatch.diffs) != 0 && patch.Length1 < patchSize-dmp.PatchMargin {
- diffType := bigpatch.diffs[0].Type
- diffText := bigpatch.diffs[0].Text
- if diffType == DiffInsert {
- // Insertions are harmless.
- patch.Length2 += len(diffText)
- Start2 += len(diffText)
- patch.diffs = append(patch.diffs, bigpatch.diffs[0])
- bigpatch.diffs = bigpatch.diffs[1:]
- empty = false
- } else if diffType == DiffDelete && len(patch.diffs) == 1 && patch.diffs[0].Type == DiffEqual && len(diffText) > 2*patchSize {
- // This is a large deletion. Let it pass in one chunk.
- patch.Length1 += len(diffText)
- Start1 += len(diffText)
- empty = false
- patch.diffs = append(patch.diffs, Diff{diffType, diffText})
- bigpatch.diffs = bigpatch.diffs[1:]
- } else {
- // Deletion or equality. Only take as much as we can stomach.
- diffText = diffText[:min(len(diffText), patchSize-patch.Length1-dmp.PatchMargin)]
-
- patch.Length1 += len(diffText)
- Start1 += len(diffText)
- if diffType == DiffEqual {
- patch.Length2 += len(diffText)
- Start2 += len(diffText)
- } else {
- empty = false
- }
- patch.diffs = append(patch.diffs, Diff{diffType, diffText})
- if diffText == bigpatch.diffs[0].Text {
- bigpatch.diffs = bigpatch.diffs[1:]
- } else {
- bigpatch.diffs[0].Text =
- bigpatch.diffs[0].Text[len(diffText):]
- }
- }
- }
- // Compute the head context for the next patch.
- precontext = dmp.DiffText2(patch.diffs)
- precontext = precontext[max(0, len(precontext)-dmp.PatchMargin):]
-
- postcontext := ""
- // Append the end context for this patch.
- if len(dmp.DiffText1(bigpatch.diffs)) > dmp.PatchMargin {
- postcontext = dmp.DiffText1(bigpatch.diffs)[:dmp.PatchMargin]
- } else {
- postcontext = dmp.DiffText1(bigpatch.diffs)
- }
-
- if len(postcontext) != 0 {
- patch.Length1 += len(postcontext)
- patch.Length2 += len(postcontext)
- if len(patch.diffs) != 0 && patch.diffs[len(patch.diffs)-1].Type == DiffEqual {
- patch.diffs[len(patch.diffs)-1].Text += postcontext
- } else {
- patch.diffs = append(patch.diffs, Diff{DiffEqual, postcontext})
- }
- }
- if !empty {
- x++
- patches = append(patches[:x], append([]Patch{patch}, patches[x:]...)...)
- }
- }
- }
- return patches
-}
-
-// PatchToText takes a list of patches and returns a textual representation.
-func (dmp *DiffMatchPatch) PatchToText(patches []Patch) string {
- var text bytes.Buffer
- for _, aPatch := range patches {
- _, _ = text.WriteString(aPatch.String())
- }
- return text.String()
-}
-
-// PatchFromText parses a textual representation of patches and returns a List of Patch objects.
-func (dmp *DiffMatchPatch) PatchFromText(textline string) ([]Patch, error) {
- patches := []Patch{}
- if len(textline) == 0 {
- return patches, nil
- }
- text := strings.Split(textline, "\n")
- textPointer := 0
- patchHeader := regexp.MustCompile("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$")
-
- var patch Patch
- var sign uint8
- var line string
- for textPointer < len(text) {
-
- if !patchHeader.MatchString(text[textPointer]) {
- return patches, errors.New("Invalid patch string: " + text[textPointer])
- }
-
- patch = Patch{}
- m := patchHeader.FindStringSubmatch(text[textPointer])
-
- patch.Start1, _ = strconv.Atoi(m[1])
- if len(m[2]) == 0 {
- patch.Start1--
- patch.Length1 = 1
- } else if m[2] == "0" {
- patch.Length1 = 0
- } else {
- patch.Start1--
- patch.Length1, _ = strconv.Atoi(m[2])
- }
-
- patch.Start2, _ = strconv.Atoi(m[3])
-
- if len(m[4]) == 0 {
- patch.Start2--
- patch.Length2 = 1
- } else if m[4] == "0" {
- patch.Length2 = 0
- } else {
- patch.Start2--
- patch.Length2, _ = strconv.Atoi(m[4])
- }
- textPointer++
-
- for textPointer < len(text) {
- if len(text[textPointer]) > 0 {
- sign = text[textPointer][0]
- } else {
- textPointer++
- continue
- }
-
- line = text[textPointer][1:]
- line = strings.Replace(line, "+", "%2b", -1)
- line, _ = url.QueryUnescape(line)
- if sign == '-' {
- // Deletion.
- patch.diffs = append(patch.diffs, Diff{DiffDelete, line})
- } else if sign == '+' {
- // Insertion.
- patch.diffs = append(patch.diffs, Diff{DiffInsert, line})
- } else if sign == ' ' {
- // Minor equality.
- patch.diffs = append(patch.diffs, Diff{DiffEqual, line})
- } else if sign == '@' {
- // Start of next patch.
- break
- } else {
- // WTF?
- return patches, errors.New("Invalid patch mode '" + string(sign) + "' in: " + string(line))
- }
- textPointer++
- }
-
- patches = append(patches, patch)
- }
- return patches, nil
-}
diff --git a/vendor/github.com/sergi/go-diff/diffmatchpatch/stringutil.go b/vendor/github.com/sergi/go-diff/diffmatchpatch/stringutil.go
deleted file mode 100644
index eb727bb59..000000000
--- a/vendor/github.com/sergi/go-diff/diffmatchpatch/stringutil.go
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (c) 2012-2016 The go-diff authors. All rights reserved.
-// https://github.com/sergi/go-diff
-// See the included LICENSE file for license details.
-//
-// go-diff is a Go implementation of Google's Diff, Match, and Patch library
-// Original library is Copyright (c) 2006 Google Inc.
-// http://code.google.com/p/google-diff-match-patch/
-
-package diffmatchpatch
-
-import (
- "fmt"
- "strings"
- "unicode/utf8"
-)
-
-const UNICODE_INVALID_RANGE_START = 0xD800
-const UNICODE_INVALID_RANGE_END = 0xDFFF
-const UNICODE_INVALID_RANGE_DELTA = UNICODE_INVALID_RANGE_END - UNICODE_INVALID_RANGE_START + 1
-const UNICODE_RANGE_MAX = 0x10FFFF
-
-// unescaper unescapes selected chars for compatibility with JavaScript's encodeURI.
-// In speed critical applications this could be dropped since the receiving application will certainly decode these fine. Note that this function is case-sensitive. Thus "%3F" would not be unescaped. But this is ok because it is only called with the output of HttpUtility.UrlEncode which returns lowercase hex. Example: "%3f" -> "?", "%24" -> "$", etc.
-var unescaper = strings.NewReplacer(
- "%21", "!", "%7E", "~", "%27", "'",
- "%28", "(", "%29", ")", "%3B", ";",
- "%2F", "/", "%3F", "?", "%3A", ":",
- "%40", "@", "%26", "&", "%3D", "=",
- "%2B", "+", "%24", "$", "%2C", ",", "%23", "#", "%2A", "*")
-
-// indexOf returns the first index of pattern in str, starting at str[i].
-func indexOf(str string, pattern string, i int) int {
- if i > len(str)-1 {
- return -1
- }
- if i <= 0 {
- return strings.Index(str, pattern)
- }
- ind := strings.Index(str[i:], pattern)
- if ind == -1 {
- return -1
- }
- return ind + i
-}
-
-// lastIndexOf returns the last index of pattern in str, starting at str[i].
-func lastIndexOf(str string, pattern string, i int) int {
- if i < 0 {
- return -1
- }
- if i >= len(str) {
- return strings.LastIndex(str, pattern)
- }
- _, size := utf8.DecodeRuneInString(str[i:])
- return strings.LastIndex(str[:i+size], pattern)
-}
-
-// runesIndexOf returns the index of pattern in target, starting at target[i].
-func runesIndexOf(target, pattern []rune, i int) int {
- if i > len(target)-1 {
- return -1
- }
- if i <= 0 {
- return runesIndex(target, pattern)
- }
- ind := runesIndex(target[i:], pattern)
- if ind == -1 {
- return -1
- }
- return ind + i
-}
-
-func runesEqual(r1, r2 []rune) bool {
- if len(r1) != len(r2) {
- return false
- }
- for i, c := range r1 {
- if c != r2[i] {
- return false
- }
- }
- return true
-}
-
-// runesIndex is the equivalent of strings.Index for rune slices.
-func runesIndex(r1, r2 []rune) int {
- last := len(r1) - len(r2)
- for i := 0; i <= last; i++ {
- if runesEqual(r1[i:i+len(r2)], r2) {
- return i
- }
- }
- return -1
-}
-
-func intArrayToString(ns []uint32) string {
- if len(ns) == 0 {
- return ""
- }
-
- b := []rune{}
- for _, n := range ns {
- b = append(b, intToRune(n))
- }
- return string(b)
-}
-
-// These constants define the number of bits representable
-// in 1,2,3,4 byte utf8 sequences, respectively.
-const ONE_BYTE_BITS = 7
-const TWO_BYTE_BITS = 11
-const THREE_BYTE_BITS = 16
-const FOUR_BYTE_BITS = 21
-
-// Helper for getting a sequence of bits from an integer.
-func getBits(i uint32, cnt byte, from byte) byte {
- return byte((i >> from) & ((1 << cnt) - 1))
-}
-
-// Converts an integer in the range 0~1112060 into a rune.
-// Based on the ranges table in https://en.wikipedia.org/wiki/UTF-8
-func intToRune(i uint32) rune {
- if i < (1 << ONE_BYTE_BITS) {
- return rune(i)
- }
-
- if i < (1 << TWO_BYTE_BITS) {
- r, size := utf8.DecodeRune([]byte{0b11000000 | getBits(i, 5, 6), 0b10000000 | getBits(i, 6, 0)})
- if size != 2 || r == utf8.RuneError {
- panic(fmt.Sprintf("Error encoding an int %d with size 2, got rune %v and size %d", size, r, i))
- }
- return r
- }
-
- // Last -3 here needed because for some reason 3rd to last codepoint 65533 in this range
- // was returning utf8.RuneError during encoding.
- if i < ((1 << THREE_BYTE_BITS) - UNICODE_INVALID_RANGE_DELTA - 3) {
- if i >= UNICODE_INVALID_RANGE_START {
- i += UNICODE_INVALID_RANGE_DELTA
- }
-
- r, size := utf8.DecodeRune([]byte{0b11100000 | getBits(i, 4, 12), 0b10000000 | getBits(i, 6, 6), 0b10000000 | getBits(i, 6, 0)})
- if size != 3 || r == utf8.RuneError {
- panic(fmt.Sprintf("Error encoding an int %d with size 3, got rune %v and size %d", size, r, i))
- }
- return r
- }
-
- if i < (1<= UNICODE_INVALID_RANGE_END {
- return result - UNICODE_INVALID_RANGE_DELTA
- }
-
- return result
- }
-
- if size == 4 {
- result := uint32(bytes[0]&0b111)<<18 | uint32(bytes[1]&0b111111)<<12 | uint32(bytes[2]&0b111111)<<6 | uint32(bytes[3]&0b111111)
- return result - UNICODE_INVALID_RANGE_DELTA - 3
- }
-
- panic(fmt.Sprintf("Unexpected state decoding rune=%v size=%d", r, size))
-}
diff --git a/vendor/github.com/skeema/knownhosts/CONTRIBUTING.md b/vendor/github.com/skeema/knownhosts/CONTRIBUTING.md
deleted file mode 100644
index 9624f8276..000000000
--- a/vendor/github.com/skeema/knownhosts/CONTRIBUTING.md
+++ /dev/null
@@ -1,36 +0,0 @@
-# Contributing to skeema/knownhosts
-
-Thank you for your interest in contributing! This document provides guidelines for submitting pull requests.
-
-### Link to an issue
-
-Before starting the pull request process, initial discussion should take place on a GitHub issue first. For bug reports, the issue should track the open bug and confirm it is reproducible. For feature requests, the issue should cover why the feature is necessary.
-
-In the issue comments, discuss your suggested approach for a fix/implementation, and please wait to get feedback before opening a pull request.
-
-### Test coverage
-
-In general, please provide reasonably thorough test coverage. Whenever possible, your PR should aim to match or improve the overall test coverage percentage of the package. You can run tests and check coverage locally using `go test -cover`. We also have CI automation in GitHub Actions which will comment on each pull request with a coverage percentage.
-
-That said, it is fine to submit an initial draft / work-in-progress PR without coverage, if you are waiting on implementation feedback before writing the tests.
-
-We intentionally avoid hard-coding SSH keys or known_hosts files into the test logic. Instead, the tests generate new keys and then use them to generate a known_hosts file, which is then cached/reused for that overall test run, in order to keep performance reasonable.
-
-### Documentation
-
-Exported types require doc comments. The linter CI step will catch this if missing.
-
-### Backwards compatibility
-
-Because this package is imported by [nearly 7000 repos on GitHub](https://github.com/skeema/knownhosts/network/dependents), we must be very strict about backwards compatibility of exported symbols and function signatures.
-
-Backwards compatibility can be very tricky in some situations. In this case, a maintainer may need to add additional commits to your branch to adjust the approach. Please do not take offense if this occurs; it is sometimes simply faster to implement a refactor on our end directly. When the PR/branch is merged, a merge commit will be used, to ensure your commits appear as-is in the repo history and are still properly credited to you.
-
-### Avoid rewriting core x/crypto/ssh/knownhosts logic
-
-skeema/knownhosts is intended to be a relatively thin *wrapper* around x/crypto/ssh/knownhosts, without duplicating or re-implementing the core known_hosts file parsing and host key handling logic. Importers of this package should be confident that it can be used as a nearly-drop-in replacement for x/crypto/ssh/knownhosts without introducing substantial risk, security flaws, parser differentials, or unexpected behavior changes.
-
-To solve shortcomings in x/crypto/ssh/knownhosts, we try to come up with workarounds that still utilize x/crypto/ssh/knownhosts functionality whenever possible.
-
-Some bugs in x/crypto/ssh/knownhosts do require re-reading the known_hosts file here to solve, but we make that *optional* by offering separate constructors/types with and without that behavior.
-
diff --git a/vendor/github.com/skeema/knownhosts/LICENSE b/vendor/github.com/skeema/knownhosts/LICENSE
deleted file mode 100644
index 8dada3eda..000000000
--- a/vendor/github.com/skeema/knownhosts/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/skeema/knownhosts/NOTICE b/vendor/github.com/skeema/knownhosts/NOTICE
deleted file mode 100644
index a92cb34d6..000000000
--- a/vendor/github.com/skeema/knownhosts/NOTICE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 2024 Skeema LLC and the Skeema Knownhosts authors
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/vendor/github.com/skeema/knownhosts/README.md b/vendor/github.com/skeema/knownhosts/README.md
deleted file mode 100644
index 046bc0edc..000000000
--- a/vendor/github.com/skeema/knownhosts/README.md
+++ /dev/null
@@ -1,133 +0,0 @@
-# knownhosts: enhanced Golang SSH known_hosts management
-
-[](https://github.com/skeema/knownhosts/actions)
-[](https://coveralls.io/r/skeema/knownhosts)
-[](https://pkg.go.dev/github.com/skeema/knownhosts)
-
-
-> This repo is brought to you by [Skeema](https://github.com/skeema/skeema), a
-> declarative pure-SQL schema management system for MySQL and MariaDB. Our
-> premium products include extensive [SSH tunnel](https://www.skeema.io/docs/features/ssh/)
-> functionality, which internally makes use of this package.
-
-Go provides excellent functionality for OpenSSH known_hosts files in its
-external package [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts).
-However, that package is somewhat low-level, making it difficult to implement full known_hosts management similar to OpenSSH's command-line behavior. Additionally, [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts) has several known issues in edge cases, some of which have remained open for multiple years.
-
-Package [github.com/skeema/knownhosts](https://github.com/skeema/knownhosts) provides a *thin wrapper* around [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts), adding the following improvements and fixes without duplicating its core logic:
-
-* Look up known_hosts public keys for any given host
-* Auto-populate ssh.ClientConfig.HostKeyAlgorithms easily based on known_hosts, providing a solution for [golang/go#29286](https://github.com/golang/go/issues/29286). (This also properly handles cert algorithms for hosts using CA keys when [using the NewDB constructor](#enhancements-requiring-extra-parsing) added in skeema/knownhosts v1.3.0.)
-* Properly match wildcard hostname known_hosts entries regardless of port number, providing a solution for [golang/go#52056](https://github.com/golang/go/issues/52056). (Added in v1.3.0; requires [using the NewDB constructor](#enhancements-requiring-extra-parsing))
-* Write new known_hosts entries to an io.Writer
-* Properly format/normalize new known_hosts entries containing ipv6 addresses, providing a solution for [golang/go#53463](https://github.com/golang/go/issues/53463)
-* Easily determine if an ssh.HostKeyCallback's error corresponds to a host whose key has changed (indicating potential MitM attack) vs a host that just isn't known yet
-
-## How host key lookup works
-
-Although [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts) doesn't directly expose a way to query its known_host map, we use a subtle trick to do so: invoke the HostKeyCallback with a valid host but a bogus key. The resulting KeyError allows us to determine which public keys are actually present for that host.
-
-By using this technique, [github.com/skeema/knownhosts](https://github.com/skeema/knownhosts) doesn't need to duplicate any of the core known_hosts host-lookup logic from [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts).
-
-## Populating ssh.ClientConfig.HostKeyAlgorithms based on known_hosts
-
-Hosts often have multiple public keys, each of a different type (algorithm). This can be [problematic](https://github.com/golang/go/issues/29286) in [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts): if a host's first public key is *not* in known_hosts, but a key of a different type *is*, the HostKeyCallback returns an error. The solution is to populate `ssh.ClientConfig.HostKeyAlgorithms` based on the algorithms of the known_hosts entries for that host, but
-[golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts)
-does not provide an obvious way to do so.
-
-This package uses its host key lookup trick in order to make ssh.ClientConfig.HostKeyAlgorithms easy to populate:
-
-```golang
-import (
- "golang.org/x/crypto/ssh"
- "github.com/skeema/knownhosts"
-)
-
-func sshConfigForHost(hostWithPort string) (*ssh.ClientConfig, error) {
- kh, err := knownhosts.NewDB("/home/myuser/.ssh/known_hosts")
- if err != nil {
- return nil, err
- }
- config := &ssh.ClientConfig{
- User: "myuser",
- Auth: []ssh.AuthMethod{ /* ... */ },
- HostKeyCallback: kh.HostKeyCallback(),
- HostKeyAlgorithms: kh.HostKeyAlgorithms(hostWithPort),
- }
- return config, nil
-}
-```
-
-## Enhancements requiring extra parsing
-
-Originally, this package did not re-read/re-parse the known_hosts files at all, relying entirely on [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts) for all known_hosts file reading and processing. This package only offered a constructor called `New`, returning a host key callback, identical to the call pattern of [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts) but with extra methods available on the callback type.
-
-However, a couple shortcomings in [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts) cannot possibly be solved without re-reading the known_hosts file. Therefore, as of v1.3.0 of this package, we now offer an alternative constructor `NewDB`, which does an additional read of the known_hosts file (after the one from [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts)), in order to detect:
-
-* @cert-authority lines, so that we can correctly return cert key algorithms instead of normal host key algorithms when appropriate
-* host pattern wildcards, so that we can match OpenSSH's behavior for non-standard port numbers, unlike how [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts) normally treats them
-
-Aside from *detecting* these special cases, this package otherwise still directly uses [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts) for host lookups and all other known_hosts file processing. We do **not** fork or re-implement those core behaviors of [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts).
-
-The performance impact of this extra known_hosts read should be minimal, as the file should typically be in the filesystem cache already from the original read by [golang.org/x/crypto/ssh/knownhosts](https://pkg.go.dev/golang.org/x/crypto/ssh/knownhosts). That said, users who wish to avoid the extra read can stay with the `New` constructor, which intentionally retains its pre-v1.3.0 behavior as-is. However, the extra fixes for @cert-authority and host pattern wildcards will not be enabled in that case.
-
-## Writing new known_hosts entries
-
-If you wish to mimic the behavior of OpenSSH's `StrictHostKeyChecking=no` or `StrictHostKeyChecking=ask`, this package provides a few functions to simplify this task. For example:
-
-```golang
-sshHost := "yourserver.com:22"
-khPath := "/home/myuser/.ssh/known_hosts"
-kh, err := knownhosts.NewDB(khPath)
-if err != nil {
- log.Fatal("Failed to read known_hosts: ", err)
-}
-
-// Create a custom permissive hostkey callback which still errors on hosts
-// with changed keys, but allows unknown hosts and adds them to known_hosts
-cb := ssh.HostKeyCallback(func(hostname string, remote net.Addr, key ssh.PublicKey) error {
- innerCallback := kh.HostKeyCallback()
- err := innerCallback(hostname, remote, key)
- if knownhosts.IsHostKeyChanged(err) {
- return fmt.Errorf("REMOTE HOST IDENTIFICATION HAS CHANGED for host %s! This may indicate a MitM attack.", hostname)
- } else if knownhosts.IsHostUnknown(err) {
- f, ferr := os.OpenFile(khPath, os.O_APPEND|os.O_WRONLY, 0600)
- if ferr == nil {
- defer f.Close()
- ferr = knownhosts.WriteKnownHost(f, hostname, remote, key)
- }
- if ferr == nil {
- log.Printf("Added host %s to known_hosts\n", hostname)
- } else {
- log.Printf("Failed to add host %s to known_hosts: %v\n", hostname, ferr)
- }
- return nil // permit previously-unknown hosts (warning: may be insecure)
- }
- return err
-})
-
-config := &ssh.ClientConfig{
- User: "myuser",
- Auth: []ssh.AuthMethod{ /* ... */ },
- HostKeyCallback: cb,
- HostKeyAlgorithms: kh.HostKeyAlgorithms(sshHost),
-}
-```
-
-## License
-
-**Source code copyright 2024 Skeema LLC and the Skeema Knownhosts authors**
-
-```text
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-```
diff --git a/vendor/github.com/skeema/knownhosts/knownhosts.go b/vendor/github.com/skeema/knownhosts/knownhosts.go
deleted file mode 100644
index 2b7536e0d..000000000
--- a/vendor/github.com/skeema/knownhosts/knownhosts.go
+++ /dev/null
@@ -1,447 +0,0 @@
-// Package knownhosts is a thin wrapper around golang.org/x/crypto/ssh/knownhosts,
-// adding the ability to obtain the list of host key algorithms for a known host.
-package knownhosts
-
-import (
- "bufio"
- "bytes"
- "encoding/base64"
- "errors"
- "fmt"
- "io"
- "net"
- "os"
- "sort"
- "strings"
-
- "golang.org/x/crypto/ssh"
- xknownhosts "golang.org/x/crypto/ssh/knownhosts"
-)
-
-// HostKeyDB wraps logic in golang.org/x/crypto/ssh/knownhosts with additional
-// behaviors, such as the ability to perform host key/algorithm lookups from
-// known_hosts entries.
-type HostKeyDB struct {
- callback ssh.HostKeyCallback
- isCert map[string]bool // keyed by "filename:line"
- isWildcard map[string]bool // keyed by "filename:line"
-}
-
-// NewDB creates a HostKeyDB from the given OpenSSH known_hosts file(s). It
-// reads and parses the provided files one additional time (beyond logic in
-// golang.org/x/crypto/ssh/knownhosts) in order to:
-//
-// - Handle CA lines properly and return ssh.CertAlgo* values when calling the
-// HostKeyAlgorithms method, for use in ssh.ClientConfig.HostKeyAlgorithms
-// - Allow * wildcards in hostnames to match on non-standard ports, providing
-// a workaround for https://github.com/golang/go/issues/52056 in order to
-// align with OpenSSH's wildcard behavior
-//
-// When supplying multiple files, their order does not matter.
-func NewDB(files ...string) (*HostKeyDB, error) {
- cb, err := xknownhosts.New(files...)
- if err != nil {
- return nil, err
- }
- hkdb := &HostKeyDB{
- callback: cb,
- isCert: make(map[string]bool),
- isWildcard: make(map[string]bool),
- }
-
- // Re-read each file a single time, looking for @cert-authority lines. The
- // logic for reading the file is designed to mimic hostKeyDB.Read from
- // golang.org/x/crypto/ssh/knownhosts
- for _, filename := range files {
- f, err := os.Open(filename)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- scanner := bufio.NewScanner(f)
- lineNum := 0
- for scanner.Scan() {
- lineNum++
- line := scanner.Bytes()
- line = bytes.TrimSpace(line)
- // Does the line start with "@cert-authority" followed by whitespace?
- if len(line) > 15 && bytes.HasPrefix(line, []byte("@cert-authority")) && (line[15] == ' ' || line[15] == '\t') {
- mapKey := fmt.Sprintf("%s:%d", filename, lineNum)
- hkdb.isCert[mapKey] = true
- line = bytes.TrimSpace(line[16:])
- }
- // truncate line to just the host pattern field
- if i := bytes.IndexAny(line, "\t "); i >= 0 {
- line = line[:i]
- }
- // Does the host pattern contain a * wildcard and no specific port?
- if i := bytes.IndexRune(line, '*'); i >= 0 && !bytes.Contains(line[i:], []byte("]:")) {
- mapKey := fmt.Sprintf("%s:%d", filename, lineNum)
- hkdb.isWildcard[mapKey] = true
- }
- }
- if err := scanner.Err(); err != nil {
- return nil, fmt.Errorf("knownhosts: %s:%d: %w", filename, lineNum, err)
- }
- }
- return hkdb, nil
-}
-
-// HostKeyCallback returns an ssh.HostKeyCallback. This can be used directly in
-// ssh.ClientConfig.HostKeyCallback, as shown in the example for NewDB.
-// Alternatively, you can wrap it with an outer callback to potentially handle
-// appending a new entry to the known_hosts file; see example in WriteKnownHost.
-func (hkdb *HostKeyDB) HostKeyCallback() ssh.HostKeyCallback {
- // Either NewDB found no wildcard host patterns, or hkdb was created from
- // HostKeyCallback.ToDB in which case we didn't scan known_hosts for them:
- // return the callback (which came from x/crypto/ssh/knownhosts) as-is
- if len(hkdb.isWildcard) == 0 {
- return hkdb.callback
- }
-
- // If we scanned for wildcards and found at least one, return a wrapped
- // callback with extra behavior: if the host lookup found no matches, and the
- // host arg had a non-standard port, re-do the lookup on standard port 22. If
- // that second call returns a *xknownhosts.KeyError, filter down any resulting
- // Want keys to known wildcard entries.
- f := func(hostname string, remote net.Addr, key ssh.PublicKey) error {
- callbackErr := hkdb.callback(hostname, remote, key)
- if callbackErr == nil || IsHostKeyChanged(callbackErr) { // hostname has known_host entries as-is
- return callbackErr
- }
- justHost, port, splitErr := net.SplitHostPort(hostname)
- if splitErr != nil || port == "" || port == "22" { // hostname already using standard port
- return callbackErr
- }
- // If we reach here, the port was non-standard and no known_host entries
- // were found for the non-standard port. Try again with standard port.
- if tcpAddr, ok := remote.(*net.TCPAddr); ok && tcpAddr.Port != 22 {
- remote = &net.TCPAddr{
- IP: tcpAddr.IP,
- Port: 22,
- Zone: tcpAddr.Zone,
- }
- }
- callbackErr = hkdb.callback(justHost+":22", remote, key)
- var keyErr *xknownhosts.KeyError
- if errors.As(callbackErr, &keyErr) && len(keyErr.Want) > 0 {
- wildcardKeys := make([]xknownhosts.KnownKey, 0, len(keyErr.Want))
- for _, wantKey := range keyErr.Want {
- if hkdb.isWildcard[fmt.Sprintf("%s:%d", wantKey.Filename, wantKey.Line)] {
- wildcardKeys = append(wildcardKeys, wantKey)
- }
- }
- callbackErr = &xknownhosts.KeyError{
- Want: wildcardKeys,
- }
- }
- return callbackErr
- }
- return ssh.HostKeyCallback(f)
-}
-
-// PublicKey wraps ssh.PublicKey with an additional field, to identify
-// whether the key corresponds to a certificate authority.
-type PublicKey struct {
- ssh.PublicKey
- Cert bool
-}
-
-// HostKeys returns a slice of known host public keys for the supplied host:port
-// found in the known_hosts file(s), or an empty slice if the host is not
-// already known. For hosts that have multiple known_hosts entries (for
-// different key types), the result will be sorted by known_hosts filename and
-// line number.
-// If hkdb was originally created by calling NewDB, the Cert boolean field of
-// each result entry reports whether the key corresponded to a @cert-authority
-// line. If hkdb was NOT obtained from NewDB, then Cert will always be false.
-func (hkdb *HostKeyDB) HostKeys(hostWithPort string) (keys []PublicKey) {
- var keyErr *xknownhosts.KeyError
- placeholderAddr := &net.TCPAddr{IP: []byte{0, 0, 0, 0}}
- placeholderPubKey := &fakePublicKey{}
- var kkeys []xknownhosts.KnownKey
- callback := hkdb.HostKeyCallback()
- if hkcbErr := callback(hostWithPort, placeholderAddr, placeholderPubKey); errors.As(hkcbErr, &keyErr) {
- kkeys = append(kkeys, keyErr.Want...)
- knownKeyLess := func(i, j int) bool {
- if kkeys[i].Filename < kkeys[j].Filename {
- return true
- }
- return (kkeys[i].Filename == kkeys[j].Filename && kkeys[i].Line < kkeys[j].Line)
- }
- sort.Slice(kkeys, knownKeyLess)
- keys = make([]PublicKey, len(kkeys))
- for n := range kkeys {
- keys[n] = PublicKey{
- PublicKey: kkeys[n].Key,
- }
- if len(hkdb.isCert) > 0 {
- keys[n].Cert = hkdb.isCert[fmt.Sprintf("%s:%d", kkeys[n].Filename, kkeys[n].Line)]
- }
- }
- }
- return keys
-}
-
-// HostKeyAlgorithms returns a slice of host key algorithms for the supplied
-// host:port found in the known_hosts file(s), or an empty slice if the host
-// is not already known. The result may be used in ssh.ClientConfig's
-// HostKeyAlgorithms field, either as-is or after filtering (if you wish to
-// ignore or prefer particular algorithms). For hosts that have multiple
-// known_hosts entries (of different key types), the result will be sorted by
-// known_hosts filename and line number.
-// If hkdb was originally created by calling NewDB, any @cert-authority lines
-// in the known_hosts file will properly be converted to the corresponding
-// ssh.CertAlgo* values.
-func (hkdb *HostKeyDB) HostKeyAlgorithms(hostWithPort string) (algos []string) {
- // We ensure that algos never contains duplicates. This is done for robustness
- // even though currently golang.org/x/crypto/ssh/knownhosts never exposes
- // multiple keys of the same type. This way our behavior here is unaffected
- // even if https://github.com/golang/go/issues/28870 is implemented, for
- // example by https://github.com/golang/crypto/pull/254.
- hostKeys := hkdb.HostKeys(hostWithPort)
- seen := make(map[string]struct{}, len(hostKeys))
- addAlgo := func(typ string, cert bool) {
- if cert {
- typ = keyTypeToCertAlgo(typ)
- }
- if _, already := seen[typ]; !already {
- algos = append(algos, typ)
- seen[typ] = struct{}{}
- }
- }
- for _, key := range hostKeys {
- typ := key.Type()
- if typ == ssh.KeyAlgoRSA {
- // KeyAlgoRSASHA256 and KeyAlgoRSASHA512 are only public key algorithms,
- // not public key formats, so they can't appear as a PublicKey.Type.
- // The corresponding PublicKey.Type is KeyAlgoRSA. See RFC 8332, Section 2.
- addAlgo(ssh.KeyAlgoRSASHA512, key.Cert)
- addAlgo(ssh.KeyAlgoRSASHA256, key.Cert)
- }
- addAlgo(typ, key.Cert)
- }
- return algos
-}
-
-func keyTypeToCertAlgo(keyType string) string {
- switch keyType {
- case ssh.KeyAlgoRSA:
- return ssh.CertAlgoRSAv01
- case ssh.KeyAlgoRSASHA256:
- return ssh.CertAlgoRSASHA256v01
- case ssh.KeyAlgoRSASHA512:
- return ssh.CertAlgoRSASHA512v01
- case ssh.KeyAlgoDSA:
- return ssh.CertAlgoDSAv01
- case ssh.KeyAlgoECDSA256:
- return ssh.CertAlgoECDSA256v01
- case ssh.KeyAlgoSKECDSA256:
- return ssh.CertAlgoSKECDSA256v01
- case ssh.KeyAlgoECDSA384:
- return ssh.CertAlgoECDSA384v01
- case ssh.KeyAlgoECDSA521:
- return ssh.CertAlgoECDSA521v01
- case ssh.KeyAlgoED25519:
- return ssh.CertAlgoED25519v01
- case ssh.KeyAlgoSKED25519:
- return ssh.CertAlgoSKED25519v01
- }
- return ""
-}
-
-// HostKeyCallback wraps ssh.HostKeyCallback with additional methods to
-// perform host key and algorithm lookups from the known_hosts entries. It is
-// otherwise identical to ssh.HostKeyCallback, and does not introduce any file-
-// parsing behavior beyond what is in golang.org/x/crypto/ssh/knownhosts.
-//
-// In most situations, use HostKeyDB and its constructor NewDB instead of using
-// the HostKeyCallback type. The HostKeyCallback type is only provided for
-// backwards compatibility with older versions of this package, as well as for
-// very strict situations where any extra known_hosts file-parsing is
-// undesirable.
-//
-// Methods of HostKeyCallback do not provide any special treatment for
-// @cert-authority lines, which will (incorrectly) look like normal non-CA host
-// keys. Additionally, HostKeyCallback lacks the fix for applying * wildcard
-// known_host entries to all ports, like OpenSSH's behavior.
-type HostKeyCallback ssh.HostKeyCallback
-
-// New creates a HostKeyCallback from the given OpenSSH known_hosts file(s). The
-// returned value may be used in ssh.ClientConfig.HostKeyCallback by casting it
-// to ssh.HostKeyCallback, or using its HostKeyCallback method. Otherwise, it
-// operates the same as the New function in golang.org/x/crypto/ssh/knownhosts.
-// When supplying multiple files, their order does not matter.
-//
-// In most situations, you should avoid this function, as the returned value
-// lacks several enhanced behaviors. See doc comment for HostKeyCallback for
-// more information. Instead, most callers should use NewDB to create a
-// HostKeyDB, which includes these enhancements.
-func New(files ...string) (HostKeyCallback, error) {
- cb, err := xknownhosts.New(files...)
- return HostKeyCallback(cb), err
-}
-
-// HostKeyCallback simply casts the receiver back to ssh.HostKeyCallback, for
-// use in ssh.ClientConfig.HostKeyCallback.
-func (hkcb HostKeyCallback) HostKeyCallback() ssh.HostKeyCallback {
- return ssh.HostKeyCallback(hkcb)
-}
-
-// ToDB converts the receiver into a HostKeyDB. However, the returned HostKeyDB
-// lacks the enhanced behaviors described in the doc comment for NewDB: proper
-// CA support, and wildcard matching on nonstandard ports.
-//
-// It is generally preferable to create a HostKeyDB by using NewDB. The ToDB
-// method is only provided for situations in which the calling code needs to
-// make the extra NewDB behaviors optional / user-configurable, perhaps for
-// reasons of performance or code trust (since NewDB reads the known_host file
-// an extra time, which may be undesirable in some strict situations). This way,
-// callers can conditionally create a non-enhanced HostKeyDB by using New and
-// ToDB. See code example.
-func (hkcb HostKeyCallback) ToDB() *HostKeyDB {
- // This intentionally leaves the isCert and isWildcard map fields as nil, as
- // there is no way to retroactively populate them from just a HostKeyCallback.
- // Methods of HostKeyDB will skip any related enhanced behaviors accordingly.
- return &HostKeyDB{callback: ssh.HostKeyCallback(hkcb)}
-}
-
-// HostKeys returns a slice of known host public keys for the supplied host:port
-// found in the known_hosts file(s), or an empty slice if the host is not
-// already known. For hosts that have multiple known_hosts entries (for
-// different key types), the result will be sorted by known_hosts filename and
-// line number.
-// In the returned values, there is no way to distinguish between CA keys
-// (known_hosts lines beginning with @cert-authority) and regular keys. To do
-// so, see NewDB and HostKeyDB.HostKeys instead.
-func (hkcb HostKeyCallback) HostKeys(hostWithPort string) []ssh.PublicKey {
- annotatedKeys := hkcb.ToDB().HostKeys(hostWithPort)
- rawKeys := make([]ssh.PublicKey, len(annotatedKeys))
- for n, ak := range annotatedKeys {
- rawKeys[n] = ak.PublicKey
- }
- return rawKeys
-}
-
-// HostKeyAlgorithms returns a slice of host key algorithms for the supplied
-// host:port found in the known_hosts file(s), or an empty slice if the host
-// is not already known. The result may be used in ssh.ClientConfig's
-// HostKeyAlgorithms field, either as-is or after filtering (if you wish to
-// ignore or prefer particular algorithms). For hosts that have multiple
-// known_hosts entries (for different key types), the result will be sorted by
-// known_hosts filename and line number.
-// The returned values will not include ssh.CertAlgo* values. If any
-// known_hosts lines had @cert-authority prefixes, their original key algo will
-// be returned instead. For proper CA support, see NewDB and
-// HostKeyDB.HostKeyAlgorithms instead.
-func (hkcb HostKeyCallback) HostKeyAlgorithms(hostWithPort string) (algos []string) {
- return hkcb.ToDB().HostKeyAlgorithms(hostWithPort)
-}
-
-// HostKeyAlgorithms is a convenience function for performing host key algorithm
-// lookups on an ssh.HostKeyCallback directly. It is intended for use in code
-// paths that stay with the New method of golang.org/x/crypto/ssh/knownhosts
-// rather than this package's New or NewDB methods.
-// The returned values will not include ssh.CertAlgo* values. If any
-// known_hosts lines had @cert-authority prefixes, their original key algo will
-// be returned instead. For proper CA support, see NewDB and
-// HostKeyDB.HostKeyAlgorithms instead.
-func HostKeyAlgorithms(cb ssh.HostKeyCallback, hostWithPort string) []string {
- return HostKeyCallback(cb).HostKeyAlgorithms(hostWithPort)
-}
-
-// IsHostKeyChanged returns a boolean indicating whether the error indicates
-// the host key has changed. It is intended to be called on the error returned
-// from invoking a host key callback, to check whether an SSH host is known.
-func IsHostKeyChanged(err error) bool {
- var keyErr *xknownhosts.KeyError
- return errors.As(err, &keyErr) && len(keyErr.Want) > 0
-}
-
-// IsHostUnknown returns a boolean indicating whether the error represents an
-// unknown host. It is intended to be called on the error returned from invoking
-// a host key callback to check whether an SSH host is known.
-func IsHostUnknown(err error) bool {
- var keyErr *xknownhosts.KeyError
- return errors.As(err, &keyErr) && len(keyErr.Want) == 0
-}
-
-// Normalize normalizes an address into the form used in known_hosts. This
-// implementation includes a fix for https://github.com/golang/go/issues/53463
-// and will omit brackets around ipv6 addresses on standard port 22.
-func Normalize(address string) string {
- host, port, err := net.SplitHostPort(address)
- if err != nil {
- host = address
- port = "22"
- }
- entry := host
- if port != "22" {
- entry = "[" + entry + "]:" + port
- } else if strings.HasPrefix(host, "[") && strings.HasSuffix(host, "]") {
- entry = entry[1 : len(entry)-1]
- }
- return entry
-}
-
-// Line returns a line to append to the known_hosts files. This implementation
-// uses the local patched implementation of Normalize in order to solve
-// https://github.com/golang/go/issues/53463.
-func Line(addresses []string, key ssh.PublicKey) string {
- var trimmed []string
- for _, a := range addresses {
- trimmed = append(trimmed, Normalize(a))
- }
-
- return strings.Join([]string{
- strings.Join(trimmed, ","),
- key.Type(),
- base64.StdEncoding.EncodeToString(key.Marshal()),
- }, " ")
-}
-
-// WriteKnownHost writes a known_hosts line to w for the supplied hostname,
-// remote, and key. This is useful when writing a custom hostkey callback which
-// wraps a callback obtained from this package to provide additional known_hosts
-// management functionality. The hostname, remote, and key typically correspond
-// to the callback's args. This function does not support writing
-// @cert-authority lines.
-func WriteKnownHost(w io.Writer, hostname string, remote net.Addr, key ssh.PublicKey) error {
- // Always include hostname; only also include remote if it isn't a zero value
- // and doesn't normalize to the same string as hostname.
- hostnameNormalized := Normalize(hostname)
- if strings.ContainsAny(hostnameNormalized, "\t ") {
- return fmt.Errorf("knownhosts: hostname '%s' contains spaces", hostnameNormalized)
- }
- addresses := []string{hostnameNormalized}
- remoteStrNormalized := Normalize(remote.String())
- if remoteStrNormalized != "[0.0.0.0]:0" && remoteStrNormalized != hostnameNormalized &&
- !strings.ContainsAny(remoteStrNormalized, "\t ") {
- addresses = append(addresses, remoteStrNormalized)
- }
- line := Line(addresses, key) + "\n"
- _, err := w.Write([]byte(line))
- return err
-}
-
-// WriteKnownHostCA writes a @cert-authority line to w for the supplied host
-// name/pattern and key.
-func WriteKnownHostCA(w io.Writer, hostPattern string, key ssh.PublicKey) error {
- encodedKey := base64.StdEncoding.EncodeToString(key.Marshal())
- _, err := fmt.Fprintf(w, "@cert-authority %s %s %s\n", hostPattern, key.Type(), encodedKey)
- return err
-}
-
-// fakePublicKey is used as part of the work-around for
-// https://github.com/golang/go/issues/29286
-type fakePublicKey struct{}
-
-func (fakePublicKey) Type() string {
- return "fake-public-key"
-}
-func (fakePublicKey) Marshal() []byte {
- return []byte("fake public key")
-}
-func (fakePublicKey) Verify(_ []byte, _ *ssh.Signature) error {
- return errors.New("Verify called on placeholder key")
-}
diff --git a/vendor/github.com/sourcegraph/conc/.golangci.yml b/vendor/github.com/sourcegraph/conc/.golangci.yml
deleted file mode 100644
index ae65a760a..000000000
--- a/vendor/github.com/sourcegraph/conc/.golangci.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-linters:
- disable-all: true
- enable:
- - errcheck
- - godot
- - gosimple
- - govet
- - ineffassign
- - staticcheck
- - typecheck
- - unused
diff --git a/vendor/github.com/sourcegraph/conc/LICENSE b/vendor/github.com/sourcegraph/conc/LICENSE
deleted file mode 100644
index 1081f4ef4..000000000
--- a/vendor/github.com/sourcegraph/conc/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2023 Sourcegraph
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/sourcegraph/conc/README.md b/vendor/github.com/sourcegraph/conc/README.md
deleted file mode 100644
index 1c87c3c96..000000000
--- a/vendor/github.com/sourcegraph/conc/README.md
+++ /dev/null
@@ -1,464 +0,0 @@
-
-
-# `conc`: better structured concurrency for go
-
-[](https://pkg.go.dev/github.com/sourcegraph/conc)
-[](https://sourcegraph.com/github.com/sourcegraph/conc)
-[](https://goreportcard.com/report/github.com/sourcegraph/conc)
-[](https://codecov.io/gh/sourcegraph/conc)
-[](https://discord.gg/bvXQXmtRjN)
-
-`conc` is your toolbelt for structured concurrency in go, making common tasks
-easier and safer.
-
-```sh
-go get github.com/sourcegraph/conc
-```
-
-# At a glance
-
-- Use [`conc.WaitGroup`](https://pkg.go.dev/github.com/sourcegraph/conc#WaitGroup) if you just want a safer version of `sync.WaitGroup`
-- Use [`pool.Pool`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#Pool) if you want a concurrency-limited task runner
-- Use [`pool.ResultPool`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#ResultPool) if you want a concurrent task runner that collects task results
-- Use [`pool.(Result)?ErrorPool`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#ErrorPool) if your tasks are fallible
-- Use [`pool.(Result)?ContextPool`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#ContextPool) if your tasks should be canceled on failure
-- Use [`stream.Stream`](https://pkg.go.dev/github.com/sourcegraph/conc/stream#Stream) if you want to process an ordered stream of tasks in parallel with serial callbacks
-- Use [`iter.Map`](https://pkg.go.dev/github.com/sourcegraph/conc/iter#Map) if you want to concurrently map a slice
-- Use [`iter.ForEach`](https://pkg.go.dev/github.com/sourcegraph/conc/iter#ForEach) if you want to concurrently iterate over a slice
-- Use [`panics.Catcher`](https://pkg.go.dev/github.com/sourcegraph/conc/panics#Catcher) if you want to catch panics in your own goroutines
-
-All pools are created with
-[`pool.New()`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#New)
-or
-[`pool.NewWithResults[T]()`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#NewWithResults),
-then configured with methods:
-
-- [`p.WithMaxGoroutines()`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#Pool.MaxGoroutines) configures the maximum number of goroutines in the pool
-- [`p.WithErrors()`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#Pool.WithErrors) configures the pool to run tasks that return errors
-- [`p.WithContext(ctx)`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#Pool.WithContext) configures the pool to run tasks that should be canceled on first error
-- [`p.WithFirstError()`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#ErrorPool.WithFirstError) configures error pools to only keep the first returned error rather than an aggregated error
-- [`p.WithCollectErrored()`](https://pkg.go.dev/github.com/sourcegraph/conc/pool#ResultContextPool.WithCollectErrored) configures result pools to collect results even when the task errored
-
-# Goals
-
-The main goals of the package are:
-1) Make it harder to leak goroutines
-2) Handle panics gracefully
-3) Make concurrent code easier to read
-
-## Goal #1: Make it harder to leak goroutines
-
-A common pain point when working with goroutines is cleaning them up. It's
-really easy to fire off a `go` statement and fail to properly wait for it to
-complete.
-
-`conc` takes the opinionated stance that all concurrency should be scoped.
-That is, goroutines should have an owner and that owner should always
-ensure that its owned goroutines exit properly.
-
-In `conc`, the owner of a goroutine is always a `conc.WaitGroup`. Goroutines
-are spawned in a `WaitGroup` with `(*WaitGroup).Go()`, and
-`(*WaitGroup).Wait()` should always be called before the `WaitGroup` goes out
-of scope.
-
-In some cases, you might want a spawned goroutine to outlast the scope of the
-caller. In that case, you could pass a `WaitGroup` into the spawning function.
-
-```go
-func main() {
- var wg conc.WaitGroup
- defer wg.Wait()
-
- startTheThing(&wg)
-}
-
-func startTheThing(wg *conc.WaitGroup) {
- wg.Go(func() { ... })
-}
-```
-
-For some more discussion on why scoped concurrency is nice, check out [this
-blog
-post](https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/).
-
-## Goal #2: Handle panics gracefully
-
-A frequent problem with goroutines in long-running applications is handling
-panics. A goroutine spawned without a panic handler will crash the whole process
-on panic. This is usually undesirable.
-
-However, if you do add a panic handler to a goroutine, what do you do with the
-panic once you catch it? Some options:
-1) Ignore it
-2) Log it
-3) Turn it into an error and return that to the goroutine spawner
-4) Propagate the panic to the goroutine spawner
-
-Ignoring panics is a bad idea since panics usually mean there is actually
-something wrong and someone should fix it.
-
-Just logging panics isn't great either because then there is no indication to the spawner
-that something bad happened, and it might just continue on as normal even though your
-program is in a really bad state.
-
-Both (3) and (4) are reasonable options, but both require the goroutine to have
-an owner that can actually receive the message that something went wrong. This
-is generally not true with a goroutine spawned with `go`, but in the `conc`
-package, all goroutines have an owner that must collect the spawned goroutine.
-In the conc package, any call to `Wait()` will panic if any of the spawned goroutines
-panicked. Additionally, it decorates the panic value with a stacktrace from the child
-goroutine so that you don't lose information about what caused the panic.
-
-Doing this all correctly every time you spawn something with `go` is not
-trivial and it requires a lot of boilerplate that makes the important parts of
-the code more difficult to read, so `conc` does this for you.
-
-
-
-stdlib |
-conc |
-
-
-|
-
-```go
-type caughtPanicError struct {
- val any
- stack []byte
-}
-
-func (e *caughtPanicError) Error() string {
- return fmt.Sprintf(
- "panic: %q\n%s",
- e.val,
- string(e.stack)
- )
-}
-
-func main() {
- done := make(chan error)
- go func() {
- defer func() {
- if v := recover(); v != nil {
- done <- &caughtPanicError{
- val: v,
- stack: debug.Stack()
- }
- } else {
- done <- nil
- }
- }()
- doSomethingThatMightPanic()
- }()
- err := <-done
- if err != nil {
- panic(err)
- }
-}
-```
- |
-
-
-```go
-func main() {
- var wg conc.WaitGroup
- wg.Go(doSomethingThatMightPanic)
- // panics with a nice stacktrace
- wg.Wait()
-}
-```
- |
-
-
-
-## Goal #3: Make concurrent code easier to read
-
-Doing concurrency correctly is difficult. Doing it in a way that doesn't
-obfuscate what the code is actually doing is more difficult. The `conc` package
-attempts to make common operations easier by abstracting as much boilerplate
-complexity as possible.
-
-Want to run a set of concurrent tasks with a bounded set of goroutines? Use
-`pool.New()`. Want to process an ordered stream of results concurrently, but
-still maintain order? Try `stream.New()`. What about a concurrent map over
-a slice? Take a peek at `iter.Map()`.
-
-Browse some examples below for some comparisons with doing these by hand.
-
-# Examples
-
-Each of these examples forgoes propagating panics for simplicity. To see
-what kind of complexity that would add, check out the "Goal #2" header above.
-
-Spawn a set of goroutines and waiting for them to finish:
-
-
-
-stdlib |
-conc |
-
-
-|
-
-```go
-func main() {
- var wg sync.WaitGroup
- for i := 0; i < 10; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- // crashes on panic!
- doSomething()
- }()
- }
- wg.Wait()
-}
-```
- |
-
-
-```go
-func main() {
- var wg conc.WaitGroup
- for i := 0; i < 10; i++ {
- wg.Go(doSomething)
- }
- wg.Wait()
-}
-```
- |
-
-
-
-Process each element of a stream in a static pool of goroutines:
-
-
-
-stdlib |
-conc |
-
-
-|
-
-```go
-func process(stream chan int) {
- var wg sync.WaitGroup
- for i := 0; i < 10; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- for elem := range stream {
- handle(elem)
- }
- }()
- }
- wg.Wait()
-}
-```
- |
-
-
-```go
-func process(stream chan int) {
- p := pool.New().WithMaxGoroutines(10)
- for elem := range stream {
- elem := elem
- p.Go(func() {
- handle(elem)
- })
- }
- p.Wait()
-}
-```
- |
-
-
-
-Process each element of a slice in a static pool of goroutines:
-
-
-
-stdlib |
-conc |
-
-
-|
-
-```go
-func process(values []int) {
- feeder := make(chan int, 8)
-
- var wg sync.WaitGroup
- for i := 0; i < 10; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
- for elem := range feeder {
- handle(elem)
- }
- }()
- }
-
- for _, value := range values {
- feeder <- value
- }
- close(feeder)
- wg.Wait()
-}
-```
- |
-
-
-```go
-func process(values []int) {
- iter.ForEach(values, handle)
-}
-```
- |
-
-
-
-Concurrently map a slice:
-
-
-
-stdlib |
-conc |
-
-
-|
-
-```go
-func concMap(
- input []int,
- f func(int) int,
-) []int {
- res := make([]int, len(input))
- var idx atomic.Int64
-
- var wg sync.WaitGroup
- for i := 0; i < 10; i++ {
- wg.Add(1)
- go func() {
- defer wg.Done()
-
- for {
- i := int(idx.Add(1) - 1)
- if i >= len(input) {
- return
- }
-
- res[i] = f(input[i])
- }
- }()
- }
- wg.Wait()
- return res
-}
-```
- |
-
-
-```go
-func concMap(
- input []int,
- f func(*int) int,
-) []int {
- return iter.Map(input, f)
-}
-```
- |
-
-
-
-Process an ordered stream concurrently:
-
-
-
-
-stdlib |
-conc |
-
-
-|
-
-```go
-func mapStream(
- in chan int,
- out chan int,
- f func(int) int,
-) {
- tasks := make(chan func())
- taskResults := make(chan chan int)
-
- // Worker goroutines
- var workerWg sync.WaitGroup
- for i := 0; i < 10; i++ {
- workerWg.Add(1)
- go func() {
- defer workerWg.Done()
- for task := range tasks {
- task()
- }
- }()
- }
-
- // Ordered reader goroutines
- var readerWg sync.WaitGroup
- readerWg.Add(1)
- go func() {
- defer readerWg.Done()
- for result := range taskResults {
- item := <-result
- out <- item
- }
- }()
-
- // Feed the workers with tasks
- for elem := range in {
- resultCh := make(chan int, 1)
- taskResults <- resultCh
- tasks <- func() {
- resultCh <- f(elem)
- }
- }
-
- // We've exhausted input.
- // Wait for everything to finish
- close(tasks)
- workerWg.Wait()
- close(taskResults)
- readerWg.Wait()
-}
-```
- |
-
-
-```go
-func mapStream(
- in chan int,
- out chan int,
- f func(int) int,
-) {
- s := stream.New().WithMaxGoroutines(10)
- for elem := range in {
- elem := elem
- s.Go(func() stream.Callback {
- res := f(elem)
- return func() { out <- res }
- })
- }
- s.Wait()
-}
-```
- |
-
-
-
-# Status
-
-This package is currently pre-1.0. There are likely to be minor breaking
-changes before a 1.0 release as we stabilize the APIs and tweak defaults.
-Please open an issue if you have questions, concerns, or requests that you'd
-like addressed before the 1.0 release. Currently, a 1.0 is targeted for
-March 2023.
diff --git a/vendor/github.com/sourcegraph/conc/internal/multierror/multierror_go119.go b/vendor/github.com/sourcegraph/conc/internal/multierror/multierror_go119.go
deleted file mode 100644
index 7087e32a8..000000000
--- a/vendor/github.com/sourcegraph/conc/internal/multierror/multierror_go119.go
+++ /dev/null
@@ -1,10 +0,0 @@
-//go:build !go1.20
-// +build !go1.20
-
-package multierror
-
-import "go.uber.org/multierr"
-
-var (
- Join = multierr.Combine
-)
diff --git a/vendor/github.com/sourcegraph/conc/internal/multierror/multierror_go120.go b/vendor/github.com/sourcegraph/conc/internal/multierror/multierror_go120.go
deleted file mode 100644
index 39cff829a..000000000
--- a/vendor/github.com/sourcegraph/conc/internal/multierror/multierror_go120.go
+++ /dev/null
@@ -1,10 +0,0 @@
-//go:build go1.20
-// +build go1.20
-
-package multierror
-
-import "errors"
-
-var (
- Join = errors.Join
-)
diff --git a/vendor/github.com/sourcegraph/conc/iter/iter.go b/vendor/github.com/sourcegraph/conc/iter/iter.go
deleted file mode 100644
index 124b4f940..000000000
--- a/vendor/github.com/sourcegraph/conc/iter/iter.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package iter
-
-import (
- "runtime"
- "sync/atomic"
-
- "github.com/sourcegraph/conc"
-)
-
-// defaultMaxGoroutines returns the default maximum number of
-// goroutines to use within this package.
-func defaultMaxGoroutines() int { return runtime.GOMAXPROCS(0) }
-
-// Iterator can be used to configure the behaviour of ForEach
-// and ForEachIdx. The zero value is safe to use with reasonable
-// defaults.
-//
-// Iterator is also safe for reuse and concurrent use.
-type Iterator[T any] struct {
- // MaxGoroutines controls the maximum number of goroutines
- // to use on this Iterator's methods.
- //
- // If unset, MaxGoroutines defaults to runtime.GOMAXPROCS(0).
- MaxGoroutines int
-}
-
-// ForEach executes f in parallel over each element in input.
-//
-// It is safe to mutate the input parameter, which makes it
-// possible to map in place.
-//
-// ForEach always uses at most runtime.GOMAXPROCS goroutines.
-// It takes roughly 2µs to start up the goroutines and adds
-// an overhead of roughly 50ns per element of input. For
-// a configurable goroutine limit, use a custom Iterator.
-func ForEach[T any](input []T, f func(*T)) { Iterator[T]{}.ForEach(input, f) }
-
-// ForEach executes f in parallel over each element in input,
-// using up to the Iterator's configured maximum number of
-// goroutines.
-//
-// It is safe to mutate the input parameter, which makes it
-// possible to map in place.
-//
-// It takes roughly 2µs to start up the goroutines and adds
-// an overhead of roughly 50ns per element of input.
-func (iter Iterator[T]) ForEach(input []T, f func(*T)) {
- iter.ForEachIdx(input, func(_ int, t *T) {
- f(t)
- })
-}
-
-// ForEachIdx is the same as ForEach except it also provides the
-// index of the element to the callback.
-func ForEachIdx[T any](input []T, f func(int, *T)) { Iterator[T]{}.ForEachIdx(input, f) }
-
-// ForEachIdx is the same as ForEach except it also provides the
-// index of the element to the callback.
-func (iter Iterator[T]) ForEachIdx(input []T, f func(int, *T)) {
- if iter.MaxGoroutines == 0 {
- // iter is a value receiver and is hence safe to mutate
- iter.MaxGoroutines = defaultMaxGoroutines()
- }
-
- numInput := len(input)
- if iter.MaxGoroutines > numInput {
- // No more concurrent tasks than the number of input items.
- iter.MaxGoroutines = numInput
- }
-
- var idx atomic.Int64
- // Create the task outside the loop to avoid extra closure allocations.
- task := func() {
- i := int(idx.Add(1) - 1)
- for ; i < numInput; i = int(idx.Add(1) - 1) {
- f(i, &input[i])
- }
- }
-
- var wg conc.WaitGroup
- for i := 0; i < iter.MaxGoroutines; i++ {
- wg.Go(task)
- }
- wg.Wait()
-}
diff --git a/vendor/github.com/sourcegraph/conc/iter/map.go b/vendor/github.com/sourcegraph/conc/iter/map.go
deleted file mode 100644
index efbe6bfaf..000000000
--- a/vendor/github.com/sourcegraph/conc/iter/map.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package iter
-
-import (
- "sync"
-
- "github.com/sourcegraph/conc/internal/multierror"
-)
-
-// Mapper is an Iterator with a result type R. It can be used to configure
-// the behaviour of Map and MapErr. The zero value is safe to use with
-// reasonable defaults.
-//
-// Mapper is also safe for reuse and concurrent use.
-type Mapper[T, R any] Iterator[T]
-
-// Map applies f to each element of input, returning the mapped result.
-//
-// Map always uses at most runtime.GOMAXPROCS goroutines. For a configurable
-// goroutine limit, use a custom Mapper.
-func Map[T, R any](input []T, f func(*T) R) []R {
- return Mapper[T, R]{}.Map(input, f)
-}
-
-// Map applies f to each element of input, returning the mapped result.
-//
-// Map uses up to the configured Mapper's maximum number of goroutines.
-func (m Mapper[T, R]) Map(input []T, f func(*T) R) []R {
- res := make([]R, len(input))
- Iterator[T](m).ForEachIdx(input, func(i int, t *T) {
- res[i] = f(t)
- })
- return res
-}
-
-// MapErr applies f to each element of the input, returning the mapped result
-// and a combined error of all returned errors.
-//
-// Map always uses at most runtime.GOMAXPROCS goroutines. For a configurable
-// goroutine limit, use a custom Mapper.
-func MapErr[T, R any](input []T, f func(*T) (R, error)) ([]R, error) {
- return Mapper[T, R]{}.MapErr(input, f)
-}
-
-// MapErr applies f to each element of the input, returning the mapped result
-// and a combined error of all returned errors.
-//
-// Map uses up to the configured Mapper's maximum number of goroutines.
-func (m Mapper[T, R]) MapErr(input []T, f func(*T) (R, error)) ([]R, error) {
- var (
- res = make([]R, len(input))
- errMux sync.Mutex
- errs error
- )
- Iterator[T](m).ForEachIdx(input, func(i int, t *T) {
- var err error
- res[i], err = f(t)
- if err != nil {
- errMux.Lock()
- // TODO: use stdlib errors once multierrors land in go 1.20
- errs = multierror.Join(errs, err)
- errMux.Unlock()
- }
- })
- return res, errs
-}
diff --git a/vendor/github.com/sourcegraph/conc/panics/panics.go b/vendor/github.com/sourcegraph/conc/panics/panics.go
deleted file mode 100644
index abbed7fa0..000000000
--- a/vendor/github.com/sourcegraph/conc/panics/panics.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package panics
-
-import (
- "fmt"
- "runtime"
- "runtime/debug"
- "sync/atomic"
-)
-
-// Catcher is used to catch panics. You can execute a function with Try,
-// which will catch any spawned panic. Try can be called any number of times,
-// from any number of goroutines. Once all calls to Try have completed, you can
-// get the value of the first panic (if any) with Recovered(), or you can just
-// propagate the panic (re-panic) with Repanic().
-type Catcher struct {
- recovered atomic.Pointer[Recovered]
-}
-
-// Try executes f, catching any panic it might spawn. It is safe
-// to call from multiple goroutines simultaneously.
-func (p *Catcher) Try(f func()) {
- defer p.tryRecover()
- f()
-}
-
-func (p *Catcher) tryRecover() {
- if val := recover(); val != nil {
- rp := NewRecovered(1, val)
- p.recovered.CompareAndSwap(nil, &rp)
- }
-}
-
-// Repanic panics if any calls to Try caught a panic. It will panic with the
-// value of the first panic caught, wrapped in a panics.Recovered with caller
-// information.
-func (p *Catcher) Repanic() {
- if val := p.Recovered(); val != nil {
- panic(val)
- }
-}
-
-// Recovered returns the value of the first panic caught by Try, or nil if
-// no calls to Try panicked.
-func (p *Catcher) Recovered() *Recovered {
- return p.recovered.Load()
-}
-
-// NewRecovered creates a panics.Recovered from a panic value and a collected
-// stacktrace. The skip parameter allows the caller to skip stack frames when
-// collecting the stacktrace. Calling with a skip of 0 means include the call to
-// NewRecovered in the stacktrace.
-func NewRecovered(skip int, value any) Recovered {
- // 64 frames should be plenty
- var callers [64]uintptr
- n := runtime.Callers(skip+1, callers[:])
- return Recovered{
- Value: value,
- Callers: callers[:n],
- Stack: debug.Stack(),
- }
-}
-
-// Recovered is a panic that was caught with recover().
-type Recovered struct {
- // The original value of the panic.
- Value any
- // The caller list as returned by runtime.Callers when the panic was
- // recovered. Can be used to produce a more detailed stack information with
- // runtime.CallersFrames.
- Callers []uintptr
- // The formatted stacktrace from the goroutine where the panic was recovered.
- // Easier to use than Callers.
- Stack []byte
-}
-
-// String renders a human-readable formatting of the panic.
-func (p *Recovered) String() string {
- return fmt.Sprintf("panic: %v\nstacktrace:\n%s\n", p.Value, p.Stack)
-}
-
-// AsError casts the panic into an error implementation. The implementation
-// is unwrappable with the cause of the panic, if the panic was provided one.
-func (p *Recovered) AsError() error {
- if p == nil {
- return nil
- }
- return &ErrRecovered{*p}
-}
-
-// ErrRecovered wraps a panics.Recovered in an error implementation.
-type ErrRecovered struct{ Recovered }
-
-var _ error = (*ErrRecovered)(nil)
-
-func (p *ErrRecovered) Error() string { return p.String() }
-
-func (p *ErrRecovered) Unwrap() error {
- if err, ok := p.Value.(error); ok {
- return err
- }
- return nil
-}
diff --git a/vendor/github.com/sourcegraph/conc/panics/try.go b/vendor/github.com/sourcegraph/conc/panics/try.go
deleted file mode 100644
index 4ded92a1c..000000000
--- a/vendor/github.com/sourcegraph/conc/panics/try.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package panics
-
-// Try executes f, catching and returning any panic it might spawn.
-//
-// The recovered panic can be propagated with panic(), or handled as a normal error with
-// (*panics.Recovered).AsError().
-func Try(f func()) *Recovered {
- var c Catcher
- c.Try(f)
- return c.Recovered()
-}
diff --git a/vendor/github.com/sourcegraph/conc/waitgroup.go b/vendor/github.com/sourcegraph/conc/waitgroup.go
deleted file mode 100644
index 47b1bc1a5..000000000
--- a/vendor/github.com/sourcegraph/conc/waitgroup.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package conc
-
-import (
- "sync"
-
- "github.com/sourcegraph/conc/panics"
-)
-
-// NewWaitGroup creates a new WaitGroup.
-func NewWaitGroup() *WaitGroup {
- return &WaitGroup{}
-}
-
-// WaitGroup is the primary building block for scoped concurrency.
-// Goroutines can be spawned in the WaitGroup with the Go method,
-// and calling Wait() will ensure that each of those goroutines exits
-// before continuing. Any panics in a child goroutine will be caught
-// and propagated to the caller of Wait().
-//
-// The zero value of WaitGroup is usable, just like sync.WaitGroup.
-// Also like sync.WaitGroup, it must not be copied after first use.
-type WaitGroup struct {
- wg sync.WaitGroup
- pc panics.Catcher
-}
-
-// Go spawns a new goroutine in the WaitGroup.
-func (h *WaitGroup) Go(f func()) {
- h.wg.Add(1)
- go func() {
- defer h.wg.Done()
- h.pc.Try(f)
- }()
-}
-
-// Wait will block until all goroutines spawned with Go exit and will
-// propagate any panics spawned in a child goroutine.
-func (h *WaitGroup) Wait() {
- h.wg.Wait()
-
- // Propagate a panic if we caught one from a child goroutine.
- h.pc.Repanic()
-}
-
-// WaitAndRecover will block until all goroutines spawned with Go exit and
-// will return a *panics.Recovered if one of the child goroutines panics.
-func (h *WaitGroup) WaitAndRecover() *panics.Recovered {
- h.wg.Wait()
-
- // Return a recovered panic if we caught one from a child goroutine.
- return h.pc.Recovered()
-}
diff --git a/vendor/github.com/spf13/afero/.gitignore b/vendor/github.com/spf13/afero/.gitignore
deleted file mode 100644
index 9c1d98611..000000000
--- a/vendor/github.com/spf13/afero/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-sftpfs/file1
-sftpfs/test/
diff --git a/vendor/github.com/spf13/afero/LICENSE.txt b/vendor/github.com/spf13/afero/LICENSE.txt
deleted file mode 100644
index 298f0e266..000000000
--- a/vendor/github.com/spf13/afero/LICENSE.txt
+++ /dev/null
@@ -1,174 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
diff --git a/vendor/github.com/spf13/afero/README.md b/vendor/github.com/spf13/afero/README.md
deleted file mode 100644
index 3bafbfdfc..000000000
--- a/vendor/github.com/spf13/afero/README.md
+++ /dev/null
@@ -1,442 +0,0 @@
-
-
-A FileSystem Abstraction System for Go
-
-[](https://github.com/spf13/afero/actions/workflows/test.yml) [](https://godoc.org/github.com/spf13/afero) [](https://gitter.im/spf13/afero?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-# Overview
-
-Afero is a filesystem framework providing a simple, uniform and universal API
-interacting with any filesystem, as an abstraction layer providing interfaces,
-types and methods. Afero has an exceptionally clean interface and simple design
-without needless constructors or initialization methods.
-
-Afero is also a library providing a base set of interoperable backend
-filesystems that make it easy to work with afero while retaining all the power
-and benefit of the os and ioutil packages.
-
-Afero provides significant improvements over using the os package alone, most
-notably the ability to create mock and testing filesystems without relying on the disk.
-
-It is suitable for use in any situation where you would consider using the OS
-package as it provides an additional abstraction that makes it easy to use a
-memory backed file system during testing. It also adds support for the http
-filesystem for full interoperability.
-
-
-## Afero Features
-
-* A single consistent API for accessing a variety of filesystems
-* Interoperation between a variety of file system types
-* A set of interfaces to encourage and enforce interoperability between backends
-* An atomic cross platform memory backed file system
-* Support for compositional (union) file systems by combining multiple file systems acting as one
-* Specialized backends which modify existing filesystems (Read Only, Regexp filtered)
-* A set of utility functions ported from io, ioutil & hugo to be afero aware
-* Wrapper for go 1.16 filesystem abstraction `io/fs.FS`
-
-# Using Afero
-
-Afero is easy to use and easier to adopt.
-
-A few different ways you could use Afero:
-
-* Use the interfaces alone to define your own file system.
-* Wrapper for the OS packages.
-* Define different filesystems for different parts of your application.
-* Use Afero for mock filesystems while testing
-
-## Step 1: Install Afero
-
-First use go get to install the latest version of the library.
-
- $ go get github.com/spf13/afero
-
-Next include Afero in your application.
-```go
-import "github.com/spf13/afero"
-```
-
-## Step 2: Declare a backend
-
-First define a package variable and set it to a pointer to a filesystem.
-```go
-var AppFs = afero.NewMemMapFs()
-
-or
-
-var AppFs = afero.NewOsFs()
-```
-It is important to note that if you repeat the composite literal you
-will be using a completely new and isolated filesystem. In the case of
-OsFs it will still use the same underlying filesystem but will reduce
-the ability to drop in other filesystems as desired.
-
-## Step 3: Use it like you would the OS package
-
-Throughout your application use any function and method like you normally
-would.
-
-So if my application before had:
-```go
-os.Open("/tmp/foo")
-```
-We would replace it with:
-```go
-AppFs.Open("/tmp/foo")
-```
-
-`AppFs` being the variable we defined above.
-
-
-## List of all available functions
-
-File System Methods Available:
-```go
-Chmod(name string, mode os.FileMode) : error
-Chown(name string, uid, gid int) : error
-Chtimes(name string, atime time.Time, mtime time.Time) : error
-Create(name string) : File, error
-Mkdir(name string, perm os.FileMode) : error
-MkdirAll(path string, perm os.FileMode) : error
-Name() : string
-Open(name string) : File, error
-OpenFile(name string, flag int, perm os.FileMode) : File, error
-Remove(name string) : error
-RemoveAll(path string) : error
-Rename(oldname, newname string) : error
-Stat(name string) : os.FileInfo, error
-```
-File Interfaces and Methods Available:
-```go
-io.Closer
-io.Reader
-io.ReaderAt
-io.Seeker
-io.Writer
-io.WriterAt
-
-Name() : string
-Readdir(count int) : []os.FileInfo, error
-Readdirnames(n int) : []string, error
-Stat() : os.FileInfo, error
-Sync() : error
-Truncate(size int64) : error
-WriteString(s string) : ret int, err error
-```
-In some applications it may make sense to define a new package that
-simply exports the file system variable for easy access from anywhere.
-
-## Using Afero's utility functions
-
-Afero provides a set of functions to make it easier to use the underlying file systems.
-These functions have been primarily ported from io & ioutil with some developed for Hugo.
-
-The afero utilities support all afero compatible backends.
-
-The list of utilities includes:
-
-```go
-DirExists(path string) (bool, error)
-Exists(path string) (bool, error)
-FileContainsBytes(filename string, subslice []byte) (bool, error)
-GetTempDir(subPath string) string
-IsDir(path string) (bool, error)
-IsEmpty(path string) (bool, error)
-ReadDir(dirname string) ([]os.FileInfo, error)
-ReadFile(filename string) ([]byte, error)
-SafeWriteReader(path string, r io.Reader) (err error)
-TempDir(dir, prefix string) (name string, err error)
-TempFile(dir, prefix string) (f File, err error)
-Walk(root string, walkFn filepath.WalkFunc) error
-WriteFile(filename string, data []byte, perm os.FileMode) error
-WriteReader(path string, r io.Reader) (err error)
-```
-For a complete list see [Afero's GoDoc](https://godoc.org/github.com/spf13/afero)
-
-They are available under two different approaches to use. You can either call
-them directly where the first parameter of each function will be the file
-system, or you can declare a new `Afero`, a custom type used to bind these
-functions as methods to a given filesystem.
-
-### Calling utilities directly
-
-```go
-fs := new(afero.MemMapFs)
-f, err := afero.TempFile(fs,"", "ioutil-test")
-
-```
-
-### Calling via Afero
-
-```go
-fs := afero.NewMemMapFs()
-afs := &afero.Afero{Fs: fs}
-f, err := afs.TempFile("", "ioutil-test")
-```
-
-## Using Afero for Testing
-
-There is a large benefit to using a mock filesystem for testing. It has a
-completely blank state every time it is initialized and can be easily
-reproducible regardless of OS. You could create files to your heart’s content
-and the file access would be fast while also saving you from all the annoying
-issues with deleting temporary files, Windows file locking, etc. The MemMapFs
-backend is perfect for testing.
-
-* Much faster than performing I/O operations on disk
-* Avoid security issues and permissions
-* Far more control. 'rm -rf /' with confidence
-* Test setup is far more easier to do
-* No test cleanup needed
-
-One way to accomplish this is to define a variable as mentioned above.
-In your application this will be set to afero.NewOsFs() during testing you
-can set it to afero.NewMemMapFs().
-
-It wouldn't be uncommon to have each test initialize a blank slate memory
-backend. To do this I would define my `appFS = afero.NewOsFs()` somewhere
-appropriate in my application code. This approach ensures that Tests are order
-independent, with no test relying on the state left by an earlier test.
-
-Then in my tests I would initialize a new MemMapFs for each test:
-```go
-func TestExist(t *testing.T) {
- appFS := afero.NewMemMapFs()
- // create test files and directories
- appFS.MkdirAll("src/a", 0755)
- afero.WriteFile(appFS, "src/a/b", []byte("file b"), 0644)
- afero.WriteFile(appFS, "src/c", []byte("file c"), 0644)
- name := "src/c"
- _, err := appFS.Stat(name)
- if os.IsNotExist(err) {
- t.Errorf("file \"%s\" does not exist.\n", name)
- }
-}
-```
-
-# Available Backends
-
-## Operating System Native
-
-### OsFs
-
-The first is simply a wrapper around the native OS calls. This makes it
-very easy to use as all of the calls are the same as the existing OS
-calls. It also makes it trivial to have your code use the OS during
-operation and a mock filesystem during testing or as needed.
-
-```go
-appfs := afero.NewOsFs()
-appfs.MkdirAll("src/a", 0755)
-```
-
-## Memory Backed Storage
-
-### MemMapFs
-
-Afero also provides a fully atomic memory backed filesystem perfect for use in
-mocking and to speed up unnecessary disk io when persistence isn’t
-necessary. It is fully concurrent and will work within go routines
-safely.
-
-```go
-mm := afero.NewMemMapFs()
-mm.MkdirAll("src/a", 0755)
-```
-
-#### InMemoryFile
-
-As part of MemMapFs, Afero also provides an atomic, fully concurrent memory
-backed file implementation. This can be used in other memory backed file
-systems with ease. Plans are to add a radix tree memory stored file
-system using InMemoryFile.
-
-## Network Interfaces
-
-### SftpFs
-
-Afero has experimental support for secure file transfer protocol (sftp). Which can
-be used to perform file operations over a encrypted channel.
-
-### GCSFs
-
-Afero has experimental support for Google Cloud Storage (GCS). You can either set the
-`GOOGLE_APPLICATION_CREDENTIALS_JSON` env variable to your JSON credentials or use `opts` in
-`NewGcsFS` to configure access to your GCS bucket.
-
-Some known limitations of the existing implementation:
-* No Chmod support - The GCS ACL could probably be mapped to *nix style permissions but that would add another level of complexity and is ignored in this version.
-* No Chtimes support - Could be simulated with attributes (gcs a/m-times are set implicitly) but that's is left for another version.
-* Not thread safe - Also assumes all file operations are done through the same instance of the GcsFs. File operations between different GcsFs instances are not guaranteed to be consistent.
-
-
-## Filtering Backends
-
-### BasePathFs
-
-The BasePathFs restricts all operations to a given path within an Fs.
-The given file name to the operations on this Fs will be prepended with
-the base path before calling the source Fs.
-
-```go
-bp := afero.NewBasePathFs(afero.NewOsFs(), "/base/path")
-```
-
-### ReadOnlyFs
-
-A thin wrapper around the source Fs providing a read only view.
-
-```go
-fs := afero.NewReadOnlyFs(afero.NewOsFs())
-_, err := fs.Create("/file.txt")
-// err = syscall.EPERM
-```
-
-# RegexpFs
-
-A filtered view on file names, any file NOT matching
-the passed regexp will be treated as non-existing.
-Files not matching the regexp provided will not be created.
-Directories are not filtered.
-
-```go
-fs := afero.NewRegexpFs(afero.NewMemMapFs(), regexp.MustCompile(`\.txt$`))
-_, err := fs.Create("/file.html")
-// err = syscall.ENOENT
-```
-
-### HttpFs
-
-Afero provides an http compatible backend which can wrap any of the existing
-backends.
-
-The Http package requires a slightly specific version of Open which
-returns an http.File type.
-
-Afero provides an httpFs file system which satisfies this requirement.
-Any Afero FileSystem can be used as an httpFs.
-
-```go
-httpFs := afero.NewHttpFs()
-fileserver := http.FileServer(httpFs.Dir())
-http.Handle("/", fileserver)
-```
-
-## Composite Backends
-
-Afero provides the ability have two filesystems (or more) act as a single
-file system.
-
-### CacheOnReadFs
-
-The CacheOnReadFs will lazily make copies of any accessed files from the base
-layer into the overlay. Subsequent reads will be pulled from the overlay
-directly permitting the request is within the cache duration of when it was
-created in the overlay.
-
-If the base filesystem is writeable, any changes to files will be
-done first to the base, then to the overlay layer. Write calls to open file
-handles like `Write()` or `Truncate()` to the overlay first.
-
-To writing files to the overlay only, you can use the overlay Fs directly (not
-via the union Fs).
-
-Cache files in the layer for the given time.Duration, a cache duration of 0
-means "forever" meaning the file will not be re-requested from the base ever.
-
-A read-only base will make the overlay also read-only but still copy files
-from the base to the overlay when they're not present (or outdated) in the
-caching layer.
-
-```go
-base := afero.NewOsFs()
-layer := afero.NewMemMapFs()
-ufs := afero.NewCacheOnReadFs(base, layer, 100 * time.Second)
-```
-
-### CopyOnWriteFs()
-
-The CopyOnWriteFs is a read only base file system with a potentially
-writeable layer on top.
-
-Read operations will first look in the overlay and if not found there, will
-serve the file from the base.
-
-Changes to the file system will only be made in the overlay.
-
-Any attempt to modify a file found only in the base will copy the file to the
-overlay layer before modification (including opening a file with a writable
-handle).
-
-Removing and Renaming files present only in the base layer is not currently
-permitted. If a file is present in the base layer and the overlay, only the
-overlay will be removed/renamed.
-
-```go
- base := afero.NewOsFs()
- roBase := afero.NewReadOnlyFs(base)
- ufs := afero.NewCopyOnWriteFs(roBase, afero.NewMemMapFs())
-
- fh, _ = ufs.Create("/home/test/file2.txt")
- fh.WriteString("This is a test")
- fh.Close()
-```
-
-In this example all write operations will only occur in memory (MemMapFs)
-leaving the base filesystem (OsFs) untouched.
-
-
-## Desired/possible backends
-
-The following is a short list of possible backends we hope someone will
-implement:
-
-* SSH
-* S3
-
-# About the project
-
-## What's in the name
-
-Afero comes from the latin roots Ad-Facere.
-
-**"Ad"** is a prefix meaning "to".
-
-**"Facere"** is a form of the root "faciō" making "make or do".
-
-The literal meaning of afero is "to make" or "to do" which seems very fitting
-for a library that allows one to make files and directories and do things with them.
-
-The English word that shares the same roots as Afero is "affair". Affair shares
-the same concept but as a noun it means "something that is made or done" or "an
-object of a particular type".
-
-It's also nice that unlike some of my other libraries (hugo, cobra, viper) it
-Googles very well.
-
-## Release Notes
-
-See the [Releases Page](https://github.com/spf13/afero/releases).
-
-## Contributing
-
-1. Fork it
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create new Pull Request
-
-## Contributors
-
-Names in no particular order:
-
-* [spf13](https://github.com/spf13)
-* [jaqx0r](https://github.com/jaqx0r)
-* [mbertschler](https://github.com/mbertschler)
-* [xor-gate](https://github.com/xor-gate)
-
-## License
-
-Afero is released under the Apache 2.0 license. See
-[LICENSE.txt](https://github.com/spf13/afero/blob/master/LICENSE.txt)
diff --git a/vendor/github.com/spf13/afero/afero.go b/vendor/github.com/spf13/afero/afero.go
deleted file mode 100644
index 39f658520..000000000
--- a/vendor/github.com/spf13/afero/afero.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright © 2014 Steve Francia .
-// Copyright 2013 tsuru authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package afero provides types and methods for interacting with the filesystem,
-// as an abstraction layer.
-
-// Afero also provides a few implementations that are mostly interoperable. One that
-// uses the operating system filesystem, one that uses memory to store files
-// (cross platform) and an interface that should be implemented if you want to
-// provide your own filesystem.
-
-package afero
-
-import (
- "errors"
- "io"
- "os"
- "time"
-)
-
-type Afero struct {
- Fs
-}
-
-// File represents a file in the filesystem.
-type File interface {
- io.Closer
- io.Reader
- io.ReaderAt
- io.Seeker
- io.Writer
- io.WriterAt
-
- Name() string
- Readdir(count int) ([]os.FileInfo, error)
- Readdirnames(n int) ([]string, error)
- Stat() (os.FileInfo, error)
- Sync() error
- Truncate(size int64) error
- WriteString(s string) (ret int, err error)
-}
-
-// Fs is the filesystem interface.
-//
-// Any simulated or real filesystem should implement this interface.
-type Fs interface {
- // Create creates a file in the filesystem, returning the file and an
- // error, if any happens.
- Create(name string) (File, error)
-
- // Mkdir creates a directory in the filesystem, return an error if any
- // happens.
- Mkdir(name string, perm os.FileMode) error
-
- // MkdirAll creates a directory path and all parents that does not exist
- // yet.
- MkdirAll(path string, perm os.FileMode) error
-
- // Open opens a file, returning it or an error, if any happens.
- Open(name string) (File, error)
-
- // OpenFile opens a file using the given flags and the given mode.
- OpenFile(name string, flag int, perm os.FileMode) (File, error)
-
- // Remove removes a file identified by name, returning an error, if any
- // happens.
- Remove(name string) error
-
- // RemoveAll removes a directory path and any children it contains. It
- // does not fail if the path does not exist (return nil).
- RemoveAll(path string) error
-
- // Rename renames a file.
- Rename(oldname, newname string) error
-
- // Stat returns a FileInfo describing the named file, or an error, if any
- // happens.
- Stat(name string) (os.FileInfo, error)
-
- // The name of this FileSystem
- Name() string
-
- // Chmod changes the mode of the named file to mode.
- Chmod(name string, mode os.FileMode) error
-
- // Chown changes the uid and gid of the named file.
- Chown(name string, uid, gid int) error
-
- // Chtimes changes the access and modification times of the named file
- Chtimes(name string, atime time.Time, mtime time.Time) error
-}
-
-var (
- ErrFileClosed = errors.New("File is closed")
- ErrOutOfRange = errors.New("out of range")
- ErrTooLarge = errors.New("too large")
- ErrFileNotFound = os.ErrNotExist
- ErrFileExists = os.ErrExist
- ErrDestinationExists = os.ErrExist
-)
diff --git a/vendor/github.com/spf13/afero/appveyor.yml b/vendor/github.com/spf13/afero/appveyor.yml
deleted file mode 100644
index 65e20e8ca..000000000
--- a/vendor/github.com/spf13/afero/appveyor.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-# This currently does nothing. We have moved to GitHub action, but this is kept
-# until spf13 has disabled this project in AppVeyor.
-version: '{build}'
-clone_folder: C:\gopath\src\github.com\spf13\afero
-environment:
- GOPATH: C:\gopath
-build_script:
-- cmd: >-
- go version
-
diff --git a/vendor/github.com/spf13/afero/basepath.go b/vendor/github.com/spf13/afero/basepath.go
deleted file mode 100644
index 2e72793a3..000000000
--- a/vendor/github.com/spf13/afero/basepath.go
+++ /dev/null
@@ -1,222 +0,0 @@
-package afero
-
-import (
- "io/fs"
- "os"
- "path/filepath"
- "runtime"
- "strings"
- "time"
-)
-
-var (
- _ Lstater = (*BasePathFs)(nil)
- _ fs.ReadDirFile = (*BasePathFile)(nil)
-)
-
-// The BasePathFs restricts all operations to a given path within an Fs.
-// The given file name to the operations on this Fs will be prepended with
-// the base path before calling the base Fs.
-// Any file name (after filepath.Clean()) outside this base path will be
-// treated as non existing file.
-//
-// Note that it does not clean the error messages on return, so you may
-// reveal the real path on errors.
-type BasePathFs struct {
- source Fs
- path string
-}
-
-type BasePathFile struct {
- File
- path string
-}
-
-func (f *BasePathFile) Name() string {
- sourcename := f.File.Name()
- return strings.TrimPrefix(sourcename, filepath.Clean(f.path))
-}
-
-func (f *BasePathFile) ReadDir(n int) ([]fs.DirEntry, error) {
- if rdf, ok := f.File.(fs.ReadDirFile); ok {
- return rdf.ReadDir(n)
- }
- return readDirFile{f.File}.ReadDir(n)
-}
-
-func NewBasePathFs(source Fs, path string) Fs {
- return &BasePathFs{source: source, path: path}
-}
-
-// on a file outside the base path it returns the given file name and an error,
-// else the given file with the base path prepended
-func (b *BasePathFs) RealPath(name string) (path string, err error) {
- if err := validateBasePathName(name); err != nil {
- return name, err
- }
-
- bpath := filepath.Clean(b.path)
- path = filepath.Clean(filepath.Join(bpath, name))
- if !strings.HasPrefix(path, bpath) {
- return name, os.ErrNotExist
- }
-
- return path, nil
-}
-
-func validateBasePathName(name string) error {
- if runtime.GOOS != "windows" {
- // Not much to do here;
- // the virtual file paths all look absolute on *nix.
- return nil
- }
-
- // On Windows a common mistake would be to provide an absolute OS path
- // We could strip out the base part, but that would not be very portable.
- if filepath.IsAbs(name) {
- return os.ErrNotExist
- }
-
- return nil
-}
-
-func (b *BasePathFs) Chtimes(name string, atime, mtime time.Time) (err error) {
- if name, err = b.RealPath(name); err != nil {
- return &os.PathError{Op: "chtimes", Path: name, Err: err}
- }
- return b.source.Chtimes(name, atime, mtime)
-}
-
-func (b *BasePathFs) Chmod(name string, mode os.FileMode) (err error) {
- if name, err = b.RealPath(name); err != nil {
- return &os.PathError{Op: "chmod", Path: name, Err: err}
- }
- return b.source.Chmod(name, mode)
-}
-
-func (b *BasePathFs) Chown(name string, uid, gid int) (err error) {
- if name, err = b.RealPath(name); err != nil {
- return &os.PathError{Op: "chown", Path: name, Err: err}
- }
- return b.source.Chown(name, uid, gid)
-}
-
-func (b *BasePathFs) Name() string {
- return "BasePathFs"
-}
-
-func (b *BasePathFs) Stat(name string) (fi os.FileInfo, err error) {
- if name, err = b.RealPath(name); err != nil {
- return nil, &os.PathError{Op: "stat", Path: name, Err: err}
- }
- return b.source.Stat(name)
-}
-
-func (b *BasePathFs) Rename(oldname, newname string) (err error) {
- if oldname, err = b.RealPath(oldname); err != nil {
- return &os.PathError{Op: "rename", Path: oldname, Err: err}
- }
- if newname, err = b.RealPath(newname); err != nil {
- return &os.PathError{Op: "rename", Path: newname, Err: err}
- }
- return b.source.Rename(oldname, newname)
-}
-
-func (b *BasePathFs) RemoveAll(name string) (err error) {
- if name, err = b.RealPath(name); err != nil {
- return &os.PathError{Op: "remove_all", Path: name, Err: err}
- }
- return b.source.RemoveAll(name)
-}
-
-func (b *BasePathFs) Remove(name string) (err error) {
- if name, err = b.RealPath(name); err != nil {
- return &os.PathError{Op: "remove", Path: name, Err: err}
- }
- return b.source.Remove(name)
-}
-
-func (b *BasePathFs) OpenFile(name string, flag int, mode os.FileMode) (f File, err error) {
- if name, err = b.RealPath(name); err != nil {
- return nil, &os.PathError{Op: "openfile", Path: name, Err: err}
- }
- sourcef, err := b.source.OpenFile(name, flag, mode)
- if err != nil {
- return nil, err
- }
- return &BasePathFile{sourcef, b.path}, nil
-}
-
-func (b *BasePathFs) Open(name string) (f File, err error) {
- if name, err = b.RealPath(name); err != nil {
- return nil, &os.PathError{Op: "open", Path: name, Err: err}
- }
- sourcef, err := b.source.Open(name)
- if err != nil {
- return nil, err
- }
- return &BasePathFile{File: sourcef, path: b.path}, nil
-}
-
-func (b *BasePathFs) Mkdir(name string, mode os.FileMode) (err error) {
- if name, err = b.RealPath(name); err != nil {
- return &os.PathError{Op: "mkdir", Path: name, Err: err}
- }
- return b.source.Mkdir(name, mode)
-}
-
-func (b *BasePathFs) MkdirAll(name string, mode os.FileMode) (err error) {
- if name, err = b.RealPath(name); err != nil {
- return &os.PathError{Op: "mkdir", Path: name, Err: err}
- }
- return b.source.MkdirAll(name, mode)
-}
-
-func (b *BasePathFs) Create(name string) (f File, err error) {
- if name, err = b.RealPath(name); err != nil {
- return nil, &os.PathError{Op: "create", Path: name, Err: err}
- }
- sourcef, err := b.source.Create(name)
- if err != nil {
- return nil, err
- }
- return &BasePathFile{File: sourcef, path: b.path}, nil
-}
-
-func (b *BasePathFs) LstatIfPossible(name string) (os.FileInfo, bool, error) {
- name, err := b.RealPath(name)
- if err != nil {
- return nil, false, &os.PathError{Op: "lstat", Path: name, Err: err}
- }
- if lstater, ok := b.source.(Lstater); ok {
- return lstater.LstatIfPossible(name)
- }
- fi, err := b.source.Stat(name)
- return fi, false, err
-}
-
-func (b *BasePathFs) SymlinkIfPossible(oldname, newname string) error {
- oldname, err := b.RealPath(oldname)
- if err != nil {
- return &os.LinkError{Op: "symlink", Old: oldname, New: newname, Err: err}
- }
- newname, err = b.RealPath(newname)
- if err != nil {
- return &os.LinkError{Op: "symlink", Old: oldname, New: newname, Err: err}
- }
- if linker, ok := b.source.(Linker); ok {
- return linker.SymlinkIfPossible(oldname, newname)
- }
- return &os.LinkError{Op: "symlink", Old: oldname, New: newname, Err: ErrNoSymlink}
-}
-
-func (b *BasePathFs) ReadlinkIfPossible(name string) (string, error) {
- name, err := b.RealPath(name)
- if err != nil {
- return "", &os.PathError{Op: "readlink", Path: name, Err: err}
- }
- if reader, ok := b.source.(LinkReader); ok {
- return reader.ReadlinkIfPossible(name)
- }
- return "", &os.PathError{Op: "readlink", Path: name, Err: ErrNoReadlink}
-}
diff --git a/vendor/github.com/spf13/afero/cacheOnReadFs.go b/vendor/github.com/spf13/afero/cacheOnReadFs.go
deleted file mode 100644
index 017d344fd..000000000
--- a/vendor/github.com/spf13/afero/cacheOnReadFs.go
+++ /dev/null
@@ -1,315 +0,0 @@
-package afero
-
-import (
- "os"
- "syscall"
- "time"
-)
-
-// If the cache duration is 0, cache time will be unlimited, i.e. once
-// a file is in the layer, the base will never be read again for this file.
-//
-// For cache times greater than 0, the modification time of a file is
-// checked. Note that a lot of file system implementations only allow a
-// resolution of a second for timestamps... or as the godoc for os.Chtimes()
-// states: "The underlying filesystem may truncate or round the values to a
-// less precise time unit."
-//
-// This caching union will forward all write calls also to the base file
-// system first. To prevent writing to the base Fs, wrap it in a read-only
-// filter - Note: this will also make the overlay read-only, for writing files
-// in the overlay, use the overlay Fs directly, not via the union Fs.
-type CacheOnReadFs struct {
- base Fs
- layer Fs
- cacheTime time.Duration
-}
-
-func NewCacheOnReadFs(base Fs, layer Fs, cacheTime time.Duration) Fs {
- return &CacheOnReadFs{base: base, layer: layer, cacheTime: cacheTime}
-}
-
-type cacheState int
-
-const (
- // not present in the overlay, unknown if it exists in the base:
- cacheMiss cacheState = iota
- // present in the overlay and in base, base file is newer:
- cacheStale
- // present in the overlay - with cache time == 0 it may exist in the base,
- // with cacheTime > 0 it exists in the base and is same age or newer in the
- // overlay
- cacheHit
- // happens if someone writes directly to the overlay without
- // going through this union
- cacheLocal
-)
-
-func (u *CacheOnReadFs) cacheStatus(name string) (state cacheState, fi os.FileInfo, err error) {
- var lfi, bfi os.FileInfo
- lfi, err = u.layer.Stat(name)
- if err == nil {
- if u.cacheTime == 0 {
- return cacheHit, lfi, nil
- }
- if lfi.ModTime().Add(u.cacheTime).Before(time.Now()) {
- bfi, err = u.base.Stat(name)
- if err != nil {
- return cacheLocal, lfi, nil
- }
- if bfi.ModTime().After(lfi.ModTime()) {
- return cacheStale, bfi, nil
- }
- }
- return cacheHit, lfi, nil
- }
-
- if err == syscall.ENOENT || os.IsNotExist(err) {
- return cacheMiss, nil, nil
- }
-
- return cacheMiss, nil, err
-}
-
-func (u *CacheOnReadFs) copyToLayer(name string) error {
- return copyToLayer(u.base, u.layer, name)
-}
-
-func (u *CacheOnReadFs) copyFileToLayer(name string, flag int, perm os.FileMode) error {
- return copyFileToLayer(u.base, u.layer, name, flag, perm)
-}
-
-func (u *CacheOnReadFs) Chtimes(name string, atime, mtime time.Time) error {
- st, _, err := u.cacheStatus(name)
- if err != nil {
- return err
- }
- switch st {
- case cacheLocal:
- case cacheHit:
- err = u.base.Chtimes(name, atime, mtime)
- case cacheStale, cacheMiss:
- if err := u.copyToLayer(name); err != nil {
- return err
- }
- err = u.base.Chtimes(name, atime, mtime)
- }
- if err != nil {
- return err
- }
- return u.layer.Chtimes(name, atime, mtime)
-}
-
-func (u *CacheOnReadFs) Chmod(name string, mode os.FileMode) error {
- st, _, err := u.cacheStatus(name)
- if err != nil {
- return err
- }
- switch st {
- case cacheLocal:
- case cacheHit:
- err = u.base.Chmod(name, mode)
- case cacheStale, cacheMiss:
- if err := u.copyToLayer(name); err != nil {
- return err
- }
- err = u.base.Chmod(name, mode)
- }
- if err != nil {
- return err
- }
- return u.layer.Chmod(name, mode)
-}
-
-func (u *CacheOnReadFs) Chown(name string, uid, gid int) error {
- st, _, err := u.cacheStatus(name)
- if err != nil {
- return err
- }
- switch st {
- case cacheLocal:
- case cacheHit:
- err = u.base.Chown(name, uid, gid)
- case cacheStale, cacheMiss:
- if err := u.copyToLayer(name); err != nil {
- return err
- }
- err = u.base.Chown(name, uid, gid)
- }
- if err != nil {
- return err
- }
- return u.layer.Chown(name, uid, gid)
-}
-
-func (u *CacheOnReadFs) Stat(name string) (os.FileInfo, error) {
- st, fi, err := u.cacheStatus(name)
- if err != nil {
- return nil, err
- }
- switch st {
- case cacheMiss:
- return u.base.Stat(name)
- default: // cacheStale has base, cacheHit and cacheLocal the layer os.FileInfo
- return fi, nil
- }
-}
-
-func (u *CacheOnReadFs) Rename(oldname, newname string) error {
- st, _, err := u.cacheStatus(oldname)
- if err != nil {
- return err
- }
- switch st {
- case cacheLocal:
- case cacheHit:
- err = u.base.Rename(oldname, newname)
- case cacheStale, cacheMiss:
- if err := u.copyToLayer(oldname); err != nil {
- return err
- }
- err = u.base.Rename(oldname, newname)
- }
- if err != nil {
- return err
- }
- return u.layer.Rename(oldname, newname)
-}
-
-func (u *CacheOnReadFs) Remove(name string) error {
- st, _, err := u.cacheStatus(name)
- if err != nil {
- return err
- }
- switch st {
- case cacheLocal:
- case cacheHit, cacheStale, cacheMiss:
- err = u.base.Remove(name)
- }
- if err != nil {
- return err
- }
- return u.layer.Remove(name)
-}
-
-func (u *CacheOnReadFs) RemoveAll(name string) error {
- st, _, err := u.cacheStatus(name)
- if err != nil {
- return err
- }
- switch st {
- case cacheLocal:
- case cacheHit, cacheStale, cacheMiss:
- err = u.base.RemoveAll(name)
- }
- if err != nil {
- return err
- }
- return u.layer.RemoveAll(name)
-}
-
-func (u *CacheOnReadFs) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
- st, _, err := u.cacheStatus(name)
- if err != nil {
- return nil, err
- }
- switch st {
- case cacheLocal, cacheHit:
- default:
- if err := u.copyFileToLayer(name, flag, perm); err != nil {
- return nil, err
- }
- }
- if flag&(os.O_WRONLY|syscall.O_RDWR|os.O_APPEND|os.O_CREATE|os.O_TRUNC) != 0 {
- bfi, err := u.base.OpenFile(name, flag, perm)
- if err != nil {
- return nil, err
- }
- lfi, err := u.layer.OpenFile(name, flag, perm)
- if err != nil {
- bfi.Close() // oops, what if O_TRUNC was set and file opening in the layer failed...?
- return nil, err
- }
- return &UnionFile{Base: bfi, Layer: lfi}, nil
- }
- return u.layer.OpenFile(name, flag, perm)
-}
-
-func (u *CacheOnReadFs) Open(name string) (File, error) {
- st, fi, err := u.cacheStatus(name)
- if err != nil {
- return nil, err
- }
-
- switch st {
- case cacheLocal:
- return u.layer.Open(name)
-
- case cacheMiss:
- bfi, err := u.base.Stat(name)
- if err != nil {
- return nil, err
- }
- if bfi.IsDir() {
- return u.base.Open(name)
- }
- if err := u.copyToLayer(name); err != nil {
- return nil, err
- }
- return u.layer.Open(name)
-
- case cacheStale:
- if !fi.IsDir() {
- if err := u.copyToLayer(name); err != nil {
- return nil, err
- }
- return u.layer.Open(name)
- }
- case cacheHit:
- if !fi.IsDir() {
- return u.layer.Open(name)
- }
- }
- // the dirs from cacheHit, cacheStale fall down here:
- bfile, _ := u.base.Open(name)
- lfile, err := u.layer.Open(name)
- if err != nil && bfile == nil {
- return nil, err
- }
- return &UnionFile{Base: bfile, Layer: lfile}, nil
-}
-
-func (u *CacheOnReadFs) Mkdir(name string, perm os.FileMode) error {
- err := u.base.Mkdir(name, perm)
- if err != nil {
- return err
- }
- return u.layer.MkdirAll(name, perm) // yes, MkdirAll... we cannot assume it exists in the cache
-}
-
-func (u *CacheOnReadFs) Name() string {
- return "CacheOnReadFs"
-}
-
-func (u *CacheOnReadFs) MkdirAll(name string, perm os.FileMode) error {
- err := u.base.MkdirAll(name, perm)
- if err != nil {
- return err
- }
- return u.layer.MkdirAll(name, perm)
-}
-
-func (u *CacheOnReadFs) Create(name string) (File, error) {
- bfh, err := u.base.Create(name)
- if err != nil {
- return nil, err
- }
- lfh, err := u.layer.Create(name)
- if err != nil {
- // oops, see comment about OS_TRUNC above, should we remove? then we have to
- // remember if the file did not exist before
- bfh.Close()
- return nil, err
- }
- return &UnionFile{Base: bfh, Layer: lfh}, nil
-}
diff --git a/vendor/github.com/spf13/afero/const_bsds.go b/vendor/github.com/spf13/afero/const_bsds.go
deleted file mode 100644
index 30855de57..000000000
--- a/vendor/github.com/spf13/afero/const_bsds.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright © 2016 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build aix || darwin || openbsd || freebsd || netbsd || dragonfly || zos
-// +build aix darwin openbsd freebsd netbsd dragonfly zos
-
-package afero
-
-import (
- "syscall"
-)
-
-const BADFD = syscall.EBADF
diff --git a/vendor/github.com/spf13/afero/const_win_unix.go b/vendor/github.com/spf13/afero/const_win_unix.go
deleted file mode 100644
index 12792d21e..000000000
--- a/vendor/github.com/spf13/afero/const_win_unix.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright © 2016 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//go:build !darwin && !openbsd && !freebsd && !dragonfly && !netbsd && !aix && !zos
-// +build !darwin,!openbsd,!freebsd,!dragonfly,!netbsd,!aix,!zos
-
-package afero
-
-import (
- "syscall"
-)
-
-const BADFD = syscall.EBADFD
diff --git a/vendor/github.com/spf13/afero/copyOnWriteFs.go b/vendor/github.com/spf13/afero/copyOnWriteFs.go
deleted file mode 100644
index 184d6dd70..000000000
--- a/vendor/github.com/spf13/afero/copyOnWriteFs.go
+++ /dev/null
@@ -1,327 +0,0 @@
-package afero
-
-import (
- "fmt"
- "os"
- "path/filepath"
- "syscall"
- "time"
-)
-
-var _ Lstater = (*CopyOnWriteFs)(nil)
-
-// The CopyOnWriteFs is a union filesystem: a read only base file system with
-// a possibly writeable layer on top. Changes to the file system will only
-// be made in the overlay: Changing an existing file in the base layer which
-// is not present in the overlay will copy the file to the overlay ("changing"
-// includes also calls to e.g. Chtimes(), Chmod() and Chown()).
-//
-// Reading directories is currently only supported via Open(), not OpenFile().
-type CopyOnWriteFs struct {
- base Fs
- layer Fs
-}
-
-func NewCopyOnWriteFs(base Fs, layer Fs) Fs {
- return &CopyOnWriteFs{base: base, layer: layer}
-}
-
-// Returns true if the file is not in the overlay
-func (u *CopyOnWriteFs) isBaseFile(name string) (bool, error) {
- if _, err := u.layer.Stat(name); err == nil {
- return false, nil
- }
- _, err := u.base.Stat(name)
- if err != nil {
- if oerr, ok := err.(*os.PathError); ok {
- if oerr.Err == os.ErrNotExist || oerr.Err == syscall.ENOENT || oerr.Err == syscall.ENOTDIR {
- return false, nil
- }
- }
- if err == syscall.ENOENT {
- return false, nil
- }
- }
- return true, err
-}
-
-func (u *CopyOnWriteFs) copyToLayer(name string) error {
- return copyToLayer(u.base, u.layer, name)
-}
-
-func (u *CopyOnWriteFs) Chtimes(name string, atime, mtime time.Time) error {
- b, err := u.isBaseFile(name)
- if err != nil {
- return err
- }
- if b {
- if err := u.copyToLayer(name); err != nil {
- return err
- }
- }
- return u.layer.Chtimes(name, atime, mtime)
-}
-
-func (u *CopyOnWriteFs) Chmod(name string, mode os.FileMode) error {
- b, err := u.isBaseFile(name)
- if err != nil {
- return err
- }
- if b {
- if err := u.copyToLayer(name); err != nil {
- return err
- }
- }
- return u.layer.Chmod(name, mode)
-}
-
-func (u *CopyOnWriteFs) Chown(name string, uid, gid int) error {
- b, err := u.isBaseFile(name)
- if err != nil {
- return err
- }
- if b {
- if err := u.copyToLayer(name); err != nil {
- return err
- }
- }
- return u.layer.Chown(name, uid, gid)
-}
-
-func (u *CopyOnWriteFs) Stat(name string) (os.FileInfo, error) {
- fi, err := u.layer.Stat(name)
- if err != nil {
- isNotExist := u.isNotExist(err)
- if isNotExist {
- return u.base.Stat(name)
- }
- return nil, err
- }
- return fi, nil
-}
-
-func (u *CopyOnWriteFs) LstatIfPossible(name string) (os.FileInfo, bool, error) {
- llayer, ok1 := u.layer.(Lstater)
- lbase, ok2 := u.base.(Lstater)
-
- if ok1 {
- fi, b, err := llayer.LstatIfPossible(name)
- if err == nil {
- return fi, b, nil
- }
-
- if !u.isNotExist(err) {
- return nil, b, err
- }
- }
-
- if ok2 {
- fi, b, err := lbase.LstatIfPossible(name)
- if err == nil {
- return fi, b, nil
- }
- if !u.isNotExist(err) {
- return nil, b, err
- }
- }
-
- fi, err := u.Stat(name)
-
- return fi, false, err
-}
-
-func (u *CopyOnWriteFs) SymlinkIfPossible(oldname, newname string) error {
- if slayer, ok := u.layer.(Linker); ok {
- return slayer.SymlinkIfPossible(oldname, newname)
- }
-
- return &os.LinkError{Op: "symlink", Old: oldname, New: newname, Err: ErrNoSymlink}
-}
-
-func (u *CopyOnWriteFs) ReadlinkIfPossible(name string) (string, error) {
- if rlayer, ok := u.layer.(LinkReader); ok {
- return rlayer.ReadlinkIfPossible(name)
- }
-
- if rbase, ok := u.base.(LinkReader); ok {
- return rbase.ReadlinkIfPossible(name)
- }
-
- return "", &os.PathError{Op: "readlink", Path: name, Err: ErrNoReadlink}
-}
-
-func (u *CopyOnWriteFs) isNotExist(err error) bool {
- if e, ok := err.(*os.PathError); ok {
- err = e.Err
- }
- if err == os.ErrNotExist || err == syscall.ENOENT || err == syscall.ENOTDIR {
- return true
- }
- return false
-}
-
-// Renaming files present only in the base layer is not permitted
-func (u *CopyOnWriteFs) Rename(oldname, newname string) error {
- b, err := u.isBaseFile(oldname)
- if err != nil {
- return err
- }
- if b {
- return syscall.EPERM
- }
- return u.layer.Rename(oldname, newname)
-}
-
-// Removing files present only in the base layer is not permitted. If
-// a file is present in the base layer and the overlay, only the overlay
-// will be removed.
-func (u *CopyOnWriteFs) Remove(name string) error {
- err := u.layer.Remove(name)
- switch err {
- case syscall.ENOENT:
- _, err = u.base.Stat(name)
- if err == nil {
- return syscall.EPERM
- }
- return syscall.ENOENT
- default:
- return err
- }
-}
-
-func (u *CopyOnWriteFs) RemoveAll(name string) error {
- err := u.layer.RemoveAll(name)
- switch err {
- case syscall.ENOENT:
- _, err = u.base.Stat(name)
- if err == nil {
- return syscall.EPERM
- }
- return syscall.ENOENT
- default:
- return err
- }
-}
-
-func (u *CopyOnWriteFs) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
- b, err := u.isBaseFile(name)
- if err != nil {
- return nil, err
- }
-
- if flag&(os.O_WRONLY|os.O_RDWR|os.O_APPEND|os.O_CREATE|os.O_TRUNC) != 0 {
- if b {
- if err = u.copyToLayer(name); err != nil {
- return nil, err
- }
- return u.layer.OpenFile(name, flag, perm)
- }
-
- dir := filepath.Dir(name)
- isaDir, err := IsDir(u.base, dir)
- if err != nil && !os.IsNotExist(err) {
- return nil, err
- }
- if isaDir {
- if err = u.layer.MkdirAll(dir, 0o777); err != nil {
- return nil, err
- }
- return u.layer.OpenFile(name, flag, perm)
- }
-
- isaDir, err = IsDir(u.layer, dir)
- if err != nil {
- return nil, err
- }
- if isaDir {
- return u.layer.OpenFile(name, flag, perm)
- }
-
- return nil, &os.PathError{Op: "open", Path: name, Err: syscall.ENOTDIR} // ...or os.ErrNotExist?
- }
- if b {
- return u.base.OpenFile(name, flag, perm)
- }
- return u.layer.OpenFile(name, flag, perm)
-}
-
-// This function handles the 9 different possibilities caused
-// by the union which are the intersection of the following...
-//
-// layer: doesn't exist, exists as a file, and exists as a directory
-// base: doesn't exist, exists as a file, and exists as a directory
-func (u *CopyOnWriteFs) Open(name string) (File, error) {
- // Since the overlay overrides the base we check that first
- b, err := u.isBaseFile(name)
- if err != nil {
- return nil, err
- }
-
- // If overlay doesn't exist, return the base (base state irrelevant)
- if b {
- return u.base.Open(name)
- }
-
- // If overlay is a file, return it (base state irrelevant)
- dir, err := IsDir(u.layer, name)
- if err != nil {
- return nil, err
- }
- if !dir {
- return u.layer.Open(name)
- }
-
- // Overlay is a directory, base state now matters.
- // Base state has 3 states to check but 2 outcomes:
- // A. It's a file or non-readable in the base (return just the overlay)
- // B. It's an accessible directory in the base (return a UnionFile)
-
- // If base is file or nonreadable, return overlay
- dir, err = IsDir(u.base, name)
- if !dir || err != nil {
- return u.layer.Open(name)
- }
-
- // Both base & layer are directories
- // Return union file (if opens are without error)
- bfile, bErr := u.base.Open(name)
- lfile, lErr := u.layer.Open(name)
-
- // If either have errors at this point something is very wrong. Return nil and the errors
- if bErr != nil || lErr != nil {
- return nil, fmt.Errorf("BaseErr: %v\nOverlayErr: %v", bErr, lErr)
- }
-
- return &UnionFile{Base: bfile, Layer: lfile}, nil
-}
-
-func (u *CopyOnWriteFs) Mkdir(name string, perm os.FileMode) error {
- dir, err := IsDir(u.base, name)
- if err != nil {
- return u.layer.MkdirAll(name, perm)
- }
- if dir {
- return ErrFileExists
- }
- return u.layer.MkdirAll(name, perm)
-}
-
-func (u *CopyOnWriteFs) Name() string {
- return "CopyOnWriteFs"
-}
-
-func (u *CopyOnWriteFs) MkdirAll(name string, perm os.FileMode) error {
- dir, err := IsDir(u.base, name)
- if err != nil {
- return u.layer.MkdirAll(name, perm)
- }
- if dir {
- // This is in line with how os.MkdirAll behaves.
- return nil
- }
- return u.layer.MkdirAll(name, perm)
-}
-
-func (u *CopyOnWriteFs) Create(name string) (File, error) {
- return u.OpenFile(name, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0o666)
-}
diff --git a/vendor/github.com/spf13/afero/httpFs.go b/vendor/github.com/spf13/afero/httpFs.go
deleted file mode 100644
index ac0de6d51..000000000
--- a/vendor/github.com/spf13/afero/httpFs.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright © 2014 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "errors"
- "net/http"
- "os"
- "path"
- "path/filepath"
- "strings"
- "time"
-)
-
-type httpDir struct {
- basePath string
- fs HttpFs
-}
-
-func (d httpDir) Open(name string) (http.File, error) {
- if filepath.Separator != '/' && strings.ContainsRune(name, filepath.Separator) ||
- strings.Contains(name, "\x00") {
- return nil, errors.New("http: invalid character in file path")
- }
- dir := string(d.basePath)
- if dir == "" {
- dir = "."
- }
-
- f, err := d.fs.Open(filepath.Join(dir, filepath.FromSlash(path.Clean("/"+name))))
- if err != nil {
- return nil, err
- }
- return f, nil
-}
-
-type HttpFs struct {
- source Fs
-}
-
-func NewHttpFs(source Fs) *HttpFs {
- return &HttpFs{source: source}
-}
-
-func (h HttpFs) Dir(s string) *httpDir {
- return &httpDir{basePath: s, fs: h}
-}
-
-func (h HttpFs) Name() string { return "h HttpFs" }
-
-func (h HttpFs) Create(name string) (File, error) {
- return h.source.Create(name)
-}
-
-func (h HttpFs) Chmod(name string, mode os.FileMode) error {
- return h.source.Chmod(name, mode)
-}
-
-func (h HttpFs) Chown(name string, uid, gid int) error {
- return h.source.Chown(name, uid, gid)
-}
-
-func (h HttpFs) Chtimes(name string, atime time.Time, mtime time.Time) error {
- return h.source.Chtimes(name, atime, mtime)
-}
-
-func (h HttpFs) Mkdir(name string, perm os.FileMode) error {
- return h.source.Mkdir(name, perm)
-}
-
-func (h HttpFs) MkdirAll(path string, perm os.FileMode) error {
- return h.source.MkdirAll(path, perm)
-}
-
-func (h HttpFs) Open(name string) (http.File, error) {
- f, err := h.source.Open(name)
- if err == nil {
- if httpfile, ok := f.(http.File); ok {
- return httpfile, nil
- }
- }
- return nil, err
-}
-
-func (h HttpFs) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
- return h.source.OpenFile(name, flag, perm)
-}
-
-func (h HttpFs) Remove(name string) error {
- return h.source.Remove(name)
-}
-
-func (h HttpFs) RemoveAll(path string) error {
- return h.source.RemoveAll(path)
-}
-
-func (h HttpFs) Rename(oldname, newname string) error {
- return h.source.Rename(oldname, newname)
-}
-
-func (h HttpFs) Stat(name string) (os.FileInfo, error) {
- return h.source.Stat(name)
-}
diff --git a/vendor/github.com/spf13/afero/internal/common/adapters.go b/vendor/github.com/spf13/afero/internal/common/adapters.go
deleted file mode 100644
index 60685caa5..000000000
--- a/vendor/github.com/spf13/afero/internal/common/adapters.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright © 2022 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package common
-
-import "io/fs"
-
-// FileInfoDirEntry provides an adapter from os.FileInfo to fs.DirEntry
-type FileInfoDirEntry struct {
- fs.FileInfo
-}
-
-var _ fs.DirEntry = FileInfoDirEntry{}
-
-func (d FileInfoDirEntry) Type() fs.FileMode { return d.FileInfo.Mode().Type() }
-
-func (d FileInfoDirEntry) Info() (fs.FileInfo, error) { return d.FileInfo, nil }
diff --git a/vendor/github.com/spf13/afero/iofs.go b/vendor/github.com/spf13/afero/iofs.go
deleted file mode 100644
index 938b9316e..000000000
--- a/vendor/github.com/spf13/afero/iofs.go
+++ /dev/null
@@ -1,298 +0,0 @@
-//go:build go1.16
-// +build go1.16
-
-package afero
-
-import (
- "io"
- "io/fs"
- "os"
- "path"
- "sort"
- "time"
-
- "github.com/spf13/afero/internal/common"
-)
-
-// IOFS adopts afero.Fs to stdlib io/fs.FS
-type IOFS struct {
- Fs
-}
-
-func NewIOFS(fs Fs) IOFS {
- return IOFS{Fs: fs}
-}
-
-var (
- _ fs.FS = IOFS{}
- _ fs.GlobFS = IOFS{}
- _ fs.ReadDirFS = IOFS{}
- _ fs.ReadFileFS = IOFS{}
- _ fs.StatFS = IOFS{}
- _ fs.SubFS = IOFS{}
-)
-
-func (iofs IOFS) Open(name string) (fs.File, error) {
- const op = "open"
-
- // by convention for fs.FS implementations we should perform this check
- if !fs.ValidPath(name) {
- return nil, iofs.wrapError(op, name, fs.ErrInvalid)
- }
-
- file, err := iofs.Fs.Open(name)
- if err != nil {
- return nil, iofs.wrapError(op, name, err)
- }
-
- // file should implement fs.ReadDirFile
- if _, ok := file.(fs.ReadDirFile); !ok {
- file = readDirFile{file}
- }
-
- return file, nil
-}
-
-func (iofs IOFS) Glob(pattern string) ([]string, error) {
- const op = "glob"
-
- // afero.Glob does not perform this check but it's required for implementations
- if _, err := path.Match(pattern, ""); err != nil {
- return nil, iofs.wrapError(op, pattern, err)
- }
-
- items, err := Glob(iofs.Fs, pattern)
- if err != nil {
- return nil, iofs.wrapError(op, pattern, err)
- }
-
- return items, nil
-}
-
-func (iofs IOFS) ReadDir(name string) ([]fs.DirEntry, error) {
- f, err := iofs.Fs.Open(name)
- if err != nil {
- return nil, iofs.wrapError("readdir", name, err)
- }
-
- defer f.Close()
-
- if rdf, ok := f.(fs.ReadDirFile); ok {
- items, err := rdf.ReadDir(-1)
- if err != nil {
- return nil, iofs.wrapError("readdir", name, err)
- }
- sort.Slice(items, func(i, j int) bool { return items[i].Name() < items[j].Name() })
- return items, nil
- }
-
- items, err := f.Readdir(-1)
- if err != nil {
- return nil, iofs.wrapError("readdir", name, err)
- }
- sort.Sort(byName(items))
-
- ret := make([]fs.DirEntry, len(items))
- for i := range items {
- ret[i] = common.FileInfoDirEntry{FileInfo: items[i]}
- }
-
- return ret, nil
-}
-
-func (iofs IOFS) ReadFile(name string) ([]byte, error) {
- const op = "readfile"
-
- if !fs.ValidPath(name) {
- return nil, iofs.wrapError(op, name, fs.ErrInvalid)
- }
-
- bytes, err := ReadFile(iofs.Fs, name)
- if err != nil {
- return nil, iofs.wrapError(op, name, err)
- }
-
- return bytes, nil
-}
-
-func (iofs IOFS) Sub(dir string) (fs.FS, error) { return IOFS{NewBasePathFs(iofs.Fs, dir)}, nil }
-
-func (IOFS) wrapError(op, path string, err error) error {
- if _, ok := err.(*fs.PathError); ok {
- return err // don't need to wrap again
- }
-
- return &fs.PathError{
- Op: op,
- Path: path,
- Err: err,
- }
-}
-
-// readDirFile provides adapter from afero.File to fs.ReadDirFile needed for correct Open
-type readDirFile struct {
- File
-}
-
-var _ fs.ReadDirFile = readDirFile{}
-
-func (r readDirFile) ReadDir(n int) ([]fs.DirEntry, error) {
- items, err := r.File.Readdir(n)
- if err != nil {
- return nil, err
- }
-
- ret := make([]fs.DirEntry, len(items))
- for i := range items {
- ret[i] = common.FileInfoDirEntry{FileInfo: items[i]}
- }
-
- return ret, nil
-}
-
-// FromIOFS adopts io/fs.FS to use it as afero.Fs
-// Note that io/fs.FS is read-only so all mutating methods will return fs.PathError with fs.ErrPermission
-// To store modifications you may use afero.CopyOnWriteFs
-type FromIOFS struct {
- fs.FS
-}
-
-var _ Fs = FromIOFS{}
-
-func (f FromIOFS) Create(name string) (File, error) { return nil, notImplemented("create", name) }
-
-func (f FromIOFS) Mkdir(name string, perm os.FileMode) error { return notImplemented("mkdir", name) }
-
-func (f FromIOFS) MkdirAll(path string, perm os.FileMode) error {
- return notImplemented("mkdirall", path)
-}
-
-func (f FromIOFS) Open(name string) (File, error) {
- file, err := f.FS.Open(name)
- if err != nil {
- return nil, err
- }
-
- return fromIOFSFile{File: file, name: name}, nil
-}
-
-func (f FromIOFS) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
- return f.Open(name)
-}
-
-func (f FromIOFS) Remove(name string) error {
- return notImplemented("remove", name)
-}
-
-func (f FromIOFS) RemoveAll(path string) error {
- return notImplemented("removeall", path)
-}
-
-func (f FromIOFS) Rename(oldname, newname string) error {
- return notImplemented("rename", oldname)
-}
-
-func (f FromIOFS) Stat(name string) (os.FileInfo, error) { return fs.Stat(f.FS, name) }
-
-func (f FromIOFS) Name() string { return "fromiofs" }
-
-func (f FromIOFS) Chmod(name string, mode os.FileMode) error {
- return notImplemented("chmod", name)
-}
-
-func (f FromIOFS) Chown(name string, uid, gid int) error {
- return notImplemented("chown", name)
-}
-
-func (f FromIOFS) Chtimes(name string, atime time.Time, mtime time.Time) error {
- return notImplemented("chtimes", name)
-}
-
-type fromIOFSFile struct {
- fs.File
- name string
-}
-
-func (f fromIOFSFile) ReadAt(p []byte, off int64) (n int, err error) {
- readerAt, ok := f.File.(io.ReaderAt)
- if !ok {
- return -1, notImplemented("readat", f.name)
- }
-
- return readerAt.ReadAt(p, off)
-}
-
-func (f fromIOFSFile) Seek(offset int64, whence int) (int64, error) {
- seeker, ok := f.File.(io.Seeker)
- if !ok {
- return -1, notImplemented("seek", f.name)
- }
-
- return seeker.Seek(offset, whence)
-}
-
-func (f fromIOFSFile) Write(p []byte) (n int, err error) {
- return -1, notImplemented("write", f.name)
-}
-
-func (f fromIOFSFile) WriteAt(p []byte, off int64) (n int, err error) {
- return -1, notImplemented("writeat", f.name)
-}
-
-func (f fromIOFSFile) Name() string { return f.name }
-
-func (f fromIOFSFile) Readdir(count int) ([]os.FileInfo, error) {
- rdfile, ok := f.File.(fs.ReadDirFile)
- if !ok {
- return nil, notImplemented("readdir", f.name)
- }
-
- entries, err := rdfile.ReadDir(count)
- if err != nil {
- return nil, err
- }
-
- ret := make([]os.FileInfo, len(entries))
- for i := range entries {
- ret[i], err = entries[i].Info()
-
- if err != nil {
- return nil, err
- }
- }
-
- return ret, nil
-}
-
-func (f fromIOFSFile) Readdirnames(n int) ([]string, error) {
- rdfile, ok := f.File.(fs.ReadDirFile)
- if !ok {
- return nil, notImplemented("readdir", f.name)
- }
-
- entries, err := rdfile.ReadDir(n)
- if err != nil {
- return nil, err
- }
-
- ret := make([]string, len(entries))
- for i := range entries {
- ret[i] = entries[i].Name()
- }
-
- return ret, nil
-}
-
-func (f fromIOFSFile) Sync() error { return nil }
-
-func (f fromIOFSFile) Truncate(size int64) error {
- return notImplemented("truncate", f.name)
-}
-
-func (f fromIOFSFile) WriteString(s string) (ret int, err error) {
- return -1, notImplemented("writestring", f.name)
-}
-
-func notImplemented(op, path string) error {
- return &fs.PathError{Op: op, Path: path, Err: fs.ErrPermission}
-}
diff --git a/vendor/github.com/spf13/afero/ioutil.go b/vendor/github.com/spf13/afero/ioutil.go
deleted file mode 100644
index fa6abe1ee..000000000
--- a/vendor/github.com/spf13/afero/ioutil.go
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright ©2015 The Go Authors
-// Copyright ©2015 Steve Francia
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "bytes"
- "io"
- "os"
- "path/filepath"
- "sort"
- "strconv"
- "strings"
- "sync"
- "time"
-)
-
-// byName implements sort.Interface.
-type byName []os.FileInfo
-
-func (f byName) Len() int { return len(f) }
-func (f byName) Less(i, j int) bool { return f[i].Name() < f[j].Name() }
-func (f byName) Swap(i, j int) { f[i], f[j] = f[j], f[i] }
-
-// ReadDir reads the directory named by dirname and returns
-// a list of sorted directory entries.
-func (a Afero) ReadDir(dirname string) ([]os.FileInfo, error) {
- return ReadDir(a.Fs, dirname)
-}
-
-func ReadDir(fs Fs, dirname string) ([]os.FileInfo, error) {
- f, err := fs.Open(dirname)
- if err != nil {
- return nil, err
- }
- list, err := f.Readdir(-1)
- f.Close()
- if err != nil {
- return nil, err
- }
- sort.Sort(byName(list))
- return list, nil
-}
-
-// ReadFile reads the file named by filename and returns the contents.
-// A successful call returns err == nil, not err == EOF. Because ReadFile
-// reads the whole file, it does not treat an EOF from Read as an error
-// to be reported.
-func (a Afero) ReadFile(filename string) ([]byte, error) {
- return ReadFile(a.Fs, filename)
-}
-
-func ReadFile(fs Fs, filename string) ([]byte, error) {
- f, err := fs.Open(filename)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- // It's a good but not certain bet that FileInfo will tell us exactly how much to
- // read, so let's try it but be prepared for the answer to be wrong.
- var n int64
-
- if fi, err := f.Stat(); err == nil {
- // Don't preallocate a huge buffer, just in case.
- if size := fi.Size(); size < 1e9 {
- n = size
- }
- }
- // As initial capacity for readAll, use n + a little extra in case Size is zero,
- // and to avoid another allocation after Read has filled the buffer. The readAll
- // call will read into its allocated internal buffer cheaply. If the size was
- // wrong, we'll either waste some space off the end or reallocate as needed, but
- // in the overwhelmingly common case we'll get it just right.
- return readAll(f, n+bytes.MinRead)
-}
-
-// readAll reads from r until an error or EOF and returns the data it read
-// from the internal buffer allocated with a specified capacity.
-func readAll(r io.Reader, capacity int64) (b []byte, err error) {
- buf := bytes.NewBuffer(make([]byte, 0, capacity))
- // If the buffer overflows, we will get bytes.ErrTooLarge.
- // Return that as an error. Any other panic remains.
- defer func() {
- e := recover()
- if e == nil {
- return
- }
- if panicErr, ok := e.(error); ok && panicErr == bytes.ErrTooLarge {
- err = panicErr
- } else {
- panic(e)
- }
- }()
- _, err = buf.ReadFrom(r)
- return buf.Bytes(), err
-}
-
-// ReadAll reads from r until an error or EOF and returns the data it read.
-// A successful call returns err == nil, not err == EOF. Because ReadAll is
-// defined to read from src until EOF, it does not treat an EOF from Read
-// as an error to be reported.
-func ReadAll(r io.Reader) ([]byte, error) {
- return readAll(r, bytes.MinRead)
-}
-
-// WriteFile writes data to a file named by filename.
-// If the file does not exist, WriteFile creates it with permissions perm;
-// otherwise WriteFile truncates it before writing.
-func (a Afero) WriteFile(filename string, data []byte, perm os.FileMode) error {
- return WriteFile(a.Fs, filename, data, perm)
-}
-
-func WriteFile(fs Fs, filename string, data []byte, perm os.FileMode) error {
- f, err := fs.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
- if err != nil {
- return err
- }
- n, err := f.Write(data)
- if err == nil && n < len(data) {
- err = io.ErrShortWrite
- }
- if err1 := f.Close(); err == nil {
- err = err1
- }
- return err
-}
-
-// Random number state.
-// We generate random temporary file names so that there's a good
-// chance the file doesn't exist yet - keeps the number of tries in
-// TempFile to a minimum.
-var (
- randNum uint32
- randmu sync.Mutex
-)
-
-func reseed() uint32 {
- return uint32(time.Now().UnixNano() + int64(os.Getpid()))
-}
-
-func nextRandom() string {
- randmu.Lock()
- r := randNum
- if r == 0 {
- r = reseed()
- }
- r = r*1664525 + 1013904223 // constants from Numerical Recipes
- randNum = r
- randmu.Unlock()
- return strconv.Itoa(int(1e9 + r%1e9))[1:]
-}
-
-// TempFile creates a new temporary file in the directory dir,
-// opens the file for reading and writing, and returns the resulting *os.File.
-// The filename is generated by taking pattern and adding a random
-// string to the end. If pattern includes a "*", the random string
-// replaces the last "*".
-// If dir is the empty string, TempFile uses the default directory
-// for temporary files (see os.TempDir).
-// Multiple programs calling TempFile simultaneously
-// will not choose the same file. The caller can use f.Name()
-// to find the pathname of the file. It is the caller's responsibility
-// to remove the file when no longer needed.
-func (a Afero) TempFile(dir, pattern string) (f File, err error) {
- return TempFile(a.Fs, dir, pattern)
-}
-
-func TempFile(fs Fs, dir, pattern string) (f File, err error) {
- if dir == "" {
- dir = os.TempDir()
- }
-
- var prefix, suffix string
- if pos := strings.LastIndex(pattern, "*"); pos != -1 {
- prefix, suffix = pattern[:pos], pattern[pos+1:]
- } else {
- prefix = pattern
- }
-
- nconflict := 0
- for i := 0; i < 10000; i++ {
- name := filepath.Join(dir, prefix+nextRandom()+suffix)
- f, err = fs.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0o600)
- if os.IsExist(err) {
- if nconflict++; nconflict > 10 {
- randmu.Lock()
- randNum = reseed()
- randmu.Unlock()
- }
- continue
- }
- break
- }
- return
-}
-
-// TempDir creates a new temporary directory in the directory dir
-// with a name beginning with prefix and returns the path of the
-// new directory. If dir is the empty string, TempDir uses the
-// default directory for temporary files (see os.TempDir).
-// Multiple programs calling TempDir simultaneously
-// will not choose the same directory. It is the caller's responsibility
-// to remove the directory when no longer needed.
-func (a Afero) TempDir(dir, prefix string) (name string, err error) {
- return TempDir(a.Fs, dir, prefix)
-}
-
-func TempDir(fs Fs, dir, prefix string) (name string, err error) {
- if dir == "" {
- dir = os.TempDir()
- }
-
- nconflict := 0
- for i := 0; i < 10000; i++ {
- try := filepath.Join(dir, prefix+nextRandom())
- err = fs.Mkdir(try, 0o700)
- if os.IsExist(err) {
- if nconflict++; nconflict > 10 {
- randmu.Lock()
- randNum = reseed()
- randmu.Unlock()
- }
- continue
- }
- if err == nil {
- name = try
- }
- break
- }
- return
-}
diff --git a/vendor/github.com/spf13/afero/lstater.go b/vendor/github.com/spf13/afero/lstater.go
deleted file mode 100644
index 89c1bfc0a..000000000
--- a/vendor/github.com/spf13/afero/lstater.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright © 2018 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "os"
-)
-
-// Lstater is an optional interface in Afero. It is only implemented by the
-// filesystems saying so.
-// It will call Lstat if the filesystem iself is, or it delegates to, the os filesystem.
-// Else it will call Stat.
-// In addtion to the FileInfo, it will return a boolean telling whether Lstat was called or not.
-type Lstater interface {
- LstatIfPossible(name string) (os.FileInfo, bool, error)
-}
diff --git a/vendor/github.com/spf13/afero/match.go b/vendor/github.com/spf13/afero/match.go
deleted file mode 100644
index 7db4b7de6..000000000
--- a/vendor/github.com/spf13/afero/match.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright © 2014 Steve Francia .
-// Copyright 2009 The Go Authors. All rights reserved.
-
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "path/filepath"
- "sort"
- "strings"
-)
-
-// Glob returns the names of all files matching pattern or nil
-// if there is no matching file. The syntax of patterns is the same
-// as in Match. The pattern may describe hierarchical names such as
-// /usr/*/bin/ed (assuming the Separator is '/').
-//
-// Glob ignores file system errors such as I/O errors reading directories.
-// The only possible returned error is ErrBadPattern, when pattern
-// is malformed.
-//
-// This was adapted from (http://golang.org/pkg/path/filepath) and uses several
-// built-ins from that package.
-func Glob(fs Fs, pattern string) (matches []string, err error) {
- if !hasMeta(pattern) {
- // Lstat not supported by a ll filesystems.
- if _, err = lstatIfPossible(fs, pattern); err != nil {
- return nil, nil
- }
- return []string{pattern}, nil
- }
-
- dir, file := filepath.Split(pattern)
- switch dir {
- case "":
- dir = "."
- case string(filepath.Separator):
- // nothing
- default:
- dir = dir[0 : len(dir)-1] // chop off trailing separator
- }
-
- if !hasMeta(dir) {
- return glob(fs, dir, file, nil)
- }
-
- var m []string
- m, err = Glob(fs, dir)
- if err != nil {
- return
- }
- for _, d := range m {
- matches, err = glob(fs, d, file, matches)
- if err != nil {
- return
- }
- }
- return
-}
-
-// glob searches for files matching pattern in the directory dir
-// and appends them to matches. If the directory cannot be
-// opened, it returns the existing matches. New matches are
-// added in lexicographical order.
-func glob(fs Fs, dir, pattern string, matches []string) (m []string, e error) {
- m = matches
- fi, err := fs.Stat(dir)
- if err != nil {
- return
- }
- if !fi.IsDir() {
- return
- }
- d, err := fs.Open(dir)
- if err != nil {
- return
- }
- defer d.Close()
-
- names, _ := d.Readdirnames(-1)
- sort.Strings(names)
-
- for _, n := range names {
- matched, err := filepath.Match(pattern, n)
- if err != nil {
- return m, err
- }
- if matched {
- m = append(m, filepath.Join(dir, n))
- }
- }
- return
-}
-
-// hasMeta reports whether path contains any of the magic characters
-// recognized by Match.
-func hasMeta(path string) bool {
- // TODO(niemeyer): Should other magic characters be added here?
- return strings.ContainsAny(path, "*?[")
-}
diff --git a/vendor/github.com/spf13/afero/mem/dir.go b/vendor/github.com/spf13/afero/mem/dir.go
deleted file mode 100644
index e104013f4..000000000
--- a/vendor/github.com/spf13/afero/mem/dir.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright © 2014 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mem
-
-type Dir interface {
- Len() int
- Names() []string
- Files() []*FileData
- Add(*FileData)
- Remove(*FileData)
-}
-
-func RemoveFromMemDir(dir *FileData, f *FileData) {
- dir.memDir.Remove(f)
-}
-
-func AddToMemDir(dir *FileData, f *FileData) {
- dir.memDir.Add(f)
-}
-
-func InitializeDir(d *FileData) {
- if d.memDir == nil {
- d.dir = true
- d.memDir = &DirMap{}
- }
-}
diff --git a/vendor/github.com/spf13/afero/mem/dirmap.go b/vendor/github.com/spf13/afero/mem/dirmap.go
deleted file mode 100644
index 03a57ee5b..000000000
--- a/vendor/github.com/spf13/afero/mem/dirmap.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright © 2015 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mem
-
-import "sort"
-
-type DirMap map[string]*FileData
-
-func (m DirMap) Len() int { return len(m) }
-func (m DirMap) Add(f *FileData) { m[f.name] = f }
-func (m DirMap) Remove(f *FileData) { delete(m, f.name) }
-func (m DirMap) Files() (files []*FileData) {
- for _, f := range m {
- files = append(files, f)
- }
- sort.Sort(filesSorter(files))
- return files
-}
-
-// implement sort.Interface for []*FileData
-type filesSorter []*FileData
-
-func (s filesSorter) Len() int { return len(s) }
-func (s filesSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s filesSorter) Less(i, j int) bool { return s[i].name < s[j].name }
-
-func (m DirMap) Names() (names []string) {
- for x := range m {
- names = append(names, x)
- }
- return names
-}
diff --git a/vendor/github.com/spf13/afero/mem/file.go b/vendor/github.com/spf13/afero/mem/file.go
deleted file mode 100644
index 62fe4498e..000000000
--- a/vendor/github.com/spf13/afero/mem/file.go
+++ /dev/null
@@ -1,359 +0,0 @@
-// Copyright © 2015 Steve Francia .
-// Copyright 2013 tsuru authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package mem
-
-import (
- "bytes"
- "errors"
- "io"
- "io/fs"
- "os"
- "path/filepath"
- "sync"
- "sync/atomic"
- "time"
-
- "github.com/spf13/afero/internal/common"
-)
-
-const FilePathSeparator = string(filepath.Separator)
-
-var _ fs.ReadDirFile = &File{}
-
-type File struct {
- // atomic requires 64-bit alignment for struct field access
- at int64
- readDirCount int64
- closed bool
- readOnly bool
- fileData *FileData
-}
-
-func NewFileHandle(data *FileData) *File {
- return &File{fileData: data}
-}
-
-func NewReadOnlyFileHandle(data *FileData) *File {
- return &File{fileData: data, readOnly: true}
-}
-
-func (f File) Data() *FileData {
- return f.fileData
-}
-
-type FileData struct {
- sync.Mutex
- name string
- data []byte
- memDir Dir
- dir bool
- mode os.FileMode
- modtime time.Time
- uid int
- gid int
-}
-
-func (d *FileData) Name() string {
- d.Lock()
- defer d.Unlock()
- return d.name
-}
-
-func CreateFile(name string) *FileData {
- return &FileData{name: name, mode: os.ModeTemporary, modtime: time.Now()}
-}
-
-func CreateDir(name string) *FileData {
- return &FileData{name: name, memDir: &DirMap{}, dir: true, modtime: time.Now()}
-}
-
-func ChangeFileName(f *FileData, newname string) {
- f.Lock()
- f.name = newname
- f.Unlock()
-}
-
-func SetMode(f *FileData, mode os.FileMode) {
- f.Lock()
- f.mode = mode
- f.Unlock()
-}
-
-func SetModTime(f *FileData, mtime time.Time) {
- f.Lock()
- setModTime(f, mtime)
- f.Unlock()
-}
-
-func setModTime(f *FileData, mtime time.Time) {
- f.modtime = mtime
-}
-
-func SetUID(f *FileData, uid int) {
- f.Lock()
- f.uid = uid
- f.Unlock()
-}
-
-func SetGID(f *FileData, gid int) {
- f.Lock()
- f.gid = gid
- f.Unlock()
-}
-
-func GetFileInfo(f *FileData) *FileInfo {
- return &FileInfo{f}
-}
-
-func (f *File) Open() error {
- atomic.StoreInt64(&f.at, 0)
- atomic.StoreInt64(&f.readDirCount, 0)
- f.fileData.Lock()
- f.closed = false
- f.fileData.Unlock()
- return nil
-}
-
-func (f *File) Close() error {
- f.fileData.Lock()
- f.closed = true
- if !f.readOnly {
- setModTime(f.fileData, time.Now())
- }
- f.fileData.Unlock()
- return nil
-}
-
-func (f *File) Name() string {
- return f.fileData.Name()
-}
-
-func (f *File) Stat() (os.FileInfo, error) {
- return &FileInfo{f.fileData}, nil
-}
-
-func (f *File) Sync() error {
- return nil
-}
-
-func (f *File) Readdir(count int) (res []os.FileInfo, err error) {
- if !f.fileData.dir {
- return nil, &os.PathError{Op: "readdir", Path: f.fileData.name, Err: errors.New("not a dir")}
- }
- var outLength int64
-
- f.fileData.Lock()
- files := f.fileData.memDir.Files()[f.readDirCount:]
- if count > 0 {
- if len(files) < count {
- outLength = int64(len(files))
- } else {
- outLength = int64(count)
- }
- if len(files) == 0 {
- err = io.EOF
- }
- } else {
- outLength = int64(len(files))
- }
- f.readDirCount += outLength
- f.fileData.Unlock()
-
- res = make([]os.FileInfo, outLength)
- for i := range res {
- res[i] = &FileInfo{files[i]}
- }
-
- return res, err
-}
-
-func (f *File) Readdirnames(n int) (names []string, err error) {
- fi, err := f.Readdir(n)
- names = make([]string, len(fi))
- for i, f := range fi {
- _, names[i] = filepath.Split(f.Name())
- }
- return names, err
-}
-
-// Implements fs.ReadDirFile
-func (f *File) ReadDir(n int) ([]fs.DirEntry, error) {
- fi, err := f.Readdir(n)
- if err != nil {
- return nil, err
- }
- di := make([]fs.DirEntry, len(fi))
- for i, f := range fi {
- di[i] = common.FileInfoDirEntry{FileInfo: f}
- }
- return di, nil
-}
-
-func (f *File) Read(b []byte) (n int, err error) {
- f.fileData.Lock()
- defer f.fileData.Unlock()
- if f.closed {
- return 0, ErrFileClosed
- }
- if len(b) > 0 && int(f.at) == len(f.fileData.data) {
- return 0, io.EOF
- }
- if int(f.at) > len(f.fileData.data) {
- return 0, io.ErrUnexpectedEOF
- }
- if len(f.fileData.data)-int(f.at) >= len(b) {
- n = len(b)
- } else {
- n = len(f.fileData.data) - int(f.at)
- }
- copy(b, f.fileData.data[f.at:f.at+int64(n)])
- atomic.AddInt64(&f.at, int64(n))
- return
-}
-
-func (f *File) ReadAt(b []byte, off int64) (n int, err error) {
- prev := atomic.LoadInt64(&f.at)
- atomic.StoreInt64(&f.at, off)
- n, err = f.Read(b)
- atomic.StoreInt64(&f.at, prev)
- return
-}
-
-func (f *File) Truncate(size int64) error {
- if f.closed {
- return ErrFileClosed
- }
- if f.readOnly {
- return &os.PathError{Op: "truncate", Path: f.fileData.name, Err: errors.New("file handle is read only")}
- }
- if size < 0 {
- return ErrOutOfRange
- }
- f.fileData.Lock()
- defer f.fileData.Unlock()
- if size > int64(len(f.fileData.data)) {
- diff := size - int64(len(f.fileData.data))
- f.fileData.data = append(f.fileData.data, bytes.Repeat([]byte{0o0}, int(diff))...)
- } else {
- f.fileData.data = f.fileData.data[0:size]
- }
- setModTime(f.fileData, time.Now())
- return nil
-}
-
-func (f *File) Seek(offset int64, whence int) (int64, error) {
- if f.closed {
- return 0, ErrFileClosed
- }
- switch whence {
- case io.SeekStart:
- atomic.StoreInt64(&f.at, offset)
- case io.SeekCurrent:
- atomic.AddInt64(&f.at, offset)
- case io.SeekEnd:
- atomic.StoreInt64(&f.at, int64(len(f.fileData.data))+offset)
- }
- return f.at, nil
-}
-
-func (f *File) Write(b []byte) (n int, err error) {
- if f.closed {
- return 0, ErrFileClosed
- }
- if f.readOnly {
- return 0, &os.PathError{Op: "write", Path: f.fileData.name, Err: errors.New("file handle is read only")}
- }
- n = len(b)
- cur := atomic.LoadInt64(&f.at)
- f.fileData.Lock()
- defer f.fileData.Unlock()
- diff := cur - int64(len(f.fileData.data))
- var tail []byte
- if n+int(cur) < len(f.fileData.data) {
- tail = f.fileData.data[n+int(cur):]
- }
- if diff > 0 {
- f.fileData.data = append(f.fileData.data, append(bytes.Repeat([]byte{0o0}, int(diff)), b...)...)
- f.fileData.data = append(f.fileData.data, tail...)
- } else {
- f.fileData.data = append(f.fileData.data[:cur], b...)
- f.fileData.data = append(f.fileData.data, tail...)
- }
- setModTime(f.fileData, time.Now())
-
- atomic.AddInt64(&f.at, int64(n))
- return
-}
-
-func (f *File) WriteAt(b []byte, off int64) (n int, err error) {
- atomic.StoreInt64(&f.at, off)
- return f.Write(b)
-}
-
-func (f *File) WriteString(s string) (ret int, err error) {
- return f.Write([]byte(s))
-}
-
-func (f *File) Info() *FileInfo {
- return &FileInfo{f.fileData}
-}
-
-type FileInfo struct {
- *FileData
-}
-
-// Implements os.FileInfo
-func (s *FileInfo) Name() string {
- s.Lock()
- _, name := filepath.Split(s.name)
- s.Unlock()
- return name
-}
-
-func (s *FileInfo) Mode() os.FileMode {
- s.Lock()
- defer s.Unlock()
- return s.mode
-}
-
-func (s *FileInfo) ModTime() time.Time {
- s.Lock()
- defer s.Unlock()
- return s.modtime
-}
-
-func (s *FileInfo) IsDir() bool {
- s.Lock()
- defer s.Unlock()
- return s.dir
-}
-func (s *FileInfo) Sys() interface{} { return nil }
-func (s *FileInfo) Size() int64 {
- if s.IsDir() {
- return int64(42)
- }
- s.Lock()
- defer s.Unlock()
- return int64(len(s.data))
-}
-
-var (
- ErrFileClosed = errors.New("File is closed")
- ErrOutOfRange = errors.New("out of range")
- ErrTooLarge = errors.New("too large")
- ErrFileNotFound = os.ErrNotExist
- ErrFileExists = os.ErrExist
- ErrDestinationExists = os.ErrExist
-)
diff --git a/vendor/github.com/spf13/afero/memmap.go b/vendor/github.com/spf13/afero/memmap.go
deleted file mode 100644
index d6c744e8d..000000000
--- a/vendor/github.com/spf13/afero/memmap.go
+++ /dev/null
@@ -1,465 +0,0 @@
-// Copyright © 2014 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "fmt"
- "io"
-
- "log"
- "os"
- "path/filepath"
-
- "sort"
- "strings"
- "sync"
- "time"
-
- "github.com/spf13/afero/mem"
-)
-
-const chmodBits = os.ModePerm | os.ModeSetuid | os.ModeSetgid | os.ModeSticky // Only a subset of bits are allowed to be changed. Documented under os.Chmod()
-
-type MemMapFs struct {
- mu sync.RWMutex
- data map[string]*mem.FileData
- init sync.Once
-}
-
-func NewMemMapFs() Fs {
- return &MemMapFs{}
-}
-
-func (m *MemMapFs) getData() map[string]*mem.FileData {
- m.init.Do(func() {
- m.data = make(map[string]*mem.FileData)
- // Root should always exist, right?
- // TODO: what about windows?
- root := mem.CreateDir(FilePathSeparator)
- mem.SetMode(root, os.ModeDir|0o755)
- m.data[FilePathSeparator] = root
- })
- return m.data
-}
-
-func (*MemMapFs) Name() string { return "MemMapFS" }
-
-func (m *MemMapFs) Create(name string) (File, error) {
- name = normalizePath(name)
- m.mu.Lock()
- file := mem.CreateFile(name)
- m.getData()[name] = file
- m.registerWithParent(file, 0)
- m.mu.Unlock()
- return mem.NewFileHandle(file), nil
-}
-
-func (m *MemMapFs) unRegisterWithParent(fileName string) error {
- f, err := m.lockfreeOpen(fileName)
- if err != nil {
- return err
- }
- parent := m.findParent(f)
- if parent == nil {
- log.Panic("parent of ", f.Name(), " is nil")
- }
-
- parent.Lock()
- mem.RemoveFromMemDir(parent, f)
- parent.Unlock()
- return nil
-}
-
-func (m *MemMapFs) findParent(f *mem.FileData) *mem.FileData {
- pdir, _ := filepath.Split(f.Name())
- pdir = filepath.Clean(pdir)
- pfile, err := m.lockfreeOpen(pdir)
- if err != nil {
- return nil
- }
- return pfile
-}
-
-func (m *MemMapFs) findDescendants(name string) []*mem.FileData {
- fData := m.getData()
- descendants := make([]*mem.FileData, 0, len(fData))
- for p, dFile := range fData {
- if strings.HasPrefix(p, name+FilePathSeparator) {
- descendants = append(descendants, dFile)
- }
- }
-
- sort.Slice(descendants, func(i, j int) bool {
- cur := len(strings.Split(descendants[i].Name(), FilePathSeparator))
- next := len(strings.Split(descendants[j].Name(), FilePathSeparator))
- return cur < next
- })
-
- return descendants
-}
-
-func (m *MemMapFs) registerWithParent(f *mem.FileData, perm os.FileMode) {
- if f == nil {
- return
- }
- parent := m.findParent(f)
- if parent == nil {
- pdir := filepath.Dir(filepath.Clean(f.Name()))
- err := m.lockfreeMkdir(pdir, perm)
- if err != nil {
- // log.Println("Mkdir error:", err)
- return
- }
- parent, err = m.lockfreeOpen(pdir)
- if err != nil {
- // log.Println("Open after Mkdir error:", err)
- return
- }
- }
-
- parent.Lock()
- mem.InitializeDir(parent)
- mem.AddToMemDir(parent, f)
- parent.Unlock()
-}
-
-func (m *MemMapFs) lockfreeMkdir(name string, perm os.FileMode) error {
- name = normalizePath(name)
- x, ok := m.getData()[name]
- if ok {
- // Only return ErrFileExists if it's a file, not a directory.
- i := mem.FileInfo{FileData: x}
- if !i.IsDir() {
- return ErrFileExists
- }
- } else {
- item := mem.CreateDir(name)
- mem.SetMode(item, os.ModeDir|perm)
- m.getData()[name] = item
- m.registerWithParent(item, perm)
- }
- return nil
-}
-
-func (m *MemMapFs) Mkdir(name string, perm os.FileMode) error {
- perm &= chmodBits
- name = normalizePath(name)
-
- m.mu.RLock()
- _, ok := m.getData()[name]
- m.mu.RUnlock()
- if ok {
- return &os.PathError{Op: "mkdir", Path: name, Err: ErrFileExists}
- }
-
- m.mu.Lock()
- // Dobule check that it doesn't exist.
- if _, ok := m.getData()[name]; ok {
- m.mu.Unlock()
- return &os.PathError{Op: "mkdir", Path: name, Err: ErrFileExists}
- }
- item := mem.CreateDir(name)
- mem.SetMode(item, os.ModeDir|perm)
- m.getData()[name] = item
- m.registerWithParent(item, perm)
- m.mu.Unlock()
-
- return m.setFileMode(name, perm|os.ModeDir)
-}
-
-func (m *MemMapFs) MkdirAll(path string, perm os.FileMode) error {
- err := m.Mkdir(path, perm)
- if err != nil {
- if err.(*os.PathError).Err == ErrFileExists {
- return nil
- }
- return err
- }
- return nil
-}
-
-// Handle some relative paths
-func normalizePath(path string) string {
- path = filepath.Clean(path)
-
- switch path {
- case ".":
- return FilePathSeparator
- case "..":
- return FilePathSeparator
- default:
- return path
- }
-}
-
-func (m *MemMapFs) Open(name string) (File, error) {
- f, err := m.open(name)
- if f != nil {
- return mem.NewReadOnlyFileHandle(f), err
- }
- return nil, err
-}
-
-func (m *MemMapFs) openWrite(name string) (File, error) {
- f, err := m.open(name)
- if f != nil {
- return mem.NewFileHandle(f), err
- }
- return nil, err
-}
-
-func (m *MemMapFs) open(name string) (*mem.FileData, error) {
- name = normalizePath(name)
-
- m.mu.RLock()
- f, ok := m.getData()[name]
- m.mu.RUnlock()
- if !ok {
- return nil, &os.PathError{Op: "open", Path: name, Err: ErrFileNotFound}
- }
- return f, nil
-}
-
-func (m *MemMapFs) lockfreeOpen(name string) (*mem.FileData, error) {
- name = normalizePath(name)
- f, ok := m.getData()[name]
- if ok {
- return f, nil
- } else {
- return nil, ErrFileNotFound
- }
-}
-
-func (m *MemMapFs) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
- perm &= chmodBits
- chmod := false
- file, err := m.openWrite(name)
- if err == nil && (flag&os.O_EXCL > 0) {
- return nil, &os.PathError{Op: "open", Path: name, Err: ErrFileExists}
- }
- if os.IsNotExist(err) && (flag&os.O_CREATE > 0) {
- file, err = m.Create(name)
- chmod = true
- }
- if err != nil {
- return nil, err
- }
- if flag == os.O_RDONLY {
- file = mem.NewReadOnlyFileHandle(file.(*mem.File).Data())
- }
- if flag&os.O_APPEND > 0 {
- _, err = file.Seek(0, io.SeekEnd)
- if err != nil {
- file.Close()
- return nil, err
- }
- }
- if flag&os.O_TRUNC > 0 && flag&(os.O_RDWR|os.O_WRONLY) > 0 {
- err = file.Truncate(0)
- if err != nil {
- file.Close()
- return nil, err
- }
- }
- if chmod {
- return file, m.setFileMode(name, perm)
- }
- return file, nil
-}
-
-func (m *MemMapFs) Remove(name string) error {
- name = normalizePath(name)
-
- m.mu.Lock()
- defer m.mu.Unlock()
-
- if _, ok := m.getData()[name]; ok {
- err := m.unRegisterWithParent(name)
- if err != nil {
- return &os.PathError{Op: "remove", Path: name, Err: err}
- }
- delete(m.getData(), name)
- } else {
- return &os.PathError{Op: "remove", Path: name, Err: os.ErrNotExist}
- }
- return nil
-}
-
-func (m *MemMapFs) RemoveAll(path string) error {
- path = normalizePath(path)
- m.mu.Lock()
- m.unRegisterWithParent(path)
- m.mu.Unlock()
-
- m.mu.RLock()
- defer m.mu.RUnlock()
-
- for p := range m.getData() {
- if p == path || strings.HasPrefix(p, path+FilePathSeparator) {
- m.mu.RUnlock()
- m.mu.Lock()
- delete(m.getData(), p)
- m.mu.Unlock()
- m.mu.RLock()
- }
- }
- return nil
-}
-
-func (m *MemMapFs) Rename(oldname, newname string) error {
- oldname = normalizePath(oldname)
- newname = normalizePath(newname)
-
- if oldname == newname {
- return nil
- }
-
- m.mu.RLock()
- defer m.mu.RUnlock()
- if _, ok := m.getData()[oldname]; ok {
- m.mu.RUnlock()
- m.mu.Lock()
- err := m.unRegisterWithParent(oldname)
- if err != nil {
- return err
- }
-
- fileData := m.getData()[oldname]
- mem.ChangeFileName(fileData, newname)
- m.getData()[newname] = fileData
-
- err = m.renameDescendants(oldname, newname)
- if err != nil {
- return err
- }
-
- delete(m.getData(), oldname)
-
- m.registerWithParent(fileData, 0)
- m.mu.Unlock()
- m.mu.RLock()
- } else {
- return &os.PathError{Op: "rename", Path: oldname, Err: ErrFileNotFound}
- }
- return nil
-}
-
-func (m *MemMapFs) renameDescendants(oldname, newname string) error {
- descendants := m.findDescendants(oldname)
- removes := make([]string, 0, len(descendants))
- for _, desc := range descendants {
- descNewName := strings.Replace(desc.Name(), oldname, newname, 1)
- err := m.unRegisterWithParent(desc.Name())
- if err != nil {
- return err
- }
-
- removes = append(removes, desc.Name())
- mem.ChangeFileName(desc, descNewName)
- m.getData()[descNewName] = desc
-
- m.registerWithParent(desc, 0)
- }
- for _, r := range removes {
- delete(m.getData(), r)
- }
-
- return nil
-}
-
-func (m *MemMapFs) LstatIfPossible(name string) (os.FileInfo, bool, error) {
- fileInfo, err := m.Stat(name)
- return fileInfo, false, err
-}
-
-func (m *MemMapFs) Stat(name string) (os.FileInfo, error) {
- f, err := m.Open(name)
- if err != nil {
- return nil, err
- }
- fi := mem.GetFileInfo(f.(*mem.File).Data())
- return fi, nil
-}
-
-func (m *MemMapFs) Chmod(name string, mode os.FileMode) error {
- mode &= chmodBits
-
- m.mu.RLock()
- f, ok := m.getData()[name]
- m.mu.RUnlock()
- if !ok {
- return &os.PathError{Op: "chmod", Path: name, Err: ErrFileNotFound}
- }
- prevOtherBits := mem.GetFileInfo(f).Mode() & ^chmodBits
-
- mode = prevOtherBits | mode
- return m.setFileMode(name, mode)
-}
-
-func (m *MemMapFs) setFileMode(name string, mode os.FileMode) error {
- name = normalizePath(name)
-
- m.mu.RLock()
- f, ok := m.getData()[name]
- m.mu.RUnlock()
- if !ok {
- return &os.PathError{Op: "chmod", Path: name, Err: ErrFileNotFound}
- }
-
- m.mu.Lock()
- mem.SetMode(f, mode)
- m.mu.Unlock()
-
- return nil
-}
-
-func (m *MemMapFs) Chown(name string, uid, gid int) error {
- name = normalizePath(name)
-
- m.mu.RLock()
- f, ok := m.getData()[name]
- m.mu.RUnlock()
- if !ok {
- return &os.PathError{Op: "chown", Path: name, Err: ErrFileNotFound}
- }
-
- mem.SetUID(f, uid)
- mem.SetGID(f, gid)
-
- return nil
-}
-
-func (m *MemMapFs) Chtimes(name string, atime time.Time, mtime time.Time) error {
- name = normalizePath(name)
-
- m.mu.RLock()
- f, ok := m.getData()[name]
- m.mu.RUnlock()
- if !ok {
- return &os.PathError{Op: "chtimes", Path: name, Err: ErrFileNotFound}
- }
-
- m.mu.Lock()
- mem.SetModTime(f, mtime)
- m.mu.Unlock()
-
- return nil
-}
-
-func (m *MemMapFs) List() {
- for _, x := range m.data {
- y := mem.FileInfo{FileData: x}
- fmt.Println(x.Name(), y.Size())
- }
-}
diff --git a/vendor/github.com/spf13/afero/os.go b/vendor/github.com/spf13/afero/os.go
deleted file mode 100644
index f1366321e..000000000
--- a/vendor/github.com/spf13/afero/os.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright © 2014 Steve Francia .
-// Copyright 2013 tsuru authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "os"
- "time"
-)
-
-var _ Lstater = (*OsFs)(nil)
-
-// OsFs is a Fs implementation that uses functions provided by the os package.
-//
-// For details in any method, check the documentation of the os package
-// (http://golang.org/pkg/os/).
-type OsFs struct{}
-
-func NewOsFs() Fs {
- return &OsFs{}
-}
-
-func (OsFs) Name() string { return "OsFs" }
-
-func (OsFs) Create(name string) (File, error) {
- f, e := os.Create(name)
- if f == nil {
- // while this looks strange, we need to return a bare nil (of type nil) not
- // a nil value of type *os.File or nil won't be nil
- return nil, e
- }
- return f, e
-}
-
-func (OsFs) Mkdir(name string, perm os.FileMode) error {
- return os.Mkdir(name, perm)
-}
-
-func (OsFs) MkdirAll(path string, perm os.FileMode) error {
- return os.MkdirAll(path, perm)
-}
-
-func (OsFs) Open(name string) (File, error) {
- f, e := os.Open(name)
- if f == nil {
- // while this looks strange, we need to return a bare nil (of type nil) not
- // a nil value of type *os.File or nil won't be nil
- return nil, e
- }
- return f, e
-}
-
-func (OsFs) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
- f, e := os.OpenFile(name, flag, perm)
- if f == nil {
- // while this looks strange, we need to return a bare nil (of type nil) not
- // a nil value of type *os.File or nil won't be nil
- return nil, e
- }
- return f, e
-}
-
-func (OsFs) Remove(name string) error {
- return os.Remove(name)
-}
-
-func (OsFs) RemoveAll(path string) error {
- return os.RemoveAll(path)
-}
-
-func (OsFs) Rename(oldname, newname string) error {
- return os.Rename(oldname, newname)
-}
-
-func (OsFs) Stat(name string) (os.FileInfo, error) {
- return os.Stat(name)
-}
-
-func (OsFs) Chmod(name string, mode os.FileMode) error {
- return os.Chmod(name, mode)
-}
-
-func (OsFs) Chown(name string, uid, gid int) error {
- return os.Chown(name, uid, gid)
-}
-
-func (OsFs) Chtimes(name string, atime time.Time, mtime time.Time) error {
- return os.Chtimes(name, atime, mtime)
-}
-
-func (OsFs) LstatIfPossible(name string) (os.FileInfo, bool, error) {
- fi, err := os.Lstat(name)
- return fi, true, err
-}
-
-func (OsFs) SymlinkIfPossible(oldname, newname string) error {
- return os.Symlink(oldname, newname)
-}
-
-func (OsFs) ReadlinkIfPossible(name string) (string, error) {
- return os.Readlink(name)
-}
diff --git a/vendor/github.com/spf13/afero/path.go b/vendor/github.com/spf13/afero/path.go
deleted file mode 100644
index 18f60a0f6..000000000
--- a/vendor/github.com/spf13/afero/path.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright ©2015 The Go Authors
-// Copyright ©2015 Steve Francia
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "os"
- "path/filepath"
- "sort"
-)
-
-// readDirNames reads the directory named by dirname and returns
-// a sorted list of directory entries.
-// adapted from https://golang.org/src/path/filepath/path.go
-func readDirNames(fs Fs, dirname string) ([]string, error) {
- f, err := fs.Open(dirname)
- if err != nil {
- return nil, err
- }
- names, err := f.Readdirnames(-1)
- f.Close()
- if err != nil {
- return nil, err
- }
- sort.Strings(names)
- return names, nil
-}
-
-// walk recursively descends path, calling walkFn
-// adapted from https://golang.org/src/path/filepath/path.go
-func walk(fs Fs, path string, info os.FileInfo, walkFn filepath.WalkFunc) error {
- err := walkFn(path, info, nil)
- if err != nil {
- if info.IsDir() && err == filepath.SkipDir {
- return nil
- }
- return err
- }
-
- if !info.IsDir() {
- return nil
- }
-
- names, err := readDirNames(fs, path)
- if err != nil {
- return walkFn(path, info, err)
- }
-
- for _, name := range names {
- filename := filepath.Join(path, name)
- fileInfo, err := lstatIfPossible(fs, filename)
- if err != nil {
- if err := walkFn(filename, fileInfo, err); err != nil && err != filepath.SkipDir {
- return err
- }
- } else {
- err = walk(fs, filename, fileInfo, walkFn)
- if err != nil {
- if !fileInfo.IsDir() || err != filepath.SkipDir {
- return err
- }
- }
- }
- }
- return nil
-}
-
-// if the filesystem supports it, use Lstat, else use fs.Stat
-func lstatIfPossible(fs Fs, path string) (os.FileInfo, error) {
- if lfs, ok := fs.(Lstater); ok {
- fi, _, err := lfs.LstatIfPossible(path)
- return fi, err
- }
- return fs.Stat(path)
-}
-
-// Walk walks the file tree rooted at root, calling walkFn for each file or
-// directory in the tree, including root. All errors that arise visiting files
-// and directories are filtered by walkFn. The files are walked in lexical
-// order, which makes the output deterministic but means that for very
-// large directories Walk can be inefficient.
-// Walk does not follow symbolic links.
-
-func (a Afero) Walk(root string, walkFn filepath.WalkFunc) error {
- return Walk(a.Fs, root, walkFn)
-}
-
-func Walk(fs Fs, root string, walkFn filepath.WalkFunc) error {
- info, err := lstatIfPossible(fs, root)
- if err != nil {
- return walkFn(root, nil, err)
- }
- return walk(fs, root, info, walkFn)
-}
diff --git a/vendor/github.com/spf13/afero/readonlyfs.go b/vendor/github.com/spf13/afero/readonlyfs.go
deleted file mode 100644
index bd8f9264d..000000000
--- a/vendor/github.com/spf13/afero/readonlyfs.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package afero
-
-import (
- "os"
- "syscall"
- "time"
-)
-
-var _ Lstater = (*ReadOnlyFs)(nil)
-
-type ReadOnlyFs struct {
- source Fs
-}
-
-func NewReadOnlyFs(source Fs) Fs {
- return &ReadOnlyFs{source: source}
-}
-
-func (r *ReadOnlyFs) ReadDir(name string) ([]os.FileInfo, error) {
- return ReadDir(r.source, name)
-}
-
-func (r *ReadOnlyFs) Chtimes(n string, a, m time.Time) error {
- return syscall.EPERM
-}
-
-func (r *ReadOnlyFs) Chmod(n string, m os.FileMode) error {
- return syscall.EPERM
-}
-
-func (r *ReadOnlyFs) Chown(n string, uid, gid int) error {
- return syscall.EPERM
-}
-
-func (r *ReadOnlyFs) Name() string {
- return "ReadOnlyFilter"
-}
-
-func (r *ReadOnlyFs) Stat(name string) (os.FileInfo, error) {
- return r.source.Stat(name)
-}
-
-func (r *ReadOnlyFs) LstatIfPossible(name string) (os.FileInfo, bool, error) {
- if lsf, ok := r.source.(Lstater); ok {
- return lsf.LstatIfPossible(name)
- }
- fi, err := r.Stat(name)
- return fi, false, err
-}
-
-func (r *ReadOnlyFs) SymlinkIfPossible(oldname, newname string) error {
- return &os.LinkError{Op: "symlink", Old: oldname, New: newname, Err: ErrNoSymlink}
-}
-
-func (r *ReadOnlyFs) ReadlinkIfPossible(name string) (string, error) {
- if srdr, ok := r.source.(LinkReader); ok {
- return srdr.ReadlinkIfPossible(name)
- }
-
- return "", &os.PathError{Op: "readlink", Path: name, Err: ErrNoReadlink}
-}
-
-func (r *ReadOnlyFs) Rename(o, n string) error {
- return syscall.EPERM
-}
-
-func (r *ReadOnlyFs) RemoveAll(p string) error {
- return syscall.EPERM
-}
-
-func (r *ReadOnlyFs) Remove(n string) error {
- return syscall.EPERM
-}
-
-func (r *ReadOnlyFs) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
- if flag&(os.O_WRONLY|syscall.O_RDWR|os.O_APPEND|os.O_CREATE|os.O_TRUNC) != 0 {
- return nil, syscall.EPERM
- }
- return r.source.OpenFile(name, flag, perm)
-}
-
-func (r *ReadOnlyFs) Open(n string) (File, error) {
- return r.source.Open(n)
-}
-
-func (r *ReadOnlyFs) Mkdir(n string, p os.FileMode) error {
- return syscall.EPERM
-}
-
-func (r *ReadOnlyFs) MkdirAll(n string, p os.FileMode) error {
- return syscall.EPERM
-}
-
-func (r *ReadOnlyFs) Create(n string) (File, error) {
- return nil, syscall.EPERM
-}
diff --git a/vendor/github.com/spf13/afero/regexpfs.go b/vendor/github.com/spf13/afero/regexpfs.go
deleted file mode 100644
index 218f3b235..000000000
--- a/vendor/github.com/spf13/afero/regexpfs.go
+++ /dev/null
@@ -1,223 +0,0 @@
-package afero
-
-import (
- "os"
- "regexp"
- "syscall"
- "time"
-)
-
-// The RegexpFs filters files (not directories) by regular expression. Only
-// files matching the given regexp will be allowed, all others get a ENOENT error (
-// "No such file or directory").
-type RegexpFs struct {
- re *regexp.Regexp
- source Fs
-}
-
-func NewRegexpFs(source Fs, re *regexp.Regexp) Fs {
- return &RegexpFs{source: source, re: re}
-}
-
-type RegexpFile struct {
- f File
- re *regexp.Regexp
-}
-
-func (r *RegexpFs) matchesName(name string) error {
- if r.re == nil {
- return nil
- }
- if r.re.MatchString(name) {
- return nil
- }
- return syscall.ENOENT
-}
-
-func (r *RegexpFs) dirOrMatches(name string) error {
- dir, err := IsDir(r.source, name)
- if err != nil {
- return err
- }
- if dir {
- return nil
- }
- return r.matchesName(name)
-}
-
-func (r *RegexpFs) Chtimes(name string, a, m time.Time) error {
- if err := r.dirOrMatches(name); err != nil {
- return err
- }
- return r.source.Chtimes(name, a, m)
-}
-
-func (r *RegexpFs) Chmod(name string, mode os.FileMode) error {
- if err := r.dirOrMatches(name); err != nil {
- return err
- }
- return r.source.Chmod(name, mode)
-}
-
-func (r *RegexpFs) Chown(name string, uid, gid int) error {
- if err := r.dirOrMatches(name); err != nil {
- return err
- }
- return r.source.Chown(name, uid, gid)
-}
-
-func (r *RegexpFs) Name() string {
- return "RegexpFs"
-}
-
-func (r *RegexpFs) Stat(name string) (os.FileInfo, error) {
- if err := r.dirOrMatches(name); err != nil {
- return nil, err
- }
- return r.source.Stat(name)
-}
-
-func (r *RegexpFs) Rename(oldname, newname string) error {
- dir, err := IsDir(r.source, oldname)
- if err != nil {
- return err
- }
- if dir {
- return nil
- }
- if err := r.matchesName(oldname); err != nil {
- return err
- }
- if err := r.matchesName(newname); err != nil {
- return err
- }
- return r.source.Rename(oldname, newname)
-}
-
-func (r *RegexpFs) RemoveAll(p string) error {
- dir, err := IsDir(r.source, p)
- if err != nil {
- return err
- }
- if !dir {
- if err := r.matchesName(p); err != nil {
- return err
- }
- }
- return r.source.RemoveAll(p)
-}
-
-func (r *RegexpFs) Remove(name string) error {
- if err := r.dirOrMatches(name); err != nil {
- return err
- }
- return r.source.Remove(name)
-}
-
-func (r *RegexpFs) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
- if err := r.dirOrMatches(name); err != nil {
- return nil, err
- }
- return r.source.OpenFile(name, flag, perm)
-}
-
-func (r *RegexpFs) Open(name string) (File, error) {
- dir, err := IsDir(r.source, name)
- if err != nil {
- return nil, err
- }
- if !dir {
- if err := r.matchesName(name); err != nil {
- return nil, err
- }
- }
- f, err := r.source.Open(name)
- if err != nil {
- return nil, err
- }
- return &RegexpFile{f: f, re: r.re}, nil
-}
-
-func (r *RegexpFs) Mkdir(n string, p os.FileMode) error {
- return r.source.Mkdir(n, p)
-}
-
-func (r *RegexpFs) MkdirAll(n string, p os.FileMode) error {
- return r.source.MkdirAll(n, p)
-}
-
-func (r *RegexpFs) Create(name string) (File, error) {
- if err := r.matchesName(name); err != nil {
- return nil, err
- }
- return r.source.Create(name)
-}
-
-func (f *RegexpFile) Close() error {
- return f.f.Close()
-}
-
-func (f *RegexpFile) Read(s []byte) (int, error) {
- return f.f.Read(s)
-}
-
-func (f *RegexpFile) ReadAt(s []byte, o int64) (int, error) {
- return f.f.ReadAt(s, o)
-}
-
-func (f *RegexpFile) Seek(o int64, w int) (int64, error) {
- return f.f.Seek(o, w)
-}
-
-func (f *RegexpFile) Write(s []byte) (int, error) {
- return f.f.Write(s)
-}
-
-func (f *RegexpFile) WriteAt(s []byte, o int64) (int, error) {
- return f.f.WriteAt(s, o)
-}
-
-func (f *RegexpFile) Name() string {
- return f.f.Name()
-}
-
-func (f *RegexpFile) Readdir(c int) (fi []os.FileInfo, err error) {
- var rfi []os.FileInfo
- rfi, err = f.f.Readdir(c)
- if err != nil {
- return nil, err
- }
- for _, i := range rfi {
- if i.IsDir() || f.re.MatchString(i.Name()) {
- fi = append(fi, i)
- }
- }
- return fi, nil
-}
-
-func (f *RegexpFile) Readdirnames(c int) (n []string, err error) {
- fi, err := f.Readdir(c)
- if err != nil {
- return nil, err
- }
- for _, s := range fi {
- n = append(n, s.Name())
- }
- return n, nil
-}
-
-func (f *RegexpFile) Stat() (os.FileInfo, error) {
- return f.f.Stat()
-}
-
-func (f *RegexpFile) Sync() error {
- return f.f.Sync()
-}
-
-func (f *RegexpFile) Truncate(s int64) error {
- return f.f.Truncate(s)
-}
-
-func (f *RegexpFile) WriteString(s string) (int, error) {
- return f.f.WriteString(s)
-}
diff --git a/vendor/github.com/spf13/afero/symlink.go b/vendor/github.com/spf13/afero/symlink.go
deleted file mode 100644
index aa6ae125b..000000000
--- a/vendor/github.com/spf13/afero/symlink.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright © 2018 Steve Francia .
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "errors"
-)
-
-// Symlinker is an optional interface in Afero. It is only implemented by the
-// filesystems saying so.
-// It indicates support for 3 symlink related interfaces that implement the
-// behaviors of the os methods:
-// - Lstat
-// - Symlink, and
-// - Readlink
-type Symlinker interface {
- Lstater
- Linker
- LinkReader
-}
-
-// Linker is an optional interface in Afero. It is only implemented by the
-// filesystems saying so.
-// It will call Symlink if the filesystem itself is, or it delegates to, the os filesystem,
-// or the filesystem otherwise supports Symlink's.
-type Linker interface {
- SymlinkIfPossible(oldname, newname string) error
-}
-
-// ErrNoSymlink is the error that will be wrapped in an os.LinkError if a file system
-// does not support Symlink's either directly or through its delegated filesystem.
-// As expressed by support for the Linker interface.
-var ErrNoSymlink = errors.New("symlink not supported")
-
-// LinkReader is an optional interface in Afero. It is only implemented by the
-// filesystems saying so.
-type LinkReader interface {
- ReadlinkIfPossible(name string) (string, error)
-}
-
-// ErrNoReadlink is the error that will be wrapped in an os.Path if a file system
-// does not support the readlink operation either directly or through its delegated filesystem.
-// As expressed by support for the LinkReader interface.
-var ErrNoReadlink = errors.New("readlink not supported")
diff --git a/vendor/github.com/spf13/afero/unionFile.go b/vendor/github.com/spf13/afero/unionFile.go
deleted file mode 100644
index 62dd6c93c..000000000
--- a/vendor/github.com/spf13/afero/unionFile.go
+++ /dev/null
@@ -1,330 +0,0 @@
-package afero
-
-import (
- "io"
- "os"
- "path/filepath"
- "syscall"
-)
-
-// The UnionFile implements the afero.File interface and will be returned
-// when reading a directory present at least in the overlay or opening a file
-// for writing.
-//
-// The calls to
-// Readdir() and Readdirnames() merge the file os.FileInfo / names from the
-// base and the overlay - for files present in both layers, only those
-// from the overlay will be used.
-//
-// When opening files for writing (Create() / OpenFile() with the right flags)
-// the operations will be done in both layers, starting with the overlay. A
-// successful read in the overlay will move the cursor position in the base layer
-// by the number of bytes read.
-type UnionFile struct {
- Base File
- Layer File
- Merger DirsMerger
- off int
- files []os.FileInfo
-}
-
-func (f *UnionFile) Close() error {
- // first close base, so we have a newer timestamp in the overlay. If we'd close
- // the overlay first, we'd get a cacheStale the next time we access this file
- // -> cache would be useless ;-)
- if f.Base != nil {
- f.Base.Close()
- }
- if f.Layer != nil {
- return f.Layer.Close()
- }
- return BADFD
-}
-
-func (f *UnionFile) Read(s []byte) (int, error) {
- if f.Layer != nil {
- n, err := f.Layer.Read(s)
- if (err == nil || err == io.EOF) && f.Base != nil {
- // advance the file position also in the base file, the next
- // call may be a write at this position (or a seek with SEEK_CUR)
- if _, seekErr := f.Base.Seek(int64(n), io.SeekCurrent); seekErr != nil {
- // only overwrite err in case the seek fails: we need to
- // report an eventual io.EOF to the caller
- err = seekErr
- }
- }
- return n, err
- }
- if f.Base != nil {
- return f.Base.Read(s)
- }
- return 0, BADFD
-}
-
-func (f *UnionFile) ReadAt(s []byte, o int64) (int, error) {
- if f.Layer != nil {
- n, err := f.Layer.ReadAt(s, o)
- if (err == nil || err == io.EOF) && f.Base != nil {
- _, err = f.Base.Seek(o+int64(n), io.SeekStart)
- }
- return n, err
- }
- if f.Base != nil {
- return f.Base.ReadAt(s, o)
- }
- return 0, BADFD
-}
-
-func (f *UnionFile) Seek(o int64, w int) (pos int64, err error) {
- if f.Layer != nil {
- pos, err = f.Layer.Seek(o, w)
- if (err == nil || err == io.EOF) && f.Base != nil {
- _, err = f.Base.Seek(o, w)
- }
- return pos, err
- }
- if f.Base != nil {
- return f.Base.Seek(o, w)
- }
- return 0, BADFD
-}
-
-func (f *UnionFile) Write(s []byte) (n int, err error) {
- if f.Layer != nil {
- n, err = f.Layer.Write(s)
- if err == nil && f.Base != nil { // hmm, do we have fixed size files where a write may hit the EOF mark?
- _, err = f.Base.Write(s)
- }
- return n, err
- }
- if f.Base != nil {
- return f.Base.Write(s)
- }
- return 0, BADFD
-}
-
-func (f *UnionFile) WriteAt(s []byte, o int64) (n int, err error) {
- if f.Layer != nil {
- n, err = f.Layer.WriteAt(s, o)
- if err == nil && f.Base != nil {
- _, err = f.Base.WriteAt(s, o)
- }
- return n, err
- }
- if f.Base != nil {
- return f.Base.WriteAt(s, o)
- }
- return 0, BADFD
-}
-
-func (f *UnionFile) Name() string {
- if f.Layer != nil {
- return f.Layer.Name()
- }
- return f.Base.Name()
-}
-
-// DirsMerger is how UnionFile weaves two directories together.
-// It takes the FileInfo slices from the layer and the base and returns a
-// single view.
-type DirsMerger func(lofi, bofi []os.FileInfo) ([]os.FileInfo, error)
-
-var defaultUnionMergeDirsFn = func(lofi, bofi []os.FileInfo) ([]os.FileInfo, error) {
- files := make(map[string]os.FileInfo)
-
- for _, fi := range lofi {
- files[fi.Name()] = fi
- }
-
- for _, fi := range bofi {
- if _, exists := files[fi.Name()]; !exists {
- files[fi.Name()] = fi
- }
- }
-
- rfi := make([]os.FileInfo, len(files))
-
- i := 0
- for _, fi := range files {
- rfi[i] = fi
- i++
- }
-
- return rfi, nil
-}
-
-// Readdir will weave the two directories together and
-// return a single view of the overlayed directories.
-// At the end of the directory view, the error is io.EOF if c > 0.
-func (f *UnionFile) Readdir(c int) (ofi []os.FileInfo, err error) {
- var merge DirsMerger = f.Merger
- if merge == nil {
- merge = defaultUnionMergeDirsFn
- }
-
- if f.off == 0 {
- var lfi []os.FileInfo
- if f.Layer != nil {
- lfi, err = f.Layer.Readdir(-1)
- if err != nil {
- return nil, err
- }
- }
-
- var bfi []os.FileInfo
- if f.Base != nil {
- bfi, err = f.Base.Readdir(-1)
- if err != nil {
- return nil, err
- }
-
- }
- merged, err := merge(lfi, bfi)
- if err != nil {
- return nil, err
- }
- f.files = append(f.files, merged...)
- }
- files := f.files[f.off:]
-
- if c <= 0 {
- return files, nil
- }
-
- if len(files) == 0 {
- return nil, io.EOF
- }
-
- if c > len(files) {
- c = len(files)
- }
-
- defer func() { f.off += c }()
- return files[:c], nil
-}
-
-func (f *UnionFile) Readdirnames(c int) ([]string, error) {
- rfi, err := f.Readdir(c)
- if err != nil {
- return nil, err
- }
- var names []string
- for _, fi := range rfi {
- names = append(names, fi.Name())
- }
- return names, nil
-}
-
-func (f *UnionFile) Stat() (os.FileInfo, error) {
- if f.Layer != nil {
- return f.Layer.Stat()
- }
- if f.Base != nil {
- return f.Base.Stat()
- }
- return nil, BADFD
-}
-
-func (f *UnionFile) Sync() (err error) {
- if f.Layer != nil {
- err = f.Layer.Sync()
- if err == nil && f.Base != nil {
- err = f.Base.Sync()
- }
- return err
- }
- if f.Base != nil {
- return f.Base.Sync()
- }
- return BADFD
-}
-
-func (f *UnionFile) Truncate(s int64) (err error) {
- if f.Layer != nil {
- err = f.Layer.Truncate(s)
- if err == nil && f.Base != nil {
- err = f.Base.Truncate(s)
- }
- return err
- }
- if f.Base != nil {
- return f.Base.Truncate(s)
- }
- return BADFD
-}
-
-func (f *UnionFile) WriteString(s string) (n int, err error) {
- if f.Layer != nil {
- n, err = f.Layer.WriteString(s)
- if err == nil && f.Base != nil {
- _, err = f.Base.WriteString(s)
- }
- return n, err
- }
- if f.Base != nil {
- return f.Base.WriteString(s)
- }
- return 0, BADFD
-}
-
-func copyFile(base Fs, layer Fs, name string, bfh File) error {
- // First make sure the directory exists
- exists, err := Exists(layer, filepath.Dir(name))
- if err != nil {
- return err
- }
- if !exists {
- err = layer.MkdirAll(filepath.Dir(name), 0o777) // FIXME?
- if err != nil {
- return err
- }
- }
-
- // Create the file on the overlay
- lfh, err := layer.Create(name)
- if err != nil {
- return err
- }
- n, err := io.Copy(lfh, bfh)
- if err != nil {
- // If anything fails, clean up the file
- layer.Remove(name)
- lfh.Close()
- return err
- }
-
- bfi, err := bfh.Stat()
- if err != nil || bfi.Size() != n {
- layer.Remove(name)
- lfh.Close()
- return syscall.EIO
- }
-
- err = lfh.Close()
- if err != nil {
- layer.Remove(name)
- lfh.Close()
- return err
- }
- return layer.Chtimes(name, bfi.ModTime(), bfi.ModTime())
-}
-
-func copyToLayer(base Fs, layer Fs, name string) error {
- bfh, err := base.Open(name)
- if err != nil {
- return err
- }
- defer bfh.Close()
-
- return copyFile(base, layer, name, bfh)
-}
-
-func copyFileToLayer(base Fs, layer Fs, name string, flag int, perm os.FileMode) error {
- bfh, err := base.OpenFile(name, flag, perm)
- if err != nil {
- return err
- }
- defer bfh.Close()
-
- return copyFile(base, layer, name, bfh)
-}
diff --git a/vendor/github.com/spf13/afero/util.go b/vendor/github.com/spf13/afero/util.go
deleted file mode 100644
index 9e4cba274..000000000
--- a/vendor/github.com/spf13/afero/util.go
+++ /dev/null
@@ -1,329 +0,0 @@
-// Copyright ©2015 Steve Francia
-// Portions Copyright ©2015 The Hugo Authors
-// Portions Copyright 2016-present Bjørn Erik Pedersen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package afero
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "strings"
- "unicode"
-
- "golang.org/x/text/runes"
- "golang.org/x/text/transform"
- "golang.org/x/text/unicode/norm"
-)
-
-// Filepath separator defined by os.Separator.
-const FilePathSeparator = string(filepath.Separator)
-
-// Takes a reader and a path and writes the content
-func (a Afero) WriteReader(path string, r io.Reader) (err error) {
- return WriteReader(a.Fs, path, r)
-}
-
-func WriteReader(fs Fs, path string, r io.Reader) (err error) {
- dir, _ := filepath.Split(path)
- ospath := filepath.FromSlash(dir)
-
- if ospath != "" {
- err = fs.MkdirAll(ospath, 0o777) // rwx, rw, r
- if err != nil {
- if err != os.ErrExist {
- return err
- }
- }
- }
-
- file, err := fs.Create(path)
- if err != nil {
- return
- }
- defer file.Close()
-
- _, err = io.Copy(file, r)
- return
-}
-
-// Same as WriteReader but checks to see if file/directory already exists.
-func (a Afero) SafeWriteReader(path string, r io.Reader) (err error) {
- return SafeWriteReader(a.Fs, path, r)
-}
-
-func SafeWriteReader(fs Fs, path string, r io.Reader) (err error) {
- dir, _ := filepath.Split(path)
- ospath := filepath.FromSlash(dir)
-
- if ospath != "" {
- err = fs.MkdirAll(ospath, 0o777) // rwx, rw, r
- if err != nil {
- return
- }
- }
-
- exists, err := Exists(fs, path)
- if err != nil {
- return
- }
- if exists {
- return fmt.Errorf("%v already exists", path)
- }
-
- file, err := fs.Create(path)
- if err != nil {
- return
- }
- defer file.Close()
-
- _, err = io.Copy(file, r)
- return
-}
-
-func (a Afero) GetTempDir(subPath string) string {
- return GetTempDir(a.Fs, subPath)
-}
-
-// GetTempDir returns the default temp directory with trailing slash
-// if subPath is not empty then it will be created recursively with mode 777 rwx rwx rwx
-func GetTempDir(fs Fs, subPath string) string {
- addSlash := func(p string) string {
- if FilePathSeparator != p[len(p)-1:] {
- p = p + FilePathSeparator
- }
- return p
- }
- dir := addSlash(os.TempDir())
-
- if subPath != "" {
- // preserve windows backslash :-(
- if FilePathSeparator == "\\" {
- subPath = strings.Replace(subPath, "\\", "____", -1)
- }
- dir = dir + UnicodeSanitize((subPath))
- if FilePathSeparator == "\\" {
- dir = strings.Replace(dir, "____", "\\", -1)
- }
-
- if exists, _ := Exists(fs, dir); exists {
- return addSlash(dir)
- }
-
- err := fs.MkdirAll(dir, 0o777)
- if err != nil {
- panic(err)
- }
- dir = addSlash(dir)
- }
- return dir
-}
-
-// Rewrite string to remove non-standard path characters
-func UnicodeSanitize(s string) string {
- source := []rune(s)
- target := make([]rune, 0, len(source))
-
- for _, r := range source {
- if unicode.IsLetter(r) ||
- unicode.IsDigit(r) ||
- unicode.IsMark(r) ||
- r == '.' ||
- r == '/' ||
- r == '\\' ||
- r == '_' ||
- r == '-' ||
- r == '%' ||
- r == ' ' ||
- r == '#' {
- target = append(target, r)
- }
- }
-
- return string(target)
-}
-
-// Transform characters with accents into plain forms.
-func NeuterAccents(s string) string {
- t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC)
- result, _, _ := transform.String(t, string(s))
-
- return result
-}
-
-func (a Afero) FileContainsBytes(filename string, subslice []byte) (bool, error) {
- return FileContainsBytes(a.Fs, filename, subslice)
-}
-
-// Check if a file contains a specified byte slice.
-func FileContainsBytes(fs Fs, filename string, subslice []byte) (bool, error) {
- f, err := fs.Open(filename)
- if err != nil {
- return false, err
- }
- defer f.Close()
-
- return readerContainsAny(f, subslice), nil
-}
-
-func (a Afero) FileContainsAnyBytes(filename string, subslices [][]byte) (bool, error) {
- return FileContainsAnyBytes(a.Fs, filename, subslices)
-}
-
-// Check if a file contains any of the specified byte slices.
-func FileContainsAnyBytes(fs Fs, filename string, subslices [][]byte) (bool, error) {
- f, err := fs.Open(filename)
- if err != nil {
- return false, err
- }
- defer f.Close()
-
- return readerContainsAny(f, subslices...), nil
-}
-
-// readerContains reports whether any of the subslices is within r.
-func readerContainsAny(r io.Reader, subslices ...[]byte) bool {
- if r == nil || len(subslices) == 0 {
- return false
- }
-
- largestSlice := 0
-
- for _, sl := range subslices {
- if len(sl) > largestSlice {
- largestSlice = len(sl)
- }
- }
-
- if largestSlice == 0 {
- return false
- }
-
- bufflen := largestSlice * 4
- halflen := bufflen / 2
- buff := make([]byte, bufflen)
- var err error
- var n, i int
-
- for {
- i++
- if i == 1 {
- n, err = io.ReadAtLeast(r, buff[:halflen], halflen)
- } else {
- if i != 2 {
- // shift left to catch overlapping matches
- copy(buff[:], buff[halflen:])
- }
- n, err = io.ReadAtLeast(r, buff[halflen:], halflen)
- }
-
- if n > 0 {
- for _, sl := range subslices {
- if bytes.Contains(buff, sl) {
- return true
- }
- }
- }
-
- if err != nil {
- break
- }
- }
- return false
-}
-
-func (a Afero) DirExists(path string) (bool, error) {
- return DirExists(a.Fs, path)
-}
-
-// DirExists checks if a path exists and is a directory.
-func DirExists(fs Fs, path string) (bool, error) {
- fi, err := fs.Stat(path)
- if err == nil && fi.IsDir() {
- return true, nil
- }
- if os.IsNotExist(err) {
- return false, nil
- }
- return false, err
-}
-
-func (a Afero) IsDir(path string) (bool, error) {
- return IsDir(a.Fs, path)
-}
-
-// IsDir checks if a given path is a directory.
-func IsDir(fs Fs, path string) (bool, error) {
- fi, err := fs.Stat(path)
- if err != nil {
- return false, err
- }
- return fi.IsDir(), nil
-}
-
-func (a Afero) IsEmpty(path string) (bool, error) {
- return IsEmpty(a.Fs, path)
-}
-
-// IsEmpty checks if a given file or directory is empty.
-func IsEmpty(fs Fs, path string) (bool, error) {
- if b, _ := Exists(fs, path); !b {
- return false, fmt.Errorf("%q path does not exist", path)
- }
- fi, err := fs.Stat(path)
- if err != nil {
- return false, err
- }
- if fi.IsDir() {
- f, err := fs.Open(path)
- if err != nil {
- return false, err
- }
- defer f.Close()
- list, err := f.Readdir(-1)
- if err != nil {
- return false, err
- }
- return len(list) == 0, nil
- }
- return fi.Size() == 0, nil
-}
-
-func (a Afero) Exists(path string) (bool, error) {
- return Exists(a.Fs, path)
-}
-
-// Check if a file or directory exists.
-func Exists(fs Fs, path string) (bool, error) {
- _, err := fs.Stat(path)
- if err == nil {
- return true, nil
- }
- if os.IsNotExist(err) {
- return false, nil
- }
- return false, err
-}
-
-func FullBaseFsPath(basePathFs *BasePathFs, relativePath string) string {
- combinedPath := filepath.Join(basePathFs.path, relativePath)
- if parent, ok := basePathFs.source.(*BasePathFs); ok {
- return FullBaseFsPath(parent, combinedPath)
- }
-
- return combinedPath
-}
diff --git a/vendor/github.com/spf13/cast/.gitignore b/vendor/github.com/spf13/cast/.gitignore
deleted file mode 100644
index 53053a8ac..000000000
--- a/vendor/github.com/spf13/cast/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-
-*.bench
diff --git a/vendor/github.com/spf13/cast/LICENSE b/vendor/github.com/spf13/cast/LICENSE
deleted file mode 100644
index 4527efb9c..000000000
--- a/vendor/github.com/spf13/cast/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Steve Francia
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/spf13/cast/Makefile b/vendor/github.com/spf13/cast/Makefile
deleted file mode 100644
index f01a5dbb6..000000000
--- a/vendor/github.com/spf13/cast/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-GOVERSION := $(shell go version | cut -d ' ' -f 3 | cut -d '.' -f 2)
-
-.PHONY: check fmt lint test test-race vet test-cover-html help
-.DEFAULT_GOAL := help
-
-check: test-race fmt vet lint ## Run tests and linters
-
-test: ## Run tests
- go test ./...
-
-test-race: ## Run tests with race detector
- go test -race ./...
-
-fmt: ## Run gofmt linter
-ifeq "$(GOVERSION)" "12"
- @for d in `go list` ; do \
- if [ "`gofmt -l -s $$GOPATH/src/$$d | tee /dev/stderr`" ]; then \
- echo "^ improperly formatted go files" && echo && exit 1; \
- fi \
- done
-endif
-
-lint: ## Run golint linter
- @for d in `go list` ; do \
- if [ "`golint $$d | tee /dev/stderr`" ]; then \
- echo "^ golint errors!" && echo && exit 1; \
- fi \
- done
-
-vet: ## Run go vet linter
- @if [ "`go vet | tee /dev/stderr`" ]; then \
- echo "^ go vet errors!" && echo && exit 1; \
- fi
-
-test-cover-html: ## Generate test coverage report
- go test -coverprofile=coverage.out -covermode=count
- go tool cover -func=coverage.out
-
-help:
- @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
diff --git a/vendor/github.com/spf13/cast/README.md b/vendor/github.com/spf13/cast/README.md
deleted file mode 100644
index 0e9e14593..000000000
--- a/vendor/github.com/spf13/cast/README.md
+++ /dev/null
@@ -1,75 +0,0 @@
-# cast
-
-[](https://github.com/spf13/cast/actions/workflows/ci.yaml)
-[](https://pkg.go.dev/mod/github.com/spf13/cast)
-
-[](https://goreportcard.com/report/github.com/spf13/cast)
-
-Easy and safe casting from one type to another in Go
-
-Don’t Panic! ... Cast
-
-## What is Cast?
-
-Cast is a library to convert between different go types in a consistent and easy way.
-
-Cast provides simple functions to easily convert a number to a string, an
-interface into a bool, etc. Cast does this intelligently when an obvious
-conversion is possible. It doesn’t make any attempts to guess what you meant,
-for example you can only convert a string to an int when it is a string
-representation of an int such as “8”. Cast was developed for use in
-[Hugo](https://gohugo.io), a website engine which uses YAML, TOML or JSON
-for meta data.
-
-## Why use Cast?
-
-When working with dynamic data in Go you often need to cast or convert the data
-from one type into another. Cast goes beyond just using type assertion (though
-it uses that when possible) to provide a very straightforward and convenient
-library.
-
-If you are working with interfaces to handle things like dynamic content
-you’ll need an easy way to convert an interface into a given type. This
-is the library for you.
-
-If you are taking in data from YAML, TOML or JSON or other formats which lack
-full types, then Cast is the library for you.
-
-## Usage
-
-Cast provides a handful of To_____ methods. These methods will always return
-the desired type. **If input is provided that will not convert to that type, the
-0 or nil value for that type will be returned**.
-
-Cast also provides identical methods To_____E. These return the same result as
-the To_____ methods, plus an additional error which tells you if it successfully
-converted. Using these methods you can tell the difference between when the
-input matched the zero value or when the conversion failed and the zero value
-was returned.
-
-The following examples are merely a sample of what is available. Please review
-the code for a complete set.
-
-### Example ‘ToString’:
-
- cast.ToString("mayonegg") // "mayonegg"
- cast.ToString(8) // "8"
- cast.ToString(8.31) // "8.31"
- cast.ToString([]byte("one time")) // "one time"
- cast.ToString(nil) // ""
-
- var foo interface{} = "one more time"
- cast.ToString(foo) // "one more time"
-
-
-### Example ‘ToInt’:
-
- cast.ToInt(8) // 8
- cast.ToInt(8.31) // 8
- cast.ToInt("8") // 8
- cast.ToInt(true) // 1
- cast.ToInt(false) // 0
-
- var eight interface{} = 8
- cast.ToInt(eight) // 8
- cast.ToInt(nil) // 0
diff --git a/vendor/github.com/spf13/cast/cast.go b/vendor/github.com/spf13/cast/cast.go
deleted file mode 100644
index 0cfe9418d..000000000
--- a/vendor/github.com/spf13/cast/cast.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright © 2014 Steve Francia .
-//
-// Use of this source code is governed by an MIT-style
-// license that can be found in the LICENSE file.
-
-// Package cast provides easy and safe casting in Go.
-package cast
-
-import "time"
-
-// ToBool casts an interface to a bool type.
-func ToBool(i interface{}) bool {
- v, _ := ToBoolE(i)
- return v
-}
-
-// ToTime casts an interface to a time.Time type.
-func ToTime(i interface{}) time.Time {
- v, _ := ToTimeE(i)
- return v
-}
-
-func ToTimeInDefaultLocation(i interface{}, location *time.Location) time.Time {
- v, _ := ToTimeInDefaultLocationE(i, location)
- return v
-}
-
-// ToDuration casts an interface to a time.Duration type.
-func ToDuration(i interface{}) time.Duration {
- v, _ := ToDurationE(i)
- return v
-}
-
-// ToFloat64 casts an interface to a float64 type.
-func ToFloat64(i interface{}) float64 {
- v, _ := ToFloat64E(i)
- return v
-}
-
-// ToFloat32 casts an interface to a float32 type.
-func ToFloat32(i interface{}) float32 {
- v, _ := ToFloat32E(i)
- return v
-}
-
-// ToInt64 casts an interface to an int64 type.
-func ToInt64(i interface{}) int64 {
- v, _ := ToInt64E(i)
- return v
-}
-
-// ToInt32 casts an interface to an int32 type.
-func ToInt32(i interface{}) int32 {
- v, _ := ToInt32E(i)
- return v
-}
-
-// ToInt16 casts an interface to an int16 type.
-func ToInt16(i interface{}) int16 {
- v, _ := ToInt16E(i)
- return v
-}
-
-// ToInt8 casts an interface to an int8 type.
-func ToInt8(i interface{}) int8 {
- v, _ := ToInt8E(i)
- return v
-}
-
-// ToInt casts an interface to an int type.
-func ToInt(i interface{}) int {
- v, _ := ToIntE(i)
- return v
-}
-
-// ToUint casts an interface to a uint type.
-func ToUint(i interface{}) uint {
- v, _ := ToUintE(i)
- return v
-}
-
-// ToUint64 casts an interface to a uint64 type.
-func ToUint64(i interface{}) uint64 {
- v, _ := ToUint64E(i)
- return v
-}
-
-// ToUint32 casts an interface to a uint32 type.
-func ToUint32(i interface{}) uint32 {
- v, _ := ToUint32E(i)
- return v
-}
-
-// ToUint16 casts an interface to a uint16 type.
-func ToUint16(i interface{}) uint16 {
- v, _ := ToUint16E(i)
- return v
-}
-
-// ToUint8 casts an interface to a uint8 type.
-func ToUint8(i interface{}) uint8 {
- v, _ := ToUint8E(i)
- return v
-}
-
-// ToString casts an interface to a string type.
-func ToString(i interface{}) string {
- v, _ := ToStringE(i)
- return v
-}
-
-// ToStringMapString casts an interface to a map[string]string type.
-func ToStringMapString(i interface{}) map[string]string {
- v, _ := ToStringMapStringE(i)
- return v
-}
-
-// ToStringMapStringSlice casts an interface to a map[string][]string type.
-func ToStringMapStringSlice(i interface{}) map[string][]string {
- v, _ := ToStringMapStringSliceE(i)
- return v
-}
-
-// ToStringMapBool casts an interface to a map[string]bool type.
-func ToStringMapBool(i interface{}) map[string]bool {
- v, _ := ToStringMapBoolE(i)
- return v
-}
-
-// ToStringMapInt casts an interface to a map[string]int type.
-func ToStringMapInt(i interface{}) map[string]int {
- v, _ := ToStringMapIntE(i)
- return v
-}
-
-// ToStringMapInt64 casts an interface to a map[string]int64 type.
-func ToStringMapInt64(i interface{}) map[string]int64 {
- v, _ := ToStringMapInt64E(i)
- return v
-}
-
-// ToStringMap casts an interface to a map[string]interface{} type.
-func ToStringMap(i interface{}) map[string]interface{} {
- v, _ := ToStringMapE(i)
- return v
-}
-
-// ToSlice casts an interface to a []interface{} type.
-func ToSlice(i interface{}) []interface{} {
- v, _ := ToSliceE(i)
- return v
-}
-
-// ToBoolSlice casts an interface to a []bool type.
-func ToBoolSlice(i interface{}) []bool {
- v, _ := ToBoolSliceE(i)
- return v
-}
-
-// ToStringSlice casts an interface to a []string type.
-func ToStringSlice(i interface{}) []string {
- v, _ := ToStringSliceE(i)
- return v
-}
-
-// ToIntSlice casts an interface to a []int type.
-func ToIntSlice(i interface{}) []int {
- v, _ := ToIntSliceE(i)
- return v
-}
-
-// ToDurationSlice casts an interface to a []time.Duration type.
-func ToDurationSlice(i interface{}) []time.Duration {
- v, _ := ToDurationSliceE(i)
- return v
-}
diff --git a/vendor/github.com/spf13/cast/caste.go b/vendor/github.com/spf13/cast/caste.go
deleted file mode 100644
index d49bbf83e..000000000
--- a/vendor/github.com/spf13/cast/caste.go
+++ /dev/null
@@ -1,1498 +0,0 @@
-// Copyright © 2014 Steve Francia .
-//
-// Use of this source code is governed by an MIT-style
-// license that can be found in the LICENSE file.
-
-package cast
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "html/template"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-var errNegativeNotAllowed = errors.New("unable to cast negative value")
-
-// ToTimeE casts an interface to a time.Time type.
-func ToTimeE(i interface{}) (tim time.Time, err error) {
- return ToTimeInDefaultLocationE(i, time.UTC)
-}
-
-// ToTimeInDefaultLocationE casts an empty interface to time.Time,
-// interpreting inputs without a timezone to be in the given location,
-// or the local timezone if nil.
-func ToTimeInDefaultLocationE(i interface{}, location *time.Location) (tim time.Time, err error) {
- i = indirect(i)
-
- switch v := i.(type) {
- case time.Time:
- return v, nil
- case string:
- return StringToDateInDefaultLocation(v, location)
- case json.Number:
- s, err1 := ToInt64E(v)
- if err1 != nil {
- return time.Time{}, fmt.Errorf("unable to cast %#v of type %T to Time", i, i)
- }
- return time.Unix(s, 0), nil
- case int:
- return time.Unix(int64(v), 0), nil
- case int64:
- return time.Unix(v, 0), nil
- case int32:
- return time.Unix(int64(v), 0), nil
- case uint:
- return time.Unix(int64(v), 0), nil
- case uint64:
- return time.Unix(int64(v), 0), nil
- case uint32:
- return time.Unix(int64(v), 0), nil
- default:
- return time.Time{}, fmt.Errorf("unable to cast %#v of type %T to Time", i, i)
- }
-}
-
-// ToDurationE casts an interface to a time.Duration type.
-func ToDurationE(i interface{}) (d time.Duration, err error) {
- i = indirect(i)
-
- switch s := i.(type) {
- case time.Duration:
- return s, nil
- case int, int64, int32, int16, int8, uint, uint64, uint32, uint16, uint8:
- d = time.Duration(ToInt64(s))
- return
- case float32, float64:
- d = time.Duration(ToFloat64(s))
- return
- case string:
- if strings.ContainsAny(s, "nsuµmh") {
- d, err = time.ParseDuration(s)
- } else {
- d, err = time.ParseDuration(s + "ns")
- }
- return
- case json.Number:
- var v float64
- v, err = s.Float64()
- d = time.Duration(v)
- return
- default:
- err = fmt.Errorf("unable to cast %#v of type %T to Duration", i, i)
- return
- }
-}
-
-// ToBoolE casts an interface to a bool type.
-func ToBoolE(i interface{}) (bool, error) {
- i = indirect(i)
-
- switch b := i.(type) {
- case bool:
- return b, nil
- case nil:
- return false, nil
- case int:
- return b != 0, nil
- case int64:
- return b != 0, nil
- case int32:
- return b != 0, nil
- case int16:
- return b != 0, nil
- case int8:
- return b != 0, nil
- case uint:
- return b != 0, nil
- case uint64:
- return b != 0, nil
- case uint32:
- return b != 0, nil
- case uint16:
- return b != 0, nil
- case uint8:
- return b != 0, nil
- case float64:
- return b != 0, nil
- case float32:
- return b != 0, nil
- case time.Duration:
- return b != 0, nil
- case string:
- return strconv.ParseBool(i.(string))
- case json.Number:
- v, err := ToInt64E(b)
- if err == nil {
- return v != 0, nil
- }
- return false, fmt.Errorf("unable to cast %#v of type %T to bool", i, i)
- default:
- return false, fmt.Errorf("unable to cast %#v of type %T to bool", i, i)
- }
-}
-
-// ToFloat64E casts an interface to a float64 type.
-func ToFloat64E(i interface{}) (float64, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- return float64(intv), nil
- }
-
- switch s := i.(type) {
- case float64:
- return s, nil
- case float32:
- return float64(s), nil
- case int64:
- return float64(s), nil
- case int32:
- return float64(s), nil
- case int16:
- return float64(s), nil
- case int8:
- return float64(s), nil
- case uint:
- return float64(s), nil
- case uint64:
- return float64(s), nil
- case uint32:
- return float64(s), nil
- case uint16:
- return float64(s), nil
- case uint8:
- return float64(s), nil
- case string:
- v, err := strconv.ParseFloat(s, 64)
- if err == nil {
- return v, nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to float64", i, i)
- case json.Number:
- v, err := s.Float64()
- if err == nil {
- return v, nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to float64", i, i)
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to float64", i, i)
- }
-}
-
-// ToFloat32E casts an interface to a float32 type.
-func ToFloat32E(i interface{}) (float32, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- return float32(intv), nil
- }
-
- switch s := i.(type) {
- case float64:
- return float32(s), nil
- case float32:
- return s, nil
- case int64:
- return float32(s), nil
- case int32:
- return float32(s), nil
- case int16:
- return float32(s), nil
- case int8:
- return float32(s), nil
- case uint:
- return float32(s), nil
- case uint64:
- return float32(s), nil
- case uint32:
- return float32(s), nil
- case uint16:
- return float32(s), nil
- case uint8:
- return float32(s), nil
- case string:
- v, err := strconv.ParseFloat(s, 32)
- if err == nil {
- return float32(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to float32", i, i)
- case json.Number:
- v, err := s.Float64()
- if err == nil {
- return float32(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to float32", i, i)
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to float32", i, i)
- }
-}
-
-// ToInt64E casts an interface to an int64 type.
-func ToInt64E(i interface{}) (int64, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- return int64(intv), nil
- }
-
- switch s := i.(type) {
- case int64:
- return s, nil
- case int32:
- return int64(s), nil
- case int16:
- return int64(s), nil
- case int8:
- return int64(s), nil
- case uint:
- return int64(s), nil
- case uint64:
- return int64(s), nil
- case uint32:
- return int64(s), nil
- case uint16:
- return int64(s), nil
- case uint8:
- return int64(s), nil
- case float64:
- return int64(s), nil
- case float32:
- return int64(s), nil
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- return v, nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to int64", i, i)
- case json.Number:
- return ToInt64E(string(s))
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to int64", i, i)
- }
-}
-
-// ToInt32E casts an interface to an int32 type.
-func ToInt32E(i interface{}) (int32, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- return int32(intv), nil
- }
-
- switch s := i.(type) {
- case int64:
- return int32(s), nil
- case int32:
- return s, nil
- case int16:
- return int32(s), nil
- case int8:
- return int32(s), nil
- case uint:
- return int32(s), nil
- case uint64:
- return int32(s), nil
- case uint32:
- return int32(s), nil
- case uint16:
- return int32(s), nil
- case uint8:
- return int32(s), nil
- case float64:
- return int32(s), nil
- case float32:
- return int32(s), nil
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- return int32(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to int32", i, i)
- case json.Number:
- return ToInt32E(string(s))
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to int32", i, i)
- }
-}
-
-// ToInt16E casts an interface to an int16 type.
-func ToInt16E(i interface{}) (int16, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- return int16(intv), nil
- }
-
- switch s := i.(type) {
- case int64:
- return int16(s), nil
- case int32:
- return int16(s), nil
- case int16:
- return s, nil
- case int8:
- return int16(s), nil
- case uint:
- return int16(s), nil
- case uint64:
- return int16(s), nil
- case uint32:
- return int16(s), nil
- case uint16:
- return int16(s), nil
- case uint8:
- return int16(s), nil
- case float64:
- return int16(s), nil
- case float32:
- return int16(s), nil
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- return int16(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to int16", i, i)
- case json.Number:
- return ToInt16E(string(s))
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to int16", i, i)
- }
-}
-
-// ToInt8E casts an interface to an int8 type.
-func ToInt8E(i interface{}) (int8, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- return int8(intv), nil
- }
-
- switch s := i.(type) {
- case int64:
- return int8(s), nil
- case int32:
- return int8(s), nil
- case int16:
- return int8(s), nil
- case int8:
- return s, nil
- case uint:
- return int8(s), nil
- case uint64:
- return int8(s), nil
- case uint32:
- return int8(s), nil
- case uint16:
- return int8(s), nil
- case uint8:
- return int8(s), nil
- case float64:
- return int8(s), nil
- case float32:
- return int8(s), nil
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- return int8(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to int8", i, i)
- case json.Number:
- return ToInt8E(string(s))
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to int8", i, i)
- }
-}
-
-// ToIntE casts an interface to an int type.
-func ToIntE(i interface{}) (int, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- return intv, nil
- }
-
- switch s := i.(type) {
- case int64:
- return int(s), nil
- case int32:
- return int(s), nil
- case int16:
- return int(s), nil
- case int8:
- return int(s), nil
- case uint:
- return int(s), nil
- case uint64:
- return int(s), nil
- case uint32:
- return int(s), nil
- case uint16:
- return int(s), nil
- case uint8:
- return int(s), nil
- case float64:
- return int(s), nil
- case float32:
- return int(s), nil
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- return int(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to int64", i, i)
- case json.Number:
- return ToIntE(string(s))
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to int", i, i)
- }
-}
-
-// ToUintE casts an interface to a uint type.
-func ToUintE(i interface{}) (uint, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- if intv < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint(intv), nil
- }
-
- switch s := i.(type) {
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- if v < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint", i, i)
- case json.Number:
- return ToUintE(string(s))
- case int64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint(s), nil
- case int32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint(s), nil
- case int16:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint(s), nil
- case int8:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint(s), nil
- case uint:
- return s, nil
- case uint64:
- return uint(s), nil
- case uint32:
- return uint(s), nil
- case uint16:
- return uint(s), nil
- case uint8:
- return uint(s), nil
- case float64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint(s), nil
- case float32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint(s), nil
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint", i, i)
- }
-}
-
-// ToUint64E casts an interface to a uint64 type.
-func ToUint64E(i interface{}) (uint64, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- if intv < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint64(intv), nil
- }
-
- switch s := i.(type) {
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- if v < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint64(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint64", i, i)
- case json.Number:
- return ToUint64E(string(s))
- case int64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint64(s), nil
- case int32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint64(s), nil
- case int16:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint64(s), nil
- case int8:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint64(s), nil
- case uint:
- return uint64(s), nil
- case uint64:
- return s, nil
- case uint32:
- return uint64(s), nil
- case uint16:
- return uint64(s), nil
- case uint8:
- return uint64(s), nil
- case float32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint64(s), nil
- case float64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint64(s), nil
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint64", i, i)
- }
-}
-
-// ToUint32E casts an interface to a uint32 type.
-func ToUint32E(i interface{}) (uint32, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- if intv < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint32(intv), nil
- }
-
- switch s := i.(type) {
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- if v < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint32(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint32", i, i)
- case json.Number:
- return ToUint32E(string(s))
- case int64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint32(s), nil
- case int32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint32(s), nil
- case int16:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint32(s), nil
- case int8:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint32(s), nil
- case uint:
- return uint32(s), nil
- case uint64:
- return uint32(s), nil
- case uint32:
- return s, nil
- case uint16:
- return uint32(s), nil
- case uint8:
- return uint32(s), nil
- case float64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint32(s), nil
- case float32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint32(s), nil
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint32", i, i)
- }
-}
-
-// ToUint16E casts an interface to a uint16 type.
-func ToUint16E(i interface{}) (uint16, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- if intv < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint16(intv), nil
- }
-
- switch s := i.(type) {
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- if v < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint16(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint16", i, i)
- case json.Number:
- return ToUint16E(string(s))
- case int64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint16(s), nil
- case int32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint16(s), nil
- case int16:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint16(s), nil
- case int8:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint16(s), nil
- case uint:
- return uint16(s), nil
- case uint64:
- return uint16(s), nil
- case uint32:
- return uint16(s), nil
- case uint16:
- return s, nil
- case uint8:
- return uint16(s), nil
- case float64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint16(s), nil
- case float32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint16(s), nil
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint16", i, i)
- }
-}
-
-// ToUint8E casts an interface to a uint type.
-func ToUint8E(i interface{}) (uint8, error) {
- i = indirect(i)
-
- intv, ok := toInt(i)
- if ok {
- if intv < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint8(intv), nil
- }
-
- switch s := i.(type) {
- case string:
- v, err := strconv.ParseInt(trimZeroDecimal(s), 0, 0)
- if err == nil {
- if v < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint8(v), nil
- }
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint8", i, i)
- case json.Number:
- return ToUint8E(string(s))
- case int64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint8(s), nil
- case int32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint8(s), nil
- case int16:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint8(s), nil
- case int8:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint8(s), nil
- case uint:
- return uint8(s), nil
- case uint64:
- return uint8(s), nil
- case uint32:
- return uint8(s), nil
- case uint16:
- return uint8(s), nil
- case uint8:
- return s, nil
- case float64:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint8(s), nil
- case float32:
- if s < 0 {
- return 0, errNegativeNotAllowed
- }
- return uint8(s), nil
- case bool:
- if s {
- return 1, nil
- }
- return 0, nil
- case nil:
- return 0, nil
- default:
- return 0, fmt.Errorf("unable to cast %#v of type %T to uint8", i, i)
- }
-}
-
-// From html/template/content.go
-// Copyright 2011 The Go Authors. All rights reserved.
-// indirect returns the value, after dereferencing as many times
-// as necessary to reach the base type (or nil).
-func indirect(a interface{}) interface{} {
- if a == nil {
- return nil
- }
- if t := reflect.TypeOf(a); t.Kind() != reflect.Ptr {
- // Avoid creating a reflect.Value if it's not a pointer.
- return a
- }
- v := reflect.ValueOf(a)
- for v.Kind() == reflect.Ptr && !v.IsNil() {
- v = v.Elem()
- }
- return v.Interface()
-}
-
-// From html/template/content.go
-// Copyright 2011 The Go Authors. All rights reserved.
-// indirectToStringerOrError returns the value, after dereferencing as many times
-// as necessary to reach the base type (or nil) or an implementation of fmt.Stringer
-// or error,
-func indirectToStringerOrError(a interface{}) interface{} {
- if a == nil {
- return nil
- }
-
- var errorType = reflect.TypeOf((*error)(nil)).Elem()
- var fmtStringerType = reflect.TypeOf((*fmt.Stringer)(nil)).Elem()
-
- v := reflect.ValueOf(a)
- for !v.Type().Implements(fmtStringerType) && !v.Type().Implements(errorType) && v.Kind() == reflect.Ptr && !v.IsNil() {
- v = v.Elem()
- }
- return v.Interface()
-}
-
-// ToStringE casts an interface to a string type.
-func ToStringE(i interface{}) (string, error) {
- i = indirectToStringerOrError(i)
-
- switch s := i.(type) {
- case string:
- return s, nil
- case bool:
- return strconv.FormatBool(s), nil
- case float64:
- return strconv.FormatFloat(s, 'f', -1, 64), nil
- case float32:
- return strconv.FormatFloat(float64(s), 'f', -1, 32), nil
- case int:
- return strconv.Itoa(s), nil
- case int64:
- return strconv.FormatInt(s, 10), nil
- case int32:
- return strconv.Itoa(int(s)), nil
- case int16:
- return strconv.FormatInt(int64(s), 10), nil
- case int8:
- return strconv.FormatInt(int64(s), 10), nil
- case uint:
- return strconv.FormatUint(uint64(s), 10), nil
- case uint64:
- return strconv.FormatUint(uint64(s), 10), nil
- case uint32:
- return strconv.FormatUint(uint64(s), 10), nil
- case uint16:
- return strconv.FormatUint(uint64(s), 10), nil
- case uint8:
- return strconv.FormatUint(uint64(s), 10), nil
- case json.Number:
- return s.String(), nil
- case []byte:
- return string(s), nil
- case template.HTML:
- return string(s), nil
- case template.URL:
- return string(s), nil
- case template.JS:
- return string(s), nil
- case template.CSS:
- return string(s), nil
- case template.HTMLAttr:
- return string(s), nil
- case nil:
- return "", nil
- case fmt.Stringer:
- return s.String(), nil
- case error:
- return s.Error(), nil
- default:
- return "", fmt.Errorf("unable to cast %#v of type %T to string", i, i)
- }
-}
-
-// ToStringMapStringE casts an interface to a map[string]string type.
-func ToStringMapStringE(i interface{}) (map[string]string, error) {
- var m = map[string]string{}
-
- switch v := i.(type) {
- case map[string]string:
- return v, nil
- case map[string]interface{}:
- for k, val := range v {
- m[ToString(k)] = ToString(val)
- }
- return m, nil
- case map[interface{}]string:
- for k, val := range v {
- m[ToString(k)] = ToString(val)
- }
- return m, nil
- case map[interface{}]interface{}:
- for k, val := range v {
- m[ToString(k)] = ToString(val)
- }
- return m, nil
- case string:
- err := jsonStringToObject(v, &m)
- return m, err
- default:
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]string", i, i)
- }
-}
-
-// ToStringMapStringSliceE casts an interface to a map[string][]string type.
-func ToStringMapStringSliceE(i interface{}) (map[string][]string, error) {
- var m = map[string][]string{}
-
- switch v := i.(type) {
- case map[string][]string:
- return v, nil
- case map[string][]interface{}:
- for k, val := range v {
- m[ToString(k)] = ToStringSlice(val)
- }
- return m, nil
- case map[string]string:
- for k, val := range v {
- m[ToString(k)] = []string{val}
- }
- case map[string]interface{}:
- for k, val := range v {
- switch vt := val.(type) {
- case []interface{}:
- m[ToString(k)] = ToStringSlice(vt)
- case []string:
- m[ToString(k)] = vt
- default:
- m[ToString(k)] = []string{ToString(val)}
- }
- }
- return m, nil
- case map[interface{}][]string:
- for k, val := range v {
- m[ToString(k)] = ToStringSlice(val)
- }
- return m, nil
- case map[interface{}]string:
- for k, val := range v {
- m[ToString(k)] = ToStringSlice(val)
- }
- return m, nil
- case map[interface{}][]interface{}:
- for k, val := range v {
- m[ToString(k)] = ToStringSlice(val)
- }
- return m, nil
- case map[interface{}]interface{}:
- for k, val := range v {
- key, err := ToStringE(k)
- if err != nil {
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string][]string", i, i)
- }
- value, err := ToStringSliceE(val)
- if err != nil {
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string][]string", i, i)
- }
- m[key] = value
- }
- case string:
- err := jsonStringToObject(v, &m)
- return m, err
- default:
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string][]string", i, i)
- }
- return m, nil
-}
-
-// ToStringMapBoolE casts an interface to a map[string]bool type.
-func ToStringMapBoolE(i interface{}) (map[string]bool, error) {
- var m = map[string]bool{}
-
- switch v := i.(type) {
- case map[interface{}]interface{}:
- for k, val := range v {
- m[ToString(k)] = ToBool(val)
- }
- return m, nil
- case map[string]interface{}:
- for k, val := range v {
- m[ToString(k)] = ToBool(val)
- }
- return m, nil
- case map[string]bool:
- return v, nil
- case string:
- err := jsonStringToObject(v, &m)
- return m, err
- default:
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]bool", i, i)
- }
-}
-
-// ToStringMapE casts an interface to a map[string]interface{} type.
-func ToStringMapE(i interface{}) (map[string]interface{}, error) {
- var m = map[string]interface{}{}
-
- switch v := i.(type) {
- case map[interface{}]interface{}:
- for k, val := range v {
- m[ToString(k)] = val
- }
- return m, nil
- case map[string]interface{}:
- return v, nil
- case string:
- err := jsonStringToObject(v, &m)
- return m, err
- default:
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]interface{}", i, i)
- }
-}
-
-// ToStringMapIntE casts an interface to a map[string]int{} type.
-func ToStringMapIntE(i interface{}) (map[string]int, error) {
- var m = map[string]int{}
- if i == nil {
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int", i, i)
- }
-
- switch v := i.(type) {
- case map[interface{}]interface{}:
- for k, val := range v {
- m[ToString(k)] = ToInt(val)
- }
- return m, nil
- case map[string]interface{}:
- for k, val := range v {
- m[k] = ToInt(val)
- }
- return m, nil
- case map[string]int:
- return v, nil
- case string:
- err := jsonStringToObject(v, &m)
- return m, err
- }
-
- if reflect.TypeOf(i).Kind() != reflect.Map {
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int", i, i)
- }
-
- mVal := reflect.ValueOf(m)
- v := reflect.ValueOf(i)
- for _, keyVal := range v.MapKeys() {
- val, err := ToIntE(v.MapIndex(keyVal).Interface())
- if err != nil {
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int", i, i)
- }
- mVal.SetMapIndex(keyVal, reflect.ValueOf(val))
- }
- return m, nil
-}
-
-// ToStringMapInt64E casts an interface to a map[string]int64{} type.
-func ToStringMapInt64E(i interface{}) (map[string]int64, error) {
- var m = map[string]int64{}
- if i == nil {
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int64", i, i)
- }
-
- switch v := i.(type) {
- case map[interface{}]interface{}:
- for k, val := range v {
- m[ToString(k)] = ToInt64(val)
- }
- return m, nil
- case map[string]interface{}:
- for k, val := range v {
- m[k] = ToInt64(val)
- }
- return m, nil
- case map[string]int64:
- return v, nil
- case string:
- err := jsonStringToObject(v, &m)
- return m, err
- }
-
- if reflect.TypeOf(i).Kind() != reflect.Map {
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int64", i, i)
- }
- mVal := reflect.ValueOf(m)
- v := reflect.ValueOf(i)
- for _, keyVal := range v.MapKeys() {
- val, err := ToInt64E(v.MapIndex(keyVal).Interface())
- if err != nil {
- return m, fmt.Errorf("unable to cast %#v of type %T to map[string]int64", i, i)
- }
- mVal.SetMapIndex(keyVal, reflect.ValueOf(val))
- }
- return m, nil
-}
-
-// ToSliceE casts an interface to a []interface{} type.
-func ToSliceE(i interface{}) ([]interface{}, error) {
- var s []interface{}
-
- switch v := i.(type) {
- case []interface{}:
- return append(s, v...), nil
- case []map[string]interface{}:
- for _, u := range v {
- s = append(s, u)
- }
- return s, nil
- default:
- return s, fmt.Errorf("unable to cast %#v of type %T to []interface{}", i, i)
- }
-}
-
-// ToBoolSliceE casts an interface to a []bool type.
-func ToBoolSliceE(i interface{}) ([]bool, error) {
- if i == nil {
- return []bool{}, fmt.Errorf("unable to cast %#v of type %T to []bool", i, i)
- }
-
- switch v := i.(type) {
- case []bool:
- return v, nil
- }
-
- kind := reflect.TypeOf(i).Kind()
- switch kind {
- case reflect.Slice, reflect.Array:
- s := reflect.ValueOf(i)
- a := make([]bool, s.Len())
- for j := 0; j < s.Len(); j++ {
- val, err := ToBoolE(s.Index(j).Interface())
- if err != nil {
- return []bool{}, fmt.Errorf("unable to cast %#v of type %T to []bool", i, i)
- }
- a[j] = val
- }
- return a, nil
- default:
- return []bool{}, fmt.Errorf("unable to cast %#v of type %T to []bool", i, i)
- }
-}
-
-// ToStringSliceE casts an interface to a []string type.
-func ToStringSliceE(i interface{}) ([]string, error) {
- var a []string
-
- switch v := i.(type) {
- case []interface{}:
- for _, u := range v {
- a = append(a, ToString(u))
- }
- return a, nil
- case []string:
- return v, nil
- case []int8:
- for _, u := range v {
- a = append(a, ToString(u))
- }
- return a, nil
- case []int:
- for _, u := range v {
- a = append(a, ToString(u))
- }
- return a, nil
- case []int32:
- for _, u := range v {
- a = append(a, ToString(u))
- }
- return a, nil
- case []int64:
- for _, u := range v {
- a = append(a, ToString(u))
- }
- return a, nil
- case []float32:
- for _, u := range v {
- a = append(a, ToString(u))
- }
- return a, nil
- case []float64:
- for _, u := range v {
- a = append(a, ToString(u))
- }
- return a, nil
- case string:
- return strings.Fields(v), nil
- case []error:
- for _, err := range i.([]error) {
- a = append(a, err.Error())
- }
- return a, nil
- case interface{}:
- str, err := ToStringE(v)
- if err != nil {
- return a, fmt.Errorf("unable to cast %#v of type %T to []string", i, i)
- }
- return []string{str}, nil
- default:
- return a, fmt.Errorf("unable to cast %#v of type %T to []string", i, i)
- }
-}
-
-// ToIntSliceE casts an interface to a []int type.
-func ToIntSliceE(i interface{}) ([]int, error) {
- if i == nil {
- return []int{}, fmt.Errorf("unable to cast %#v of type %T to []int", i, i)
- }
-
- switch v := i.(type) {
- case []int:
- return v, nil
- }
-
- kind := reflect.TypeOf(i).Kind()
- switch kind {
- case reflect.Slice, reflect.Array:
- s := reflect.ValueOf(i)
- a := make([]int, s.Len())
- for j := 0; j < s.Len(); j++ {
- val, err := ToIntE(s.Index(j).Interface())
- if err != nil {
- return []int{}, fmt.Errorf("unable to cast %#v of type %T to []int", i, i)
- }
- a[j] = val
- }
- return a, nil
- default:
- return []int{}, fmt.Errorf("unable to cast %#v of type %T to []int", i, i)
- }
-}
-
-// ToDurationSliceE casts an interface to a []time.Duration type.
-func ToDurationSliceE(i interface{}) ([]time.Duration, error) {
- if i == nil {
- return []time.Duration{}, fmt.Errorf("unable to cast %#v of type %T to []time.Duration", i, i)
- }
-
- switch v := i.(type) {
- case []time.Duration:
- return v, nil
- }
-
- kind := reflect.TypeOf(i).Kind()
- switch kind {
- case reflect.Slice, reflect.Array:
- s := reflect.ValueOf(i)
- a := make([]time.Duration, s.Len())
- for j := 0; j < s.Len(); j++ {
- val, err := ToDurationE(s.Index(j).Interface())
- if err != nil {
- return []time.Duration{}, fmt.Errorf("unable to cast %#v of type %T to []time.Duration", i, i)
- }
- a[j] = val
- }
- return a, nil
- default:
- return []time.Duration{}, fmt.Errorf("unable to cast %#v of type %T to []time.Duration", i, i)
- }
-}
-
-// StringToDate attempts to parse a string into a time.Time type using a
-// predefined list of formats. If no suitable format is found, an error is
-// returned.
-func StringToDate(s string) (time.Time, error) {
- return parseDateWith(s, time.UTC, timeFormats)
-}
-
-// StringToDateInDefaultLocation casts an empty interface to a time.Time,
-// interpreting inputs without a timezone to be in the given location,
-// or the local timezone if nil.
-func StringToDateInDefaultLocation(s string, location *time.Location) (time.Time, error) {
- return parseDateWith(s, location, timeFormats)
-}
-
-type timeFormatType int
-
-const (
- timeFormatNoTimezone timeFormatType = iota
- timeFormatNamedTimezone
- timeFormatNumericTimezone
- timeFormatNumericAndNamedTimezone
- timeFormatTimeOnly
-)
-
-type timeFormat struct {
- format string
- typ timeFormatType
-}
-
-func (f timeFormat) hasTimezone() bool {
- // We don't include the formats with only named timezones, see
- // https://github.com/golang/go/issues/19694#issuecomment-289103522
- return f.typ >= timeFormatNumericTimezone && f.typ <= timeFormatNumericAndNamedTimezone
-}
-
-var (
- timeFormats = []timeFormat{
- // Keep common formats at the top.
- {"2006-01-02", timeFormatNoTimezone},
- {time.RFC3339, timeFormatNumericTimezone},
- {"2006-01-02T15:04:05", timeFormatNoTimezone}, // iso8601 without timezone
- {time.RFC1123Z, timeFormatNumericTimezone},
- {time.RFC1123, timeFormatNamedTimezone},
- {time.RFC822Z, timeFormatNumericTimezone},
- {time.RFC822, timeFormatNamedTimezone},
- {time.RFC850, timeFormatNamedTimezone},
- {"2006-01-02 15:04:05.999999999 -0700 MST", timeFormatNumericAndNamedTimezone}, // Time.String()
- {"2006-01-02T15:04:05-0700", timeFormatNumericTimezone}, // RFC3339 without timezone hh:mm colon
- {"2006-01-02 15:04:05Z0700", timeFormatNumericTimezone}, // RFC3339 without T or timezone hh:mm colon
- {"2006-01-02 15:04:05", timeFormatNoTimezone},
- {time.ANSIC, timeFormatNoTimezone},
- {time.UnixDate, timeFormatNamedTimezone},
- {time.RubyDate, timeFormatNumericTimezone},
- {"2006-01-02 15:04:05Z07:00", timeFormatNumericTimezone},
- {"02 Jan 2006", timeFormatNoTimezone},
- {"2006-01-02 15:04:05 -07:00", timeFormatNumericTimezone},
- {"2006-01-02 15:04:05 -0700", timeFormatNumericTimezone},
- {time.Kitchen, timeFormatTimeOnly},
- {time.Stamp, timeFormatTimeOnly},
- {time.StampMilli, timeFormatTimeOnly},
- {time.StampMicro, timeFormatTimeOnly},
- {time.StampNano, timeFormatTimeOnly},
- }
-)
-
-func parseDateWith(s string, location *time.Location, formats []timeFormat) (d time.Time, e error) {
-
- for _, format := range formats {
- if d, e = time.Parse(format.format, s); e == nil {
-
- // Some time formats have a zone name, but no offset, so it gets
- // put in that zone name (not the default one passed in to us), but
- // without that zone's offset. So set the location manually.
- if format.typ <= timeFormatNamedTimezone {
- if location == nil {
- location = time.Local
- }
- year, month, day := d.Date()
- hour, min, sec := d.Clock()
- d = time.Date(year, month, day, hour, min, sec, d.Nanosecond(), location)
- }
-
- return
- }
- }
- return d, fmt.Errorf("unable to parse date: %s", s)
-}
-
-// jsonStringToObject attempts to unmarshall a string as JSON into
-// the object passed as pointer.
-func jsonStringToObject(s string, v interface{}) error {
- data := []byte(s)
- return json.Unmarshal(data, v)
-}
-
-// toInt returns the int value of v if v or v's underlying type
-// is an int.
-// Note that this will return false for int64 etc. types.
-func toInt(v interface{}) (int, bool) {
- switch v := v.(type) {
- case int:
- return v, true
- case time.Weekday:
- return int(v), true
- case time.Month:
- return int(v), true
- default:
- return 0, false
- }
-}
-
-func trimZeroDecimal(s string) string {
- var foundZero bool
- for i := len(s); i > 0; i-- {
- switch s[i-1] {
- case '.':
- if foundZero {
- return s[:i-1]
- }
- case '0':
- foundZero = true
- default:
- return s
- }
- }
- return s
-}
diff --git a/vendor/github.com/spf13/cast/timeformattype_string.go b/vendor/github.com/spf13/cast/timeformattype_string.go
deleted file mode 100644
index 1524fc82c..000000000
--- a/vendor/github.com/spf13/cast/timeformattype_string.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Code generated by "stringer -type timeFormatType"; DO NOT EDIT.
-
-package cast
-
-import "strconv"
-
-func _() {
- // An "invalid array index" compiler error signifies that the constant values have changed.
- // Re-run the stringer command to generate them again.
- var x [1]struct{}
- _ = x[timeFormatNoTimezone-0]
- _ = x[timeFormatNamedTimezone-1]
- _ = x[timeFormatNumericTimezone-2]
- _ = x[timeFormatNumericAndNamedTimezone-3]
- _ = x[timeFormatTimeOnly-4]
-}
-
-const _timeFormatType_name = "timeFormatNoTimezonetimeFormatNamedTimezonetimeFormatNumericTimezonetimeFormatNumericAndNamedTimezonetimeFormatTimeOnly"
-
-var _timeFormatType_index = [...]uint8{0, 20, 43, 68, 101, 119}
-
-func (i timeFormatType) String() string {
- if i < 0 || i >= timeFormatType(len(_timeFormatType_index)-1) {
- return "timeFormatType(" + strconv.FormatInt(int64(i), 10) + ")"
- }
- return _timeFormatType_name[_timeFormatType_index[i]:_timeFormatType_index[i+1]]
-}
diff --git a/vendor/github.com/spf13/cobra/.gitignore b/vendor/github.com/spf13/cobra/.gitignore
deleted file mode 100644
index c7b459e4d..000000000
--- a/vendor/github.com/spf13/cobra/.gitignore
+++ /dev/null
@@ -1,39 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-# Vim files https://github.com/github/gitignore/blob/master/Global/Vim.gitignore
-# swap
-[._]*.s[a-w][a-z]
-[._]s[a-w][a-z]
-# session
-Session.vim
-# temporary
-.netrwhist
-*~
-# auto-generated tag files
-tags
-
-*.exe
-cobra.test
-bin
-
-.idea/
-*.iml
diff --git a/vendor/github.com/spf13/cobra/.golangci.yml b/vendor/github.com/spf13/cobra/.golangci.yml
deleted file mode 100644
index 2c8f4808c..000000000
--- a/vendor/github.com/spf13/cobra/.golangci.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 2013-2023 The Cobra Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-run:
- deadline: 5m
-
-linters:
- disable-all: true
- enable:
- #- bodyclose
- # - deadcode ! deprecated since v1.49.0; replaced by 'unused'
- #- depguard
- #- dogsled
- #- dupl
- - errcheck
- #- exhaustive
- #- funlen
- #- gochecknoinits
- - goconst
- - gocritic
- #- gocyclo
- - gofmt
- - goimports
- #- gomnd
- #- goprintffuncname
- - gosec
- - gosimple
- - govet
- - ineffassign
- #- lll
- - misspell
- #- nakedret
- #- noctx
- - nolintlint
- #- rowserrcheck
- #- scopelint
- - staticcheck
- #- structcheck ! deprecated since v1.49.0; replaced by 'unused'
- - stylecheck
- #- typecheck
- - unconvert
- #- unparam
- - unused
- # - varcheck ! deprecated since v1.49.0; replaced by 'unused'
- #- whitespace
- fast: false
diff --git a/vendor/github.com/spf13/cobra/.mailmap b/vendor/github.com/spf13/cobra/.mailmap
deleted file mode 100644
index 94ec53068..000000000
--- a/vendor/github.com/spf13/cobra/.mailmap
+++ /dev/null
@@ -1,3 +0,0 @@
-Steve Francia
-Bjørn Erik Pedersen
-Fabiano Franz
diff --git a/vendor/github.com/spf13/cobra/CONDUCT.md b/vendor/github.com/spf13/cobra/CONDUCT.md
deleted file mode 100644
index 9d16f88fd..000000000
--- a/vendor/github.com/spf13/cobra/CONDUCT.md
+++ /dev/null
@@ -1,37 +0,0 @@
-## Cobra User Contract
-
-### Versioning
-Cobra will follow a steady release cadence. Non breaking changes will be released as minor versions quarterly. Patch bug releases are at the discretion of the maintainers. Users can expect security patch fixes to be released within relatively short order of a CVE becoming known. For more information on security patch fixes see the CVE section below. Releases will follow [Semantic Versioning](https://semver.org/). Users tracking the Master branch should expect unpredictable breaking changes as the project continues to move forward. For stability, it is highly recommended to use a release.
-
-### Backward Compatibility
-We will maintain two major releases in a moving window. The N-1 release will only receive bug fixes and security updates and will be dropped once N+1 is released.
-
-### Deprecation
-Deprecation of Go versions or dependent packages will only occur in major releases. To reduce the change of this taking users by surprise, any large deprecation will be preceded by an announcement in the [#cobra slack channel](https://gophers.slack.com/archives/CD3LP1199) and an Issue on Github.
-
-### CVE
-Maintainers will make every effort to release security patches in the case of a medium to high severity CVE directly impacting the library. The speed in which these patches reach a release is up to the discretion of the maintainers. A low severity CVE may be a lower priority than a high severity one.
-
-### Communication
-Cobra maintainers will use GitHub issues and the [#cobra slack channel](https://gophers.slack.com/archives/CD3LP1199) as the primary means of communication with the community. This is to foster open communication with all users and contributors.
-
-### Breaking Changes
-Breaking changes are generally allowed in the master branch, as this is the branch used to develop the next release of Cobra.
-
-There may be times, however, when master is closed for breaking changes. This is likely to happen as we near the release of a new version.
-
-Breaking changes are not allowed in release branches, as these represent minor versions that have already been released. These version have consumers who expect the APIs, behaviors, etc, to remain stable during the lifetime of the patch stream for the minor release.
-
-Examples of breaking changes include:
-- Removing or renaming exported constant, variable, type, or function.
-- Updating the version of critical libraries such as `spf13/pflag`, `spf13/viper` etc...
- - Some version updates may be acceptable for picking up bug fixes, but maintainers must exercise caution when reviewing.
-
-There may, at times, need to be exceptions where breaking changes are allowed in release branches. These are at the discretion of the project's maintainers, and must be carefully considered before merging.
-
-### CI Testing
-Maintainers will ensure the Cobra test suite utilizes the current supported versions of Golang.
-
-### Disclaimer
-Changes to this document and the contents therein are at the discretion of the maintainers.
-None of the contents of this document are legally binding in any way to the maintainers or the users.
diff --git a/vendor/github.com/spf13/cobra/CONTRIBUTING.md b/vendor/github.com/spf13/cobra/CONTRIBUTING.md
deleted file mode 100644
index 6f356e6a8..000000000
--- a/vendor/github.com/spf13/cobra/CONTRIBUTING.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Contributing to Cobra
-
-Thank you so much for contributing to Cobra. We appreciate your time and help.
-Here are some guidelines to help you get started.
-
-## Code of Conduct
-
-Be kind and respectful to the members of the community. Take time to educate
-others who are seeking help. Harassment of any kind will not be tolerated.
-
-## Questions
-
-If you have questions regarding Cobra, feel free to ask it in the community
-[#cobra Slack channel][cobra-slack]
-
-## Filing a bug or feature
-
-1. Before filing an issue, please check the existing issues to see if a
- similar one was already opened. If there is one already opened, feel free
- to comment on it.
-1. If you believe you've found a bug, please provide detailed steps of
- reproduction, the version of Cobra and anything else you believe will be
- useful to help troubleshoot it (e.g. OS environment, environment variables,
- etc...). Also state the current behavior vs. the expected behavior.
-1. If you'd like to see a feature or an enhancement please open an issue with
- a clear title and description of what the feature is and why it would be
- beneficial to the project and its users.
-
-## Submitting changes
-
-1. CLA: Upon submitting a Pull Request (PR), contributors will be prompted to
- sign a CLA. Please sign the CLA :slightly_smiling_face:
-1. Tests: If you are submitting code, please ensure you have adequate tests
- for the feature. Tests can be run via `go test ./...` or `make test`.
-1. Since this is golang project, ensure the new code is properly formatted to
- ensure code consistency. Run `make all`.
-
-### Quick steps to contribute
-
-1. Fork the project.
-1. Download your fork to your PC (`git clone https://github.com/your_username/cobra && cd cobra`)
-1. Create your feature branch (`git checkout -b my-new-feature`)
-1. Make changes and run tests (`make test`)
-1. Add them to staging (`git add .`)
-1. Commit your changes (`git commit -m 'Add some feature'`)
-1. Push to the branch (`git push origin my-new-feature`)
-1. Create new pull request
-
-
-[cobra-slack]: https://gophers.slack.com/archives/CD3LP1199
diff --git a/vendor/github.com/spf13/cobra/LICENSE.txt b/vendor/github.com/spf13/cobra/LICENSE.txt
deleted file mode 100644
index 298f0e266..000000000
--- a/vendor/github.com/spf13/cobra/LICENSE.txt
+++ /dev/null
@@ -1,174 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
diff --git a/vendor/github.com/spf13/cobra/MAINTAINERS b/vendor/github.com/spf13/cobra/MAINTAINERS
deleted file mode 100644
index 4c5ac3dd9..000000000
--- a/vendor/github.com/spf13/cobra/MAINTAINERS
+++ /dev/null
@@ -1,13 +0,0 @@
-maintainers:
-- spf13
-- johnSchnake
-- jpmcb
-- marckhouzam
-inactive:
-- anthonyfok
-- bep
-- bogem
-- broady
-- eparis
-- jharshman
-- wfernandes
diff --git a/vendor/github.com/spf13/cobra/Makefile b/vendor/github.com/spf13/cobra/Makefile
deleted file mode 100644
index 0da8d7aa0..000000000
--- a/vendor/github.com/spf13/cobra/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-BIN="./bin"
-SRC=$(shell find . -name "*.go")
-
-ifeq (, $(shell which golangci-lint))
-$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")
-endif
-
-.PHONY: fmt lint test install_deps clean
-
-default: all
-
-all: fmt test
-
-fmt:
- $(info ******************** checking formatting ********************)
- @test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
-
-lint:
- $(info ******************** running lint tools ********************)
- golangci-lint run -v
-
-test: install_deps
- $(info ******************** running tests ********************)
- go test -v ./...
-
-richtest: install_deps
- $(info ******************** running tests with kyoh86/richgo ********************)
- richgo test -v ./...
-
-install_deps:
- $(info ******************** downloading dependencies ********************)
- go get -v ./...
-
-clean:
- rm -rf $(BIN)
diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md
deleted file mode 100644
index 6444f4b7f..000000000
--- a/vendor/github.com/spf13/cobra/README.md
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-Cobra is a library for creating powerful modern CLI applications.
-
-Cobra is used in many Go projects such as [Kubernetes](https://kubernetes.io/),
-[Hugo](https://gohugo.io), and [GitHub CLI](https://github.com/cli/cli) to
-name a few. [This list](site/content/projects_using_cobra.md) contains a more extensive list of projects using Cobra.
-
-[](https://github.com/spf13/cobra/actions?query=workflow%3ATest)
-[](https://pkg.go.dev/github.com/spf13/cobra)
-[](https://goreportcard.com/report/github.com/spf13/cobra)
-[](https://gophers.slack.com/archives/CD3LP1199)
-
-# Overview
-
-Cobra is a library providing a simple interface to create powerful modern CLI
-interfaces similar to git & go tools.
-
-Cobra provides:
-* Easy subcommand-based CLIs: `app server`, `app fetch`, etc.
-* Fully POSIX-compliant flags (including short & long versions)
-* Nested subcommands
-* Global, local and cascading flags
-* Intelligent suggestions (`app srver`... did you mean `app server`?)
-* Automatic help generation for commands and flags
-* Grouping help for subcommands
-* Automatic help flag recognition of `-h`, `--help`, etc.
-* Automatically generated shell autocomplete for your application (bash, zsh, fish, powershell)
-* Automatically generated man pages for your application
-* Command aliases so you can change things without breaking them
-* The flexibility to define your own help, usage, etc.
-* Optional seamless integration with [viper](https://github.com/spf13/viper) for 12-factor apps
-
-# Concepts
-
-Cobra is built on a structure of commands, arguments & flags.
-
-**Commands** represent actions, **Args** are things and **Flags** are modifiers for those actions.
-
-The best applications read like sentences when used, and as a result, users
-intuitively know how to interact with them.
-
-The pattern to follow is
-`APPNAME VERB NOUN --ADJECTIVE`
- or
-`APPNAME COMMAND ARG --FLAG`.
-
-A few good real world examples may better illustrate this point.
-
-In the following example, 'server' is a command, and 'port' is a flag:
-
- hugo server --port=1313
-
-In this command we are telling Git to clone the url bare.
-
- git clone URL --bare
-
-## Commands
-
-Command is the central point of the application. Each interaction that
-the application supports will be contained in a Command. A command can
-have children commands and optionally run an action.
-
-In the example above, 'server' is the command.
-
-[More about cobra.Command](https://pkg.go.dev/github.com/spf13/cobra#Command)
-
-## Flags
-
-A flag is a way to modify the behavior of a command. Cobra supports
-fully POSIX-compliant flags as well as the Go [flag package](https://golang.org/pkg/flag/).
-A Cobra command can define flags that persist through to children commands
-and flags that are only available to that command.
-
-In the example above, 'port' is the flag.
-
-Flag functionality is provided by the [pflag
-library](https://github.com/spf13/pflag), a fork of the flag standard library
-which maintains the same interface while adding POSIX compliance.
-
-# Installing
-Using Cobra is easy. First, use `go get` to install the latest version
-of the library.
-
-```
-go get -u github.com/spf13/cobra@latest
-```
-
-Next, include Cobra in your application:
-
-```go
-import "github.com/spf13/cobra"
-```
-
-# Usage
-`cobra-cli` is a command line program to generate cobra applications and command files.
-It will bootstrap your application scaffolding to rapidly
-develop a Cobra-based application. It is the easiest way to incorporate Cobra into your application.
-
-It can be installed by running:
-
-```
-go install github.com/spf13/cobra-cli@latest
-```
-
-For complete details on using the Cobra-CLI generator, please read [The Cobra Generator README](https://github.com/spf13/cobra-cli/blob/main/README.md)
-
-For complete details on using the Cobra library, please read the [The Cobra User Guide](site/content/user_guide.md).
-
-# License
-
-Cobra is released under the Apache 2.0 license. See [LICENSE.txt](LICENSE.txt)
diff --git a/vendor/github.com/spf13/cobra/active_help.go b/vendor/github.com/spf13/cobra/active_help.go
deleted file mode 100644
index 25c30e3cc..000000000
--- a/vendor/github.com/spf13/cobra/active_help.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "fmt"
- "os"
-)
-
-const (
- activeHelpMarker = "_activeHelp_ "
- // The below values should not be changed: programs will be using them explicitly
- // in their user documentation, and users will be using them explicitly.
- activeHelpEnvVarSuffix = "ACTIVE_HELP"
- activeHelpGlobalEnvVar = configEnvVarGlobalPrefix + "_" + activeHelpEnvVarSuffix
- activeHelpGlobalDisable = "0"
-)
-
-// AppendActiveHelp adds the specified string to the specified array to be used as ActiveHelp.
-// Such strings will be processed by the completion script and will be shown as ActiveHelp
-// to the user.
-// The array parameter should be the array that will contain the completions.
-// This function can be called multiple times before and/or after completions are added to
-// the array. Each time this function is called with the same array, the new
-// ActiveHelp line will be shown below the previous ones when completion is triggered.
-func AppendActiveHelp(compArray []string, activeHelpStr string) []string {
- return append(compArray, fmt.Sprintf("%s%s", activeHelpMarker, activeHelpStr))
-}
-
-// GetActiveHelpConfig returns the value of the ActiveHelp environment variable
-// _ACTIVE_HELP where is the name of the root command in upper
-// case, with all non-ASCII-alphanumeric characters replaced by `_`.
-// It will always return "0" if the global environment variable COBRA_ACTIVE_HELP
-// is set to "0".
-func GetActiveHelpConfig(cmd *Command) string {
- activeHelpCfg := os.Getenv(activeHelpGlobalEnvVar)
- if activeHelpCfg != activeHelpGlobalDisable {
- activeHelpCfg = os.Getenv(activeHelpEnvVar(cmd.Root().Name()))
- }
- return activeHelpCfg
-}
-
-// activeHelpEnvVar returns the name of the program-specific ActiveHelp environment
-// variable. It has the format _ACTIVE_HELP where is the name of the
-// root command in upper case, with all non-ASCII-alphanumeric characters replaced by `_`.
-func activeHelpEnvVar(name string) string {
- return configEnvVar(name, activeHelpEnvVarSuffix)
-}
diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go
deleted file mode 100644
index ed1e70cea..000000000
--- a/vendor/github.com/spf13/cobra/args.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "fmt"
- "strings"
-)
-
-type PositionalArgs func(cmd *Command, args []string) error
-
-// legacyArgs validation has the following behaviour:
-// - root commands with no subcommands can take arbitrary arguments
-// - root commands with subcommands will do subcommand validity checking
-// - subcommands will always accept arbitrary arguments
-func legacyArgs(cmd *Command, args []string) error {
- // no subcommand, always take args
- if !cmd.HasSubCommands() {
- return nil
- }
-
- // root command with subcommands, do subcommand checking.
- if !cmd.HasParent() && len(args) > 0 {
- return fmt.Errorf("unknown command %q for %q%s", args[0], cmd.CommandPath(), cmd.findSuggestions(args[0]))
- }
- return nil
-}
-
-// NoArgs returns an error if any args are included.
-func NoArgs(cmd *Command, args []string) error {
- if len(args) > 0 {
- return fmt.Errorf("unknown command %q for %q", args[0], cmd.CommandPath())
- }
- return nil
-}
-
-// OnlyValidArgs returns an error if there are any positional args that are not in
-// the `ValidArgs` field of `Command`
-func OnlyValidArgs(cmd *Command, args []string) error {
- if len(cmd.ValidArgs) > 0 {
- // Remove any description that may be included in ValidArgs.
- // A description is following a tab character.
- validArgs := make([]string, 0, len(cmd.ValidArgs))
- for _, v := range cmd.ValidArgs {
- validArgs = append(validArgs, strings.SplitN(v, "\t", 2)[0])
- }
- for _, v := range args {
- if !stringInSlice(v, validArgs) {
- return fmt.Errorf("invalid argument %q for %q%s", v, cmd.CommandPath(), cmd.findSuggestions(args[0]))
- }
- }
- }
- return nil
-}
-
-// ArbitraryArgs never returns an error.
-func ArbitraryArgs(cmd *Command, args []string) error {
- return nil
-}
-
-// MinimumNArgs returns an error if there is not at least N args.
-func MinimumNArgs(n int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if len(args) < n {
- return fmt.Errorf("requires at least %d arg(s), only received %d", n, len(args))
- }
- return nil
- }
-}
-
-// MaximumNArgs returns an error if there are more than N args.
-func MaximumNArgs(n int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if len(args) > n {
- return fmt.Errorf("accepts at most %d arg(s), received %d", n, len(args))
- }
- return nil
- }
-}
-
-// ExactArgs returns an error if there are not exactly n args.
-func ExactArgs(n int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if len(args) != n {
- return fmt.Errorf("accepts %d arg(s), received %d", n, len(args))
- }
- return nil
- }
-}
-
-// RangeArgs returns an error if the number of args is not within the expected range.
-func RangeArgs(min int, max int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if len(args) < min || len(args) > max {
- return fmt.Errorf("accepts between %d and %d arg(s), received %d", min, max, len(args))
- }
- return nil
- }
-}
-
-// MatchAll allows combining several PositionalArgs to work in concert.
-func MatchAll(pargs ...PositionalArgs) PositionalArgs {
- return func(cmd *Command, args []string) error {
- for _, parg := range pargs {
- if err := parg(cmd, args); err != nil {
- return err
- }
- }
- return nil
- }
-}
-
-// ExactValidArgs returns an error if there are not exactly N positional args OR
-// there are any positional args that are not in the `ValidArgs` field of `Command`
-//
-// Deprecated: use MatchAll(ExactArgs(n), OnlyValidArgs) instead
-func ExactValidArgs(n int) PositionalArgs {
- return MatchAll(ExactArgs(n), OnlyValidArgs)
-}
diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go
deleted file mode 100644
index f4d198cbc..000000000
--- a/vendor/github.com/spf13/cobra/bash_completions.go
+++ /dev/null
@@ -1,709 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "sort"
- "strings"
-
- "github.com/spf13/pflag"
-)
-
-// Annotations for Bash completion.
-const (
- BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extensions"
- BashCompCustom = "cobra_annotation_bash_completion_custom"
- BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag"
- BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir"
-)
-
-func writePreamble(buf io.StringWriter, name string) {
- WriteStringAndCheck(buf, fmt.Sprintf("# bash completion for %-36s -*- shell-script -*-\n", name))
- WriteStringAndCheck(buf, fmt.Sprintf(`
-__%[1]s_debug()
-{
- if [[ -n ${BASH_COMP_DEBUG_FILE:-} ]]; then
- echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
- fi
-}
-
-# Homebrew on Macs have version 1.3 of bash-completion which doesn't include
-# _init_completion. This is a very minimal version of that function.
-__%[1]s_init_completion()
-{
- COMPREPLY=()
- _get_comp_words_by_ref "$@" cur prev words cword
-}
-
-__%[1]s_index_of_word()
-{
- local w word=$1
- shift
- index=0
- for w in "$@"; do
- [[ $w = "$word" ]] && return
- index=$((index+1))
- done
- index=-1
-}
-
-__%[1]s_contains_word()
-{
- local w word=$1; shift
- for w in "$@"; do
- [[ $w = "$word" ]] && return
- done
- return 1
-}
-
-__%[1]s_handle_go_custom_completion()
-{
- __%[1]s_debug "${FUNCNAME[0]}: cur is ${cur}, words[*] is ${words[*]}, #words[@] is ${#words[@]}"
-
- local shellCompDirectiveError=%[3]d
- local shellCompDirectiveNoSpace=%[4]d
- local shellCompDirectiveNoFileComp=%[5]d
- local shellCompDirectiveFilterFileExt=%[6]d
- local shellCompDirectiveFilterDirs=%[7]d
-
- local out requestComp lastParam lastChar comp directive args
-
- # Prepare the command to request completions for the program.
- # Calling ${words[0]} instead of directly %[1]s allows handling aliases
- args=("${words[@]:1}")
- # Disable ActiveHelp which is not supported for bash completion v1
- requestComp="%[8]s=0 ${words[0]} %[2]s ${args[*]}"
-
- lastParam=${words[$((${#words[@]}-1))]}
- lastChar=${lastParam:$((${#lastParam}-1)):1}
- __%[1]s_debug "${FUNCNAME[0]}: lastParam ${lastParam}, lastChar ${lastChar}"
-
- if [ -z "${cur}" ] && [ "${lastChar}" != "=" ]; then
- # If the last parameter is complete (there is a space following it)
- # We add an extra empty parameter so we can indicate this to the go method.
- __%[1]s_debug "${FUNCNAME[0]}: Adding extra empty parameter"
- requestComp="${requestComp} \"\""
- fi
-
- __%[1]s_debug "${FUNCNAME[0]}: calling ${requestComp}"
- # Use eval to handle any environment variables and such
- out=$(eval "${requestComp}" 2>/dev/null)
-
- # Extract the directive integer at the very end of the output following a colon (:)
- directive=${out##*:}
- # Remove the directive
- out=${out%%:*}
- if [ "${directive}" = "${out}" ]; then
- # There is not directive specified
- directive=0
- fi
- __%[1]s_debug "${FUNCNAME[0]}: the completion directive is: ${directive}"
- __%[1]s_debug "${FUNCNAME[0]}: the completions are: ${out}"
-
- if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
- # Error code. No completion.
- __%[1]s_debug "${FUNCNAME[0]}: received error from custom completion go code"
- return
- else
- if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
- if [[ $(type -t compopt) = "builtin" ]]; then
- __%[1]s_debug "${FUNCNAME[0]}: activating no space"
- compopt -o nospace
- fi
- fi
- if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
- if [[ $(type -t compopt) = "builtin" ]]; then
- __%[1]s_debug "${FUNCNAME[0]}: activating no file completion"
- compopt +o default
- fi
- fi
- fi
-
- if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
- # File extension filtering
- local fullFilter filter filteringCmd
- # Do not use quotes around the $out variable or else newline
- # characters will be kept.
- for filter in ${out}; do
- fullFilter+="$filter|"
- done
-
- filteringCmd="_filedir $fullFilter"
- __%[1]s_debug "File filtering command: $filteringCmd"
- $filteringCmd
- elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
- # File completion for directories only
- local subdir
- # Use printf to strip any trailing newline
- subdir=$(printf "%%s" "${out}")
- if [ -n "$subdir" ]; then
- __%[1]s_debug "Listing directories in $subdir"
- __%[1]s_handle_subdirs_in_dir_flag "$subdir"
- else
- __%[1]s_debug "Listing directories in ."
- _filedir -d
- fi
- else
- while IFS='' read -r comp; do
- COMPREPLY+=("$comp")
- done < <(compgen -W "${out}" -- "$cur")
- fi
-}
-
-__%[1]s_handle_reply()
-{
- __%[1]s_debug "${FUNCNAME[0]}"
- local comp
- case $cur in
- -*)
- if [[ $(type -t compopt) = "builtin" ]]; then
- compopt -o nospace
- fi
- local allflags
- if [ ${#must_have_one_flag[@]} -ne 0 ]; then
- allflags=("${must_have_one_flag[@]}")
- else
- allflags=("${flags[*]} ${two_word_flags[*]}")
- fi
- while IFS='' read -r comp; do
- COMPREPLY+=("$comp")
- done < <(compgen -W "${allflags[*]}" -- "$cur")
- if [[ $(type -t compopt) = "builtin" ]]; then
- [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
- fi
-
- # complete after --flag=abc
- if [[ $cur == *=* ]]; then
- if [[ $(type -t compopt) = "builtin" ]]; then
- compopt +o nospace
- fi
-
- local index flag
- flag="${cur%%=*}"
- __%[1]s_index_of_word "${flag}" "${flags_with_completion[@]}"
- COMPREPLY=()
- if [[ ${index} -ge 0 ]]; then
- PREFIX=""
- cur="${cur#*=}"
- ${flags_completion[${index}]}
- if [ -n "${ZSH_VERSION:-}" ]; then
- # zsh completion needs --flag= prefix
- eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )"
- fi
- fi
- fi
-
- if [[ -z "${flag_parsing_disabled}" ]]; then
- # If flag parsing is enabled, we have completed the flags and can return.
- # If flag parsing is disabled, we may not know all (or any) of the flags, so we fallthrough
- # to possibly call handle_go_custom_completion.
- return 0;
- fi
- ;;
- esac
-
- # check if we are handling a flag with special work handling
- local index
- __%[1]s_index_of_word "${prev}" "${flags_with_completion[@]}"
- if [[ ${index} -ge 0 ]]; then
- ${flags_completion[${index}]}
- return
- fi
-
- # we are parsing a flag and don't have a special handler, no completion
- if [[ ${cur} != "${words[cword]}" ]]; then
- return
- fi
-
- local completions
- completions=("${commands[@]}")
- if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
- completions+=("${must_have_one_noun[@]}")
- elif [[ -n "${has_completion_function}" ]]; then
- # if a go completion function is provided, defer to that function
- __%[1]s_handle_go_custom_completion
- fi
- if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
- completions+=("${must_have_one_flag[@]}")
- fi
- while IFS='' read -r comp; do
- COMPREPLY+=("$comp")
- done < <(compgen -W "${completions[*]}" -- "$cur")
-
- if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
- while IFS='' read -r comp; do
- COMPREPLY+=("$comp")
- done < <(compgen -W "${noun_aliases[*]}" -- "$cur")
- fi
-
- if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
- if declare -F __%[1]s_custom_func >/dev/null; then
- # try command name qualified custom func
- __%[1]s_custom_func
- else
- # otherwise fall back to unqualified for compatibility
- declare -F __custom_func >/dev/null && __custom_func
- fi
- fi
-
- # available in bash-completion >= 2, not always present on macOS
- if declare -F __ltrim_colon_completions >/dev/null; then
- __ltrim_colon_completions "$cur"
- fi
-
- # If there is only 1 completion and it is a flag with an = it will be completed
- # but we don't want a space after the =
- if [[ "${#COMPREPLY[@]}" -eq "1" ]] && [[ $(type -t compopt) = "builtin" ]] && [[ "${COMPREPLY[0]}" == --*= ]]; then
- compopt -o nospace
- fi
-}
-
-# The arguments should be in the form "ext1|ext2|extn"
-__%[1]s_handle_filename_extension_flag()
-{
- local ext="$1"
- _filedir "@(${ext})"
-}
-
-__%[1]s_handle_subdirs_in_dir_flag()
-{
- local dir="$1"
- pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return
-}
-
-__%[1]s_handle_flag()
-{
- __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- # if a command required a flag, and we found it, unset must_have_one_flag()
- local flagname=${words[c]}
- local flagvalue=""
- # if the word contained an =
- if [[ ${words[c]} == *"="* ]]; then
- flagvalue=${flagname#*=} # take in as flagvalue after the =
- flagname=${flagname%%=*} # strip everything after the =
- flagname="${flagname}=" # but put the = back
- fi
- __%[1]s_debug "${FUNCNAME[0]}: looking for ${flagname}"
- if __%[1]s_contains_word "${flagname}" "${must_have_one_flag[@]}"; then
- must_have_one_flag=()
- fi
-
- # if you set a flag which only applies to this command, don't show subcommands
- if __%[1]s_contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then
- commands=()
- fi
-
- # keep flag value with flagname as flaghash
- # flaghash variable is an associative array which is only supported in bash > 3.
- if [[ -z "${BASH_VERSION:-}" || "${BASH_VERSINFO[0]:-}" -gt 3 ]]; then
- if [ -n "${flagvalue}" ] ; then
- flaghash[${flagname}]=${flagvalue}
- elif [ -n "${words[ $((c+1)) ]}" ] ; then
- flaghash[${flagname}]=${words[ $((c+1)) ]}
- else
- flaghash[${flagname}]="true" # pad "true" for bool flag
- fi
- fi
-
- # skip the argument to a two word flag
- if [[ ${words[c]} != *"="* ]] && __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then
- __%[1]s_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument"
- c=$((c+1))
- # if we are looking for a flags value, don't show commands
- if [[ $c -eq $cword ]]; then
- commands=()
- fi
- fi
-
- c=$((c+1))
-
-}
-
-__%[1]s_handle_noun()
-{
- __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- if __%[1]s_contains_word "${words[c]}" "${must_have_one_noun[@]}"; then
- must_have_one_noun=()
- elif __%[1]s_contains_word "${words[c]}" "${noun_aliases[@]}"; then
- must_have_one_noun=()
- fi
-
- nouns+=("${words[c]}")
- c=$((c+1))
-}
-
-__%[1]s_handle_command()
-{
- __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- local next_command
- if [[ -n ${last_command} ]]; then
- next_command="_${last_command}_${words[c]//:/__}"
- else
- if [[ $c -eq 0 ]]; then
- next_command="_%[1]s_root_command"
- else
- next_command="_${words[c]//:/__}"
- fi
- fi
- c=$((c+1))
- __%[1]s_debug "${FUNCNAME[0]}: looking for ${next_command}"
- declare -F "$next_command" >/dev/null && $next_command
-}
-
-__%[1]s_handle_word()
-{
- if [[ $c -ge $cword ]]; then
- __%[1]s_handle_reply
- return
- fi
- __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
- if [[ "${words[c]}" == -* ]]; then
- __%[1]s_handle_flag
- elif __%[1]s_contains_word "${words[c]}" "${commands[@]}"; then
- __%[1]s_handle_command
- elif [[ $c -eq 0 ]]; then
- __%[1]s_handle_command
- elif __%[1]s_contains_word "${words[c]}" "${command_aliases[@]}"; then
- # aliashash variable is an associative array which is only supported in bash > 3.
- if [[ -z "${BASH_VERSION:-}" || "${BASH_VERSINFO[0]:-}" -gt 3 ]]; then
- words[c]=${aliashash[${words[c]}]}
- __%[1]s_handle_command
- else
- __%[1]s_handle_noun
- fi
- else
- __%[1]s_handle_noun
- fi
- __%[1]s_handle_word
-}
-
-`, name, ShellCompNoDescRequestCmd,
- ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp,
- ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, activeHelpEnvVar(name)))
-}
-
-func writePostscript(buf io.StringWriter, name string) {
- name = strings.ReplaceAll(name, ":", "__")
- WriteStringAndCheck(buf, fmt.Sprintf("__start_%s()\n", name))
- WriteStringAndCheck(buf, fmt.Sprintf(`{
- local cur prev words cword split
- declare -A flaghash 2>/dev/null || :
- declare -A aliashash 2>/dev/null || :
- if declare -F _init_completion >/dev/null 2>&1; then
- _init_completion -s || return
- else
- __%[1]s_init_completion -n "=" || return
- fi
-
- local c=0
- local flag_parsing_disabled=
- local flags=()
- local two_word_flags=()
- local local_nonpersistent_flags=()
- local flags_with_completion=()
- local flags_completion=()
- local commands=("%[1]s")
- local command_aliases=()
- local must_have_one_flag=()
- local must_have_one_noun=()
- local has_completion_function=""
- local last_command=""
- local nouns=()
- local noun_aliases=()
-
- __%[1]s_handle_word
-}
-
-`, name))
- WriteStringAndCheck(buf, fmt.Sprintf(`if [[ $(type -t compopt) = "builtin" ]]; then
- complete -o default -F __start_%s %s
-else
- complete -o default -o nospace -F __start_%s %s
-fi
-
-`, name, name, name, name))
- WriteStringAndCheck(buf, "# ex: ts=4 sw=4 et filetype=sh\n")
-}
-
-func writeCommands(buf io.StringWriter, cmd *Command) {
- WriteStringAndCheck(buf, " commands=()\n")
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() && c != cmd.helpCommand {
- continue
- }
- WriteStringAndCheck(buf, fmt.Sprintf(" commands+=(%q)\n", c.Name()))
- writeCmdAliases(buf, c)
- }
- WriteStringAndCheck(buf, "\n")
-}
-
-func writeFlagHandler(buf io.StringWriter, name string, annotations map[string][]string, cmd *Command) {
- for key, value := range annotations {
- switch key {
- case BashCompFilenameExt:
- WriteStringAndCheck(buf, fmt.Sprintf(" flags_with_completion+=(%q)\n", name))
-
- var ext string
- if len(value) > 0 {
- ext = fmt.Sprintf("__%s_handle_filename_extension_flag ", cmd.Root().Name()) + strings.Join(value, "|")
- } else {
- ext = "_filedir"
- }
- WriteStringAndCheck(buf, fmt.Sprintf(" flags_completion+=(%q)\n", ext))
- case BashCompCustom:
- WriteStringAndCheck(buf, fmt.Sprintf(" flags_with_completion+=(%q)\n", name))
-
- if len(value) > 0 {
- handlers := strings.Join(value, "; ")
- WriteStringAndCheck(buf, fmt.Sprintf(" flags_completion+=(%q)\n", handlers))
- } else {
- WriteStringAndCheck(buf, " flags_completion+=(:)\n")
- }
- case BashCompSubdirsInDir:
- WriteStringAndCheck(buf, fmt.Sprintf(" flags_with_completion+=(%q)\n", name))
-
- var ext string
- if len(value) == 1 {
- ext = fmt.Sprintf("__%s_handle_subdirs_in_dir_flag ", cmd.Root().Name()) + value[0]
- } else {
- ext = "_filedir -d"
- }
- WriteStringAndCheck(buf, fmt.Sprintf(" flags_completion+=(%q)\n", ext))
- }
- }
-}
-
-const cbn = "\")\n"
-
-func writeShortFlag(buf io.StringWriter, flag *pflag.Flag, cmd *Command) {
- name := flag.Shorthand
- format := " "
- if len(flag.NoOptDefVal) == 0 {
- format += "two_word_"
- }
- format += "flags+=(\"-%s" + cbn
- WriteStringAndCheck(buf, fmt.Sprintf(format, name))
- writeFlagHandler(buf, "-"+name, flag.Annotations, cmd)
-}
-
-func writeFlag(buf io.StringWriter, flag *pflag.Flag, cmd *Command) {
- name := flag.Name
- format := " flags+=(\"--%s"
- if len(flag.NoOptDefVal) == 0 {
- format += "="
- }
- format += cbn
- WriteStringAndCheck(buf, fmt.Sprintf(format, name))
- if len(flag.NoOptDefVal) == 0 {
- format = " two_word_flags+=(\"--%s" + cbn
- WriteStringAndCheck(buf, fmt.Sprintf(format, name))
- }
- writeFlagHandler(buf, "--"+name, flag.Annotations, cmd)
-}
-
-func writeLocalNonPersistentFlag(buf io.StringWriter, flag *pflag.Flag) {
- name := flag.Name
- format := " local_nonpersistent_flags+=(\"--%[1]s" + cbn
- if len(flag.NoOptDefVal) == 0 {
- format += " local_nonpersistent_flags+=(\"--%[1]s=" + cbn
- }
- WriteStringAndCheck(buf, fmt.Sprintf(format, name))
- if len(flag.Shorthand) > 0 {
- WriteStringAndCheck(buf, fmt.Sprintf(" local_nonpersistent_flags+=(\"-%s\")\n", flag.Shorthand))
- }
-}
-
-// prepareCustomAnnotationsForFlags setup annotations for go completions for registered flags
-func prepareCustomAnnotationsForFlags(cmd *Command) {
- flagCompletionMutex.RLock()
- defer flagCompletionMutex.RUnlock()
- for flag := range flagCompletionFunctions {
- // Make sure the completion script calls the __*_go_custom_completion function for
- // every registered flag. We need to do this here (and not when the flag was registered
- // for completion) so that we can know the root command name for the prefix
- // of ___go_custom_completion
- if flag.Annotations == nil {
- flag.Annotations = map[string][]string{}
- }
- flag.Annotations[BashCompCustom] = []string{fmt.Sprintf("__%[1]s_handle_go_custom_completion", cmd.Root().Name())}
- }
-}
-
-func writeFlags(buf io.StringWriter, cmd *Command) {
- prepareCustomAnnotationsForFlags(cmd)
- WriteStringAndCheck(buf, ` flags=()
- two_word_flags=()
- local_nonpersistent_flags=()
- flags_with_completion=()
- flags_completion=()
-
-`)
-
- if cmd.DisableFlagParsing {
- WriteStringAndCheck(buf, " flag_parsing_disabled=1\n")
- }
-
- localNonPersistentFlags := cmd.LocalNonPersistentFlags()
- cmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) {
- if nonCompletableFlag(flag) {
- return
- }
- writeFlag(buf, flag, cmd)
- if len(flag.Shorthand) > 0 {
- writeShortFlag(buf, flag, cmd)
- }
- // localNonPersistentFlags are used to stop the completion of subcommands when one is set
- // if TraverseChildren is true we should allow to complete subcommands
- if localNonPersistentFlags.Lookup(flag.Name) != nil && !cmd.Root().TraverseChildren {
- writeLocalNonPersistentFlag(buf, flag)
- }
- })
- cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {
- if nonCompletableFlag(flag) {
- return
- }
- writeFlag(buf, flag, cmd)
- if len(flag.Shorthand) > 0 {
- writeShortFlag(buf, flag, cmd)
- }
- })
-
- WriteStringAndCheck(buf, "\n")
-}
-
-func writeRequiredFlag(buf io.StringWriter, cmd *Command) {
- WriteStringAndCheck(buf, " must_have_one_flag=()\n")
- flags := cmd.NonInheritedFlags()
- flags.VisitAll(func(flag *pflag.Flag) {
- if nonCompletableFlag(flag) {
- return
- }
- if _, ok := flag.Annotations[BashCompOneRequiredFlag]; ok {
- format := " must_have_one_flag+=(\"--%s"
- if flag.Value.Type() != "bool" {
- format += "="
- }
- format += cbn
- WriteStringAndCheck(buf, fmt.Sprintf(format, flag.Name))
-
- if len(flag.Shorthand) > 0 {
- WriteStringAndCheck(buf, fmt.Sprintf(" must_have_one_flag+=(\"-%s"+cbn, flag.Shorthand))
- }
- }
- })
-}
-
-func writeRequiredNouns(buf io.StringWriter, cmd *Command) {
- WriteStringAndCheck(buf, " must_have_one_noun=()\n")
- sort.Strings(cmd.ValidArgs)
- for _, value := range cmd.ValidArgs {
- // Remove any description that may be included following a tab character.
- // Descriptions are not supported by bash completion.
- value = strings.SplitN(value, "\t", 2)[0]
- WriteStringAndCheck(buf, fmt.Sprintf(" must_have_one_noun+=(%q)\n", value))
- }
- if cmd.ValidArgsFunction != nil {
- WriteStringAndCheck(buf, " has_completion_function=1\n")
- }
-}
-
-func writeCmdAliases(buf io.StringWriter, cmd *Command) {
- if len(cmd.Aliases) == 0 {
- return
- }
-
- sort.Strings(cmd.Aliases)
-
- WriteStringAndCheck(buf, fmt.Sprint(` if [[ -z "${BASH_VERSION:-}" || "${BASH_VERSINFO[0]:-}" -gt 3 ]]; then`, "\n"))
- for _, value := range cmd.Aliases {
- WriteStringAndCheck(buf, fmt.Sprintf(" command_aliases+=(%q)\n", value))
- WriteStringAndCheck(buf, fmt.Sprintf(" aliashash[%q]=%q\n", value, cmd.Name()))
- }
- WriteStringAndCheck(buf, ` fi`)
- WriteStringAndCheck(buf, "\n")
-}
-func writeArgAliases(buf io.StringWriter, cmd *Command) {
- WriteStringAndCheck(buf, " noun_aliases=()\n")
- sort.Strings(cmd.ArgAliases)
- for _, value := range cmd.ArgAliases {
- WriteStringAndCheck(buf, fmt.Sprintf(" noun_aliases+=(%q)\n", value))
- }
-}
-
-func gen(buf io.StringWriter, cmd *Command) {
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() && c != cmd.helpCommand {
- continue
- }
- gen(buf, c)
- }
- commandName := cmd.CommandPath()
- commandName = strings.ReplaceAll(commandName, " ", "_")
- commandName = strings.ReplaceAll(commandName, ":", "__")
-
- if cmd.Root() == cmd {
- WriteStringAndCheck(buf, fmt.Sprintf("_%s_root_command()\n{\n", commandName))
- } else {
- WriteStringAndCheck(buf, fmt.Sprintf("_%s()\n{\n", commandName))
- }
-
- WriteStringAndCheck(buf, fmt.Sprintf(" last_command=%q\n", commandName))
- WriteStringAndCheck(buf, "\n")
- WriteStringAndCheck(buf, " command_aliases=()\n")
- WriteStringAndCheck(buf, "\n")
-
- writeCommands(buf, cmd)
- writeFlags(buf, cmd)
- writeRequiredFlag(buf, cmd)
- writeRequiredNouns(buf, cmd)
- writeArgAliases(buf, cmd)
- WriteStringAndCheck(buf, "}\n\n")
-}
-
-// GenBashCompletion generates bash completion file and writes to the passed writer.
-func (c *Command) GenBashCompletion(w io.Writer) error {
- buf := new(bytes.Buffer)
- writePreamble(buf, c.Name())
- if len(c.BashCompletionFunction) > 0 {
- buf.WriteString(c.BashCompletionFunction + "\n")
- }
- gen(buf, c)
- writePostscript(buf, c.Name())
-
- _, err := buf.WriteTo(w)
- return err
-}
-
-func nonCompletableFlag(flag *pflag.Flag) bool {
- return flag.Hidden || len(flag.Deprecated) > 0
-}
-
-// GenBashCompletionFile generates bash completion file.
-func (c *Command) GenBashCompletionFile(filename string) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return c.GenBashCompletion(outFile)
-}
diff --git a/vendor/github.com/spf13/cobra/bash_completionsV2.go b/vendor/github.com/spf13/cobra/bash_completionsV2.go
deleted file mode 100644
index 1cce5c329..000000000
--- a/vendor/github.com/spf13/cobra/bash_completionsV2.go
+++ /dev/null
@@ -1,396 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
-)
-
-func (c *Command) genBashCompletion(w io.Writer, includeDesc bool) error {
- buf := new(bytes.Buffer)
- genBashComp(buf, c.Name(), includeDesc)
- _, err := buf.WriteTo(w)
- return err
-}
-
-func genBashComp(buf io.StringWriter, name string, includeDesc bool) {
- compCmd := ShellCompRequestCmd
- if !includeDesc {
- compCmd = ShellCompNoDescRequestCmd
- }
-
- WriteStringAndCheck(buf, fmt.Sprintf(`# bash completion V2 for %-36[1]s -*- shell-script -*-
-
-__%[1]s_debug()
-{
- if [[ -n ${BASH_COMP_DEBUG_FILE-} ]]; then
- echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
- fi
-}
-
-# Macs have bash3 for which the bash-completion package doesn't include
-# _init_completion. This is a minimal version of that function.
-__%[1]s_init_completion()
-{
- COMPREPLY=()
- _get_comp_words_by_ref "$@" cur prev words cword
-}
-
-# This function calls the %[1]s program to obtain the completion
-# results and the directive. It fills the 'out' and 'directive' vars.
-__%[1]s_get_completion_results() {
- local requestComp lastParam lastChar args
-
- # Prepare the command to request completions for the program.
- # Calling ${words[0]} instead of directly %[1]s allows handling aliases
- args=("${words[@]:1}")
- requestComp="${words[0]} %[2]s ${args[*]}"
-
- lastParam=${words[$((${#words[@]}-1))]}
- lastChar=${lastParam:$((${#lastParam}-1)):1}
- __%[1]s_debug "lastParam ${lastParam}, lastChar ${lastChar}"
-
- if [[ -z ${cur} && ${lastChar} != = ]]; then
- # If the last parameter is complete (there is a space following it)
- # We add an extra empty parameter so we can indicate this to the go method.
- __%[1]s_debug "Adding extra empty parameter"
- requestComp="${requestComp} ''"
- fi
-
- # When completing a flag with an = (e.g., %[1]s -n=)
- # bash focuses on the part after the =, so we need to remove
- # the flag part from $cur
- if [[ ${cur} == -*=* ]]; then
- cur="${cur#*=}"
- fi
-
- __%[1]s_debug "Calling ${requestComp}"
- # Use eval to handle any environment variables and such
- out=$(eval "${requestComp}" 2>/dev/null)
-
- # Extract the directive integer at the very end of the output following a colon (:)
- directive=${out##*:}
- # Remove the directive
- out=${out%%:*}
- if [[ ${directive} == "${out}" ]]; then
- # There is not directive specified
- directive=0
- fi
- __%[1]s_debug "The completion directive is: ${directive}"
- __%[1]s_debug "The completions are: ${out}"
-}
-
-__%[1]s_process_completion_results() {
- local shellCompDirectiveError=%[3]d
- local shellCompDirectiveNoSpace=%[4]d
- local shellCompDirectiveNoFileComp=%[5]d
- local shellCompDirectiveFilterFileExt=%[6]d
- local shellCompDirectiveFilterDirs=%[7]d
- local shellCompDirectiveKeepOrder=%[8]d
-
- if (((directive & shellCompDirectiveError) != 0)); then
- # Error code. No completion.
- __%[1]s_debug "Received error from custom completion go code"
- return
- else
- if (((directive & shellCompDirectiveNoSpace) != 0)); then
- if [[ $(type -t compopt) == builtin ]]; then
- __%[1]s_debug "Activating no space"
- compopt -o nospace
- else
- __%[1]s_debug "No space directive not supported in this version of bash"
- fi
- fi
- if (((directive & shellCompDirectiveKeepOrder) != 0)); then
- if [[ $(type -t compopt) == builtin ]]; then
- # no sort isn't supported for bash less than < 4.4
- if [[ ${BASH_VERSINFO[0]} -lt 4 || ( ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VERSINFO[1]} -lt 4 ) ]]; then
- __%[1]s_debug "No sort directive not supported in this version of bash"
- else
- __%[1]s_debug "Activating keep order"
- compopt -o nosort
- fi
- else
- __%[1]s_debug "No sort directive not supported in this version of bash"
- fi
- fi
- if (((directive & shellCompDirectiveNoFileComp) != 0)); then
- if [[ $(type -t compopt) == builtin ]]; then
- __%[1]s_debug "Activating no file completion"
- compopt +o default
- else
- __%[1]s_debug "No file completion directive not supported in this version of bash"
- fi
- fi
- fi
-
- # Separate activeHelp from normal completions
- local completions=()
- local activeHelp=()
- __%[1]s_extract_activeHelp
-
- if (((directive & shellCompDirectiveFilterFileExt) != 0)); then
- # File extension filtering
- local fullFilter filter filteringCmd
-
- # Do not use quotes around the $completions variable or else newline
- # characters will be kept.
- for filter in ${completions[*]}; do
- fullFilter+="$filter|"
- done
-
- filteringCmd="_filedir $fullFilter"
- __%[1]s_debug "File filtering command: $filteringCmd"
- $filteringCmd
- elif (((directive & shellCompDirectiveFilterDirs) != 0)); then
- # File completion for directories only
-
- local subdir
- subdir=${completions[0]}
- if [[ -n $subdir ]]; then
- __%[1]s_debug "Listing directories in $subdir"
- pushd "$subdir" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return
- else
- __%[1]s_debug "Listing directories in ."
- _filedir -d
- fi
- else
- __%[1]s_handle_completion_types
- fi
-
- __%[1]s_handle_special_char "$cur" :
- __%[1]s_handle_special_char "$cur" =
-
- # Print the activeHelp statements before we finish
- if ((${#activeHelp[*]} != 0)); then
- printf "\n";
- printf "%%s\n" "${activeHelp[@]}"
- printf "\n"
-
- # The prompt format is only available from bash 4.4.
- # We test if it is available before using it.
- if (x=${PS1@P}) 2> /dev/null; then
- printf "%%s" "${PS1@P}${COMP_LINE[@]}"
- else
- # Can't print the prompt. Just print the
- # text the user had typed, it is workable enough.
- printf "%%s" "${COMP_LINE[@]}"
- fi
- fi
-}
-
-# Separate activeHelp lines from real completions.
-# Fills the $activeHelp and $completions arrays.
-__%[1]s_extract_activeHelp() {
- local activeHelpMarker="%[9]s"
- local endIndex=${#activeHelpMarker}
-
- while IFS='' read -r comp; do
- if [[ ${comp:0:endIndex} == $activeHelpMarker ]]; then
- comp=${comp:endIndex}
- __%[1]s_debug "ActiveHelp found: $comp"
- if [[ -n $comp ]]; then
- activeHelp+=("$comp")
- fi
- else
- # Not an activeHelp line but a normal completion
- completions+=("$comp")
- fi
- done <<<"${out}"
-}
-
-__%[1]s_handle_completion_types() {
- __%[1]s_debug "__%[1]s_handle_completion_types: COMP_TYPE is $COMP_TYPE"
-
- case $COMP_TYPE in
- 37|42)
- # Type: menu-complete/menu-complete-backward and insert-completions
- # If the user requested inserting one completion at a time, or all
- # completions at once on the command-line we must remove the descriptions.
- # https://github.com/spf13/cobra/issues/1508
- local tab=$'\t' comp
- while IFS='' read -r comp; do
- [[ -z $comp ]] && continue
- # Strip any description
- comp=${comp%%%%$tab*}
- # Only consider the completions that match
- if [[ $comp == "$cur"* ]]; then
- COMPREPLY+=("$comp")
- fi
- done < <(printf "%%s\n" "${completions[@]}")
- ;;
-
- *)
- # Type: complete (normal completion)
- __%[1]s_handle_standard_completion_case
- ;;
- esac
-}
-
-__%[1]s_handle_standard_completion_case() {
- local tab=$'\t' comp
-
- # Short circuit to optimize if we don't have descriptions
- if [[ "${completions[*]}" != *$tab* ]]; then
- IFS=$'\n' read -ra COMPREPLY -d '' < <(compgen -W "${completions[*]}" -- "$cur")
- return 0
- fi
-
- local longest=0
- local compline
- # Look for the longest completion so that we can format things nicely
- while IFS='' read -r compline; do
- [[ -z $compline ]] && continue
- # Strip any description before checking the length
- comp=${compline%%%%$tab*}
- # Only consider the completions that match
- [[ $comp == "$cur"* ]] || continue
- COMPREPLY+=("$compline")
- if ((${#comp}>longest)); then
- longest=${#comp}
- fi
- done < <(printf "%%s\n" "${completions[@]}")
-
- # If there is a single completion left, remove the description text
- if ((${#COMPREPLY[*]} == 1)); then
- __%[1]s_debug "COMPREPLY[0]: ${COMPREPLY[0]}"
- comp="${COMPREPLY[0]%%%%$tab*}"
- __%[1]s_debug "Removed description from single completion, which is now: ${comp}"
- COMPREPLY[0]=$comp
- else # Format the descriptions
- __%[1]s_format_comp_descriptions $longest
- fi
-}
-
-__%[1]s_handle_special_char()
-{
- local comp="$1"
- local char=$2
- if [[ "$comp" == *${char}* && "$COMP_WORDBREAKS" == *${char}* ]]; then
- local word=${comp%%"${comp##*${char}}"}
- local idx=${#COMPREPLY[*]}
- while ((--idx >= 0)); do
- COMPREPLY[idx]=${COMPREPLY[idx]#"$word"}
- done
- fi
-}
-
-__%[1]s_format_comp_descriptions()
-{
- local tab=$'\t'
- local comp desc maxdesclength
- local longest=$1
-
- local i ci
- for ci in ${!COMPREPLY[*]}; do
- comp=${COMPREPLY[ci]}
- # Properly format the description string which follows a tab character if there is one
- if [[ "$comp" == *$tab* ]]; then
- __%[1]s_debug "Original comp: $comp"
- desc=${comp#*$tab}
- comp=${comp%%%%$tab*}
-
- # $COLUMNS stores the current shell width.
- # Remove an extra 4 because we add 2 spaces and 2 parentheses.
- maxdesclength=$(( COLUMNS - longest - 4 ))
-
- # Make sure we can fit a description of at least 8 characters
- # if we are to align the descriptions.
- if ((maxdesclength > 8)); then
- # Add the proper number of spaces to align the descriptions
- for ((i = ${#comp} ; i < longest ; i++)); do
- comp+=" "
- done
- else
- # Don't pad the descriptions so we can fit more text after the completion
- maxdesclength=$(( COLUMNS - ${#comp} - 4 ))
- fi
-
- # If there is enough space for any description text,
- # truncate the descriptions that are too long for the shell width
- if ((maxdesclength > 0)); then
- if ((${#desc} > maxdesclength)); then
- desc=${desc:0:$(( maxdesclength - 1 ))}
- desc+="…"
- fi
- comp+=" ($desc)"
- fi
- COMPREPLY[ci]=$comp
- __%[1]s_debug "Final comp: $comp"
- fi
- done
-}
-
-__start_%[1]s()
-{
- local cur prev words cword split
-
- COMPREPLY=()
-
- # Call _init_completion from the bash-completion package
- # to prepare the arguments properly
- if declare -F _init_completion >/dev/null 2>&1; then
- _init_completion -n =: || return
- else
- __%[1]s_init_completion -n =: || return
- fi
-
- __%[1]s_debug
- __%[1]s_debug "========= starting completion logic =========="
- __%[1]s_debug "cur is ${cur}, words[*] is ${words[*]}, #words[@] is ${#words[@]}, cword is $cword"
-
- # The user could have moved the cursor backwards on the command-line.
- # We need to trigger completion from the $cword location, so we need
- # to truncate the command-line ($words) up to the $cword location.
- words=("${words[@]:0:$cword+1}")
- __%[1]s_debug "Truncated words[*]: ${words[*]},"
-
- local out directive
- __%[1]s_get_completion_results
- __%[1]s_process_completion_results
-}
-
-if [[ $(type -t compopt) = "builtin" ]]; then
- complete -o default -F __start_%[1]s %[1]s
-else
- complete -o default -o nospace -F __start_%[1]s %[1]s
-fi
-
-# ex: ts=4 sw=4 et filetype=sh
-`, name, compCmd,
- ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp,
- ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder,
- activeHelpMarker))
-}
-
-// GenBashCompletionFileV2 generates Bash completion version 2.
-func (c *Command) GenBashCompletionFileV2(filename string, includeDesc bool) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return c.GenBashCompletionV2(outFile, includeDesc)
-}
-
-// GenBashCompletionV2 generates Bash completion file version 2
-// and writes it to the passed writer.
-func (c *Command) GenBashCompletionV2(w io.Writer, includeDesc bool) error {
- return c.genBashCompletion(w, includeDesc)
-}
diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go
deleted file mode 100644
index e0b0947b0..000000000
--- a/vendor/github.com/spf13/cobra/cobra.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Commands similar to git, go tools and other modern CLI tools
-// inspired by go, go-Commander, gh and subcommand
-
-package cobra
-
-import (
- "fmt"
- "io"
- "os"
- "reflect"
- "strconv"
- "strings"
- "text/template"
- "time"
- "unicode"
-)
-
-var templateFuncs = template.FuncMap{
- "trim": strings.TrimSpace,
- "trimRightSpace": trimRightSpace,
- "trimTrailingWhitespaces": trimRightSpace,
- "appendIfNotPresent": appendIfNotPresent,
- "rpad": rpad,
- "gt": Gt,
- "eq": Eq,
-}
-
-var initializers []func()
-var finalizers []func()
-
-const (
- defaultPrefixMatching = false
- defaultCommandSorting = true
- defaultCaseInsensitive = false
- defaultTraverseRunHooks = false
-)
-
-// EnablePrefixMatching allows setting automatic prefix matching. Automatic prefix matching can be a dangerous thing
-// to automatically enable in CLI tools.
-// Set this to true to enable it.
-var EnablePrefixMatching = defaultPrefixMatching
-
-// EnableCommandSorting controls sorting of the slice of commands, which is turned on by default.
-// To disable sorting, set it to false.
-var EnableCommandSorting = defaultCommandSorting
-
-// EnableCaseInsensitive allows case-insensitive commands names. (case sensitive by default)
-var EnableCaseInsensitive = defaultCaseInsensitive
-
-// EnableTraverseRunHooks executes persistent pre-run and post-run hooks from all parents.
-// By default this is disabled, which means only the first run hook to be found is executed.
-var EnableTraverseRunHooks = defaultTraverseRunHooks
-
-// MousetrapHelpText enables an information splash screen on Windows
-// if the CLI is started from explorer.exe.
-// To disable the mousetrap, just set this variable to blank string ("").
-// Works only on Microsoft Windows.
-var MousetrapHelpText = `This is a command line tool.
-
-You need to open cmd.exe and run it from there.
-`
-
-// MousetrapDisplayDuration controls how long the MousetrapHelpText message is displayed on Windows
-// if the CLI is started from explorer.exe. Set to 0 to wait for the return key to be pressed.
-// To disable the mousetrap, just set MousetrapHelpText to blank string ("").
-// Works only on Microsoft Windows.
-var MousetrapDisplayDuration = 5 * time.Second
-
-// AddTemplateFunc adds a template function that's available to Usage and Help
-// template generation.
-func AddTemplateFunc(name string, tmplFunc interface{}) {
- templateFuncs[name] = tmplFunc
-}
-
-// AddTemplateFuncs adds multiple template functions that are available to Usage and
-// Help template generation.
-func AddTemplateFuncs(tmplFuncs template.FuncMap) {
- for k, v := range tmplFuncs {
- templateFuncs[k] = v
- }
-}
-
-// OnInitialize sets the passed functions to be run when each command's
-// Execute method is called.
-func OnInitialize(y ...func()) {
- initializers = append(initializers, y...)
-}
-
-// OnFinalize sets the passed functions to be run when each command's
-// Execute method is terminated.
-func OnFinalize(y ...func()) {
- finalizers = append(finalizers, y...)
-}
-
-// FIXME Gt is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra.
-
-// Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans,
-// Maps and Slices, Gt will compare their lengths. Ints are compared directly while strings are first parsed as
-// ints and then compared.
-func Gt(a interface{}, b interface{}) bool {
- var left, right int64
- av := reflect.ValueOf(a)
-
- switch av.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- left = int64(av.Len())
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- left = av.Int()
- case reflect.String:
- left, _ = strconv.ParseInt(av.String(), 10, 64)
- }
-
- bv := reflect.ValueOf(b)
-
- switch bv.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- right = int64(bv.Len())
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- right = bv.Int()
- case reflect.String:
- right, _ = strconv.ParseInt(bv.String(), 10, 64)
- }
-
- return left > right
-}
-
-// FIXME Eq is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra.
-
-// Eq takes two types and checks whether they are equal. Supported types are int and string. Unsupported types will panic.
-func Eq(a interface{}, b interface{}) bool {
- av := reflect.ValueOf(a)
- bv := reflect.ValueOf(b)
-
- switch av.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- panic("Eq called on unsupported type")
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return av.Int() == bv.Int()
- case reflect.String:
- return av.String() == bv.String()
- }
- return false
-}
-
-func trimRightSpace(s string) string {
- return strings.TrimRightFunc(s, unicode.IsSpace)
-}
-
-// FIXME appendIfNotPresent is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra.
-
-// appendIfNotPresent will append stringToAppend to the end of s, but only if it's not yet present in s.
-func appendIfNotPresent(s, stringToAppend string) string {
- if strings.Contains(s, stringToAppend) {
- return s
- }
- return s + " " + stringToAppend
-}
-
-// rpad adds padding to the right of a string.
-func rpad(s string, padding int) string {
- formattedString := fmt.Sprintf("%%-%ds", padding)
- return fmt.Sprintf(formattedString, s)
-}
-
-// tmpl executes the given template text on data, writing the result to w.
-func tmpl(w io.Writer, text string, data interface{}) error {
- t := template.New("top")
- t.Funcs(templateFuncs)
- template.Must(t.Parse(text))
- return t.Execute(w, data)
-}
-
-// ld compares two strings and returns the levenshtein distance between them.
-func ld(s, t string, ignoreCase bool) int {
- if ignoreCase {
- s = strings.ToLower(s)
- t = strings.ToLower(t)
- }
- d := make([][]int, len(s)+1)
- for i := range d {
- d[i] = make([]int, len(t)+1)
- d[i][0] = i
- }
- for j := range d[0] {
- d[0][j] = j
- }
- for j := 1; j <= len(t); j++ {
- for i := 1; i <= len(s); i++ {
- if s[i-1] == t[j-1] {
- d[i][j] = d[i-1][j-1]
- } else {
- min := d[i-1][j]
- if d[i][j-1] < min {
- min = d[i][j-1]
- }
- if d[i-1][j-1] < min {
- min = d[i-1][j-1]
- }
- d[i][j] = min + 1
- }
- }
-
- }
- return d[len(s)][len(t)]
-}
-
-func stringInSlice(a string, list []string) bool {
- for _, b := range list {
- if b == a {
- return true
- }
- }
- return false
-}
-
-// CheckErr prints the msg with the prefix 'Error:' and exits with error code 1. If the msg is nil, it does nothing.
-func CheckErr(msg interface{}) {
- if msg != nil {
- fmt.Fprintln(os.Stderr, "Error:", msg)
- os.Exit(1)
- }
-}
-
-// WriteStringAndCheck writes a string into a buffer, and checks if the error is not nil.
-func WriteStringAndCheck(b io.StringWriter, s string) {
- _, err := b.WriteString(s)
- CheckErr(err)
-}
diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go
deleted file mode 100644
index 54748fc67..000000000
--- a/vendor/github.com/spf13/cobra/command.go
+++ /dev/null
@@ -1,1896 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
-// In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code.
-package cobra
-
-import (
- "bytes"
- "context"
- "errors"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "sort"
- "strings"
-
- flag "github.com/spf13/pflag"
-)
-
-const (
- FlagSetByCobraAnnotation = "cobra_annotation_flag_set_by_cobra"
- CommandDisplayNameAnnotation = "cobra_annotation_command_display_name"
-)
-
-// FParseErrWhitelist configures Flag parse errors to be ignored
-type FParseErrWhitelist flag.ParseErrorsWhitelist
-
-// Group Structure to manage groups for commands
-type Group struct {
- ID string
- Title string
-}
-
-// Command is just that, a command for your application.
-// E.g. 'go run ...' - 'run' is the command. Cobra requires
-// you to define the usage and description as part of your command
-// definition to ensure usability.
-type Command struct {
- // Use is the one-line usage message.
- // Recommended syntax is as follows:
- // [ ] identifies an optional argument. Arguments that are not enclosed in brackets are required.
- // ... indicates that you can specify multiple values for the previous argument.
- // | indicates mutually exclusive information. You can use the argument to the left of the separator or the
- // argument to the right of the separator. You cannot use both arguments in a single use of the command.
- // { } delimits a set of mutually exclusive arguments when one of the arguments is required. If the arguments are
- // optional, they are enclosed in brackets ([ ]).
- // Example: add [-F file | -D dir]... [-f format] profile
- Use string
-
- // Aliases is an array of aliases that can be used instead of the first word in Use.
- Aliases []string
-
- // SuggestFor is an array of command names for which this command will be suggested -
- // similar to aliases but only suggests.
- SuggestFor []string
-
- // Short is the short description shown in the 'help' output.
- Short string
-
- // The group id under which this subcommand is grouped in the 'help' output of its parent.
- GroupID string
-
- // Long is the long message shown in the 'help ' output.
- Long string
-
- // Example is examples of how to use the command.
- Example string
-
- // ValidArgs is list of all valid non-flag arguments that are accepted in shell completions
- ValidArgs []string
- // ValidArgsFunction is an optional function that provides valid non-flag arguments for shell completion.
- // It is a dynamic version of using ValidArgs.
- // Only one of ValidArgs and ValidArgsFunction can be used for a command.
- ValidArgsFunction func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)
-
- // Expected arguments
- Args PositionalArgs
-
- // ArgAliases is List of aliases for ValidArgs.
- // These are not suggested to the user in the shell completion,
- // but accepted if entered manually.
- ArgAliases []string
-
- // BashCompletionFunction is custom bash functions used by the legacy bash autocompletion generator.
- // For portability with other shells, it is recommended to instead use ValidArgsFunction
- BashCompletionFunction string
-
- // Deprecated defines, if this command is deprecated and should print this string when used.
- Deprecated string
-
- // Annotations are key/value pairs that can be used by applications to identify or
- // group commands or set special options.
- Annotations map[string]string
-
- // Version defines the version for this command. If this value is non-empty and the command does not
- // define a "version" flag, a "version" boolean flag will be added to the command and, if specified,
- // will print content of the "Version" variable. A shorthand "v" flag will also be added if the
- // command does not define one.
- Version string
-
- // The *Run functions are executed in the following order:
- // * PersistentPreRun()
- // * PreRun()
- // * Run()
- // * PostRun()
- // * PersistentPostRun()
- // All functions get the same args, the arguments after the command name.
- // The *PreRun and *PostRun functions will only be executed if the Run function of the current
- // command has been declared.
- //
- // PersistentPreRun: children of this command will inherit and execute.
- PersistentPreRun func(cmd *Command, args []string)
- // PersistentPreRunE: PersistentPreRun but returns an error.
- PersistentPreRunE func(cmd *Command, args []string) error
- // PreRun: children of this command will not inherit.
- PreRun func(cmd *Command, args []string)
- // PreRunE: PreRun but returns an error.
- PreRunE func(cmd *Command, args []string) error
- // Run: Typically the actual work function. Most commands will only implement this.
- Run func(cmd *Command, args []string)
- // RunE: Run but returns an error.
- RunE func(cmd *Command, args []string) error
- // PostRun: run after the Run command.
- PostRun func(cmd *Command, args []string)
- // PostRunE: PostRun but returns an error.
- PostRunE func(cmd *Command, args []string) error
- // PersistentPostRun: children of this command will inherit and execute after PostRun.
- PersistentPostRun func(cmd *Command, args []string)
- // PersistentPostRunE: PersistentPostRun but returns an error.
- PersistentPostRunE func(cmd *Command, args []string) error
-
- // groups for subcommands
- commandgroups []*Group
-
- // args is actual args parsed from flags.
- args []string
- // flagErrorBuf contains all error messages from pflag.
- flagErrorBuf *bytes.Buffer
- // flags is full set of flags.
- flags *flag.FlagSet
- // pflags contains persistent flags.
- pflags *flag.FlagSet
- // lflags contains local flags.
- // This field does not represent internal state, it's used as a cache to optimise LocalFlags function call
- lflags *flag.FlagSet
- // iflags contains inherited flags.
- // This field does not represent internal state, it's used as a cache to optimise InheritedFlags function call
- iflags *flag.FlagSet
- // parentsPflags is all persistent flags of cmd's parents.
- parentsPflags *flag.FlagSet
- // globNormFunc is the global normalization function
- // that we can use on every pflag set and children commands
- globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName
-
- // usageFunc is usage func defined by user.
- usageFunc func(*Command) error
- // usageTemplate is usage template defined by user.
- usageTemplate string
- // flagErrorFunc is func defined by user and it's called when the parsing of
- // flags returns an error.
- flagErrorFunc func(*Command, error) error
- // helpTemplate is help template defined by user.
- helpTemplate string
- // helpFunc is help func defined by user.
- helpFunc func(*Command, []string)
- // helpCommand is command with usage 'help'. If it's not defined by user,
- // cobra uses default help command.
- helpCommand *Command
- // helpCommandGroupID is the group id for the helpCommand
- helpCommandGroupID string
-
- // completionCommandGroupID is the group id for the completion command
- completionCommandGroupID string
-
- // versionTemplate is the version template defined by user.
- versionTemplate string
-
- // errPrefix is the error message prefix defined by user.
- errPrefix string
-
- // inReader is a reader defined by the user that replaces stdin
- inReader io.Reader
- // outWriter is a writer defined by the user that replaces stdout
- outWriter io.Writer
- // errWriter is a writer defined by the user that replaces stderr
- errWriter io.Writer
-
- // FParseErrWhitelist flag parse errors to be ignored
- FParseErrWhitelist FParseErrWhitelist
-
- // CompletionOptions is a set of options to control the handling of shell completion
- CompletionOptions CompletionOptions
-
- // commandsAreSorted defines, if command slice are sorted or not.
- commandsAreSorted bool
- // commandCalledAs is the name or alias value used to call this command.
- commandCalledAs struct {
- name string
- called bool
- }
-
- ctx context.Context
-
- // commands is the list of commands supported by this program.
- commands []*Command
- // parent is a parent command for this command.
- parent *Command
- // Max lengths of commands' string lengths for use in padding.
- commandsMaxUseLen int
- commandsMaxCommandPathLen int
- commandsMaxNameLen int
-
- // TraverseChildren parses flags on all parents before executing child command.
- TraverseChildren bool
-
- // Hidden defines, if this command is hidden and should NOT show up in the list of available commands.
- Hidden bool
-
- // SilenceErrors is an option to quiet errors down stream.
- SilenceErrors bool
-
- // SilenceUsage is an option to silence usage when an error occurs.
- SilenceUsage bool
-
- // DisableFlagParsing disables the flag parsing.
- // If this is true all flags will be passed to the command as arguments.
- DisableFlagParsing bool
-
- // DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...")
- // will be printed by generating docs for this command.
- DisableAutoGenTag bool
-
- // DisableFlagsInUseLine will disable the addition of [flags] to the usage
- // line of a command when printing help or generating docs
- DisableFlagsInUseLine bool
-
- // DisableSuggestions disables the suggestions based on Levenshtein distance
- // that go along with 'unknown command' messages.
- DisableSuggestions bool
-
- // SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions.
- // Must be > 0.
- SuggestionsMinimumDistance int
-}
-
-// Context returns underlying command context. If command was executed
-// with ExecuteContext or the context was set with SetContext, the
-// previously set context will be returned. Otherwise, nil is returned.
-//
-// Notice that a call to Execute and ExecuteC will replace a nil context of
-// a command with a context.Background, so a background context will be
-// returned by Context after one of these functions has been called.
-func (c *Command) Context() context.Context {
- return c.ctx
-}
-
-// SetContext sets context for the command. This context will be overwritten by
-// Command.ExecuteContext or Command.ExecuteContextC.
-func (c *Command) SetContext(ctx context.Context) {
- c.ctx = ctx
-}
-
-// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
-// particularly useful when testing.
-func (c *Command) SetArgs(a []string) {
- c.args = a
-}
-
-// SetOutput sets the destination for usage and error messages.
-// If output is nil, os.Stderr is used.
-// Deprecated: Use SetOut and/or SetErr instead
-func (c *Command) SetOutput(output io.Writer) {
- c.outWriter = output
- c.errWriter = output
-}
-
-// SetOut sets the destination for usage messages.
-// If newOut is nil, os.Stdout is used.
-func (c *Command) SetOut(newOut io.Writer) {
- c.outWriter = newOut
-}
-
-// SetErr sets the destination for error messages.
-// If newErr is nil, os.Stderr is used.
-func (c *Command) SetErr(newErr io.Writer) {
- c.errWriter = newErr
-}
-
-// SetIn sets the source for input data
-// If newIn is nil, os.Stdin is used.
-func (c *Command) SetIn(newIn io.Reader) {
- c.inReader = newIn
-}
-
-// SetUsageFunc sets usage function. Usage can be defined by application.
-func (c *Command) SetUsageFunc(f func(*Command) error) {
- c.usageFunc = f
-}
-
-// SetUsageTemplate sets usage template. Can be defined by Application.
-func (c *Command) SetUsageTemplate(s string) {
- c.usageTemplate = s
-}
-
-// SetFlagErrorFunc sets a function to generate an error when flag parsing
-// fails.
-func (c *Command) SetFlagErrorFunc(f func(*Command, error) error) {
- c.flagErrorFunc = f
-}
-
-// SetHelpFunc sets help function. Can be defined by Application.
-func (c *Command) SetHelpFunc(f func(*Command, []string)) {
- c.helpFunc = f
-}
-
-// SetHelpCommand sets help command.
-func (c *Command) SetHelpCommand(cmd *Command) {
- c.helpCommand = cmd
-}
-
-// SetHelpCommandGroupID sets the group id of the help command.
-func (c *Command) SetHelpCommandGroupID(groupID string) {
- if c.helpCommand != nil {
- c.helpCommand.GroupID = groupID
- }
- // helpCommandGroupID is used if no helpCommand is defined by the user
- c.helpCommandGroupID = groupID
-}
-
-// SetCompletionCommandGroupID sets the group id of the completion command.
-func (c *Command) SetCompletionCommandGroupID(groupID string) {
- // completionCommandGroupID is used if no completion command is defined by the user
- c.Root().completionCommandGroupID = groupID
-}
-
-// SetHelpTemplate sets help template to be used. Application can use it to set custom template.
-func (c *Command) SetHelpTemplate(s string) {
- c.helpTemplate = s
-}
-
-// SetVersionTemplate sets version template to be used. Application can use it to set custom template.
-func (c *Command) SetVersionTemplate(s string) {
- c.versionTemplate = s
-}
-
-// SetErrPrefix sets error message prefix to be used. Application can use it to set custom prefix.
-func (c *Command) SetErrPrefix(s string) {
- c.errPrefix = s
-}
-
-// SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands.
-// The user should not have a cyclic dependency on commands.
-func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string) flag.NormalizedName) {
- c.Flags().SetNormalizeFunc(n)
- c.PersistentFlags().SetNormalizeFunc(n)
- c.globNormFunc = n
-
- for _, command := range c.commands {
- command.SetGlobalNormalizationFunc(n)
- }
-}
-
-// OutOrStdout returns output to stdout.
-func (c *Command) OutOrStdout() io.Writer {
- return c.getOut(os.Stdout)
-}
-
-// OutOrStderr returns output to stderr
-func (c *Command) OutOrStderr() io.Writer {
- return c.getOut(os.Stderr)
-}
-
-// ErrOrStderr returns output to stderr
-func (c *Command) ErrOrStderr() io.Writer {
- return c.getErr(os.Stderr)
-}
-
-// InOrStdin returns input to stdin
-func (c *Command) InOrStdin() io.Reader {
- return c.getIn(os.Stdin)
-}
-
-func (c *Command) getOut(def io.Writer) io.Writer {
- if c.outWriter != nil {
- return c.outWriter
- }
- if c.HasParent() {
- return c.parent.getOut(def)
- }
- return def
-}
-
-func (c *Command) getErr(def io.Writer) io.Writer {
- if c.errWriter != nil {
- return c.errWriter
- }
- if c.HasParent() {
- return c.parent.getErr(def)
- }
- return def
-}
-
-func (c *Command) getIn(def io.Reader) io.Reader {
- if c.inReader != nil {
- return c.inReader
- }
- if c.HasParent() {
- return c.parent.getIn(def)
- }
- return def
-}
-
-// UsageFunc returns either the function set by SetUsageFunc for this command
-// or a parent, or it returns a default usage function.
-func (c *Command) UsageFunc() (f func(*Command) error) {
- if c.usageFunc != nil {
- return c.usageFunc
- }
- if c.HasParent() {
- return c.Parent().UsageFunc()
- }
- return func(c *Command) error {
- c.mergePersistentFlags()
- err := tmpl(c.OutOrStderr(), c.UsageTemplate(), c)
- if err != nil {
- c.PrintErrln(err)
- }
- return err
- }
-}
-
-// Usage puts out the usage for the command.
-// Used when a user provides invalid input.
-// Can be defined by user by overriding UsageFunc.
-func (c *Command) Usage() error {
- return c.UsageFunc()(c)
-}
-
-// HelpFunc returns either the function set by SetHelpFunc for this command
-// or a parent, or it returns a function with default help behavior.
-func (c *Command) HelpFunc() func(*Command, []string) {
- if c.helpFunc != nil {
- return c.helpFunc
- }
- if c.HasParent() {
- return c.Parent().HelpFunc()
- }
- return func(c *Command, a []string) {
- c.mergePersistentFlags()
- // The help should be sent to stdout
- // See https://github.com/spf13/cobra/issues/1002
- err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c)
- if err != nil {
- c.PrintErrln(err)
- }
- }
-}
-
-// Help puts out the help for the command.
-// Used when a user calls help [command].
-// Can be defined by user by overriding HelpFunc.
-func (c *Command) Help() error {
- c.HelpFunc()(c, []string{})
- return nil
-}
-
-// UsageString returns usage string.
-func (c *Command) UsageString() string {
- // Storing normal writers
- tmpOutput := c.outWriter
- tmpErr := c.errWriter
-
- bb := new(bytes.Buffer)
- c.outWriter = bb
- c.errWriter = bb
-
- CheckErr(c.Usage())
-
- // Setting things back to normal
- c.outWriter = tmpOutput
- c.errWriter = tmpErr
-
- return bb.String()
-}
-
-// FlagErrorFunc returns either the function set by SetFlagErrorFunc for this
-// command or a parent, or it returns a function which returns the original
-// error.
-func (c *Command) FlagErrorFunc() (f func(*Command, error) error) {
- if c.flagErrorFunc != nil {
- return c.flagErrorFunc
- }
-
- if c.HasParent() {
- return c.parent.FlagErrorFunc()
- }
- return func(c *Command, err error) error {
- return err
- }
-}
-
-var minUsagePadding = 25
-
-// UsagePadding return padding for the usage.
-func (c *Command) UsagePadding() int {
- if c.parent == nil || minUsagePadding > c.parent.commandsMaxUseLen {
- return minUsagePadding
- }
- return c.parent.commandsMaxUseLen
-}
-
-var minCommandPathPadding = 11
-
-// CommandPathPadding return padding for the command path.
-func (c *Command) CommandPathPadding() int {
- if c.parent == nil || minCommandPathPadding > c.parent.commandsMaxCommandPathLen {
- return minCommandPathPadding
- }
- return c.parent.commandsMaxCommandPathLen
-}
-
-var minNamePadding = 11
-
-// NamePadding returns padding for the name.
-func (c *Command) NamePadding() int {
- if c.parent == nil || minNamePadding > c.parent.commandsMaxNameLen {
- return minNamePadding
- }
- return c.parent.commandsMaxNameLen
-}
-
-// UsageTemplate returns usage template for the command.
-func (c *Command) UsageTemplate() string {
- if c.usageTemplate != "" {
- return c.usageTemplate
- }
-
- if c.HasParent() {
- return c.parent.UsageTemplate()
- }
- return `Usage:{{if .Runnable}}
- {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
- {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
-
-Aliases:
- {{.NameAndAliases}}{{end}}{{if .HasExample}}
-
-Examples:
-{{.Example}}{{end}}{{if .HasAvailableSubCommands}}{{$cmds := .Commands}}{{if eq (len .Groups) 0}}
-
-Available Commands:{{range $cmds}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
- {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{else}}{{range $group := .Groups}}
-
-{{.Title}}{{range $cmds}}{{if (and (eq .GroupID $group.ID) (or .IsAvailableCommand (eq .Name "help")))}}
- {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if not .AllChildCommandsHaveGroup}}
-
-Additional Commands:{{range $cmds}}{{if (and (eq .GroupID "") (or .IsAvailableCommand (eq .Name "help")))}}
- {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
-
-Flags:
-{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
-
-Global Flags:
-{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}
-
-Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
- {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}
-
-Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
-`
-}
-
-// HelpTemplate return help template for the command.
-func (c *Command) HelpTemplate() string {
- if c.helpTemplate != "" {
- return c.helpTemplate
- }
-
- if c.HasParent() {
- return c.parent.HelpTemplate()
- }
- return `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}}
-
-{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
-}
-
-// VersionTemplate return version template for the command.
-func (c *Command) VersionTemplate() string {
- if c.versionTemplate != "" {
- return c.versionTemplate
- }
-
- if c.HasParent() {
- return c.parent.VersionTemplate()
- }
- return `{{with .Name}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}}
-`
-}
-
-// ErrPrefix return error message prefix for the command
-func (c *Command) ErrPrefix() string {
- if c.errPrefix != "" {
- return c.errPrefix
- }
-
- if c.HasParent() {
- return c.parent.ErrPrefix()
- }
- return "Error:"
-}
-
-func hasNoOptDefVal(name string, fs *flag.FlagSet) bool {
- flag := fs.Lookup(name)
- if flag == nil {
- return false
- }
- return flag.NoOptDefVal != ""
-}
-
-func shortHasNoOptDefVal(name string, fs *flag.FlagSet) bool {
- if len(name) == 0 {
- return false
- }
-
- flag := fs.ShorthandLookup(name[:1])
- if flag == nil {
- return false
- }
- return flag.NoOptDefVal != ""
-}
-
-func stripFlags(args []string, c *Command) []string {
- if len(args) == 0 {
- return args
- }
- c.mergePersistentFlags()
-
- commands := []string{}
- flags := c.Flags()
-
-Loop:
- for len(args) > 0 {
- s := args[0]
- args = args[1:]
- switch {
- case s == "--":
- // "--" terminates the flags
- break Loop
- case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags):
- // If '--flag arg' then
- // delete arg from args.
- fallthrough // (do the same as below)
- case strings.HasPrefix(s, "-") && !strings.Contains(s, "=") && len(s) == 2 && !shortHasNoOptDefVal(s[1:], flags):
- // If '-f arg' then
- // delete 'arg' from args or break the loop if len(args) <= 1.
- if len(args) <= 1 {
- break Loop
- } else {
- args = args[1:]
- continue
- }
- case s != "" && !strings.HasPrefix(s, "-"):
- commands = append(commands, s)
- }
- }
-
- return commands
-}
-
-// argsMinusFirstX removes only the first x from args. Otherwise, commands that look like
-// openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]).
-// Special care needs to be taken not to remove a flag value.
-func (c *Command) argsMinusFirstX(args []string, x string) []string {
- if len(args) == 0 {
- return args
- }
- c.mergePersistentFlags()
- flags := c.Flags()
-
-Loop:
- for pos := 0; pos < len(args); pos++ {
- s := args[pos]
- switch {
- case s == "--":
- // -- means we have reached the end of the parseable args. Break out of the loop now.
- break Loop
- case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags):
- fallthrough
- case strings.HasPrefix(s, "-") && !strings.Contains(s, "=") && len(s) == 2 && !shortHasNoOptDefVal(s[1:], flags):
- // This is a flag without a default value, and an equal sign is not used. Increment pos in order to skip
- // over the next arg, because that is the value of this flag.
- pos++
- continue
- case !strings.HasPrefix(s, "-"):
- // This is not a flag or a flag value. Check to see if it matches what we're looking for, and if so,
- // return the args, excluding the one at this position.
- if s == x {
- ret := make([]string, 0, len(args)-1)
- ret = append(ret, args[:pos]...)
- ret = append(ret, args[pos+1:]...)
- return ret
- }
- }
- }
- return args
-}
-
-func isFlagArg(arg string) bool {
- return ((len(arg) >= 3 && arg[0:2] == "--") ||
- (len(arg) >= 2 && arg[0] == '-' && arg[1] != '-'))
-}
-
-// Find the target command given the args and command tree
-// Meant to be run on the highest node. Only searches down.
-func (c *Command) Find(args []string) (*Command, []string, error) {
- var innerfind func(*Command, []string) (*Command, []string)
-
- innerfind = func(c *Command, innerArgs []string) (*Command, []string) {
- argsWOflags := stripFlags(innerArgs, c)
- if len(argsWOflags) == 0 {
- return c, innerArgs
- }
- nextSubCmd := argsWOflags[0]
-
- cmd := c.findNext(nextSubCmd)
- if cmd != nil {
- return innerfind(cmd, c.argsMinusFirstX(innerArgs, nextSubCmd))
- }
- return c, innerArgs
- }
-
- commandFound, a := innerfind(c, args)
- if commandFound.Args == nil {
- return commandFound, a, legacyArgs(commandFound, stripFlags(a, commandFound))
- }
- return commandFound, a, nil
-}
-
-func (c *Command) findSuggestions(arg string) string {
- if c.DisableSuggestions {
- return ""
- }
- if c.SuggestionsMinimumDistance <= 0 {
- c.SuggestionsMinimumDistance = 2
- }
- var sb strings.Builder
- if suggestions := c.SuggestionsFor(arg); len(suggestions) > 0 {
- sb.WriteString("\n\nDid you mean this?\n")
- for _, s := range suggestions {
- _, _ = fmt.Fprintf(&sb, "\t%v\n", s)
- }
- }
- return sb.String()
-}
-
-func (c *Command) findNext(next string) *Command {
- matches := make([]*Command, 0)
- for _, cmd := range c.commands {
- if commandNameMatches(cmd.Name(), next) || cmd.HasAlias(next) {
- cmd.commandCalledAs.name = next
- return cmd
- }
- if EnablePrefixMatching && cmd.hasNameOrAliasPrefix(next) {
- matches = append(matches, cmd)
- }
- }
-
- if len(matches) == 1 {
- // Temporarily disable gosec G602, which produces a false positive.
- // See https://github.com/securego/gosec/issues/1005.
- return matches[0] // #nosec G602
- }
-
- return nil
-}
-
-// Traverse the command tree to find the command, and parse args for
-// each parent.
-func (c *Command) Traverse(args []string) (*Command, []string, error) {
- flags := []string{}
- inFlag := false
-
- for i, arg := range args {
- switch {
- // A long flag with a space separated value
- case strings.HasPrefix(arg, "--") && !strings.Contains(arg, "="):
- // TODO: this isn't quite right, we should really check ahead for 'true' or 'false'
- inFlag = !hasNoOptDefVal(arg[2:], c.Flags())
- flags = append(flags, arg)
- continue
- // A short flag with a space separated value
- case strings.HasPrefix(arg, "-") && !strings.Contains(arg, "=") && len(arg) == 2 && !shortHasNoOptDefVal(arg[1:], c.Flags()):
- inFlag = true
- flags = append(flags, arg)
- continue
- // The value for a flag
- case inFlag:
- inFlag = false
- flags = append(flags, arg)
- continue
- // A flag without a value, or with an `=` separated value
- case isFlagArg(arg):
- flags = append(flags, arg)
- continue
- }
-
- cmd := c.findNext(arg)
- if cmd == nil {
- return c, args, nil
- }
-
- if err := c.ParseFlags(flags); err != nil {
- return nil, args, err
- }
- return cmd.Traverse(args[i+1:])
- }
- return c, args, nil
-}
-
-// SuggestionsFor provides suggestions for the typedName.
-func (c *Command) SuggestionsFor(typedName string) []string {
- suggestions := []string{}
- for _, cmd := range c.commands {
- if cmd.IsAvailableCommand() {
- levenshteinDistance := ld(typedName, cmd.Name(), true)
- suggestByLevenshtein := levenshteinDistance <= c.SuggestionsMinimumDistance
- suggestByPrefix := strings.HasPrefix(strings.ToLower(cmd.Name()), strings.ToLower(typedName))
- if suggestByLevenshtein || suggestByPrefix {
- suggestions = append(suggestions, cmd.Name())
- }
- for _, explicitSuggestion := range cmd.SuggestFor {
- if strings.EqualFold(typedName, explicitSuggestion) {
- suggestions = append(suggestions, cmd.Name())
- }
- }
- }
- }
- return suggestions
-}
-
-// VisitParents visits all parents of the command and invokes fn on each parent.
-func (c *Command) VisitParents(fn func(*Command)) {
- if c.HasParent() {
- fn(c.Parent())
- c.Parent().VisitParents(fn)
- }
-}
-
-// Root finds root command.
-func (c *Command) Root() *Command {
- if c.HasParent() {
- return c.Parent().Root()
- }
- return c
-}
-
-// ArgsLenAtDash will return the length of c.Flags().Args at the moment
-// when a -- was found during args parsing.
-func (c *Command) ArgsLenAtDash() int {
- return c.Flags().ArgsLenAtDash()
-}
-
-func (c *Command) execute(a []string) (err error) {
- if c == nil {
- return fmt.Errorf("called Execute() on a nil Command")
- }
-
- if len(c.Deprecated) > 0 {
- c.Printf("Command %q is deprecated, %s\n", c.Name(), c.Deprecated)
- }
-
- // initialize help and version flag at the last point possible to allow for user
- // overriding
- c.InitDefaultHelpFlag()
- c.InitDefaultVersionFlag()
-
- err = c.ParseFlags(a)
- if err != nil {
- return c.FlagErrorFunc()(c, err)
- }
-
- // If help is called, regardless of other flags, return we want help.
- // Also say we need help if the command isn't runnable.
- helpVal, err := c.Flags().GetBool("help")
- if err != nil {
- // should be impossible to get here as we always declare a help
- // flag in InitDefaultHelpFlag()
- c.Println("\"help\" flag declared as non-bool. Please correct your code")
- return err
- }
-
- if helpVal {
- return flag.ErrHelp
- }
-
- // for back-compat, only add version flag behavior if version is defined
- if c.Version != "" {
- versionVal, err := c.Flags().GetBool("version")
- if err != nil {
- c.Println("\"version\" flag declared as non-bool. Please correct your code")
- return err
- }
- if versionVal {
- err := tmpl(c.OutOrStdout(), c.VersionTemplate(), c)
- if err != nil {
- c.Println(err)
- }
- return err
- }
- }
-
- if !c.Runnable() {
- return flag.ErrHelp
- }
-
- c.preRun()
-
- defer c.postRun()
-
- argWoFlags := c.Flags().Args()
- if c.DisableFlagParsing {
- argWoFlags = a
- }
-
- if err := c.ValidateArgs(argWoFlags); err != nil {
- return err
- }
-
- parents := make([]*Command, 0, 5)
- for p := c; p != nil; p = p.Parent() {
- if EnableTraverseRunHooks {
- // When EnableTraverseRunHooks is set:
- // - Execute all persistent pre-runs from the root parent till this command.
- // - Execute all persistent post-runs from this command till the root parent.
- parents = append([]*Command{p}, parents...)
- } else {
- // Otherwise, execute only the first found persistent hook.
- parents = append(parents, p)
- }
- }
- for _, p := range parents {
- if p.PersistentPreRunE != nil {
- if err := p.PersistentPreRunE(c, argWoFlags); err != nil {
- return err
- }
- if !EnableTraverseRunHooks {
- break
- }
- } else if p.PersistentPreRun != nil {
- p.PersistentPreRun(c, argWoFlags)
- if !EnableTraverseRunHooks {
- break
- }
- }
- }
- if c.PreRunE != nil {
- if err := c.PreRunE(c, argWoFlags); err != nil {
- return err
- }
- } else if c.PreRun != nil {
- c.PreRun(c, argWoFlags)
- }
-
- if err := c.ValidateRequiredFlags(); err != nil {
- return err
- }
- if err := c.ValidateFlagGroups(); err != nil {
- return err
- }
-
- if c.RunE != nil {
- if err := c.RunE(c, argWoFlags); err != nil {
- return err
- }
- } else {
- c.Run(c, argWoFlags)
- }
- if c.PostRunE != nil {
- if err := c.PostRunE(c, argWoFlags); err != nil {
- return err
- }
- } else if c.PostRun != nil {
- c.PostRun(c, argWoFlags)
- }
- for p := c; p != nil; p = p.Parent() {
- if p.PersistentPostRunE != nil {
- if err := p.PersistentPostRunE(c, argWoFlags); err != nil {
- return err
- }
- if !EnableTraverseRunHooks {
- break
- }
- } else if p.PersistentPostRun != nil {
- p.PersistentPostRun(c, argWoFlags)
- if !EnableTraverseRunHooks {
- break
- }
- }
- }
-
- return nil
-}
-
-func (c *Command) preRun() {
- for _, x := range initializers {
- x()
- }
-}
-
-func (c *Command) postRun() {
- for _, x := range finalizers {
- x()
- }
-}
-
-// ExecuteContext is the same as Execute(), but sets the ctx on the command.
-// Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs
-// functions.
-func (c *Command) ExecuteContext(ctx context.Context) error {
- c.ctx = ctx
- return c.Execute()
-}
-
-// Execute uses the args (os.Args[1:] by default)
-// and run through the command tree finding appropriate matches
-// for commands and then corresponding flags.
-func (c *Command) Execute() error {
- _, err := c.ExecuteC()
- return err
-}
-
-// ExecuteContextC is the same as ExecuteC(), but sets the ctx on the command.
-// Retrieve ctx by calling cmd.Context() inside your *Run lifecycle or ValidArgs
-// functions.
-func (c *Command) ExecuteContextC(ctx context.Context) (*Command, error) {
- c.ctx = ctx
- return c.ExecuteC()
-}
-
-// ExecuteC executes the command.
-func (c *Command) ExecuteC() (cmd *Command, err error) {
- if c.ctx == nil {
- c.ctx = context.Background()
- }
-
- // Regardless of what command execute is called on, run on Root only
- if c.HasParent() {
- return c.Root().ExecuteC()
- }
-
- // windows hook
- if preExecHookFn != nil {
- preExecHookFn(c)
- }
-
- // initialize help at the last point to allow for user overriding
- c.InitDefaultHelpCmd()
- // initialize completion at the last point to allow for user overriding
- c.InitDefaultCompletionCmd()
-
- // Now that all commands have been created, let's make sure all groups
- // are properly created also
- c.checkCommandGroups()
-
- args := c.args
-
- // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155
- if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" {
- args = os.Args[1:]
- }
-
- // initialize the hidden command to be used for shell completion
- c.initCompleteCmd(args)
-
- var flags []string
- if c.TraverseChildren {
- cmd, flags, err = c.Traverse(args)
- } else {
- cmd, flags, err = c.Find(args)
- }
- if err != nil {
- // If found parse to a subcommand and then failed, talk about the subcommand
- if cmd != nil {
- c = cmd
- }
- if !c.SilenceErrors {
- c.PrintErrln(c.ErrPrefix(), err.Error())
- c.PrintErrf("Run '%v --help' for usage.\n", c.CommandPath())
- }
- return c, err
- }
-
- cmd.commandCalledAs.called = true
- if cmd.commandCalledAs.name == "" {
- cmd.commandCalledAs.name = cmd.Name()
- }
-
- // We have to pass global context to children command
- // if context is present on the parent command.
- if cmd.ctx == nil {
- cmd.ctx = c.ctx
- }
-
- err = cmd.execute(flags)
- if err != nil {
- // Always show help if requested, even if SilenceErrors is in
- // effect
- if errors.Is(err, flag.ErrHelp) {
- cmd.HelpFunc()(cmd, args)
- return cmd, nil
- }
-
- // If root command has SilenceErrors flagged,
- // all subcommands should respect it
- if !cmd.SilenceErrors && !c.SilenceErrors {
- c.PrintErrln(cmd.ErrPrefix(), err.Error())
- }
-
- // If root command has SilenceUsage flagged,
- // all subcommands should respect it
- if !cmd.SilenceUsage && !c.SilenceUsage {
- c.Println(cmd.UsageString())
- }
- }
- return cmd, err
-}
-
-func (c *Command) ValidateArgs(args []string) error {
- if c.Args == nil {
- return ArbitraryArgs(c, args)
- }
- return c.Args(c, args)
-}
-
-// ValidateRequiredFlags validates all required flags are present and returns an error otherwise
-func (c *Command) ValidateRequiredFlags() error {
- if c.DisableFlagParsing {
- return nil
- }
-
- flags := c.Flags()
- missingFlagNames := []string{}
- flags.VisitAll(func(pflag *flag.Flag) {
- requiredAnnotation, found := pflag.Annotations[BashCompOneRequiredFlag]
- if !found {
- return
- }
- if (requiredAnnotation[0] == "true") && !pflag.Changed {
- missingFlagNames = append(missingFlagNames, pflag.Name)
- }
- })
-
- if len(missingFlagNames) > 0 {
- return fmt.Errorf(`required flag(s) "%s" not set`, strings.Join(missingFlagNames, `", "`))
- }
- return nil
-}
-
-// checkCommandGroups checks if a command has been added to a group that does not exists.
-// If so, we panic because it indicates a coding error that should be corrected.
-func (c *Command) checkCommandGroups() {
- for _, sub := range c.commands {
- // if Group is not defined let the developer know right away
- if sub.GroupID != "" && !c.ContainsGroup(sub.GroupID) {
- panic(fmt.Sprintf("group id '%s' is not defined for subcommand '%s'", sub.GroupID, sub.CommandPath()))
- }
-
- sub.checkCommandGroups()
- }
-}
-
-// InitDefaultHelpFlag adds default help flag to c.
-// It is called automatically by executing the c or by calling help and usage.
-// If c already has help flag, it will do nothing.
-func (c *Command) InitDefaultHelpFlag() {
- c.mergePersistentFlags()
- if c.Flags().Lookup("help") == nil {
- usage := "help for "
- name := c.displayName()
- if name == "" {
- usage += "this command"
- } else {
- usage += name
- }
- c.Flags().BoolP("help", "h", false, usage)
- _ = c.Flags().SetAnnotation("help", FlagSetByCobraAnnotation, []string{"true"})
- }
-}
-
-// InitDefaultVersionFlag adds default version flag to c.
-// It is called automatically by executing the c.
-// If c already has a version flag, it will do nothing.
-// If c.Version is empty, it will do nothing.
-func (c *Command) InitDefaultVersionFlag() {
- if c.Version == "" {
- return
- }
-
- c.mergePersistentFlags()
- if c.Flags().Lookup("version") == nil {
- usage := "version for "
- if c.Name() == "" {
- usage += "this command"
- } else {
- usage += c.Name()
- }
- if c.Flags().ShorthandLookup("v") == nil {
- c.Flags().BoolP("version", "v", false, usage)
- } else {
- c.Flags().Bool("version", false, usage)
- }
- _ = c.Flags().SetAnnotation("version", FlagSetByCobraAnnotation, []string{"true"})
- }
-}
-
-// InitDefaultHelpCmd adds default help command to c.
-// It is called automatically by executing the c or by calling help and usage.
-// If c already has help command or c has no subcommands, it will do nothing.
-func (c *Command) InitDefaultHelpCmd() {
- if !c.HasSubCommands() {
- return
- }
-
- if c.helpCommand == nil {
- c.helpCommand = &Command{
- Use: "help [command]",
- Short: "Help about any command",
- Long: `Help provides help for any command in the application.
-Simply type ` + c.displayName() + ` help [path to command] for full details.`,
- ValidArgsFunction: func(c *Command, args []string, toComplete string) ([]string, ShellCompDirective) {
- var completions []string
- cmd, _, e := c.Root().Find(args)
- if e != nil {
- return nil, ShellCompDirectiveNoFileComp
- }
- if cmd == nil {
- // Root help command.
- cmd = c.Root()
- }
- for _, subCmd := range cmd.Commands() {
- if subCmd.IsAvailableCommand() || subCmd == cmd.helpCommand {
- if strings.HasPrefix(subCmd.Name(), toComplete) {
- completions = append(completions, fmt.Sprintf("%s\t%s", subCmd.Name(), subCmd.Short))
- }
- }
- }
- return completions, ShellCompDirectiveNoFileComp
- },
- Run: func(c *Command, args []string) {
- cmd, _, e := c.Root().Find(args)
- if cmd == nil || e != nil {
- c.Printf("Unknown help topic %#q\n", args)
- CheckErr(c.Root().Usage())
- } else {
- cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown
- cmd.InitDefaultVersionFlag() // make possible 'version' flag to be shown
- CheckErr(cmd.Help())
- }
- },
- GroupID: c.helpCommandGroupID,
- }
- }
- c.RemoveCommand(c.helpCommand)
- c.AddCommand(c.helpCommand)
-}
-
-// ResetCommands delete parent, subcommand and help command from c.
-func (c *Command) ResetCommands() {
- c.parent = nil
- c.commands = nil
- c.helpCommand = nil
- c.parentsPflags = nil
-}
-
-// Sorts commands by their names.
-type commandSorterByName []*Command
-
-func (c commandSorterByName) Len() int { return len(c) }
-func (c commandSorterByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
-func (c commandSorterByName) Less(i, j int) bool { return c[i].Name() < c[j].Name() }
-
-// Commands returns a sorted slice of child commands.
-func (c *Command) Commands() []*Command {
- // do not sort commands if it already sorted or sorting was disabled
- if EnableCommandSorting && !c.commandsAreSorted {
- sort.Sort(commandSorterByName(c.commands))
- c.commandsAreSorted = true
- }
- return c.commands
-}
-
-// AddCommand adds one or more commands to this parent command.
-func (c *Command) AddCommand(cmds ...*Command) {
- for i, x := range cmds {
- if cmds[i] == c {
- panic("Command can't be a child of itself")
- }
- cmds[i].parent = c
- // update max lengths
- usageLen := len(x.Use)
- if usageLen > c.commandsMaxUseLen {
- c.commandsMaxUseLen = usageLen
- }
- commandPathLen := len(x.CommandPath())
- if commandPathLen > c.commandsMaxCommandPathLen {
- c.commandsMaxCommandPathLen = commandPathLen
- }
- nameLen := len(x.Name())
- if nameLen > c.commandsMaxNameLen {
- c.commandsMaxNameLen = nameLen
- }
- // If global normalization function exists, update all children
- if c.globNormFunc != nil {
- x.SetGlobalNormalizationFunc(c.globNormFunc)
- }
- c.commands = append(c.commands, x)
- c.commandsAreSorted = false
- }
-}
-
-// Groups returns a slice of child command groups.
-func (c *Command) Groups() []*Group {
- return c.commandgroups
-}
-
-// AllChildCommandsHaveGroup returns if all subcommands are assigned to a group
-func (c *Command) AllChildCommandsHaveGroup() bool {
- for _, sub := range c.commands {
- if (sub.IsAvailableCommand() || sub == c.helpCommand) && sub.GroupID == "" {
- return false
- }
- }
- return true
-}
-
-// ContainsGroup return if groupID exists in the list of command groups.
-func (c *Command) ContainsGroup(groupID string) bool {
- for _, x := range c.commandgroups {
- if x.ID == groupID {
- return true
- }
- }
- return false
-}
-
-// AddGroup adds one or more command groups to this parent command.
-func (c *Command) AddGroup(groups ...*Group) {
- c.commandgroups = append(c.commandgroups, groups...)
-}
-
-// RemoveCommand removes one or more commands from a parent command.
-func (c *Command) RemoveCommand(cmds ...*Command) {
- commands := []*Command{}
-main:
- for _, command := range c.commands {
- for _, cmd := range cmds {
- if command == cmd {
- command.parent = nil
- continue main
- }
- }
- commands = append(commands, command)
- }
- c.commands = commands
- // recompute all lengths
- c.commandsMaxUseLen = 0
- c.commandsMaxCommandPathLen = 0
- c.commandsMaxNameLen = 0
- for _, command := range c.commands {
- usageLen := len(command.Use)
- if usageLen > c.commandsMaxUseLen {
- c.commandsMaxUseLen = usageLen
- }
- commandPathLen := len(command.CommandPath())
- if commandPathLen > c.commandsMaxCommandPathLen {
- c.commandsMaxCommandPathLen = commandPathLen
- }
- nameLen := len(command.Name())
- if nameLen > c.commandsMaxNameLen {
- c.commandsMaxNameLen = nameLen
- }
- }
-}
-
-// Print is a convenience method to Print to the defined output, fallback to Stderr if not set.
-func (c *Command) Print(i ...interface{}) {
- fmt.Fprint(c.OutOrStderr(), i...)
-}
-
-// Println is a convenience method to Println to the defined output, fallback to Stderr if not set.
-func (c *Command) Println(i ...interface{}) {
- c.Print(fmt.Sprintln(i...))
-}
-
-// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set.
-func (c *Command) Printf(format string, i ...interface{}) {
- c.Print(fmt.Sprintf(format, i...))
-}
-
-// PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set.
-func (c *Command) PrintErr(i ...interface{}) {
- fmt.Fprint(c.ErrOrStderr(), i...)
-}
-
-// PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set.
-func (c *Command) PrintErrln(i ...interface{}) {
- c.PrintErr(fmt.Sprintln(i...))
-}
-
-// PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set.
-func (c *Command) PrintErrf(format string, i ...interface{}) {
- c.PrintErr(fmt.Sprintf(format, i...))
-}
-
-// CommandPath returns the full path to this command.
-func (c *Command) CommandPath() string {
- if c.HasParent() {
- return c.Parent().CommandPath() + " " + c.Name()
- }
- return c.displayName()
-}
-
-func (c *Command) displayName() string {
- if displayName, ok := c.Annotations[CommandDisplayNameAnnotation]; ok {
- return displayName
- }
- return c.Name()
-}
-
-// UseLine puts out the full usage for a given command (including parents).
-func (c *Command) UseLine() string {
- var useline string
- use := strings.Replace(c.Use, c.Name(), c.displayName(), 1)
- if c.HasParent() {
- useline = c.parent.CommandPath() + " " + use
- } else {
- useline = use
- }
- if c.DisableFlagsInUseLine {
- return useline
- }
- if c.HasAvailableFlags() && !strings.Contains(useline, "[flags]") {
- useline += " [flags]"
- }
- return useline
-}
-
-// DebugFlags used to determine which flags have been assigned to which commands
-// and which persist.
-func (c *Command) DebugFlags() {
- c.Println("DebugFlags called on", c.Name())
- var debugflags func(*Command)
-
- debugflags = func(x *Command) {
- if x.HasFlags() || x.HasPersistentFlags() {
- c.Println(x.Name())
- }
- if x.HasFlags() {
- x.flags.VisitAll(func(f *flag.Flag) {
- if x.HasPersistentFlags() && x.persistentFlag(f.Name) != nil {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [LP]")
- } else {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [L]")
- }
- })
- }
- if x.HasPersistentFlags() {
- x.pflags.VisitAll(func(f *flag.Flag) {
- if x.HasFlags() {
- if x.flags.Lookup(f.Name) == nil {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]")
- }
- } else {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]")
- }
- })
- }
- c.Println(x.flagErrorBuf)
- if x.HasSubCommands() {
- for _, y := range x.commands {
- debugflags(y)
- }
- }
- }
-
- debugflags(c)
-}
-
-// Name returns the command's name: the first word in the use line.
-func (c *Command) Name() string {
- name := c.Use
- i := strings.Index(name, " ")
- if i >= 0 {
- name = name[:i]
- }
- return name
-}
-
-// HasAlias determines if a given string is an alias of the command.
-func (c *Command) HasAlias(s string) bool {
- for _, a := range c.Aliases {
- if commandNameMatches(a, s) {
- return true
- }
- }
- return false
-}
-
-// CalledAs returns the command name or alias that was used to invoke
-// this command or an empty string if the command has not been called.
-func (c *Command) CalledAs() string {
- if c.commandCalledAs.called {
- return c.commandCalledAs.name
- }
- return ""
-}
-
-// hasNameOrAliasPrefix returns true if the Name or any of aliases start
-// with prefix
-func (c *Command) hasNameOrAliasPrefix(prefix string) bool {
- if strings.HasPrefix(c.Name(), prefix) {
- c.commandCalledAs.name = c.Name()
- return true
- }
- for _, alias := range c.Aliases {
- if strings.HasPrefix(alias, prefix) {
- c.commandCalledAs.name = alias
- return true
- }
- }
- return false
-}
-
-// NameAndAliases returns a list of the command name and all aliases
-func (c *Command) NameAndAliases() string {
- return strings.Join(append([]string{c.Name()}, c.Aliases...), ", ")
-}
-
-// HasExample determines if the command has example.
-func (c *Command) HasExample() bool {
- return len(c.Example) > 0
-}
-
-// Runnable determines if the command is itself runnable.
-func (c *Command) Runnable() bool {
- return c.Run != nil || c.RunE != nil
-}
-
-// HasSubCommands determines if the command has children commands.
-func (c *Command) HasSubCommands() bool {
- return len(c.commands) > 0
-}
-
-// IsAvailableCommand determines if a command is available as a non-help command
-// (this includes all non deprecated/hidden commands).
-func (c *Command) IsAvailableCommand() bool {
- if len(c.Deprecated) != 0 || c.Hidden {
- return false
- }
-
- if c.HasParent() && c.Parent().helpCommand == c {
- return false
- }
-
- if c.Runnable() || c.HasAvailableSubCommands() {
- return true
- }
-
- return false
-}
-
-// IsAdditionalHelpTopicCommand determines if a command is an additional
-// help topic command; additional help topic command is determined by the
-// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that
-// are runnable/hidden/deprecated.
-// Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924.
-func (c *Command) IsAdditionalHelpTopicCommand() bool {
- // if a command is runnable, deprecated, or hidden it is not a 'help' command
- if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
- return false
- }
-
- // if any non-help sub commands are found, the command is not a 'help' command
- for _, sub := range c.commands {
- if !sub.IsAdditionalHelpTopicCommand() {
- return false
- }
- }
-
- // the command either has no sub commands, or no non-help sub commands
- return true
-}
-
-// HasHelpSubCommands determines if a command has any available 'help' sub commands
-// that need to be shown in the usage/help default template under 'additional help
-// topics'.
-func (c *Command) HasHelpSubCommands() bool {
- // return true on the first found available 'help' sub command
- for _, sub := range c.commands {
- if sub.IsAdditionalHelpTopicCommand() {
- return true
- }
- }
-
- // the command either has no sub commands, or no available 'help' sub commands
- return false
-}
-
-// HasAvailableSubCommands determines if a command has available sub commands that
-// need to be shown in the usage/help default template under 'available commands'.
-func (c *Command) HasAvailableSubCommands() bool {
- // return true on the first found available (non deprecated/help/hidden)
- // sub command
- for _, sub := range c.commands {
- if sub.IsAvailableCommand() {
- return true
- }
- }
-
- // the command either has no sub commands, or no available (non deprecated/help/hidden)
- // sub commands
- return false
-}
-
-// HasParent determines if the command is a child command.
-func (c *Command) HasParent() bool {
- return c.parent != nil
-}
-
-// GlobalNormalizationFunc returns the global normalization function or nil if it doesn't exist.
-func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName {
- return c.globNormFunc
-}
-
-// Flags returns the complete FlagSet that applies
-// to this command (local and persistent declared here and by all parents).
-func (c *Command) Flags() *flag.FlagSet {
- if c.flags == nil {
- c.flags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.flags.SetOutput(c.flagErrorBuf)
- }
-
- return c.flags
-}
-
-// LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands.
-// This function does not modify the flags of the current command, it's purpose is to return the current state.
-func (c *Command) LocalNonPersistentFlags() *flag.FlagSet {
- persistentFlags := c.PersistentFlags()
-
- out := flag.NewFlagSet(c.displayName(), flag.ContinueOnError)
- c.LocalFlags().VisitAll(func(f *flag.Flag) {
- if persistentFlags.Lookup(f.Name) == nil {
- out.AddFlag(f)
- }
- })
- return out
-}
-
-// LocalFlags returns the local FlagSet specifically set in the current command.
-// This function does not modify the flags of the current command, it's purpose is to return the current state.
-func (c *Command) LocalFlags() *flag.FlagSet {
- c.mergePersistentFlags()
-
- if c.lflags == nil {
- c.lflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.lflags.SetOutput(c.flagErrorBuf)
- }
- c.lflags.SortFlags = c.Flags().SortFlags
- if c.globNormFunc != nil {
- c.lflags.SetNormalizeFunc(c.globNormFunc)
- }
-
- addToLocal := func(f *flag.Flag) {
- // Add the flag if it is not a parent PFlag, or it shadows a parent PFlag
- if c.lflags.Lookup(f.Name) == nil && f != c.parentsPflags.Lookup(f.Name) {
- c.lflags.AddFlag(f)
- }
- }
- c.Flags().VisitAll(addToLocal)
- c.PersistentFlags().VisitAll(addToLocal)
- return c.lflags
-}
-
-// InheritedFlags returns all flags which were inherited from parent commands.
-// This function does not modify the flags of the current command, it's purpose is to return the current state.
-func (c *Command) InheritedFlags() *flag.FlagSet {
- c.mergePersistentFlags()
-
- if c.iflags == nil {
- c.iflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.iflags.SetOutput(c.flagErrorBuf)
- }
-
- local := c.LocalFlags()
- if c.globNormFunc != nil {
- c.iflags.SetNormalizeFunc(c.globNormFunc)
- }
-
- c.parentsPflags.VisitAll(func(f *flag.Flag) {
- if c.iflags.Lookup(f.Name) == nil && local.Lookup(f.Name) == nil {
- c.iflags.AddFlag(f)
- }
- })
- return c.iflags
-}
-
-// NonInheritedFlags returns all flags which were not inherited from parent commands.
-// This function does not modify the flags of the current command, it's purpose is to return the current state.
-func (c *Command) NonInheritedFlags() *flag.FlagSet {
- return c.LocalFlags()
-}
-
-// PersistentFlags returns the persistent FlagSet specifically set in the current command.
-func (c *Command) PersistentFlags() *flag.FlagSet {
- if c.pflags == nil {
- c.pflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.pflags.SetOutput(c.flagErrorBuf)
- }
- return c.pflags
-}
-
-// ResetFlags deletes all flags from command.
-func (c *Command) ResetFlags() {
- c.flagErrorBuf = new(bytes.Buffer)
- c.flagErrorBuf.Reset()
- c.flags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError)
- c.flags.SetOutput(c.flagErrorBuf)
- c.pflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError)
- c.pflags.SetOutput(c.flagErrorBuf)
-
- c.lflags = nil
- c.iflags = nil
- c.parentsPflags = nil
-}
-
-// HasFlags checks if the command contains any flags (local plus persistent from the entire structure).
-func (c *Command) HasFlags() bool {
- return c.Flags().HasFlags()
-}
-
-// HasPersistentFlags checks if the command contains persistent flags.
-func (c *Command) HasPersistentFlags() bool {
- return c.PersistentFlags().HasFlags()
-}
-
-// HasLocalFlags checks if the command has flags specifically declared locally.
-func (c *Command) HasLocalFlags() bool {
- return c.LocalFlags().HasFlags()
-}
-
-// HasInheritedFlags checks if the command has flags inherited from its parent command.
-func (c *Command) HasInheritedFlags() bool {
- return c.InheritedFlags().HasFlags()
-}
-
-// HasAvailableFlags checks if the command contains any flags (local plus persistent from the entire
-// structure) which are not hidden or deprecated.
-func (c *Command) HasAvailableFlags() bool {
- return c.Flags().HasAvailableFlags()
-}
-
-// HasAvailablePersistentFlags checks if the command contains persistent flags which are not hidden or deprecated.
-func (c *Command) HasAvailablePersistentFlags() bool {
- return c.PersistentFlags().HasAvailableFlags()
-}
-
-// HasAvailableLocalFlags checks if the command has flags specifically declared locally which are not hidden
-// or deprecated.
-func (c *Command) HasAvailableLocalFlags() bool {
- return c.LocalFlags().HasAvailableFlags()
-}
-
-// HasAvailableInheritedFlags checks if the command has flags inherited from its parent command which are
-// not hidden or deprecated.
-func (c *Command) HasAvailableInheritedFlags() bool {
- return c.InheritedFlags().HasAvailableFlags()
-}
-
-// Flag climbs up the command tree looking for matching flag.
-func (c *Command) Flag(name string) (flag *flag.Flag) {
- flag = c.Flags().Lookup(name)
-
- if flag == nil {
- flag = c.persistentFlag(name)
- }
-
- return
-}
-
-// Recursively find matching persistent flag.
-func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
- if c.HasPersistentFlags() {
- flag = c.PersistentFlags().Lookup(name)
- }
-
- if flag == nil {
- c.updateParentsPflags()
- flag = c.parentsPflags.Lookup(name)
- }
- return
-}
-
-// ParseFlags parses persistent flag tree and local flags.
-func (c *Command) ParseFlags(args []string) error {
- if c.DisableFlagParsing {
- return nil
- }
-
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- beforeErrorBufLen := c.flagErrorBuf.Len()
- c.mergePersistentFlags()
-
- // do it here after merging all flags and just before parse
- c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist)
-
- err := c.Flags().Parse(args)
- // Print warnings if they occurred (e.g. deprecated flag messages).
- if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil {
- c.Print(c.flagErrorBuf.String())
- }
-
- return err
-}
-
-// Parent returns a commands parent command.
-func (c *Command) Parent() *Command {
- return c.parent
-}
-
-// mergePersistentFlags merges c.PersistentFlags() to c.Flags()
-// and adds missing persistent flags of all parents.
-func (c *Command) mergePersistentFlags() {
- c.updateParentsPflags()
- c.Flags().AddFlagSet(c.PersistentFlags())
- c.Flags().AddFlagSet(c.parentsPflags)
-}
-
-// updateParentsPflags updates c.parentsPflags by adding
-// new persistent flags of all parents.
-// If c.parentsPflags == nil, it makes new.
-func (c *Command) updateParentsPflags() {
- if c.parentsPflags == nil {
- c.parentsPflags = flag.NewFlagSet(c.displayName(), flag.ContinueOnError)
- c.parentsPflags.SetOutput(c.flagErrorBuf)
- c.parentsPflags.SortFlags = false
- }
-
- if c.globNormFunc != nil {
- c.parentsPflags.SetNormalizeFunc(c.globNormFunc)
- }
-
- c.Root().PersistentFlags().AddFlagSet(flag.CommandLine)
-
- c.VisitParents(func(parent *Command) {
- c.parentsPflags.AddFlagSet(parent.PersistentFlags())
- })
-}
-
-// commandNameMatches checks if two command names are equal
-// taking into account case sensitivity according to
-// EnableCaseInsensitive global configuration.
-func commandNameMatches(s string, t string) bool {
- if EnableCaseInsensitive {
- return strings.EqualFold(s, t)
- }
-
- return s == t
-}
diff --git a/vendor/github.com/spf13/cobra/command_notwin.go b/vendor/github.com/spf13/cobra/command_notwin.go
deleted file mode 100644
index 307f0c127..000000000
--- a/vendor/github.com/spf13/cobra/command_notwin.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !windows
-// +build !windows
-
-package cobra
-
-var preExecHookFn func(*Command)
diff --git a/vendor/github.com/spf13/cobra/command_win.go b/vendor/github.com/spf13/cobra/command_win.go
deleted file mode 100644
index adbef395c..000000000
--- a/vendor/github.com/spf13/cobra/command_win.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build windows
-// +build windows
-
-package cobra
-
-import (
- "fmt"
- "os"
- "time"
-
- "github.com/inconshreveable/mousetrap"
-)
-
-var preExecHookFn = preExecHook
-
-func preExecHook(c *Command) {
- if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
- c.Print(MousetrapHelpText)
- if MousetrapDisplayDuration > 0 {
- time.Sleep(MousetrapDisplayDuration)
- } else {
- c.Println("Press return to continue...")
- fmt.Scanln()
- }
- os.Exit(1)
- }
-}
diff --git a/vendor/github.com/spf13/cobra/completions.go b/vendor/github.com/spf13/cobra/completions.go
deleted file mode 100644
index c0c08b057..000000000
--- a/vendor/github.com/spf13/cobra/completions.go
+++ /dev/null
@@ -1,939 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "fmt"
- "os"
- "regexp"
- "strconv"
- "strings"
- "sync"
-
- "github.com/spf13/pflag"
-)
-
-const (
- // ShellCompRequestCmd is the name of the hidden command that is used to request
- // completion results from the program. It is used by the shell completion scripts.
- ShellCompRequestCmd = "__complete"
- // ShellCompNoDescRequestCmd is the name of the hidden command that is used to request
- // completion results without their description. It is used by the shell completion scripts.
- ShellCompNoDescRequestCmd = "__completeNoDesc"
-)
-
-// Global map of flag completion functions. Make sure to use flagCompletionMutex before you try to read and write from it.
-var flagCompletionFunctions = map[*pflag.Flag]func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective){}
-
-// lock for reading and writing from flagCompletionFunctions
-var flagCompletionMutex = &sync.RWMutex{}
-
-// ShellCompDirective is a bit map representing the different behaviors the shell
-// can be instructed to have once completions have been provided.
-type ShellCompDirective int
-
-type flagCompError struct {
- subCommand string
- flagName string
-}
-
-func (e *flagCompError) Error() string {
- return "Subcommand '" + e.subCommand + "' does not support flag '" + e.flagName + "'"
-}
-
-const (
- // ShellCompDirectiveError indicates an error occurred and completions should be ignored.
- ShellCompDirectiveError ShellCompDirective = 1 << iota
-
- // ShellCompDirectiveNoSpace indicates that the shell should not add a space
- // after the completion even if there is a single completion provided.
- ShellCompDirectiveNoSpace
-
- // ShellCompDirectiveNoFileComp indicates that the shell should not provide
- // file completion even when no completion is provided.
- ShellCompDirectiveNoFileComp
-
- // ShellCompDirectiveFilterFileExt indicates that the provided completions
- // should be used as file extension filters.
- // For flags, using Command.MarkFlagFilename() and Command.MarkPersistentFlagFilename()
- // is a shortcut to using this directive explicitly. The BashCompFilenameExt
- // annotation can also be used to obtain the same behavior for flags.
- ShellCompDirectiveFilterFileExt
-
- // ShellCompDirectiveFilterDirs indicates that only directory names should
- // be provided in file completion. To request directory names within another
- // directory, the returned completions should specify the directory within
- // which to search. The BashCompSubdirsInDir annotation can be used to
- // obtain the same behavior but only for flags.
- ShellCompDirectiveFilterDirs
-
- // ShellCompDirectiveKeepOrder indicates that the shell should preserve the order
- // in which the completions are provided
- ShellCompDirectiveKeepOrder
-
- // ===========================================================================
-
- // All directives using iota should be above this one.
- // For internal use.
- shellCompDirectiveMaxValue
-
- // ShellCompDirectiveDefault indicates to let the shell perform its default
- // behavior after completions have been provided.
- // This one must be last to avoid messing up the iota count.
- ShellCompDirectiveDefault ShellCompDirective = 0
-)
-
-const (
- // Constants for the completion command
- compCmdName = "completion"
- compCmdNoDescFlagName = "no-descriptions"
- compCmdNoDescFlagDesc = "disable completion descriptions"
- compCmdNoDescFlagDefault = false
-)
-
-// CompletionOptions are the options to control shell completion
-type CompletionOptions struct {
- // DisableDefaultCmd prevents Cobra from creating a default 'completion' command
- DisableDefaultCmd bool
- // DisableNoDescFlag prevents Cobra from creating the '--no-descriptions' flag
- // for shells that support completion descriptions
- DisableNoDescFlag bool
- // DisableDescriptions turns off all completion descriptions for shells
- // that support them
- DisableDescriptions bool
- // HiddenDefaultCmd makes the default 'completion' command hidden
- HiddenDefaultCmd bool
-}
-
-// NoFileCompletions can be used to disable file completion for commands that should
-// not trigger file completions.
-func NoFileCompletions(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective) {
- return nil, ShellCompDirectiveNoFileComp
-}
-
-// FixedCompletions can be used to create a completion function which always
-// returns the same results.
-func FixedCompletions(choices []string, directive ShellCompDirective) func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective) {
- return func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective) {
- return choices, directive
- }
-}
-
-// RegisterFlagCompletionFunc should be called to register a function to provide completion for a flag.
-func (c *Command) RegisterFlagCompletionFunc(flagName string, f func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)) error {
- flag := c.Flag(flagName)
- if flag == nil {
- return fmt.Errorf("RegisterFlagCompletionFunc: flag '%s' does not exist", flagName)
- }
- flagCompletionMutex.Lock()
- defer flagCompletionMutex.Unlock()
-
- if _, exists := flagCompletionFunctions[flag]; exists {
- return fmt.Errorf("RegisterFlagCompletionFunc: flag '%s' already registered", flagName)
- }
- flagCompletionFunctions[flag] = f
- return nil
-}
-
-// GetFlagCompletionFunc returns the completion function for the given flag of the command, if available.
-func (c *Command) GetFlagCompletionFunc(flagName string) (func(*Command, []string, string) ([]string, ShellCompDirective), bool) {
- flag := c.Flag(flagName)
- if flag == nil {
- return nil, false
- }
-
- flagCompletionMutex.RLock()
- defer flagCompletionMutex.RUnlock()
-
- completionFunc, exists := flagCompletionFunctions[flag]
- return completionFunc, exists
-}
-
-// Returns a string listing the different directive enabled in the specified parameter
-func (d ShellCompDirective) string() string {
- var directives []string
- if d&ShellCompDirectiveError != 0 {
- directives = append(directives, "ShellCompDirectiveError")
- }
- if d&ShellCompDirectiveNoSpace != 0 {
- directives = append(directives, "ShellCompDirectiveNoSpace")
- }
- if d&ShellCompDirectiveNoFileComp != 0 {
- directives = append(directives, "ShellCompDirectiveNoFileComp")
- }
- if d&ShellCompDirectiveFilterFileExt != 0 {
- directives = append(directives, "ShellCompDirectiveFilterFileExt")
- }
- if d&ShellCompDirectiveFilterDirs != 0 {
- directives = append(directives, "ShellCompDirectiveFilterDirs")
- }
- if d&ShellCompDirectiveKeepOrder != 0 {
- directives = append(directives, "ShellCompDirectiveKeepOrder")
- }
- if len(directives) == 0 {
- directives = append(directives, "ShellCompDirectiveDefault")
- }
-
- if d >= shellCompDirectiveMaxValue {
- return fmt.Sprintf("ERROR: unexpected ShellCompDirective value: %d", d)
- }
- return strings.Join(directives, ", ")
-}
-
-// initCompleteCmd adds a special hidden command that can be used to request custom completions.
-func (c *Command) initCompleteCmd(args []string) {
- completeCmd := &Command{
- Use: fmt.Sprintf("%s [command-line]", ShellCompRequestCmd),
- Aliases: []string{ShellCompNoDescRequestCmd},
- DisableFlagsInUseLine: true,
- Hidden: true,
- DisableFlagParsing: true,
- Args: MinimumNArgs(1),
- Short: "Request shell completion choices for the specified command-line",
- Long: fmt.Sprintf("%[2]s is a special command that is used by the shell completion logic\n%[1]s",
- "to request completion choices for the specified command-line.", ShellCompRequestCmd),
- Run: func(cmd *Command, args []string) {
- finalCmd, completions, directive, err := cmd.getCompletions(args)
- if err != nil {
- CompErrorln(err.Error())
- // Keep going for multiple reasons:
- // 1- There could be some valid completions even though there was an error
- // 2- Even without completions, we need to print the directive
- }
-
- noDescriptions := cmd.CalledAs() == ShellCompNoDescRequestCmd
- if !noDescriptions {
- if doDescriptions, err := strconv.ParseBool(getEnvConfig(cmd, configEnvVarSuffixDescriptions)); err == nil {
- noDescriptions = !doDescriptions
- }
- }
- noActiveHelp := GetActiveHelpConfig(finalCmd) == activeHelpGlobalDisable
- out := finalCmd.OutOrStdout()
- for _, comp := range completions {
- if noActiveHelp && strings.HasPrefix(comp, activeHelpMarker) {
- // Remove all activeHelp entries if it's disabled.
- continue
- }
- if noDescriptions {
- // Remove any description that may be included following a tab character.
- comp = strings.SplitN(comp, "\t", 2)[0]
- }
-
- // Make sure we only write the first line to the output.
- // This is needed if a description contains a linebreak.
- // Otherwise the shell scripts will interpret the other lines as new flags
- // and could therefore provide a wrong completion.
- comp = strings.SplitN(comp, "\n", 2)[0]
-
- // Finally trim the completion. This is especially important to get rid
- // of a trailing tab when there are no description following it.
- // For example, a sub-command without a description should not be completed
- // with a tab at the end (or else zsh will show a -- following it
- // although there is no description).
- comp = strings.TrimSpace(comp)
-
- // Print each possible completion to the output for the completion script to consume.
- fmt.Fprintln(out, comp)
- }
-
- // As the last printout, print the completion directive for the completion script to parse.
- // The directive integer must be that last character following a single colon (:).
- // The completion script expects :
- fmt.Fprintf(out, ":%d\n", directive)
-
- // Print some helpful info to stderr for the user to understand.
- // Output from stderr must be ignored by the completion script.
- fmt.Fprintf(finalCmd.ErrOrStderr(), "Completion ended with directive: %s\n", directive.string())
- },
- }
- c.AddCommand(completeCmd)
- subCmd, _, err := c.Find(args)
- if err != nil || subCmd.Name() != ShellCompRequestCmd {
- // Only create this special command if it is actually being called.
- // This reduces possible side-effects of creating such a command;
- // for example, having this command would cause problems to a
- // cobra program that only consists of the root command, since this
- // command would cause the root command to suddenly have a subcommand.
- c.RemoveCommand(completeCmd)
- }
-}
-
-func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDirective, error) {
- // The last argument, which is not completely typed by the user,
- // should not be part of the list of arguments
- toComplete := args[len(args)-1]
- trimmedArgs := args[:len(args)-1]
-
- var finalCmd *Command
- var finalArgs []string
- var err error
- // Find the real command for which completion must be performed
- // check if we need to traverse here to parse local flags on parent commands
- if c.Root().TraverseChildren {
- finalCmd, finalArgs, err = c.Root().Traverse(trimmedArgs)
- } else {
- // For Root commands that don't specify any value for their Args fields, when we call
- // Find(), if those Root commands don't have any sub-commands, they will accept arguments.
- // However, because we have added the __complete sub-command in the current code path, the
- // call to Find() -> legacyArgs() will return an error if there are any arguments.
- // To avoid this, we first remove the __complete command to get back to having no sub-commands.
- rootCmd := c.Root()
- if len(rootCmd.Commands()) == 1 {
- rootCmd.RemoveCommand(c)
- }
-
- finalCmd, finalArgs, err = rootCmd.Find(trimmedArgs)
- }
- if err != nil {
- // Unable to find the real command. E.g., someInvalidCmd
- return c, []string{}, ShellCompDirectiveDefault, fmt.Errorf("unable to find a command for arguments: %v", trimmedArgs)
- }
- finalCmd.ctx = c.ctx
-
- // These flags are normally added when `execute()` is called on `finalCmd`,
- // however, when doing completion, we don't call `finalCmd.execute()`.
- // Let's add the --help and --version flag ourselves but only if the finalCmd
- // has not disabled flag parsing; if flag parsing is disabled, it is up to the
- // finalCmd itself to handle the completion of *all* flags.
- if !finalCmd.DisableFlagParsing {
- finalCmd.InitDefaultHelpFlag()
- finalCmd.InitDefaultVersionFlag()
- }
-
- // Check if we are doing flag value completion before parsing the flags.
- // This is important because if we are completing a flag value, we need to also
- // remove the flag name argument from the list of finalArgs or else the parsing
- // could fail due to an invalid value (incomplete) for the flag.
- flag, finalArgs, toComplete, flagErr := checkIfFlagCompletion(finalCmd, finalArgs, toComplete)
-
- // Check if interspersed is false or -- was set on a previous arg.
- // This works by counting the arguments. Normally -- is not counted as arg but
- // if -- was already set or interspersed is false and there is already one arg then
- // the extra added -- is counted as arg.
- flagCompletion := true
- _ = finalCmd.ParseFlags(append(finalArgs, "--"))
- newArgCount := finalCmd.Flags().NArg()
-
- // Parse the flags early so we can check if required flags are set
- if err = finalCmd.ParseFlags(finalArgs); err != nil {
- return finalCmd, []string{}, ShellCompDirectiveDefault, fmt.Errorf("Error while parsing flags from args %v: %s", finalArgs, err.Error())
- }
-
- realArgCount := finalCmd.Flags().NArg()
- if newArgCount > realArgCount {
- // don't do flag completion (see above)
- flagCompletion = false
- }
- // Error while attempting to parse flags
- if flagErr != nil {
- // If error type is flagCompError and we don't want flagCompletion we should ignore the error
- if _, ok := flagErr.(*flagCompError); !(ok && !flagCompletion) {
- return finalCmd, []string{}, ShellCompDirectiveDefault, flagErr
- }
- }
-
- // Look for the --help or --version flags. If they are present,
- // there should be no further completions.
- if helpOrVersionFlagPresent(finalCmd) {
- return finalCmd, []string{}, ShellCompDirectiveNoFileComp, nil
- }
-
- // We only remove the flags from the arguments if DisableFlagParsing is not set.
- // This is important for commands which have requested to do their own flag completion.
- if !finalCmd.DisableFlagParsing {
- finalArgs = finalCmd.Flags().Args()
- }
-
- if flag != nil && flagCompletion {
- // Check if we are completing a flag value subject to annotations
- if validExts, present := flag.Annotations[BashCompFilenameExt]; present {
- if len(validExts) != 0 {
- // File completion filtered by extensions
- return finalCmd, validExts, ShellCompDirectiveFilterFileExt, nil
- }
-
- // The annotation requests simple file completion. There is no reason to do
- // that since it is the default behavior anyway. Let's ignore this annotation
- // in case the program also registered a completion function for this flag.
- // Even though it is a mistake on the program's side, let's be nice when we can.
- }
-
- if subDir, present := flag.Annotations[BashCompSubdirsInDir]; present {
- if len(subDir) == 1 {
- // Directory completion from within a directory
- return finalCmd, subDir, ShellCompDirectiveFilterDirs, nil
- }
- // Directory completion
- return finalCmd, []string{}, ShellCompDirectiveFilterDirs, nil
- }
- }
-
- var completions []string
- var directive ShellCompDirective
-
- // Enforce flag groups before doing flag completions
- finalCmd.enforceFlagGroupsForCompletion()
-
- // Note that we want to perform flagname completion even if finalCmd.DisableFlagParsing==true;
- // doing this allows for completion of persistent flag names even for commands that disable flag parsing.
- //
- // When doing completion of a flag name, as soon as an argument starts with
- // a '-' we know it is a flag. We cannot use isFlagArg() here as it requires
- // the flag name to be complete
- if flag == nil && len(toComplete) > 0 && toComplete[0] == '-' && !strings.Contains(toComplete, "=") && flagCompletion {
- // First check for required flags
- completions = completeRequireFlags(finalCmd, toComplete)
-
- // If we have not found any required flags, only then can we show regular flags
- if len(completions) == 0 {
- doCompleteFlags := func(flag *pflag.Flag) {
- if !flag.Changed ||
- strings.Contains(flag.Value.Type(), "Slice") ||
- strings.Contains(flag.Value.Type(), "Array") {
- // If the flag is not already present, or if it can be specified multiple times (Array or Slice)
- // we suggest it as a completion
- completions = append(completions, getFlagNameCompletions(flag, toComplete)...)
- }
- }
-
- // We cannot use finalCmd.Flags() because we may not have called ParsedFlags() for commands
- // that have set DisableFlagParsing; it is ParseFlags() that merges the inherited and
- // non-inherited flags.
- finalCmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {
- doCompleteFlags(flag)
- })
- // Try to complete non-inherited flags even if DisableFlagParsing==true.
- // This allows programs to tell Cobra about flags for completion even
- // if the actual parsing of flags is not done by Cobra.
- // For instance, Helm uses this to provide flag name completion for
- // some of its plugins.
- finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) {
- doCompleteFlags(flag)
- })
- }
-
- directive = ShellCompDirectiveNoFileComp
- if len(completions) == 1 && strings.HasSuffix(completions[0], "=") {
- // If there is a single completion, the shell usually adds a space
- // after the completion. We don't want that if the flag ends with an =
- directive = ShellCompDirectiveNoSpace
- }
-
- if !finalCmd.DisableFlagParsing {
- // If DisableFlagParsing==false, we have completed the flags as known by Cobra;
- // we can return what we found.
- // If DisableFlagParsing==true, Cobra may not be aware of all flags, so we
- // let the logic continue to see if ValidArgsFunction needs to be called.
- return finalCmd, completions, directive, nil
- }
- } else {
- directive = ShellCompDirectiveDefault
- if flag == nil {
- foundLocalNonPersistentFlag := false
- // If TraverseChildren is true on the root command we don't check for
- // local flags because we can use a local flag on a parent command
- if !finalCmd.Root().TraverseChildren {
- // Check if there are any local, non-persistent flags on the command-line
- localNonPersistentFlags := finalCmd.LocalNonPersistentFlags()
- finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) {
- if localNonPersistentFlags.Lookup(flag.Name) != nil && flag.Changed {
- foundLocalNonPersistentFlag = true
- }
- })
- }
-
- // Complete subcommand names, including the help command
- if len(finalArgs) == 0 && !foundLocalNonPersistentFlag {
- // We only complete sub-commands if:
- // - there are no arguments on the command-line and
- // - there are no local, non-persistent flags on the command-line or TraverseChildren is true
- for _, subCmd := range finalCmd.Commands() {
- if subCmd.IsAvailableCommand() || subCmd == finalCmd.helpCommand {
- if strings.HasPrefix(subCmd.Name(), toComplete) {
- completions = append(completions, fmt.Sprintf("%s\t%s", subCmd.Name(), subCmd.Short))
- }
- directive = ShellCompDirectiveNoFileComp
- }
- }
- }
-
- // Complete required flags even without the '-' prefix
- completions = append(completions, completeRequireFlags(finalCmd, toComplete)...)
-
- // Always complete ValidArgs, even if we are completing a subcommand name.
- // This is for commands that have both subcommands and ValidArgs.
- if len(finalCmd.ValidArgs) > 0 {
- if len(finalArgs) == 0 {
- // ValidArgs are only for the first argument
- for _, validArg := range finalCmd.ValidArgs {
- if strings.HasPrefix(validArg, toComplete) {
- completions = append(completions, validArg)
- }
- }
- directive = ShellCompDirectiveNoFileComp
-
- // If no completions were found within commands or ValidArgs,
- // see if there are any ArgAliases that should be completed.
- if len(completions) == 0 {
- for _, argAlias := range finalCmd.ArgAliases {
- if strings.HasPrefix(argAlias, toComplete) {
- completions = append(completions, argAlias)
- }
- }
- }
- }
-
- // If there are ValidArgs specified (even if they don't match), we stop completion.
- // Only one of ValidArgs or ValidArgsFunction can be used for a single command.
- return finalCmd, completions, directive, nil
- }
-
- // Let the logic continue so as to add any ValidArgsFunction completions,
- // even if we already found sub-commands.
- // This is for commands that have subcommands but also specify a ValidArgsFunction.
- }
- }
-
- // Find the completion function for the flag or command
- var completionFn func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)
- if flag != nil && flagCompletion {
- flagCompletionMutex.RLock()
- completionFn = flagCompletionFunctions[flag]
- flagCompletionMutex.RUnlock()
- } else {
- completionFn = finalCmd.ValidArgsFunction
- }
- if completionFn != nil {
- // Go custom completion defined for this flag or command.
- // Call the registered completion function to get the completions.
- var comps []string
- comps, directive = completionFn(finalCmd, finalArgs, toComplete)
- completions = append(completions, comps...)
- }
-
- return finalCmd, completions, directive, nil
-}
-
-func helpOrVersionFlagPresent(cmd *Command) bool {
- if versionFlag := cmd.Flags().Lookup("version"); versionFlag != nil &&
- len(versionFlag.Annotations[FlagSetByCobraAnnotation]) > 0 && versionFlag.Changed {
- return true
- }
- if helpFlag := cmd.Flags().Lookup("help"); helpFlag != nil &&
- len(helpFlag.Annotations[FlagSetByCobraAnnotation]) > 0 && helpFlag.Changed {
- return true
- }
- return false
-}
-
-func getFlagNameCompletions(flag *pflag.Flag, toComplete string) []string {
- if nonCompletableFlag(flag) {
- return []string{}
- }
-
- var completions []string
- flagName := "--" + flag.Name
- if strings.HasPrefix(flagName, toComplete) {
- // Flag without the =
- completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage))
-
- // Why suggest both long forms: --flag and --flag= ?
- // This forces the user to *always* have to type either an = or a space after the flag name.
- // Let's be nice and avoid making users have to do that.
- // Since boolean flags and shortname flags don't show the = form, let's go that route and never show it.
- // The = form will still work, we just won't suggest it.
- // This also makes the list of suggested flags shorter as we avoid all the = forms.
- //
- // if len(flag.NoOptDefVal) == 0 {
- // // Flag requires a value, so it can be suffixed with =
- // flagName += "="
- // completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage))
- // }
- }
-
- flagName = "-" + flag.Shorthand
- if len(flag.Shorthand) > 0 && strings.HasPrefix(flagName, toComplete) {
- completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage))
- }
-
- return completions
-}
-
-func completeRequireFlags(finalCmd *Command, toComplete string) []string {
- var completions []string
-
- doCompleteRequiredFlags := func(flag *pflag.Flag) {
- if _, present := flag.Annotations[BashCompOneRequiredFlag]; present {
- if !flag.Changed {
- // If the flag is not already present, we suggest it as a completion
- completions = append(completions, getFlagNameCompletions(flag, toComplete)...)
- }
- }
- }
-
- // We cannot use finalCmd.Flags() because we may not have called ParsedFlags() for commands
- // that have set DisableFlagParsing; it is ParseFlags() that merges the inherited and
- // non-inherited flags.
- finalCmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {
- doCompleteRequiredFlags(flag)
- })
- finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) {
- doCompleteRequiredFlags(flag)
- })
-
- return completions
-}
-
-func checkIfFlagCompletion(finalCmd *Command, args []string, lastArg string) (*pflag.Flag, []string, string, error) {
- if finalCmd.DisableFlagParsing {
- // We only do flag completion if we are allowed to parse flags
- // This is important for commands which have requested to do their own flag completion.
- return nil, args, lastArg, nil
- }
-
- var flagName string
- trimmedArgs := args
- flagWithEqual := false
- orgLastArg := lastArg
-
- // When doing completion of a flag name, as soon as an argument starts with
- // a '-' we know it is a flag. We cannot use isFlagArg() here as that function
- // requires the flag name to be complete
- if len(lastArg) > 0 && lastArg[0] == '-' {
- if index := strings.Index(lastArg, "="); index >= 0 {
- // Flag with an =
- if strings.HasPrefix(lastArg[:index], "--") {
- // Flag has full name
- flagName = lastArg[2:index]
- } else {
- // Flag is shorthand
- // We have to get the last shorthand flag name
- // e.g. `-asd` => d to provide the correct completion
- // https://github.com/spf13/cobra/issues/1257
- flagName = lastArg[index-1 : index]
- }
- lastArg = lastArg[index+1:]
- flagWithEqual = true
- } else {
- // Normal flag completion
- return nil, args, lastArg, nil
- }
- }
-
- if len(flagName) == 0 {
- if len(args) > 0 {
- prevArg := args[len(args)-1]
- if isFlagArg(prevArg) {
- // Only consider the case where the flag does not contain an =.
- // If the flag contains an = it means it has already been fully processed,
- // so we don't need to deal with it here.
- if index := strings.Index(prevArg, "="); index < 0 {
- if strings.HasPrefix(prevArg, "--") {
- // Flag has full name
- flagName = prevArg[2:]
- } else {
- // Flag is shorthand
- // We have to get the last shorthand flag name
- // e.g. `-asd` => d to provide the correct completion
- // https://github.com/spf13/cobra/issues/1257
- flagName = prevArg[len(prevArg)-1:]
- }
- // Remove the uncompleted flag or else there could be an error created
- // for an invalid value for that flag
- trimmedArgs = args[:len(args)-1]
- }
- }
- }
- }
-
- if len(flagName) == 0 {
- // Not doing flag completion
- return nil, trimmedArgs, lastArg, nil
- }
-
- flag := findFlag(finalCmd, flagName)
- if flag == nil {
- // Flag not supported by this command, the interspersed option might be set so return the original args
- return nil, args, orgLastArg, &flagCompError{subCommand: finalCmd.Name(), flagName: flagName}
- }
-
- if !flagWithEqual {
- if len(flag.NoOptDefVal) != 0 {
- // We had assumed dealing with a two-word flag but the flag is a boolean flag.
- // In that case, there is no value following it, so we are not really doing flag completion.
- // Reset everything to do noun completion.
- trimmedArgs = args
- flag = nil
- }
- }
-
- return flag, trimmedArgs, lastArg, nil
-}
-
-// InitDefaultCompletionCmd adds a default 'completion' command to c.
-// This function will do nothing if any of the following is true:
-// 1- the feature has been explicitly disabled by the program,
-// 2- c has no subcommands (to avoid creating one),
-// 3- c already has a 'completion' command provided by the program.
-func (c *Command) InitDefaultCompletionCmd() {
- if c.CompletionOptions.DisableDefaultCmd || !c.HasSubCommands() {
- return
- }
-
- for _, cmd := range c.commands {
- if cmd.Name() == compCmdName || cmd.HasAlias(compCmdName) {
- // A completion command is already available
- return
- }
- }
-
- haveNoDescFlag := !c.CompletionOptions.DisableNoDescFlag && !c.CompletionOptions.DisableDescriptions
-
- completionCmd := &Command{
- Use: compCmdName,
- Short: "Generate the autocompletion script for the specified shell",
- Long: fmt.Sprintf(`Generate the autocompletion script for %[1]s for the specified shell.
-See each sub-command's help for details on how to use the generated script.
-`, c.Root().Name()),
- Args: NoArgs,
- ValidArgsFunction: NoFileCompletions,
- Hidden: c.CompletionOptions.HiddenDefaultCmd,
- GroupID: c.completionCommandGroupID,
- }
- c.AddCommand(completionCmd)
-
- out := c.OutOrStdout()
- noDesc := c.CompletionOptions.DisableDescriptions
- shortDesc := "Generate the autocompletion script for %s"
- bash := &Command{
- Use: "bash",
- Short: fmt.Sprintf(shortDesc, "bash"),
- Long: fmt.Sprintf(`Generate the autocompletion script for the bash shell.
-
-This script depends on the 'bash-completion' package.
-If it is not installed already, you can install it via your OS's package manager.
-
-To load completions in your current shell session:
-
- source <(%[1]s completion bash)
-
-To load completions for every new session, execute once:
-
-#### Linux:
-
- %[1]s completion bash > /etc/bash_completion.d/%[1]s
-
-#### macOS:
-
- %[1]s completion bash > $(brew --prefix)/etc/bash_completion.d/%[1]s
-
-You will need to start a new shell for this setup to take effect.
-`, c.Root().Name()),
- Args: NoArgs,
- DisableFlagsInUseLine: true,
- ValidArgsFunction: NoFileCompletions,
- RunE: func(cmd *Command, args []string) error {
- return cmd.Root().GenBashCompletionV2(out, !noDesc)
- },
- }
- if haveNoDescFlag {
- bash.Flags().BoolVar(&noDesc, compCmdNoDescFlagName, compCmdNoDescFlagDefault, compCmdNoDescFlagDesc)
- }
-
- zsh := &Command{
- Use: "zsh",
- Short: fmt.Sprintf(shortDesc, "zsh"),
- Long: fmt.Sprintf(`Generate the autocompletion script for the zsh shell.
-
-If shell completion is not already enabled in your environment you will need
-to enable it. You can execute the following once:
-
- echo "autoload -U compinit; compinit" >> ~/.zshrc
-
-To load completions in your current shell session:
-
- source <(%[1]s completion zsh)
-
-To load completions for every new session, execute once:
-
-#### Linux:
-
- %[1]s completion zsh > "${fpath[1]}/_%[1]s"
-
-#### macOS:
-
- %[1]s completion zsh > $(brew --prefix)/share/zsh/site-functions/_%[1]s
-
-You will need to start a new shell for this setup to take effect.
-`, c.Root().Name()),
- Args: NoArgs,
- ValidArgsFunction: NoFileCompletions,
- RunE: func(cmd *Command, args []string) error {
- if noDesc {
- return cmd.Root().GenZshCompletionNoDesc(out)
- }
- return cmd.Root().GenZshCompletion(out)
- },
- }
- if haveNoDescFlag {
- zsh.Flags().BoolVar(&noDesc, compCmdNoDescFlagName, compCmdNoDescFlagDefault, compCmdNoDescFlagDesc)
- }
-
- fish := &Command{
- Use: "fish",
- Short: fmt.Sprintf(shortDesc, "fish"),
- Long: fmt.Sprintf(`Generate the autocompletion script for the fish shell.
-
-To load completions in your current shell session:
-
- %[1]s completion fish | source
-
-To load completions for every new session, execute once:
-
- %[1]s completion fish > ~/.config/fish/completions/%[1]s.fish
-
-You will need to start a new shell for this setup to take effect.
-`, c.Root().Name()),
- Args: NoArgs,
- ValidArgsFunction: NoFileCompletions,
- RunE: func(cmd *Command, args []string) error {
- return cmd.Root().GenFishCompletion(out, !noDesc)
- },
- }
- if haveNoDescFlag {
- fish.Flags().BoolVar(&noDesc, compCmdNoDescFlagName, compCmdNoDescFlagDefault, compCmdNoDescFlagDesc)
- }
-
- powershell := &Command{
- Use: "powershell",
- Short: fmt.Sprintf(shortDesc, "powershell"),
- Long: fmt.Sprintf(`Generate the autocompletion script for powershell.
-
-To load completions in your current shell session:
-
- %[1]s completion powershell | Out-String | Invoke-Expression
-
-To load completions for every new session, add the output of the above command
-to your powershell profile.
-`, c.Root().Name()),
- Args: NoArgs,
- ValidArgsFunction: NoFileCompletions,
- RunE: func(cmd *Command, args []string) error {
- if noDesc {
- return cmd.Root().GenPowerShellCompletion(out)
- }
- return cmd.Root().GenPowerShellCompletionWithDesc(out)
-
- },
- }
- if haveNoDescFlag {
- powershell.Flags().BoolVar(&noDesc, compCmdNoDescFlagName, compCmdNoDescFlagDefault, compCmdNoDescFlagDesc)
- }
-
- completionCmd.AddCommand(bash, zsh, fish, powershell)
-}
-
-func findFlag(cmd *Command, name string) *pflag.Flag {
- flagSet := cmd.Flags()
- if len(name) == 1 {
- // First convert the short flag into a long flag
- // as the cmd.Flag() search only accepts long flags
- if short := flagSet.ShorthandLookup(name); short != nil {
- name = short.Name
- } else {
- set := cmd.InheritedFlags()
- if short = set.ShorthandLookup(name); short != nil {
- name = short.Name
- } else {
- return nil
- }
- }
- }
- return cmd.Flag(name)
-}
-
-// CompDebug prints the specified string to the same file as where the
-// completion script prints its logs.
-// Note that completion printouts should never be on stdout as they would
-// be wrongly interpreted as actual completion choices by the completion script.
-func CompDebug(msg string, printToStdErr bool) {
- msg = fmt.Sprintf("[Debug] %s", msg)
-
- // Such logs are only printed when the user has set the environment
- // variable BASH_COMP_DEBUG_FILE to the path of some file to be used.
- if path := os.Getenv("BASH_COMP_DEBUG_FILE"); path != "" {
- f, err := os.OpenFile(path,
- os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
- if err == nil {
- defer f.Close()
- WriteStringAndCheck(f, msg)
- }
- }
-
- if printToStdErr {
- // Must print to stderr for this not to be read by the completion script.
- fmt.Fprint(os.Stderr, msg)
- }
-}
-
-// CompDebugln prints the specified string with a newline at the end
-// to the same file as where the completion script prints its logs.
-// Such logs are only printed when the user has set the environment
-// variable BASH_COMP_DEBUG_FILE to the path of some file to be used.
-func CompDebugln(msg string, printToStdErr bool) {
- CompDebug(fmt.Sprintf("%s\n", msg), printToStdErr)
-}
-
-// CompError prints the specified completion message to stderr.
-func CompError(msg string) {
- msg = fmt.Sprintf("[Error] %s", msg)
- CompDebug(msg, true)
-}
-
-// CompErrorln prints the specified completion message to stderr with a newline at the end.
-func CompErrorln(msg string) {
- CompError(fmt.Sprintf("%s\n", msg))
-}
-
-// These values should not be changed: users will be using them explicitly.
-const (
- configEnvVarGlobalPrefix = "COBRA"
- configEnvVarSuffixDescriptions = "COMPLETION_DESCRIPTIONS"
-)
-
-var configEnvVarPrefixSubstRegexp = regexp.MustCompile(`[^A-Z0-9_]`)
-
-// configEnvVar returns the name of the program-specific configuration environment
-// variable. It has the format _ where is the name of the
-// root command in upper case, with all non-ASCII-alphanumeric characters replaced by `_`.
-func configEnvVar(name, suffix string) string {
- // This format should not be changed: users will be using it explicitly.
- v := strings.ToUpper(fmt.Sprintf("%s_%s", name, suffix))
- v = configEnvVarPrefixSubstRegexp.ReplaceAllString(v, "_")
- return v
-}
-
-// getEnvConfig returns the value of the configuration environment variable
-// _ where is the name of the root command in upper
-// case, with all non-ASCII-alphanumeric characters replaced by `_`.
-// If the value is empty or not set, the value of the environment variable
-// COBRA_ is returned instead.
-func getEnvConfig(cmd *Command, suffix string) string {
- v := os.Getenv(configEnvVar(cmd.Root().Name(), suffix))
- if v == "" {
- v = os.Getenv(configEnvVar(configEnvVarGlobalPrefix, suffix))
- }
- return v
-}
diff --git a/vendor/github.com/spf13/cobra/fish_completions.go b/vendor/github.com/spf13/cobra/fish_completions.go
deleted file mode 100644
index 12d61b691..000000000
--- a/vendor/github.com/spf13/cobra/fish_completions.go
+++ /dev/null
@@ -1,292 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "strings"
-)
-
-func genFishComp(buf io.StringWriter, name string, includeDesc bool) {
- // Variables should not contain a '-' or ':' character
- nameForVar := name
- nameForVar = strings.ReplaceAll(nameForVar, "-", "_")
- nameForVar = strings.ReplaceAll(nameForVar, ":", "_")
-
- compCmd := ShellCompRequestCmd
- if !includeDesc {
- compCmd = ShellCompNoDescRequestCmd
- }
- WriteStringAndCheck(buf, fmt.Sprintf("# fish completion for %-36s -*- shell-script -*-\n", name))
- WriteStringAndCheck(buf, fmt.Sprintf(`
-function __%[1]s_debug
- set -l file "$BASH_COMP_DEBUG_FILE"
- if test -n "$file"
- echo "$argv" >> $file
- end
-end
-
-function __%[1]s_perform_completion
- __%[1]s_debug "Starting __%[1]s_perform_completion"
-
- # Extract all args except the last one
- set -l args (commandline -opc)
- # Extract the last arg and escape it in case it is a space
- set -l lastArg (string escape -- (commandline -ct))
-
- __%[1]s_debug "args: $args"
- __%[1]s_debug "last arg: $lastArg"
-
- # Disable ActiveHelp which is not supported for fish shell
- set -l requestComp "%[10]s=0 $args[1] %[3]s $args[2..-1] $lastArg"
-
- __%[1]s_debug "Calling $requestComp"
- set -l results (eval $requestComp 2> /dev/null)
-
- # Some programs may output extra empty lines after the directive.
- # Let's ignore them or else it will break completion.
- # Ref: https://github.com/spf13/cobra/issues/1279
- for line in $results[-1..1]
- if test (string trim -- $line) = ""
- # Found an empty line, remove it
- set results $results[1..-2]
- else
- # Found non-empty line, we have our proper output
- break
- end
- end
-
- set -l comps $results[1..-2]
- set -l directiveLine $results[-1]
-
- # For Fish, when completing a flag with an = (e.g., -n=)
- # completions must be prefixed with the flag
- set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
-
- __%[1]s_debug "Comps: $comps"
- __%[1]s_debug "DirectiveLine: $directiveLine"
- __%[1]s_debug "flagPrefix: $flagPrefix"
-
- for comp in $comps
- printf "%%s%%s\n" "$flagPrefix" "$comp"
- end
-
- printf "%%s\n" "$directiveLine"
-end
-
-# this function limits calls to __%[1]s_perform_completion, by caching the result behind $__%[1]s_perform_completion_once_result
-function __%[1]s_perform_completion_once
- __%[1]s_debug "Starting __%[1]s_perform_completion_once"
-
- if test -n "$__%[1]s_perform_completion_once_result"
- __%[1]s_debug "Seems like a valid result already exists, skipping __%[1]s_perform_completion"
- return 0
- end
-
- set --global __%[1]s_perform_completion_once_result (__%[1]s_perform_completion)
- if test -z "$__%[1]s_perform_completion_once_result"
- __%[1]s_debug "No completions, probably due to a failure"
- return 1
- end
-
- __%[1]s_debug "Performed completions and set __%[1]s_perform_completion_once_result"
- return 0
-end
-
-# this function is used to clear the $__%[1]s_perform_completion_once_result variable after completions are run
-function __%[1]s_clear_perform_completion_once_result
- __%[1]s_debug ""
- __%[1]s_debug "========= clearing previously set __%[1]s_perform_completion_once_result variable =========="
- set --erase __%[1]s_perform_completion_once_result
- __%[1]s_debug "Successfully erased the variable __%[1]s_perform_completion_once_result"
-end
-
-function __%[1]s_requires_order_preservation
- __%[1]s_debug ""
- __%[1]s_debug "========= checking if order preservation is required =========="
-
- __%[1]s_perform_completion_once
- if test -z "$__%[1]s_perform_completion_once_result"
- __%[1]s_debug "Error determining if order preservation is required"
- return 1
- end
-
- set -l directive (string sub --start 2 $__%[1]s_perform_completion_once_result[-1])
- __%[1]s_debug "Directive is: $directive"
-
- set -l shellCompDirectiveKeepOrder %[9]d
- set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) %% 2)
- __%[1]s_debug "Keeporder is: $keeporder"
-
- if test $keeporder -ne 0
- __%[1]s_debug "This does require order preservation"
- return 0
- end
-
- __%[1]s_debug "This doesn't require order preservation"
- return 1
-end
-
-
-# This function does two things:
-# - Obtain the completions and store them in the global __%[1]s_comp_results
-# - Return false if file completion should be performed
-function __%[1]s_prepare_completions
- __%[1]s_debug ""
- __%[1]s_debug "========= starting completion logic =========="
-
- # Start fresh
- set --erase __%[1]s_comp_results
-
- __%[1]s_perform_completion_once
- __%[1]s_debug "Completion results: $__%[1]s_perform_completion_once_result"
-
- if test -z "$__%[1]s_perform_completion_once_result"
- __%[1]s_debug "No completion, probably due to a failure"
- # Might as well do file completion, in case it helps
- return 1
- end
-
- set -l directive (string sub --start 2 $__%[1]s_perform_completion_once_result[-1])
- set --global __%[1]s_comp_results $__%[1]s_perform_completion_once_result[1..-2]
-
- __%[1]s_debug "Completions are: $__%[1]s_comp_results"
- __%[1]s_debug "Directive is: $directive"
-
- set -l shellCompDirectiveError %[4]d
- set -l shellCompDirectiveNoSpace %[5]d
- set -l shellCompDirectiveNoFileComp %[6]d
- set -l shellCompDirectiveFilterFileExt %[7]d
- set -l shellCompDirectiveFilterDirs %[8]d
-
- if test -z "$directive"
- set directive 0
- end
-
- set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) %% 2)
- if test $compErr -eq 1
- __%[1]s_debug "Received error directive: aborting."
- # Might as well do file completion, in case it helps
- return 1
- end
-
- set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) %% 2)
- set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) %% 2)
- if test $filefilter -eq 1; or test $dirfilter -eq 1
- __%[1]s_debug "File extension filtering or directory filtering not supported"
- # Do full file completion instead
- return 1
- end
-
- set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) %% 2)
- set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) %% 2)
-
- __%[1]s_debug "nospace: $nospace, nofiles: $nofiles"
-
- # If we want to prevent a space, or if file completion is NOT disabled,
- # we need to count the number of valid completions.
- # To do so, we will filter on prefix as the completions we have received
- # may not already be filtered so as to allow fish to match on different
- # criteria than the prefix.
- if test $nospace -ne 0; or test $nofiles -eq 0
- set -l prefix (commandline -t | string escape --style=regex)
- __%[1]s_debug "prefix: $prefix"
-
- set -l completions (string match -r -- "^$prefix.*" $__%[1]s_comp_results)
- set --global __%[1]s_comp_results $completions
- __%[1]s_debug "Filtered completions are: $__%[1]s_comp_results"
-
- # Important not to quote the variable for count to work
- set -l numComps (count $__%[1]s_comp_results)
- __%[1]s_debug "numComps: $numComps"
-
- if test $numComps -eq 1; and test $nospace -ne 0
- # We must first split on \t to get rid of the descriptions to be
- # able to check what the actual completion will be.
- # We don't need descriptions anyway since there is only a single
- # real completion which the shell will expand immediately.
- set -l split (string split --max 1 \t $__%[1]s_comp_results[1])
-
- # Fish won't add a space if the completion ends with any
- # of the following characters: @=/:.,
- set -l lastChar (string sub -s -1 -- $split)
- if not string match -r -q "[@=/:.,]" -- "$lastChar"
- # In other cases, to support the "nospace" directive we trick the shell
- # by outputting an extra, longer completion.
- __%[1]s_debug "Adding second completion to perform nospace directive"
- set --global __%[1]s_comp_results $split[1] $split[1].
- __%[1]s_debug "Completions are now: $__%[1]s_comp_results"
- end
- end
-
- if test $numComps -eq 0; and test $nofiles -eq 0
- # To be consistent with bash and zsh, we only trigger file
- # completion when there are no other completions
- __%[1]s_debug "Requesting file completion"
- return 1
- end
- end
-
- return 0
-end
-
-# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves
-# so we can properly delete any completions provided by another script.
-# Only do this if the program can be found, or else fish may print some errors; besides,
-# the existing completions will only be loaded if the program can be found.
-if type -q "%[2]s"
- # The space after the program name is essential to trigger completion for the program
- # and not completion of the program name itself.
- # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
- complete --do-complete "%[2]s " > /dev/null 2>&1
-end
-
-# Remove any pre-existing completions for the program since we will be handling all of them.
-complete -c %[2]s -e
-
-# this will get called after the two calls below and clear the $__%[1]s_perform_completion_once_result global
-complete -c %[2]s -n '__%[1]s_clear_perform_completion_once_result'
-# The call to __%[1]s_prepare_completions will setup __%[1]s_comp_results
-# which provides the program's completion choices.
-# If this doesn't require order preservation, we don't use the -k flag
-complete -c %[2]s -n 'not __%[1]s_requires_order_preservation && __%[1]s_prepare_completions' -f -a '$__%[1]s_comp_results'
-# otherwise we use the -k flag
-complete -k -c %[2]s -n '__%[1]s_requires_order_preservation && __%[1]s_prepare_completions' -f -a '$__%[1]s_comp_results'
-`, nameForVar, name, compCmd,
- ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp,
- ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpEnvVar(name)))
-}
-
-// GenFishCompletion generates fish completion file and writes to the passed writer.
-func (c *Command) GenFishCompletion(w io.Writer, includeDesc bool) error {
- buf := new(bytes.Buffer)
- genFishComp(buf, c.Name(), includeDesc)
- _, err := buf.WriteTo(w)
- return err
-}
-
-// GenFishCompletionFile generates fish completion file.
-func (c *Command) GenFishCompletionFile(filename string, includeDesc bool) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return c.GenFishCompletion(outFile, includeDesc)
-}
diff --git a/vendor/github.com/spf13/cobra/flag_groups.go b/vendor/github.com/spf13/cobra/flag_groups.go
deleted file mode 100644
index 560612fd3..000000000
--- a/vendor/github.com/spf13/cobra/flag_groups.go
+++ /dev/null
@@ -1,290 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "fmt"
- "sort"
- "strings"
-
- flag "github.com/spf13/pflag"
-)
-
-const (
- requiredAsGroupAnnotation = "cobra_annotation_required_if_others_set"
- oneRequiredAnnotation = "cobra_annotation_one_required"
- mutuallyExclusiveAnnotation = "cobra_annotation_mutually_exclusive"
-)
-
-// MarkFlagsRequiredTogether marks the given flags with annotations so that Cobra errors
-// if the command is invoked with a subset (but not all) of the given flags.
-func (c *Command) MarkFlagsRequiredTogether(flagNames ...string) {
- c.mergePersistentFlags()
- for _, v := range flagNames {
- f := c.Flags().Lookup(v)
- if f == nil {
- panic(fmt.Sprintf("Failed to find flag %q and mark it as being required in a flag group", v))
- }
- if err := c.Flags().SetAnnotation(v, requiredAsGroupAnnotation, append(f.Annotations[requiredAsGroupAnnotation], strings.Join(flagNames, " "))); err != nil {
- // Only errs if the flag isn't found.
- panic(err)
- }
- }
-}
-
-// MarkFlagsOneRequired marks the given flags with annotations so that Cobra errors
-// if the command is invoked without at least one flag from the given set of flags.
-func (c *Command) MarkFlagsOneRequired(flagNames ...string) {
- c.mergePersistentFlags()
- for _, v := range flagNames {
- f := c.Flags().Lookup(v)
- if f == nil {
- panic(fmt.Sprintf("Failed to find flag %q and mark it as being in a one-required flag group", v))
- }
- if err := c.Flags().SetAnnotation(v, oneRequiredAnnotation, append(f.Annotations[oneRequiredAnnotation], strings.Join(flagNames, " "))); err != nil {
- // Only errs if the flag isn't found.
- panic(err)
- }
- }
-}
-
-// MarkFlagsMutuallyExclusive marks the given flags with annotations so that Cobra errors
-// if the command is invoked with more than one flag from the given set of flags.
-func (c *Command) MarkFlagsMutuallyExclusive(flagNames ...string) {
- c.mergePersistentFlags()
- for _, v := range flagNames {
- f := c.Flags().Lookup(v)
- if f == nil {
- panic(fmt.Sprintf("Failed to find flag %q and mark it as being in a mutually exclusive flag group", v))
- }
- // Each time this is called is a single new entry; this allows it to be a member of multiple groups if needed.
- if err := c.Flags().SetAnnotation(v, mutuallyExclusiveAnnotation, append(f.Annotations[mutuallyExclusiveAnnotation], strings.Join(flagNames, " "))); err != nil {
- panic(err)
- }
- }
-}
-
-// ValidateFlagGroups validates the mutuallyExclusive/oneRequired/requiredAsGroup logic and returns the
-// first error encountered.
-func (c *Command) ValidateFlagGroups() error {
- if c.DisableFlagParsing {
- return nil
- }
-
- flags := c.Flags()
-
- // groupStatus format is the list of flags as a unique ID,
- // then a map of each flag name and whether it is set or not.
- groupStatus := map[string]map[string]bool{}
- oneRequiredGroupStatus := map[string]map[string]bool{}
- mutuallyExclusiveGroupStatus := map[string]map[string]bool{}
- flags.VisitAll(func(pflag *flag.Flag) {
- processFlagForGroupAnnotation(flags, pflag, requiredAsGroupAnnotation, groupStatus)
- processFlagForGroupAnnotation(flags, pflag, oneRequiredAnnotation, oneRequiredGroupStatus)
- processFlagForGroupAnnotation(flags, pflag, mutuallyExclusiveAnnotation, mutuallyExclusiveGroupStatus)
- })
-
- if err := validateRequiredFlagGroups(groupStatus); err != nil {
- return err
- }
- if err := validateOneRequiredFlagGroups(oneRequiredGroupStatus); err != nil {
- return err
- }
- if err := validateExclusiveFlagGroups(mutuallyExclusiveGroupStatus); err != nil {
- return err
- }
- return nil
-}
-
-func hasAllFlags(fs *flag.FlagSet, flagnames ...string) bool {
- for _, fname := range flagnames {
- f := fs.Lookup(fname)
- if f == nil {
- return false
- }
- }
- return true
-}
-
-func processFlagForGroupAnnotation(flags *flag.FlagSet, pflag *flag.Flag, annotation string, groupStatus map[string]map[string]bool) {
- groupInfo, found := pflag.Annotations[annotation]
- if found {
- for _, group := range groupInfo {
- if groupStatus[group] == nil {
- flagnames := strings.Split(group, " ")
-
- // Only consider this flag group at all if all the flags are defined.
- if !hasAllFlags(flags, flagnames...) {
- continue
- }
-
- groupStatus[group] = make(map[string]bool, len(flagnames))
- for _, name := range flagnames {
- groupStatus[group][name] = false
- }
- }
-
- groupStatus[group][pflag.Name] = pflag.Changed
- }
- }
-}
-
-func validateRequiredFlagGroups(data map[string]map[string]bool) error {
- keys := sortedKeys(data)
- for _, flagList := range keys {
- flagnameAndStatus := data[flagList]
-
- unset := []string{}
- for flagname, isSet := range flagnameAndStatus {
- if !isSet {
- unset = append(unset, flagname)
- }
- }
- if len(unset) == len(flagnameAndStatus) || len(unset) == 0 {
- continue
- }
-
- // Sort values, so they can be tested/scripted against consistently.
- sort.Strings(unset)
- return fmt.Errorf("if any flags in the group [%v] are set they must all be set; missing %v", flagList, unset)
- }
-
- return nil
-}
-
-func validateOneRequiredFlagGroups(data map[string]map[string]bool) error {
- keys := sortedKeys(data)
- for _, flagList := range keys {
- flagnameAndStatus := data[flagList]
- var set []string
- for flagname, isSet := range flagnameAndStatus {
- if isSet {
- set = append(set, flagname)
- }
- }
- if len(set) >= 1 {
- continue
- }
-
- // Sort values, so they can be tested/scripted against consistently.
- sort.Strings(set)
- return fmt.Errorf("at least one of the flags in the group [%v] is required", flagList)
- }
- return nil
-}
-
-func validateExclusiveFlagGroups(data map[string]map[string]bool) error {
- keys := sortedKeys(data)
- for _, flagList := range keys {
- flagnameAndStatus := data[flagList]
- var set []string
- for flagname, isSet := range flagnameAndStatus {
- if isSet {
- set = append(set, flagname)
- }
- }
- if len(set) == 0 || len(set) == 1 {
- continue
- }
-
- // Sort values, so they can be tested/scripted against consistently.
- sort.Strings(set)
- return fmt.Errorf("if any flags in the group [%v] are set none of the others can be; %v were all set", flagList, set)
- }
- return nil
-}
-
-func sortedKeys(m map[string]map[string]bool) []string {
- keys := make([]string, len(m))
- i := 0
- for k := range m {
- keys[i] = k
- i++
- }
- sort.Strings(keys)
- return keys
-}
-
-// enforceFlagGroupsForCompletion will do the following:
-// - when a flag in a group is present, other flags in the group will be marked required
-// - when none of the flags in a one-required group are present, all flags in the group will be marked required
-// - when a flag in a mutually exclusive group is present, other flags in the group will be marked as hidden
-// This allows the standard completion logic to behave appropriately for flag groups
-func (c *Command) enforceFlagGroupsForCompletion() {
- if c.DisableFlagParsing {
- return
- }
-
- flags := c.Flags()
- groupStatus := map[string]map[string]bool{}
- oneRequiredGroupStatus := map[string]map[string]bool{}
- mutuallyExclusiveGroupStatus := map[string]map[string]bool{}
- c.Flags().VisitAll(func(pflag *flag.Flag) {
- processFlagForGroupAnnotation(flags, pflag, requiredAsGroupAnnotation, groupStatus)
- processFlagForGroupAnnotation(flags, pflag, oneRequiredAnnotation, oneRequiredGroupStatus)
- processFlagForGroupAnnotation(flags, pflag, mutuallyExclusiveAnnotation, mutuallyExclusiveGroupStatus)
- })
-
- // If a flag that is part of a group is present, we make all the other flags
- // of that group required so that the shell completion suggests them automatically
- for flagList, flagnameAndStatus := range groupStatus {
- for _, isSet := range flagnameAndStatus {
- if isSet {
- // One of the flags of the group is set, mark the other ones as required
- for _, fName := range strings.Split(flagList, " ") {
- _ = c.MarkFlagRequired(fName)
- }
- }
- }
- }
-
- // If none of the flags of a one-required group are present, we make all the flags
- // of that group required so that the shell completion suggests them automatically
- for flagList, flagnameAndStatus := range oneRequiredGroupStatus {
- isSet := false
-
- for _, isSet = range flagnameAndStatus {
- if isSet {
- break
- }
- }
-
- // None of the flags of the group are set, mark all flags in the group
- // as required
- if !isSet {
- for _, fName := range strings.Split(flagList, " ") {
- _ = c.MarkFlagRequired(fName)
- }
- }
- }
-
- // If a flag that is mutually exclusive to others is present, we hide the other
- // flags of that group so the shell completion does not suggest them
- for flagList, flagnameAndStatus := range mutuallyExclusiveGroupStatus {
- for flagName, isSet := range flagnameAndStatus {
- if isSet {
- // One of the flags of the mutually exclusive group is set, mark the other ones as hidden
- // Don't mark the flag that is already set as hidden because it may be an
- // array or slice flag and therefore must continue being suggested
- for _, fName := range strings.Split(flagList, " ") {
- if fName != flagName {
- flag := c.Flags().Lookup(fName)
- flag.Hidden = true
- }
- }
- }
- }
- }
-}
diff --git a/vendor/github.com/spf13/cobra/powershell_completions.go b/vendor/github.com/spf13/cobra/powershell_completions.go
deleted file mode 100644
index a830b7bca..000000000
--- a/vendor/github.com/spf13/cobra/powershell_completions.go
+++ /dev/null
@@ -1,325 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// The generated scripts require PowerShell v5.0+ (which comes Windows 10, but
-// can be downloaded separately for windows 7 or 8.1).
-
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "strings"
-)
-
-func genPowerShellComp(buf io.StringWriter, name string, includeDesc bool) {
- // Variables should not contain a '-' or ':' character
- nameForVar := name
- nameForVar = strings.ReplaceAll(nameForVar, "-", "_")
- nameForVar = strings.ReplaceAll(nameForVar, ":", "_")
-
- compCmd := ShellCompRequestCmd
- if !includeDesc {
- compCmd = ShellCompNoDescRequestCmd
- }
- WriteStringAndCheck(buf, fmt.Sprintf(`# powershell completion for %-36[1]s -*- shell-script -*-
-
-function __%[1]s_debug {
- if ($env:BASH_COMP_DEBUG_FILE) {
- "$args" | Out-File -Append -FilePath "$env:BASH_COMP_DEBUG_FILE"
- }
-}
-
-filter __%[1]s_escapeStringWithSpecialChars {
-`+" $_ -replace '\\s|#|@|\\$|;|,|''|\\{|\\}|\\(|\\)|\"|`|\\||<|>|&','`$&'"+`
-}
-
-[scriptblock]${__%[2]sCompleterBlock} = {
- param(
- $WordToComplete,
- $CommandAst,
- $CursorPosition
- )
-
- # Get the current command line and convert into a string
- $Command = $CommandAst.CommandElements
- $Command = "$Command"
-
- __%[1]s_debug ""
- __%[1]s_debug "========= starting completion logic =========="
- __%[1]s_debug "WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition"
-
- # The user could have moved the cursor backwards on the command-line.
- # We need to trigger completion from the $CursorPosition location, so we need
- # to truncate the command-line ($Command) up to the $CursorPosition location.
- # Make sure the $Command is longer then the $CursorPosition before we truncate.
- # This happens because the $Command does not include the last space.
- if ($Command.Length -gt $CursorPosition) {
- $Command=$Command.Substring(0,$CursorPosition)
- }
- __%[1]s_debug "Truncated command: $Command"
-
- $ShellCompDirectiveError=%[4]d
- $ShellCompDirectiveNoSpace=%[5]d
- $ShellCompDirectiveNoFileComp=%[6]d
- $ShellCompDirectiveFilterFileExt=%[7]d
- $ShellCompDirectiveFilterDirs=%[8]d
- $ShellCompDirectiveKeepOrder=%[9]d
-
- # Prepare the command to request completions for the program.
- # Split the command at the first space to separate the program and arguments.
- $Program,$Arguments = $Command.Split(" ",2)
-
- $RequestComp="$Program %[3]s $Arguments"
- __%[1]s_debug "RequestComp: $RequestComp"
-
- # we cannot use $WordToComplete because it
- # has the wrong values if the cursor was moved
- # so use the last argument
- if ($WordToComplete -ne "" ) {
- $WordToComplete = $Arguments.Split(" ")[-1]
- }
- __%[1]s_debug "New WordToComplete: $WordToComplete"
-
-
- # Check for flag with equal sign
- $IsEqualFlag = ($WordToComplete -Like "--*=*" )
- if ( $IsEqualFlag ) {
- __%[1]s_debug "Completing equal sign flag"
- # Remove the flag part
- $Flag,$WordToComplete = $WordToComplete.Split("=",2)
- }
-
- if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag )) {
- # If the last parameter is complete (there is a space following it)
- # We add an extra empty parameter so we can indicate this to the go method.
- __%[1]s_debug "Adding extra empty parameter"
- # PowerShell 7.2+ changed the way how the arguments are passed to executables,
- # so for pre-7.2 or when Legacy argument passing is enabled we need to use
-`+" # `\"`\" to pass an empty argument, a \"\" or '' does not work!!!"+`
- if ($PSVersionTable.PsVersion -lt [version]'7.2.0' -or
- ($PSVersionTable.PsVersion -lt [version]'7.3.0' -and -not [ExperimentalFeature]::IsEnabled("PSNativeCommandArgumentPassing")) -or
- (($PSVersionTable.PsVersion -ge [version]'7.3.0' -or [ExperimentalFeature]::IsEnabled("PSNativeCommandArgumentPassing")) -and
- $PSNativeCommandArgumentPassing -eq 'Legacy')) {
-`+" $RequestComp=\"$RequestComp\" + ' `\"`\"'"+`
- } else {
- $RequestComp="$RequestComp" + ' ""'
- }
- }
-
- __%[1]s_debug "Calling $RequestComp"
- # First disable ActiveHelp which is not supported for Powershell
- ${env:%[10]s}=0
-
- #call the command store the output in $out and redirect stderr and stdout to null
- # $Out is an array contains each line per element
- Invoke-Expression -OutVariable out "$RequestComp" 2>&1 | Out-Null
-
- # get directive from last line
- [int]$Directive = $Out[-1].TrimStart(':')
- if ($Directive -eq "") {
- # There is no directive specified
- $Directive = 0
- }
- __%[1]s_debug "The completion directive is: $Directive"
-
- # remove directive (last element) from out
- $Out = $Out | Where-Object { $_ -ne $Out[-1] }
- __%[1]s_debug "The completions are: $Out"
-
- if (($Directive -band $ShellCompDirectiveError) -ne 0 ) {
- # Error code. No completion.
- __%[1]s_debug "Received error from custom completion go code"
- return
- }
-
- $Longest = 0
- [Array]$Values = $Out | ForEach-Object {
- #Split the output in name and description
-`+" $Name, $Description = $_.Split(\"`t\",2)"+`
- __%[1]s_debug "Name: $Name Description: $Description"
-
- # Look for the longest completion so that we can format things nicely
- if ($Longest -lt $Name.Length) {
- $Longest = $Name.Length
- }
-
- # Set the description to a one space string if there is none set.
- # This is needed because the CompletionResult does not accept an empty string as argument
- if (-Not $Description) {
- $Description = " "
- }
- @{Name="$Name";Description="$Description"}
- }
-
-
- $Space = " "
- if (($Directive -band $ShellCompDirectiveNoSpace) -ne 0 ) {
- # remove the space here
- __%[1]s_debug "ShellCompDirectiveNoSpace is called"
- $Space = ""
- }
-
- if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or
- (($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {
- __%[1]s_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported"
-
- # return here to prevent the completion of the extensions
- return
- }
-
- $Values = $Values | Where-Object {
- # filter the result
- $_.Name -like "$WordToComplete*"
-
- # Join the flag back if we have an equal sign flag
- if ( $IsEqualFlag ) {
- __%[1]s_debug "Join the equal sign flag back to the completion value"
- $_.Name = $Flag + "=" + $_.Name
- }
- }
-
- # we sort the values in ascending order by name if keep order isn't passed
- if (($Directive -band $ShellCompDirectiveKeepOrder) -eq 0 ) {
- $Values = $Values | Sort-Object -Property Name
- }
-
- if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
- __%[1]s_debug "ShellCompDirectiveNoFileComp is called"
-
- if ($Values.Length -eq 0) {
- # Just print an empty string here so the
- # shell does not start to complete paths.
- # We cannot use CompletionResult here because
- # it does not accept an empty string as argument.
- ""
- return
- }
- }
-
- # Get the current mode
- $Mode = (Get-PSReadLineKeyHandler | Where-Object {$_.Key -eq "Tab" }).Function
- __%[1]s_debug "Mode: $Mode"
-
- $Values | ForEach-Object {
-
- # store temporary because switch will overwrite $_
- $comp = $_
-
- # PowerShell supports three different completion modes
- # - TabCompleteNext (default windows style - on each key press the next option is displayed)
- # - Complete (works like bash)
- # - MenuComplete (works like zsh)
- # You set the mode with Set-PSReadLineKeyHandler -Key Tab -Function
-
- # CompletionResult Arguments:
- # 1) CompletionText text to be used as the auto completion result
- # 2) ListItemText text to be displayed in the suggestion list
- # 3) ResultType type of completion result
- # 4) ToolTip text for the tooltip with details about the object
-
- switch ($Mode) {
-
- # bash like
- "Complete" {
-
- if ($Values.Length -eq 1) {
- __%[1]s_debug "Only one completion left"
-
- # insert space after value
- [System.Management.Automation.CompletionResult]::new($($comp.Name | __%[1]s_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
-
- } else {
- # Add the proper number of spaces to align the descriptions
- while($comp.Name.Length -lt $Longest) {
- $comp.Name = $comp.Name + " "
- }
-
- # Check for empty description and only add parentheses if needed
- if ($($comp.Description) -eq " " ) {
- $Description = ""
- } else {
- $Description = " ($($comp.Description))"
- }
-
- [System.Management.Automation.CompletionResult]::new("$($comp.Name)$Description", "$($comp.Name)$Description", 'ParameterValue', "$($comp.Description)")
- }
- }
-
- # zsh like
- "MenuComplete" {
- # insert space after value
- # MenuComplete will automatically show the ToolTip of
- # the highlighted value at the bottom of the suggestions.
- [System.Management.Automation.CompletionResult]::new($($comp.Name | __%[1]s_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
- }
-
- # TabCompleteNext and in case we get something unknown
- Default {
- # Like MenuComplete but we don't want to add a space here because
- # the user need to press space anyway to get the completion.
- # Description will not be shown because that's not possible with TabCompleteNext
- [System.Management.Automation.CompletionResult]::new($($comp.Name | __%[1]s_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
- }
- }
-
- }
-}
-
-Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock ${__%[2]sCompleterBlock}
-`, name, nameForVar, compCmd,
- ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp,
- ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder, activeHelpEnvVar(name)))
-}
-
-func (c *Command) genPowerShellCompletion(w io.Writer, includeDesc bool) error {
- buf := new(bytes.Buffer)
- genPowerShellComp(buf, c.Name(), includeDesc)
- _, err := buf.WriteTo(w)
- return err
-}
-
-func (c *Command) genPowerShellCompletionFile(filename string, includeDesc bool) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return c.genPowerShellCompletion(outFile, includeDesc)
-}
-
-// GenPowerShellCompletionFile generates powershell completion file without descriptions.
-func (c *Command) GenPowerShellCompletionFile(filename string) error {
- return c.genPowerShellCompletionFile(filename, false)
-}
-
-// GenPowerShellCompletion generates powershell completion file without descriptions
-// and writes it to the passed writer.
-func (c *Command) GenPowerShellCompletion(w io.Writer) error {
- return c.genPowerShellCompletion(w, false)
-}
-
-// GenPowerShellCompletionFileWithDesc generates powershell completion file with descriptions.
-func (c *Command) GenPowerShellCompletionFileWithDesc(filename string) error {
- return c.genPowerShellCompletionFile(filename, true)
-}
-
-// GenPowerShellCompletionWithDesc generates powershell completion file with descriptions
-// and writes it to the passed writer.
-func (c *Command) GenPowerShellCompletionWithDesc(w io.Writer) error {
- return c.genPowerShellCompletion(w, true)
-}
diff --git a/vendor/github.com/spf13/cobra/shell_completions.go b/vendor/github.com/spf13/cobra/shell_completions.go
deleted file mode 100644
index b035742d3..000000000
--- a/vendor/github.com/spf13/cobra/shell_completions.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "github.com/spf13/pflag"
-)
-
-// MarkFlagRequired instructs the various shell completion implementations to
-// prioritize the named flag when performing completion,
-// and causes your command to report an error if invoked without the flag.
-func (c *Command) MarkFlagRequired(name string) error {
- return MarkFlagRequired(c.Flags(), name)
-}
-
-// MarkPersistentFlagRequired instructs the various shell completion implementations to
-// prioritize the named persistent flag when performing completion,
-// and causes your command to report an error if invoked without the flag.
-func (c *Command) MarkPersistentFlagRequired(name string) error {
- return MarkFlagRequired(c.PersistentFlags(), name)
-}
-
-// MarkFlagRequired instructs the various shell completion implementations to
-// prioritize the named flag when performing completion,
-// and causes your command to report an error if invoked without the flag.
-func MarkFlagRequired(flags *pflag.FlagSet, name string) error {
- return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"})
-}
-
-// MarkFlagFilename instructs the various shell completion implementations to
-// limit completions for the named flag to the specified file extensions.
-func (c *Command) MarkFlagFilename(name string, extensions ...string) error {
- return MarkFlagFilename(c.Flags(), name, extensions...)
-}
-
-// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists.
-// The bash completion script will call the bash function f for the flag.
-//
-// This will only work for bash completion.
-// It is recommended to instead use c.RegisterFlagCompletionFunc(...) which allows
-// to register a Go function which will work across all shells.
-func (c *Command) MarkFlagCustom(name string, f string) error {
- return MarkFlagCustom(c.Flags(), name, f)
-}
-
-// MarkPersistentFlagFilename instructs the various shell completion
-// implementations to limit completions for the named persistent flag to the
-// specified file extensions.
-func (c *Command) MarkPersistentFlagFilename(name string, extensions ...string) error {
- return MarkFlagFilename(c.PersistentFlags(), name, extensions...)
-}
-
-// MarkFlagFilename instructs the various shell completion implementations to
-// limit completions for the named flag to the specified file extensions.
-func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error {
- return flags.SetAnnotation(name, BashCompFilenameExt, extensions)
-}
-
-// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists.
-// The bash completion script will call the bash function f for the flag.
-//
-// This will only work for bash completion.
-// It is recommended to instead use c.RegisterFlagCompletionFunc(...) which allows
-// to register a Go function which will work across all shells.
-func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error {
- return flags.SetAnnotation(name, BashCompCustom, []string{f})
-}
-
-// MarkFlagDirname instructs the various shell completion implementations to
-// limit completions for the named flag to directory names.
-func (c *Command) MarkFlagDirname(name string) error {
- return MarkFlagDirname(c.Flags(), name)
-}
-
-// MarkPersistentFlagDirname instructs the various shell completion
-// implementations to limit completions for the named persistent flag to
-// directory names.
-func (c *Command) MarkPersistentFlagDirname(name string) error {
- return MarkFlagDirname(c.PersistentFlags(), name)
-}
-
-// MarkFlagDirname instructs the various shell completion implementations to
-// limit completions for the named flag to directory names.
-func MarkFlagDirname(flags *pflag.FlagSet, name string) error {
- return flags.SetAnnotation(name, BashCompSubdirsInDir, []string{})
-}
diff --git a/vendor/github.com/spf13/cobra/zsh_completions.go b/vendor/github.com/spf13/cobra/zsh_completions.go
deleted file mode 100644
index 1856e4c7f..000000000
--- a/vendor/github.com/spf13/cobra/zsh_completions.go
+++ /dev/null
@@ -1,308 +0,0 @@
-// Copyright 2013-2023 The Cobra Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
-)
-
-// GenZshCompletionFile generates zsh completion file including descriptions.
-func (c *Command) GenZshCompletionFile(filename string) error {
- return c.genZshCompletionFile(filename, true)
-}
-
-// GenZshCompletion generates zsh completion file including descriptions
-// and writes it to the passed writer.
-func (c *Command) GenZshCompletion(w io.Writer) error {
- return c.genZshCompletion(w, true)
-}
-
-// GenZshCompletionFileNoDesc generates zsh completion file without descriptions.
-func (c *Command) GenZshCompletionFileNoDesc(filename string) error {
- return c.genZshCompletionFile(filename, false)
-}
-
-// GenZshCompletionNoDesc generates zsh completion file without descriptions
-// and writes it to the passed writer.
-func (c *Command) GenZshCompletionNoDesc(w io.Writer) error {
- return c.genZshCompletion(w, false)
-}
-
-// MarkZshCompPositionalArgumentFile only worked for zsh and its behavior was
-// not consistent with Bash completion. It has therefore been disabled.
-// Instead, when no other completion is specified, file completion is done by
-// default for every argument. One can disable file completion on a per-argument
-// basis by using ValidArgsFunction and ShellCompDirectiveNoFileComp.
-// To achieve file extension filtering, one can use ValidArgsFunction and
-// ShellCompDirectiveFilterFileExt.
-//
-// Deprecated
-func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ...string) error {
- return nil
-}
-
-// MarkZshCompPositionalArgumentWords only worked for zsh. It has therefore
-// been disabled.
-// To achieve the same behavior across all shells, one can use
-// ValidArgs (for the first argument only) or ValidArgsFunction for
-// any argument (can include the first one also).
-//
-// Deprecated
-func (c *Command) MarkZshCompPositionalArgumentWords(argPosition int, words ...string) error {
- return nil
-}
-
-func (c *Command) genZshCompletionFile(filename string, includeDesc bool) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return c.genZshCompletion(outFile, includeDesc)
-}
-
-func (c *Command) genZshCompletion(w io.Writer, includeDesc bool) error {
- buf := new(bytes.Buffer)
- genZshComp(buf, c.Name(), includeDesc)
- _, err := buf.WriteTo(w)
- return err
-}
-
-func genZshComp(buf io.StringWriter, name string, includeDesc bool) {
- compCmd := ShellCompRequestCmd
- if !includeDesc {
- compCmd = ShellCompNoDescRequestCmd
- }
- WriteStringAndCheck(buf, fmt.Sprintf(`#compdef %[1]s
-compdef _%[1]s %[1]s
-
-# zsh completion for %-36[1]s -*- shell-script -*-
-
-__%[1]s_debug()
-{
- local file="$BASH_COMP_DEBUG_FILE"
- if [[ -n ${file} ]]; then
- echo "$*" >> "${file}"
- fi
-}
-
-_%[1]s()
-{
- local shellCompDirectiveError=%[3]d
- local shellCompDirectiveNoSpace=%[4]d
- local shellCompDirectiveNoFileComp=%[5]d
- local shellCompDirectiveFilterFileExt=%[6]d
- local shellCompDirectiveFilterDirs=%[7]d
- local shellCompDirectiveKeepOrder=%[8]d
-
- local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
- local -a completions
-
- __%[1]s_debug "\n========= starting completion logic =========="
- __%[1]s_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
-
- # The user could have moved the cursor backwards on the command-line.
- # We need to trigger completion from the $CURRENT location, so we need
- # to truncate the command-line ($words) up to the $CURRENT location.
- # (We cannot use $CURSOR as its value does not work when a command is an alias.)
- words=("${=words[1,CURRENT]}")
- __%[1]s_debug "Truncated words[*]: ${words[*]},"
-
- lastParam=${words[-1]}
- lastChar=${lastParam[-1]}
- __%[1]s_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
-
- # For zsh, when completing a flag with an = (e.g., %[1]s -n=)
- # completions must be prefixed with the flag
- setopt local_options BASH_REMATCH
- if [[ "${lastParam}" =~ '-.*=' ]]; then
- # We are dealing with a flag with an =
- flagPrefix="-P ${BASH_REMATCH}"
- fi
-
- # Prepare the command to obtain completions
- requestComp="${words[1]} %[2]s ${words[2,-1]}"
- if [ "${lastChar}" = "" ]; then
- # If the last parameter is complete (there is a space following it)
- # We add an extra empty parameter so we can indicate this to the go completion code.
- __%[1]s_debug "Adding extra empty parameter"
- requestComp="${requestComp} \"\""
- fi
-
- __%[1]s_debug "About to call: eval ${requestComp}"
-
- # Use eval to handle any environment variables and such
- out=$(eval ${requestComp} 2>/dev/null)
- __%[1]s_debug "completion output: ${out}"
-
- # Extract the directive integer following a : from the last line
- local lastLine
- while IFS='\n' read -r line; do
- lastLine=${line}
- done < <(printf "%%s\n" "${out[@]}")
- __%[1]s_debug "last line: ${lastLine}"
-
- if [ "${lastLine[1]}" = : ]; then
- directive=${lastLine[2,-1]}
- # Remove the directive including the : and the newline
- local suffix
- (( suffix=${#lastLine}+2))
- out=${out[1,-$suffix]}
- else
- # There is no directive specified. Leave $out as is.
- __%[1]s_debug "No directive found. Setting do default"
- directive=0
- fi
-
- __%[1]s_debug "directive: ${directive}"
- __%[1]s_debug "completions: ${out}"
- __%[1]s_debug "flagPrefix: ${flagPrefix}"
-
- if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
- __%[1]s_debug "Completion received error. Ignoring completions."
- return
- fi
-
- local activeHelpMarker="%[9]s"
- local endIndex=${#activeHelpMarker}
- local startIndex=$((${#activeHelpMarker}+1))
- local hasActiveHelp=0
- while IFS='\n' read -r comp; do
- # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
- if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
- __%[1]s_debug "ActiveHelp found: $comp"
- comp="${comp[$startIndex,-1]}"
- if [ -n "$comp" ]; then
- compadd -x "${comp}"
- __%[1]s_debug "ActiveHelp will need delimiter"
- hasActiveHelp=1
- fi
-
- continue
- fi
-
- if [ -n "$comp" ]; then
- # If requested, completions are returned with a description.
- # The description is preceded by a TAB character.
- # For zsh's _describe, we need to use a : instead of a TAB.
- # We first need to escape any : as part of the completion itself.
- comp=${comp//:/\\:}
-
- local tab="$(printf '\t')"
- comp=${comp//$tab/:}
-
- __%[1]s_debug "Adding completion: ${comp}"
- completions+=${comp}
- lastComp=$comp
- fi
- done < <(printf "%%s\n" "${out[@]}")
-
- # Add a delimiter after the activeHelp statements, but only if:
- # - there are completions following the activeHelp statements, or
- # - file completion will be performed (so there will be choices after the activeHelp)
- if [ $hasActiveHelp -eq 1 ]; then
- if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
- __%[1]s_debug "Adding activeHelp delimiter"
- compadd -x "--"
- hasActiveHelp=0
- fi
- fi
-
- if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
- __%[1]s_debug "Activating nospace."
- noSpace="-S ''"
- fi
-
- if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
- __%[1]s_debug "Activating keep order."
- keepOrder="-V"
- fi
-
- if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
- # File extension filtering
- local filteringCmd
- filteringCmd='_files'
- for filter in ${completions[@]}; do
- if [ ${filter[1]} != '*' ]; then
- # zsh requires a glob pattern to do file filtering
- filter="\*.$filter"
- fi
- filteringCmd+=" -g $filter"
- done
- filteringCmd+=" ${flagPrefix}"
-
- __%[1]s_debug "File filtering command: $filteringCmd"
- _arguments '*:filename:'"$filteringCmd"
- elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
- # File completion for directories only
- local subdir
- subdir="${completions[1]}"
- if [ -n "$subdir" ]; then
- __%[1]s_debug "Listing directories in $subdir"
- pushd "${subdir}" >/dev/null 2>&1
- else
- __%[1]s_debug "Listing directories in ."
- fi
-
- local result
- _arguments '*:dirname:_files -/'" ${flagPrefix}"
- result=$?
- if [ -n "$subdir" ]; then
- popd >/dev/null 2>&1
- fi
- return $result
- else
- __%[1]s_debug "Calling _describe"
- if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then
- __%[1]s_debug "_describe found some completions"
-
- # Return the success of having called _describe
- return 0
- else
- __%[1]s_debug "_describe did not find completions."
- __%[1]s_debug "Checking if we should do file completion."
- if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
- __%[1]s_debug "deactivating file completion"
-
- # We must return an error code here to let zsh know that there were no
- # completions found by _describe; this is what will trigger other
- # matching algorithms to attempt to find completions.
- # For example zsh can match letters in the middle of words.
- return 1
- else
- # Perform file completion
- __%[1]s_debug "Activating file completion"
-
- # We must return the result of this command, so it must be the
- # last command, or else we must store its result to return it.
- _arguments '*:filename:_files'" ${flagPrefix}"
- fi
- fi
- fi
-}
-
-# don't run the completion function when being source-ed or eval-ed
-if [ "$funcstack[1]" = "_%[1]s" ]; then
- _%[1]s
-fi
-`, name, compCmd,
- ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp,
- ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs, ShellCompDirectiveKeepOrder,
- activeHelpMarker))
-}
diff --git a/vendor/github.com/spf13/pflag/.gitignore b/vendor/github.com/spf13/pflag/.gitignore
deleted file mode 100644
index c3da29013..000000000
--- a/vendor/github.com/spf13/pflag/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.idea/*
-
diff --git a/vendor/github.com/spf13/pflag/.travis.yml b/vendor/github.com/spf13/pflag/.travis.yml
deleted file mode 100644
index 00d04cb9b..000000000
--- a/vendor/github.com/spf13/pflag/.travis.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-sudo: false
-
-language: go
-
-go:
- - 1.9.x
- - 1.10.x
- - 1.11.x
- - tip
-
-matrix:
- allow_failures:
- - go: tip
-
-install:
- - go get golang.org/x/lint/golint
- - export PATH=$GOPATH/bin:$PATH
- - go install ./...
-
-script:
- - verify/all.sh -v
- - go test ./...
diff --git a/vendor/github.com/spf13/pflag/LICENSE b/vendor/github.com/spf13/pflag/LICENSE
deleted file mode 100644
index 63ed1cfea..000000000
--- a/vendor/github.com/spf13/pflag/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2012 Alex Ogier. All rights reserved.
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/spf13/pflag/README.md b/vendor/github.com/spf13/pflag/README.md
deleted file mode 100644
index 7eacc5bdb..000000000
--- a/vendor/github.com/spf13/pflag/README.md
+++ /dev/null
@@ -1,296 +0,0 @@
-[](https://travis-ci.org/spf13/pflag)
-[](https://goreportcard.com/report/github.com/spf13/pflag)
-[](https://godoc.org/github.com/spf13/pflag)
-
-## Description
-
-pflag is a drop-in replacement for Go's flag package, implementing
-POSIX/GNU-style --flags.
-
-pflag is compatible with the [GNU extensions to the POSIX recommendations
-for command-line options][1]. For a more precise description, see the
-"Command-line flag syntax" section below.
-
-[1]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
-
-pflag is available under the same style of BSD license as the Go language,
-which can be found in the LICENSE file.
-
-## Installation
-
-pflag is available using the standard `go get` command.
-
-Install by running:
-
- go get github.com/spf13/pflag
-
-Run tests by running:
-
- go test github.com/spf13/pflag
-
-## Usage
-
-pflag is a drop-in replacement of Go's native flag package. If you import
-pflag under the name "flag" then all code should continue to function
-with no changes.
-
-``` go
-import flag "github.com/spf13/pflag"
-```
-
-There is one exception to this: if you directly instantiate the Flag struct
-there is one more field "Shorthand" that you will need to set.
-Most code never instantiates this struct directly, and instead uses
-functions such as String(), BoolVar(), and Var(), and is therefore
-unaffected.
-
-Define flags using flag.String(), Bool(), Int(), etc.
-
-This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
-
-``` go
-var ip *int = flag.Int("flagname", 1234, "help message for flagname")
-```
-
-If you like, you can bind the flag to a variable using the Var() functions.
-
-``` go
-var flagvar int
-func init() {
- flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
-}
-```
-
-Or you can create custom flags that satisfy the Value interface (with
-pointer receivers) and couple them to flag parsing by
-
-``` go
-flag.Var(&flagVal, "name", "help message for flagname")
-```
-
-For such flags, the default value is just the initial value of the variable.
-
-After all flags are defined, call
-
-``` go
-flag.Parse()
-```
-
-to parse the command line into the defined flags.
-
-Flags may then be used directly. If you're using the flags themselves,
-they are all pointers; if you bind to variables, they're values.
-
-``` go
-fmt.Println("ip has value ", *ip)
-fmt.Println("flagvar has value ", flagvar)
-```
-
-There are helper functions available to get the value stored in a Flag if you have a FlagSet but find
-it difficult to keep up with all of the pointers in your code.
-If you have a pflag.FlagSet with a flag called 'flagname' of type int you
-can use GetInt() to get the int value. But notice that 'flagname' must exist
-and it must be an int. GetString("flagname") will fail.
-
-``` go
-i, err := flagset.GetInt("flagname")
-```
-
-After parsing, the arguments after the flag are available as the
-slice flag.Args() or individually as flag.Arg(i).
-The arguments are indexed from 0 through flag.NArg()-1.
-
-The pflag package also defines some new functions that are not in flag,
-that give one-letter shorthands for flags. You can use these by appending
-'P' to the name of any function that defines a flag.
-
-``` go
-var ip = flag.IntP("flagname", "f", 1234, "help message")
-var flagvar bool
-func init() {
- flag.BoolVarP(&flagvar, "boolname", "b", true, "help message")
-}
-flag.VarP(&flagVal, "varname", "v", "help message")
-```
-
-Shorthand letters can be used with single dashes on the command line.
-Boolean shorthand flags can be combined with other shorthand flags.
-
-The default set of command-line flags is controlled by
-top-level functions. The FlagSet type allows one to define
-independent sets of flags, such as to implement subcommands
-in a command-line interface. The methods of FlagSet are
-analogous to the top-level functions for the command-line
-flag set.
-
-## Setting no option default values for flags
-
-After you create a flag it is possible to set the pflag.NoOptDefVal for
-the given flag. Doing this changes the meaning of the flag slightly. If
-a flag has a NoOptDefVal and the flag is set on the command line without
-an option the flag will be set to the NoOptDefVal. For example given:
-
-``` go
-var ip = flag.IntP("flagname", "f", 1234, "help message")
-flag.Lookup("flagname").NoOptDefVal = "4321"
-```
-
-Would result in something like
-
-| Parsed Arguments | Resulting Value |
-| ------------- | ------------- |
-| --flagname=1357 | ip=1357 |
-| --flagname | ip=4321 |
-| [nothing] | ip=1234 |
-
-## Command line flag syntax
-
-```
---flag // boolean flags, or flags with no option default values
---flag x // only on flags without a default value
---flag=x
-```
-
-Unlike the flag package, a single dash before an option means something
-different than a double dash. Single dashes signify a series of shorthand
-letters for flags. All but the last shorthand letter must be boolean flags
-or a flag with a default value
-
-```
-// boolean or flags where the 'no option default value' is set
--f
--f=true
--abc
-but
--b true is INVALID
-
-// non-boolean and flags without a 'no option default value'
--n 1234
--n=1234
--n1234
-
-// mixed
--abcs "hello"
--absd="hello"
--abcs1234
-```
-
-Flag parsing stops after the terminator "--". Unlike the flag package,
-flags can be interspersed with arguments anywhere on the command line
-before this terminator.
-
-Integer flags accept 1234, 0664, 0x1234 and may be negative.
-Boolean flags (in their long form) accept 1, 0, t, f, true, false,
-TRUE, FALSE, True, False.
-Duration flags accept any input valid for time.ParseDuration.
-
-## Mutating or "Normalizing" Flag names
-
-It is possible to set a custom flag name 'normalization function.' It allows flag names to be mutated both when created in the code and when used on the command line to some 'normalized' form. The 'normalized' form is used for comparison. Two examples of using the custom normalization func follow.
-
-**Example #1**: You want -, _, and . in flags to compare the same. aka --my-flag == --my_flag == --my.flag
-
-``` go
-func wordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
- from := []string{"-", "_"}
- to := "."
- for _, sep := range from {
- name = strings.Replace(name, sep, to, -1)
- }
- return pflag.NormalizedName(name)
-}
-
-myFlagSet.SetNormalizeFunc(wordSepNormalizeFunc)
-```
-
-**Example #2**: You want to alias two flags. aka --old-flag-name == --new-flag-name
-
-``` go
-func aliasNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
- switch name {
- case "old-flag-name":
- name = "new-flag-name"
- break
- }
- return pflag.NormalizedName(name)
-}
-
-myFlagSet.SetNormalizeFunc(aliasNormalizeFunc)
-```
-
-## Deprecating a flag or its shorthand
-It is possible to deprecate a flag, or just its shorthand. Deprecating a flag/shorthand hides it from help text and prints a usage message when the deprecated flag/shorthand is used.
-
-**Example #1**: You want to deprecate a flag named "badflag" as well as inform the users what flag they should use instead.
-```go
-// deprecate a flag by specifying its name and a usage message
-flags.MarkDeprecated("badflag", "please use --good-flag instead")
-```
-This hides "badflag" from help text, and prints `Flag --badflag has been deprecated, please use --good-flag instead` when "badflag" is used.
-
-**Example #2**: You want to keep a flag name "noshorthandflag" but deprecate its shortname "n".
-```go
-// deprecate a flag shorthand by specifying its flag name and a usage message
-flags.MarkShorthandDeprecated("noshorthandflag", "please use --noshorthandflag only")
-```
-This hides the shortname "n" from help text, and prints `Flag shorthand -n has been deprecated, please use --noshorthandflag only` when the shorthand "n" is used.
-
-Note that usage message is essential here, and it should not be empty.
-
-## Hidden flags
-It is possible to mark a flag as hidden, meaning it will still function as normal, however will not show up in usage/help text.
-
-**Example**: You have a flag named "secretFlag" that you need for internal use only and don't want it showing up in help text, or for its usage text to be available.
-```go
-// hide a flag by specifying its name
-flags.MarkHidden("secretFlag")
-```
-
-## Disable sorting of flags
-`pflag` allows you to disable sorting of flags for help and usage message.
-
-**Example**:
-```go
-flags.BoolP("verbose", "v", false, "verbose output")
-flags.String("coolflag", "yeaah", "it's really cool flag")
-flags.Int("usefulflag", 777, "sometimes it's very useful")
-flags.SortFlags = false
-flags.PrintDefaults()
-```
-**Output**:
-```
- -v, --verbose verbose output
- --coolflag string it's really cool flag (default "yeaah")
- --usefulflag int sometimes it's very useful (default 777)
-```
-
-
-## Supporting Go flags when using pflag
-In order to support flags defined using Go's `flag` package, they must be added to the `pflag` flagset. This is usually necessary
-to support flags defined by third-party dependencies (e.g. `golang/glog`).
-
-**Example**: You want to add the Go flags to the `CommandLine` flagset
-```go
-import (
- goflag "flag"
- flag "github.com/spf13/pflag"
-)
-
-var ip *int = flag.Int("flagname", 1234, "help message for flagname")
-
-func main() {
- flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
- flag.Parse()
-}
-```
-
-## More info
-
-You can see the full reference documentation of the pflag package
-[at godoc.org][3], or through go's standard documentation system by
-running `godoc -http=:6060` and browsing to
-[http://localhost:6060/pkg/github.com/spf13/pflag][2] after
-installation.
-
-[2]: http://localhost:6060/pkg/github.com/spf13/pflag
-[3]: http://godoc.org/github.com/spf13/pflag
diff --git a/vendor/github.com/spf13/pflag/bool.go b/vendor/github.com/spf13/pflag/bool.go
deleted file mode 100644
index c4c5c0bfd..000000000
--- a/vendor/github.com/spf13/pflag/bool.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package pflag
-
-import "strconv"
-
-// optional interface to indicate boolean flags that can be
-// supplied without "=value" text
-type boolFlag interface {
- Value
- IsBoolFlag() bool
-}
-
-// -- bool Value
-type boolValue bool
-
-func newBoolValue(val bool, p *bool) *boolValue {
- *p = val
- return (*boolValue)(p)
-}
-
-func (b *boolValue) Set(s string) error {
- v, err := strconv.ParseBool(s)
- *b = boolValue(v)
- return err
-}
-
-func (b *boolValue) Type() string {
- return "bool"
-}
-
-func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) }
-
-func (b *boolValue) IsBoolFlag() bool { return true }
-
-func boolConv(sval string) (interface{}, error) {
- return strconv.ParseBool(sval)
-}
-
-// GetBool return the bool value of a flag with the given name
-func (f *FlagSet) GetBool(name string) (bool, error) {
- val, err := f.getFlagType(name, "bool", boolConv)
- if err != nil {
- return false, err
- }
- return val.(bool), nil
-}
-
-// BoolVar defines a bool flag with specified name, default value, and usage string.
-// The argument p points to a bool variable in which to store the value of the flag.
-func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) {
- f.BoolVarP(p, name, "", value, usage)
-}
-
-// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
- flag := f.VarPF(newBoolValue(value, p), name, shorthand, usage)
- flag.NoOptDefVal = "true"
-}
-
-// BoolVar defines a bool flag with specified name, default value, and usage string.
-// The argument p points to a bool variable in which to store the value of the flag.
-func BoolVar(p *bool, name string, value bool, usage string) {
- BoolVarP(p, name, "", value, usage)
-}
-
-// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash.
-func BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
- flag := CommandLine.VarPF(newBoolValue(value, p), name, shorthand, usage)
- flag.NoOptDefVal = "true"
-}
-
-// Bool defines a bool flag with specified name, default value, and usage string.
-// The return value is the address of a bool variable that stores the value of the flag.
-func (f *FlagSet) Bool(name string, value bool, usage string) *bool {
- return f.BoolP(name, "", value, usage)
-}
-
-// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool {
- p := new(bool)
- f.BoolVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Bool defines a bool flag with specified name, default value, and usage string.
-// The return value is the address of a bool variable that stores the value of the flag.
-func Bool(name string, value bool, usage string) *bool {
- return BoolP(name, "", value, usage)
-}
-
-// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.
-func BoolP(name, shorthand string, value bool, usage string) *bool {
- b := CommandLine.BoolP(name, shorthand, value, usage)
- return b
-}
diff --git a/vendor/github.com/spf13/pflag/bool_slice.go b/vendor/github.com/spf13/pflag/bool_slice.go
deleted file mode 100644
index 3731370d6..000000000
--- a/vendor/github.com/spf13/pflag/bool_slice.go
+++ /dev/null
@@ -1,185 +0,0 @@
-package pflag
-
-import (
- "io"
- "strconv"
- "strings"
-)
-
-// -- boolSlice Value
-type boolSliceValue struct {
- value *[]bool
- changed bool
-}
-
-func newBoolSliceValue(val []bool, p *[]bool) *boolSliceValue {
- bsv := new(boolSliceValue)
- bsv.value = p
- *bsv.value = val
- return bsv
-}
-
-// Set converts, and assigns, the comma-separated boolean argument string representation as the []bool value of this flag.
-// If Set is called on a flag that already has a []bool assigned, the newly converted values will be appended.
-func (s *boolSliceValue) Set(val string) error {
-
- // remove all quote characters
- rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "")
-
- // read flag arguments with CSV parser
- boolStrSlice, err := readAsCSV(rmQuote.Replace(val))
- if err != nil && err != io.EOF {
- return err
- }
-
- // parse boolean values into slice
- out := make([]bool, 0, len(boolStrSlice))
- for _, boolStr := range boolStrSlice {
- b, err := strconv.ParseBool(strings.TrimSpace(boolStr))
- if err != nil {
- return err
- }
- out = append(out, b)
- }
-
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
-
- s.changed = true
-
- return nil
-}
-
-// Type returns a string that uniquely represents this flag's type.
-func (s *boolSliceValue) Type() string {
- return "boolSlice"
-}
-
-// String defines a "native" format for this boolean slice flag value.
-func (s *boolSliceValue) String() string {
-
- boolStrSlice := make([]string, len(*s.value))
- for i, b := range *s.value {
- boolStrSlice[i] = strconv.FormatBool(b)
- }
-
- out, _ := writeAsCSV(boolStrSlice)
-
- return "[" + out + "]"
-}
-
-func (s *boolSliceValue) fromString(val string) (bool, error) {
- return strconv.ParseBool(val)
-}
-
-func (s *boolSliceValue) toString(val bool) string {
- return strconv.FormatBool(val)
-}
-
-func (s *boolSliceValue) Append(val string) error {
- i, err := s.fromString(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *boolSliceValue) Replace(val []string) error {
- out := make([]bool, len(val))
- for i, d := range val {
- var err error
- out[i], err = s.fromString(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *boolSliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = s.toString(d)
- }
- return out
-}
-
-func boolSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []bool{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]bool, len(ss))
- for i, t := range ss {
- var err error
- out[i], err = strconv.ParseBool(t)
- if err != nil {
- return nil, err
- }
- }
- return out, nil
-}
-
-// GetBoolSlice returns the []bool value of a flag with the given name.
-func (f *FlagSet) GetBoolSlice(name string) ([]bool, error) {
- val, err := f.getFlagType(name, "boolSlice", boolSliceConv)
- if err != nil {
- return []bool{}, err
- }
- return val.([]bool), nil
-}
-
-// BoolSliceVar defines a boolSlice flag with specified name, default value, and usage string.
-// The argument p points to a []bool variable in which to store the value of the flag.
-func (f *FlagSet) BoolSliceVar(p *[]bool, name string, value []bool, usage string) {
- f.VarP(newBoolSliceValue(value, p), name, "", usage)
-}
-
-// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) {
- f.VarP(newBoolSliceValue(value, p), name, shorthand, usage)
-}
-
-// BoolSliceVar defines a []bool flag with specified name, default value, and usage string.
-// The argument p points to a []bool variable in which to store the value of the flag.
-func BoolSliceVar(p *[]bool, name string, value []bool, usage string) {
- CommandLine.VarP(newBoolSliceValue(value, p), name, "", usage)
-}
-
-// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) {
- CommandLine.VarP(newBoolSliceValue(value, p), name, shorthand, usage)
-}
-
-// BoolSlice defines a []bool flag with specified name, default value, and usage string.
-// The return value is the address of a []bool variable that stores the value of the flag.
-func (f *FlagSet) BoolSlice(name string, value []bool, usage string) *[]bool {
- p := []bool{}
- f.BoolSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool {
- p := []bool{}
- f.BoolSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// BoolSlice defines a []bool flag with specified name, default value, and usage string.
-// The return value is the address of a []bool variable that stores the value of the flag.
-func BoolSlice(name string, value []bool, usage string) *[]bool {
- return CommandLine.BoolSliceP(name, "", value, usage)
-}
-
-// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.
-func BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool {
- return CommandLine.BoolSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/bytes.go b/vendor/github.com/spf13/pflag/bytes.go
deleted file mode 100644
index 67d530457..000000000
--- a/vendor/github.com/spf13/pflag/bytes.go
+++ /dev/null
@@ -1,209 +0,0 @@
-package pflag
-
-import (
- "encoding/base64"
- "encoding/hex"
- "fmt"
- "strings"
-)
-
-// BytesHex adapts []byte for use as a flag. Value of flag is HEX encoded
-type bytesHexValue []byte
-
-// String implements pflag.Value.String.
-func (bytesHex bytesHexValue) String() string {
- return fmt.Sprintf("%X", []byte(bytesHex))
-}
-
-// Set implements pflag.Value.Set.
-func (bytesHex *bytesHexValue) Set(value string) error {
- bin, err := hex.DecodeString(strings.TrimSpace(value))
-
- if err != nil {
- return err
- }
-
- *bytesHex = bin
-
- return nil
-}
-
-// Type implements pflag.Value.Type.
-func (*bytesHexValue) Type() string {
- return "bytesHex"
-}
-
-func newBytesHexValue(val []byte, p *[]byte) *bytesHexValue {
- *p = val
- return (*bytesHexValue)(p)
-}
-
-func bytesHexConv(sval string) (interface{}, error) {
-
- bin, err := hex.DecodeString(sval)
-
- if err == nil {
- return bin, nil
- }
-
- return nil, fmt.Errorf("invalid string being converted to Bytes: %s %s", sval, err)
-}
-
-// GetBytesHex return the []byte value of a flag with the given name
-func (f *FlagSet) GetBytesHex(name string) ([]byte, error) {
- val, err := f.getFlagType(name, "bytesHex", bytesHexConv)
-
- if err != nil {
- return []byte{}, err
- }
-
- return val.([]byte), nil
-}
-
-// BytesHexVar defines an []byte flag with specified name, default value, and usage string.
-// The argument p points to an []byte variable in which to store the value of the flag.
-func (f *FlagSet) BytesHexVar(p *[]byte, name string, value []byte, usage string) {
- f.VarP(newBytesHexValue(value, p), name, "", usage)
-}
-
-// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) {
- f.VarP(newBytesHexValue(value, p), name, shorthand, usage)
-}
-
-// BytesHexVar defines an []byte flag with specified name, default value, and usage string.
-// The argument p points to an []byte variable in which to store the value of the flag.
-func BytesHexVar(p *[]byte, name string, value []byte, usage string) {
- CommandLine.VarP(newBytesHexValue(value, p), name, "", usage)
-}
-
-// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.
-func BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) {
- CommandLine.VarP(newBytesHexValue(value, p), name, shorthand, usage)
-}
-
-// BytesHex defines an []byte flag with specified name, default value, and usage string.
-// The return value is the address of an []byte variable that stores the value of the flag.
-func (f *FlagSet) BytesHex(name string, value []byte, usage string) *[]byte {
- p := new([]byte)
- f.BytesHexVarP(p, name, "", value, usage)
- return p
-}
-
-// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BytesHexP(name, shorthand string, value []byte, usage string) *[]byte {
- p := new([]byte)
- f.BytesHexVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// BytesHex defines an []byte flag with specified name, default value, and usage string.
-// The return value is the address of an []byte variable that stores the value of the flag.
-func BytesHex(name string, value []byte, usage string) *[]byte {
- return CommandLine.BytesHexP(name, "", value, usage)
-}
-
-// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash.
-func BytesHexP(name, shorthand string, value []byte, usage string) *[]byte {
- return CommandLine.BytesHexP(name, shorthand, value, usage)
-}
-
-// BytesBase64 adapts []byte for use as a flag. Value of flag is Base64 encoded
-type bytesBase64Value []byte
-
-// String implements pflag.Value.String.
-func (bytesBase64 bytesBase64Value) String() string {
- return base64.StdEncoding.EncodeToString([]byte(bytesBase64))
-}
-
-// Set implements pflag.Value.Set.
-func (bytesBase64 *bytesBase64Value) Set(value string) error {
- bin, err := base64.StdEncoding.DecodeString(strings.TrimSpace(value))
-
- if err != nil {
- return err
- }
-
- *bytesBase64 = bin
-
- return nil
-}
-
-// Type implements pflag.Value.Type.
-func (*bytesBase64Value) Type() string {
- return "bytesBase64"
-}
-
-func newBytesBase64Value(val []byte, p *[]byte) *bytesBase64Value {
- *p = val
- return (*bytesBase64Value)(p)
-}
-
-func bytesBase64ValueConv(sval string) (interface{}, error) {
-
- bin, err := base64.StdEncoding.DecodeString(sval)
- if err == nil {
- return bin, nil
- }
-
- return nil, fmt.Errorf("invalid string being converted to Bytes: %s %s", sval, err)
-}
-
-// GetBytesBase64 return the []byte value of a flag with the given name
-func (f *FlagSet) GetBytesBase64(name string) ([]byte, error) {
- val, err := f.getFlagType(name, "bytesBase64", bytesBase64ValueConv)
-
- if err != nil {
- return []byte{}, err
- }
-
- return val.([]byte), nil
-}
-
-// BytesBase64Var defines an []byte flag with specified name, default value, and usage string.
-// The argument p points to an []byte variable in which to store the value of the flag.
-func (f *FlagSet) BytesBase64Var(p *[]byte, name string, value []byte, usage string) {
- f.VarP(newBytesBase64Value(value, p), name, "", usage)
-}
-
-// BytesBase64VarP is like BytesBase64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BytesBase64VarP(p *[]byte, name, shorthand string, value []byte, usage string) {
- f.VarP(newBytesBase64Value(value, p), name, shorthand, usage)
-}
-
-// BytesBase64Var defines an []byte flag with specified name, default value, and usage string.
-// The argument p points to an []byte variable in which to store the value of the flag.
-func BytesBase64Var(p *[]byte, name string, value []byte, usage string) {
- CommandLine.VarP(newBytesBase64Value(value, p), name, "", usage)
-}
-
-// BytesBase64VarP is like BytesBase64Var, but accepts a shorthand letter that can be used after a single dash.
-func BytesBase64VarP(p *[]byte, name, shorthand string, value []byte, usage string) {
- CommandLine.VarP(newBytesBase64Value(value, p), name, shorthand, usage)
-}
-
-// BytesBase64 defines an []byte flag with specified name, default value, and usage string.
-// The return value is the address of an []byte variable that stores the value of the flag.
-func (f *FlagSet) BytesBase64(name string, value []byte, usage string) *[]byte {
- p := new([]byte)
- f.BytesBase64VarP(p, name, "", value, usage)
- return p
-}
-
-// BytesBase64P is like BytesBase64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BytesBase64P(name, shorthand string, value []byte, usage string) *[]byte {
- p := new([]byte)
- f.BytesBase64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// BytesBase64 defines an []byte flag with specified name, default value, and usage string.
-// The return value is the address of an []byte variable that stores the value of the flag.
-func BytesBase64(name string, value []byte, usage string) *[]byte {
- return CommandLine.BytesBase64P(name, "", value, usage)
-}
-
-// BytesBase64P is like BytesBase64, but accepts a shorthand letter that can be used after a single dash.
-func BytesBase64P(name, shorthand string, value []byte, usage string) *[]byte {
- return CommandLine.BytesBase64P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/count.go b/vendor/github.com/spf13/pflag/count.go
deleted file mode 100644
index a0b2679f7..000000000
--- a/vendor/github.com/spf13/pflag/count.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- count Value
-type countValue int
-
-func newCountValue(val int, p *int) *countValue {
- *p = val
- return (*countValue)(p)
-}
-
-func (i *countValue) Set(s string) error {
- // "+1" means that no specific value was passed, so increment
- if s == "+1" {
- *i = countValue(*i + 1)
- return nil
- }
- v, err := strconv.ParseInt(s, 0, 0)
- *i = countValue(v)
- return err
-}
-
-func (i *countValue) Type() string {
- return "count"
-}
-
-func (i *countValue) String() string { return strconv.Itoa(int(*i)) }
-
-func countConv(sval string) (interface{}, error) {
- i, err := strconv.Atoi(sval)
- if err != nil {
- return nil, err
- }
- return i, nil
-}
-
-// GetCount return the int value of a flag with the given name
-func (f *FlagSet) GetCount(name string) (int, error) {
- val, err := f.getFlagType(name, "count", countConv)
- if err != nil {
- return 0, err
- }
- return val.(int), nil
-}
-
-// CountVar defines a count flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-// A count flag will add 1 to its value every time it is found on the command line
-func (f *FlagSet) CountVar(p *int, name string, usage string) {
- f.CountVarP(p, name, "", usage)
-}
-
-// CountVarP is like CountVar only take a shorthand for the flag name.
-func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) {
- flag := f.VarPF(newCountValue(0, p), name, shorthand, usage)
- flag.NoOptDefVal = "+1"
-}
-
-// CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set
-func CountVar(p *int, name string, usage string) {
- CommandLine.CountVar(p, name, usage)
-}
-
-// CountVarP is like CountVar only take a shorthand for the flag name.
-func CountVarP(p *int, name, shorthand string, usage string) {
- CommandLine.CountVarP(p, name, shorthand, usage)
-}
-
-// Count defines a count flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-// A count flag will add 1 to its value every time it is found on the command line
-func (f *FlagSet) Count(name string, usage string) *int {
- p := new(int)
- f.CountVarP(p, name, "", usage)
- return p
-}
-
-// CountP is like Count only takes a shorthand for the flag name.
-func (f *FlagSet) CountP(name, shorthand string, usage string) *int {
- p := new(int)
- f.CountVarP(p, name, shorthand, usage)
- return p
-}
-
-// Count defines a count flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-// A count flag will add 1 to its value evey time it is found on the command line
-func Count(name string, usage string) *int {
- return CommandLine.CountP(name, "", usage)
-}
-
-// CountP is like Count only takes a shorthand for the flag name.
-func CountP(name, shorthand string, usage string) *int {
- return CommandLine.CountP(name, shorthand, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/duration.go b/vendor/github.com/spf13/pflag/duration.go
deleted file mode 100644
index e9debef88..000000000
--- a/vendor/github.com/spf13/pflag/duration.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package pflag
-
-import (
- "time"
-)
-
-// -- time.Duration Value
-type durationValue time.Duration
-
-func newDurationValue(val time.Duration, p *time.Duration) *durationValue {
- *p = val
- return (*durationValue)(p)
-}
-
-func (d *durationValue) Set(s string) error {
- v, err := time.ParseDuration(s)
- *d = durationValue(v)
- return err
-}
-
-func (d *durationValue) Type() string {
- return "duration"
-}
-
-func (d *durationValue) String() string { return (*time.Duration)(d).String() }
-
-func durationConv(sval string) (interface{}, error) {
- return time.ParseDuration(sval)
-}
-
-// GetDuration return the duration value of a flag with the given name
-func (f *FlagSet) GetDuration(name string) (time.Duration, error) {
- val, err := f.getFlagType(name, "duration", durationConv)
- if err != nil {
- return 0, err
- }
- return val.(time.Duration), nil
-}
-
-// DurationVar defines a time.Duration flag with specified name, default value, and usage string.
-// The argument p points to a time.Duration variable in which to store the value of the flag.
-func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
- f.VarP(newDurationValue(value, p), name, "", usage)
-}
-
-// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) {
- f.VarP(newDurationValue(value, p), name, shorthand, usage)
-}
-
-// DurationVar defines a time.Duration flag with specified name, default value, and usage string.
-// The argument p points to a time.Duration variable in which to store the value of the flag.
-func DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
- CommandLine.VarP(newDurationValue(value, p), name, "", usage)
-}
-
-// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash.
-func DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) {
- CommandLine.VarP(newDurationValue(value, p), name, shorthand, usage)
-}
-
-// Duration defines a time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a time.Duration variable that stores the value of the flag.
-func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration {
- p := new(time.Duration)
- f.DurationVarP(p, name, "", value, usage)
- return p
-}
-
-// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {
- p := new(time.Duration)
- f.DurationVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Duration defines a time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a time.Duration variable that stores the value of the flag.
-func Duration(name string, value time.Duration, usage string) *time.Duration {
- return CommandLine.DurationP(name, "", value, usage)
-}
-
-// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
-func DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {
- return CommandLine.DurationP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/duration_slice.go b/vendor/github.com/spf13/pflag/duration_slice.go
deleted file mode 100644
index badadda53..000000000
--- a/vendor/github.com/spf13/pflag/duration_slice.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strings"
- "time"
-)
-
-// -- durationSlice Value
-type durationSliceValue struct {
- value *[]time.Duration
- changed bool
-}
-
-func newDurationSliceValue(val []time.Duration, p *[]time.Duration) *durationSliceValue {
- dsv := new(durationSliceValue)
- dsv.value = p
- *dsv.value = val
- return dsv
-}
-
-func (s *durationSliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]time.Duration, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = time.ParseDuration(d)
- if err != nil {
- return err
- }
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *durationSliceValue) Type() string {
- return "durationSlice"
-}
-
-func (s *durationSliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%s", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func (s *durationSliceValue) fromString(val string) (time.Duration, error) {
- return time.ParseDuration(val)
-}
-
-func (s *durationSliceValue) toString(val time.Duration) string {
- return fmt.Sprintf("%s", val)
-}
-
-func (s *durationSliceValue) Append(val string) error {
- i, err := s.fromString(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *durationSliceValue) Replace(val []string) error {
- out := make([]time.Duration, len(val))
- for i, d := range val {
- var err error
- out[i], err = s.fromString(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *durationSliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = s.toString(d)
- }
- return out
-}
-
-func durationSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []time.Duration{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]time.Duration, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = time.ParseDuration(d)
- if err != nil {
- return nil, err
- }
-
- }
- return out, nil
-}
-
-// GetDurationSlice returns the []time.Duration value of a flag with the given name
-func (f *FlagSet) GetDurationSlice(name string) ([]time.Duration, error) {
- val, err := f.getFlagType(name, "durationSlice", durationSliceConv)
- if err != nil {
- return []time.Duration{}, err
- }
- return val.([]time.Duration), nil
-}
-
-// DurationSliceVar defines a durationSlice flag with specified name, default value, and usage string.
-// The argument p points to a []time.Duration variable in which to store the value of the flag.
-func (f *FlagSet) DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) {
- f.VarP(newDurationSliceValue(value, p), name, "", usage)
-}
-
-// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) {
- f.VarP(newDurationSliceValue(value, p), name, shorthand, usage)
-}
-
-// DurationSliceVar defines a duration[] flag with specified name, default value, and usage string.
-// The argument p points to a duration[] variable in which to store the value of the flag.
-func DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) {
- CommandLine.VarP(newDurationSliceValue(value, p), name, "", usage)
-}
-
-// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) {
- CommandLine.VarP(newDurationSliceValue(value, p), name, shorthand, usage)
-}
-
-// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a []time.Duration variable that stores the value of the flag.
-func (f *FlagSet) DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration {
- p := []time.Duration{}
- f.DurationSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration {
- p := []time.Duration{}
- f.DurationSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a []time.Duration variable that stores the value of the flag.
-func DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration {
- return CommandLine.DurationSliceP(name, "", value, usage)
-}
-
-// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.
-func DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration {
- return CommandLine.DurationSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go
deleted file mode 100644
index 24a5036e9..000000000
--- a/vendor/github.com/spf13/pflag/flag.go
+++ /dev/null
@@ -1,1239 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package pflag is a drop-in replacement for Go's flag package, implementing
-POSIX/GNU-style --flags.
-
-pflag is compatible with the GNU extensions to the POSIX recommendations
-for command-line options. See
-http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
-
-Usage:
-
-pflag is a drop-in replacement of Go's native flag package. If you import
-pflag under the name "flag" then all code should continue to function
-with no changes.
-
- import flag "github.com/spf13/pflag"
-
-There is one exception to this: if you directly instantiate the Flag struct
-there is one more field "Shorthand" that you will need to set.
-Most code never instantiates this struct directly, and instead uses
-functions such as String(), BoolVar(), and Var(), and is therefore
-unaffected.
-
-Define flags using flag.String(), Bool(), Int(), etc.
-
-This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
- var ip = flag.Int("flagname", 1234, "help message for flagname")
-If you like, you can bind the flag to a variable using the Var() functions.
- var flagvar int
- func init() {
- flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
- }
-Or you can create custom flags that satisfy the Value interface (with
-pointer receivers) and couple them to flag parsing by
- flag.Var(&flagVal, "name", "help message for flagname")
-For such flags, the default value is just the initial value of the variable.
-
-After all flags are defined, call
- flag.Parse()
-to parse the command line into the defined flags.
-
-Flags may then be used directly. If you're using the flags themselves,
-they are all pointers; if you bind to variables, they're values.
- fmt.Println("ip has value ", *ip)
- fmt.Println("flagvar has value ", flagvar)
-
-After parsing, the arguments after the flag are available as the
-slice flag.Args() or individually as flag.Arg(i).
-The arguments are indexed from 0 through flag.NArg()-1.
-
-The pflag package also defines some new functions that are not in flag,
-that give one-letter shorthands for flags. You can use these by appending
-'P' to the name of any function that defines a flag.
- var ip = flag.IntP("flagname", "f", 1234, "help message")
- var flagvar bool
- func init() {
- flag.BoolVarP(&flagvar, "boolname", "b", true, "help message")
- }
- flag.VarP(&flagval, "varname", "v", "help message")
-Shorthand letters can be used with single dashes on the command line.
-Boolean shorthand flags can be combined with other shorthand flags.
-
-Command line flag syntax:
- --flag // boolean flags only
- --flag=x
-
-Unlike the flag package, a single dash before an option means something
-different than a double dash. Single dashes signify a series of shorthand
-letters for flags. All but the last shorthand letter must be boolean flags.
- // boolean flags
- -f
- -abc
- // non-boolean flags
- -n 1234
- -Ifile
- // mixed
- -abcs "hello"
- -abcn1234
-
-Flag parsing stops after the terminator "--". Unlike the flag package,
-flags can be interspersed with arguments anywhere on the command line
-before this terminator.
-
-Integer flags accept 1234, 0664, 0x1234 and may be negative.
-Boolean flags (in their long form) accept 1, 0, t, f, true, false,
-TRUE, FALSE, True, False.
-Duration flags accept any input valid for time.ParseDuration.
-
-The default set of command-line flags is controlled by
-top-level functions. The FlagSet type allows one to define
-independent sets of flags, such as to implement subcommands
-in a command-line interface. The methods of FlagSet are
-analogous to the top-level functions for the command-line
-flag set.
-*/
-package pflag
-
-import (
- "bytes"
- "errors"
- goflag "flag"
- "fmt"
- "io"
- "os"
- "sort"
- "strings"
-)
-
-// ErrHelp is the error returned if the flag -help is invoked but no such flag is defined.
-var ErrHelp = errors.New("pflag: help requested")
-
-// ErrorHandling defines how to handle flag parsing errors.
-type ErrorHandling int
-
-const (
- // ContinueOnError will return an err from Parse() if an error is found
- ContinueOnError ErrorHandling = iota
- // ExitOnError will call os.Exit(2) if an error is found when parsing
- ExitOnError
- // PanicOnError will panic() if an error is found when parsing flags
- PanicOnError
-)
-
-// ParseErrorsWhitelist defines the parsing errors that can be ignored
-type ParseErrorsWhitelist struct {
- // UnknownFlags will ignore unknown flags errors and continue parsing rest of the flags
- UnknownFlags bool
-}
-
-// NormalizedName is a flag name that has been normalized according to rules
-// for the FlagSet (e.g. making '-' and '_' equivalent).
-type NormalizedName string
-
-// A FlagSet represents a set of defined flags.
-type FlagSet struct {
- // Usage is the function called when an error occurs while parsing flags.
- // The field is a function (not a method) that may be changed to point to
- // a custom error handler.
- Usage func()
-
- // SortFlags is used to indicate, if user wants to have sorted flags in
- // help/usage messages.
- SortFlags bool
-
- // ParseErrorsWhitelist is used to configure a whitelist of errors
- ParseErrorsWhitelist ParseErrorsWhitelist
-
- name string
- parsed bool
- actual map[NormalizedName]*Flag
- orderedActual []*Flag
- sortedActual []*Flag
- formal map[NormalizedName]*Flag
- orderedFormal []*Flag
- sortedFormal []*Flag
- shorthands map[byte]*Flag
- args []string // arguments after flags
- argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no --
- errorHandling ErrorHandling
- output io.Writer // nil means stderr; use out() accessor
- interspersed bool // allow interspersed option/non-option args
- normalizeNameFunc func(f *FlagSet, name string) NormalizedName
-
- addedGoFlagSets []*goflag.FlagSet
-}
-
-// A Flag represents the state of a flag.
-type Flag struct {
- Name string // name as it appears on command line
- Shorthand string // one-letter abbreviated flag
- Usage string // help message
- Value Value // value as set
- DefValue string // default value (as text); for usage message
- Changed bool // If the user set the value (or if left to default)
- NoOptDefVal string // default value (as text); if the flag is on the command line without any options
- Deprecated string // If this flag is deprecated, this string is the new or now thing to use
- Hidden bool // used by cobra.Command to allow flags to be hidden from help/usage text
- ShorthandDeprecated string // If the shorthand of this flag is deprecated, this string is the new or now thing to use
- Annotations map[string][]string // used by cobra.Command bash autocomple code
-}
-
-// Value is the interface to the dynamic value stored in a flag.
-// (The default value is represented as a string.)
-type Value interface {
- String() string
- Set(string) error
- Type() string
-}
-
-// SliceValue is a secondary interface to all flags which hold a list
-// of values. This allows full control over the value of list flags,
-// and avoids complicated marshalling and unmarshalling to csv.
-type SliceValue interface {
- // Append adds the specified value to the end of the flag value list.
- Append(string) error
- // Replace will fully overwrite any data currently in the flag value list.
- Replace([]string) error
- // GetSlice returns the flag value list as an array of strings.
- GetSlice() []string
-}
-
-// sortFlags returns the flags as a slice in lexicographical sorted order.
-func sortFlags(flags map[NormalizedName]*Flag) []*Flag {
- list := make(sort.StringSlice, len(flags))
- i := 0
- for k := range flags {
- list[i] = string(k)
- i++
- }
- list.Sort()
- result := make([]*Flag, len(list))
- for i, name := range list {
- result[i] = flags[NormalizedName(name)]
- }
- return result
-}
-
-// SetNormalizeFunc allows you to add a function which can translate flag names.
-// Flags added to the FlagSet will be translated and then when anything tries to
-// look up the flag that will also be translated. So it would be possible to create
-// a flag named "getURL" and have it translated to "geturl". A user could then pass
-// "--getUrl" which may also be translated to "geturl" and everything will work.
-func (f *FlagSet) SetNormalizeFunc(n func(f *FlagSet, name string) NormalizedName) {
- f.normalizeNameFunc = n
- f.sortedFormal = f.sortedFormal[:0]
- for fname, flag := range f.formal {
- nname := f.normalizeFlagName(flag.Name)
- if fname == nname {
- continue
- }
- flag.Name = string(nname)
- delete(f.formal, fname)
- f.formal[nname] = flag
- if _, set := f.actual[fname]; set {
- delete(f.actual, fname)
- f.actual[nname] = flag
- }
- }
-}
-
-// GetNormalizeFunc returns the previously set NormalizeFunc of a function which
-// does no translation, if not set previously.
-func (f *FlagSet) GetNormalizeFunc() func(f *FlagSet, name string) NormalizedName {
- if f.normalizeNameFunc != nil {
- return f.normalizeNameFunc
- }
- return func(f *FlagSet, name string) NormalizedName { return NormalizedName(name) }
-}
-
-func (f *FlagSet) normalizeFlagName(name string) NormalizedName {
- n := f.GetNormalizeFunc()
- return n(f, name)
-}
-
-func (f *FlagSet) out() io.Writer {
- if f.output == nil {
- return os.Stderr
- }
- return f.output
-}
-
-// SetOutput sets the destination for usage and error messages.
-// If output is nil, os.Stderr is used.
-func (f *FlagSet) SetOutput(output io.Writer) {
- f.output = output
-}
-
-// VisitAll visits the flags in lexicographical order or
-// in primordial order if f.SortFlags is false, calling fn for each.
-// It visits all flags, even those not set.
-func (f *FlagSet) VisitAll(fn func(*Flag)) {
- if len(f.formal) == 0 {
- return
- }
-
- var flags []*Flag
- if f.SortFlags {
- if len(f.formal) != len(f.sortedFormal) {
- f.sortedFormal = sortFlags(f.formal)
- }
- flags = f.sortedFormal
- } else {
- flags = f.orderedFormal
- }
-
- for _, flag := range flags {
- fn(flag)
- }
-}
-
-// HasFlags returns a bool to indicate if the FlagSet has any flags defined.
-func (f *FlagSet) HasFlags() bool {
- return len(f.formal) > 0
-}
-
-// HasAvailableFlags returns a bool to indicate if the FlagSet has any flags
-// that are not hidden.
-func (f *FlagSet) HasAvailableFlags() bool {
- for _, flag := range f.formal {
- if !flag.Hidden {
- return true
- }
- }
- return false
-}
-
-// VisitAll visits the command-line flags in lexicographical order or
-// in primordial order if f.SortFlags is false, calling fn for each.
-// It visits all flags, even those not set.
-func VisitAll(fn func(*Flag)) {
- CommandLine.VisitAll(fn)
-}
-
-// Visit visits the flags in lexicographical order or
-// in primordial order if f.SortFlags is false, calling fn for each.
-// It visits only those flags that have been set.
-func (f *FlagSet) Visit(fn func(*Flag)) {
- if len(f.actual) == 0 {
- return
- }
-
- var flags []*Flag
- if f.SortFlags {
- if len(f.actual) != len(f.sortedActual) {
- f.sortedActual = sortFlags(f.actual)
- }
- flags = f.sortedActual
- } else {
- flags = f.orderedActual
- }
-
- for _, flag := range flags {
- fn(flag)
- }
-}
-
-// Visit visits the command-line flags in lexicographical order or
-// in primordial order if f.SortFlags is false, calling fn for each.
-// It visits only those flags that have been set.
-func Visit(fn func(*Flag)) {
- CommandLine.Visit(fn)
-}
-
-// Lookup returns the Flag structure of the named flag, returning nil if none exists.
-func (f *FlagSet) Lookup(name string) *Flag {
- return f.lookup(f.normalizeFlagName(name))
-}
-
-// ShorthandLookup returns the Flag structure of the short handed flag,
-// returning nil if none exists.
-// It panics, if len(name) > 1.
-func (f *FlagSet) ShorthandLookup(name string) *Flag {
- if name == "" {
- return nil
- }
- if len(name) > 1 {
- msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name)
- fmt.Fprintf(f.out(), msg)
- panic(msg)
- }
- c := name[0]
- return f.shorthands[c]
-}
-
-// lookup returns the Flag structure of the named flag, returning nil if none exists.
-func (f *FlagSet) lookup(name NormalizedName) *Flag {
- return f.formal[name]
-}
-
-// func to return a given type for a given flag name
-func (f *FlagSet) getFlagType(name string, ftype string, convFunc func(sval string) (interface{}, error)) (interface{}, error) {
- flag := f.Lookup(name)
- if flag == nil {
- err := fmt.Errorf("flag accessed but not defined: %s", name)
- return nil, err
- }
-
- if flag.Value.Type() != ftype {
- err := fmt.Errorf("trying to get %s value of flag of type %s", ftype, flag.Value.Type())
- return nil, err
- }
-
- sval := flag.Value.String()
- result, err := convFunc(sval)
- if err != nil {
- return nil, err
- }
- return result, nil
-}
-
-// ArgsLenAtDash will return the length of f.Args at the moment when a -- was
-// found during arg parsing. This allows your program to know which args were
-// before the -- and which came after.
-func (f *FlagSet) ArgsLenAtDash() int {
- return f.argsLenAtDash
-}
-
-// MarkDeprecated indicated that a flag is deprecated in your program. It will
-// continue to function but will not show up in help or usage messages. Using
-// this flag will also print the given usageMessage.
-func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- if usageMessage == "" {
- return fmt.Errorf("deprecated message for flag %q must be set", name)
- }
- flag.Deprecated = usageMessage
- flag.Hidden = true
- return nil
-}
-
-// MarkShorthandDeprecated will mark the shorthand of a flag deprecated in your
-// program. It will continue to function but will not show up in help or usage
-// messages. Using this flag will also print the given usageMessage.
-func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- if usageMessage == "" {
- return fmt.Errorf("deprecated message for flag %q must be set", name)
- }
- flag.ShorthandDeprecated = usageMessage
- return nil
-}
-
-// MarkHidden sets a flag to 'hidden' in your program. It will continue to
-// function but will not show up in help or usage messages.
-func (f *FlagSet) MarkHidden(name string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- flag.Hidden = true
- return nil
-}
-
-// Lookup returns the Flag structure of the named command-line flag,
-// returning nil if none exists.
-func Lookup(name string) *Flag {
- return CommandLine.Lookup(name)
-}
-
-// ShorthandLookup returns the Flag structure of the short handed flag,
-// returning nil if none exists.
-func ShorthandLookup(name string) *Flag {
- return CommandLine.ShorthandLookup(name)
-}
-
-// Set sets the value of the named flag.
-func (f *FlagSet) Set(name, value string) error {
- normalName := f.normalizeFlagName(name)
- flag, ok := f.formal[normalName]
- if !ok {
- return fmt.Errorf("no such flag -%v", name)
- }
-
- err := flag.Value.Set(value)
- if err != nil {
- var flagName string
- if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
- flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name)
- } else {
- flagName = fmt.Sprintf("--%s", flag.Name)
- }
- return fmt.Errorf("invalid argument %q for %q flag: %v", value, flagName, err)
- }
-
- if !flag.Changed {
- if f.actual == nil {
- f.actual = make(map[NormalizedName]*Flag)
- }
- f.actual[normalName] = flag
- f.orderedActual = append(f.orderedActual, flag)
-
- flag.Changed = true
- }
-
- if flag.Deprecated != "" {
- fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
- }
- return nil
-}
-
-// SetAnnotation allows one to set arbitrary annotations on a flag in the FlagSet.
-// This is sometimes used by spf13/cobra programs which want to generate additional
-// bash completion information.
-func (f *FlagSet) SetAnnotation(name, key string, values []string) error {
- normalName := f.normalizeFlagName(name)
- flag, ok := f.formal[normalName]
- if !ok {
- return fmt.Errorf("no such flag -%v", name)
- }
- if flag.Annotations == nil {
- flag.Annotations = map[string][]string{}
- }
- flag.Annotations[key] = values
- return nil
-}
-
-// Changed returns true if the flag was explicitly set during Parse() and false
-// otherwise
-func (f *FlagSet) Changed(name string) bool {
- flag := f.Lookup(name)
- // If a flag doesn't exist, it wasn't changed....
- if flag == nil {
- return false
- }
- return flag.Changed
-}
-
-// Set sets the value of the named command-line flag.
-func Set(name, value string) error {
- return CommandLine.Set(name, value)
-}
-
-// PrintDefaults prints, to standard error unless configured
-// otherwise, the default values of all defined flags in the set.
-func (f *FlagSet) PrintDefaults() {
- usages := f.FlagUsages()
- fmt.Fprint(f.out(), usages)
-}
-
-// defaultIsZeroValue returns true if the default value for this flag represents
-// a zero value.
-func (f *Flag) defaultIsZeroValue() bool {
- switch f.Value.(type) {
- case boolFlag:
- return f.DefValue == "false"
- case *durationValue:
- // Beginning in Go 1.7, duration zero values are "0s"
- return f.DefValue == "0" || f.DefValue == "0s"
- case *intValue, *int8Value, *int32Value, *int64Value, *uintValue, *uint8Value, *uint16Value, *uint32Value, *uint64Value, *countValue, *float32Value, *float64Value:
- return f.DefValue == "0"
- case *stringValue:
- return f.DefValue == ""
- case *ipValue, *ipMaskValue, *ipNetValue:
- return f.DefValue == ""
- case *intSliceValue, *stringSliceValue, *stringArrayValue:
- return f.DefValue == "[]"
- default:
- switch f.Value.String() {
- case "false":
- return true
- case "":
- return true
- case "":
- return true
- case "0":
- return true
- }
- return false
- }
-}
-
-// UnquoteUsage extracts a back-quoted name from the usage
-// string for a flag and returns it and the un-quoted usage.
-// Given "a `name` to show" it returns ("name", "a name to show").
-// If there are no back quotes, the name is an educated guess of the
-// type of the flag's value, or the empty string if the flag is boolean.
-func UnquoteUsage(flag *Flag) (name string, usage string) {
- // Look for a back-quoted name, but avoid the strings package.
- usage = flag.Usage
- for i := 0; i < len(usage); i++ {
- if usage[i] == '`' {
- for j := i + 1; j < len(usage); j++ {
- if usage[j] == '`' {
- name = usage[i+1 : j]
- usage = usage[:i] + name + usage[j+1:]
- return name, usage
- }
- }
- break // Only one back quote; use type name.
- }
- }
-
- name = flag.Value.Type()
- switch name {
- case "bool":
- name = ""
- case "float64":
- name = "float"
- case "int64":
- name = "int"
- case "uint64":
- name = "uint"
- case "stringSlice":
- name = "strings"
- case "intSlice":
- name = "ints"
- case "uintSlice":
- name = "uints"
- case "boolSlice":
- name = "bools"
- }
-
- return
-}
-
-// Splits the string `s` on whitespace into an initial substring up to
-// `i` runes in length and the remainder. Will go `slop` over `i` if
-// that encompasses the entire string (which allows the caller to
-// avoid short orphan words on the final line).
-func wrapN(i, slop int, s string) (string, string) {
- if i+slop > len(s) {
- return s, ""
- }
-
- w := strings.LastIndexAny(s[:i], " \t\n")
- if w <= 0 {
- return s, ""
- }
- nlPos := strings.LastIndex(s[:i], "\n")
- if nlPos > 0 && nlPos < w {
- return s[:nlPos], s[nlPos+1:]
- }
- return s[:w], s[w+1:]
-}
-
-// Wraps the string `s` to a maximum width `w` with leading indent
-// `i`. The first line is not indented (this is assumed to be done by
-// caller). Pass `w` == 0 to do no wrapping
-func wrap(i, w int, s string) string {
- if w == 0 {
- return strings.Replace(s, "\n", "\n"+strings.Repeat(" ", i), -1)
- }
-
- // space between indent i and end of line width w into which
- // we should wrap the text.
- wrap := w - i
-
- var r, l string
-
- // Not enough space for sensible wrapping. Wrap as a block on
- // the next line instead.
- if wrap < 24 {
- i = 16
- wrap = w - i
- r += "\n" + strings.Repeat(" ", i)
- }
- // If still not enough space then don't even try to wrap.
- if wrap < 24 {
- return strings.Replace(s, "\n", r, -1)
- }
-
- // Try to avoid short orphan words on the final line, by
- // allowing wrapN to go a bit over if that would fit in the
- // remainder of the line.
- slop := 5
- wrap = wrap - slop
-
- // Handle first line, which is indented by the caller (or the
- // special case above)
- l, s = wrapN(wrap, slop, s)
- r = r + strings.Replace(l, "\n", "\n"+strings.Repeat(" ", i), -1)
-
- // Now wrap the rest
- for s != "" {
- var t string
-
- t, s = wrapN(wrap, slop, s)
- r = r + "\n" + strings.Repeat(" ", i) + strings.Replace(t, "\n", "\n"+strings.Repeat(" ", i), -1)
- }
-
- return r
-
-}
-
-// FlagUsagesWrapped returns a string containing the usage information
-// for all flags in the FlagSet. Wrapped to `cols` columns (0 for no
-// wrapping)
-func (f *FlagSet) FlagUsagesWrapped(cols int) string {
- buf := new(bytes.Buffer)
-
- lines := make([]string, 0, len(f.formal))
-
- maxlen := 0
- f.VisitAll(func(flag *Flag) {
- if flag.Hidden {
- return
- }
-
- line := ""
- if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
- line = fmt.Sprintf(" -%s, --%s", flag.Shorthand, flag.Name)
- } else {
- line = fmt.Sprintf(" --%s", flag.Name)
- }
-
- varname, usage := UnquoteUsage(flag)
- if varname != "" {
- line += " " + varname
- }
- if flag.NoOptDefVal != "" {
- switch flag.Value.Type() {
- case "string":
- line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal)
- case "bool":
- if flag.NoOptDefVal != "true" {
- line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
- }
- case "count":
- if flag.NoOptDefVal != "+1" {
- line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
- }
- default:
- line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
- }
- }
-
- // This special character will be replaced with spacing once the
- // correct alignment is calculated
- line += "\x00"
- if len(line) > maxlen {
- maxlen = len(line)
- }
-
- line += usage
- if !flag.defaultIsZeroValue() {
- if flag.Value.Type() == "string" {
- line += fmt.Sprintf(" (default %q)", flag.DefValue)
- } else {
- line += fmt.Sprintf(" (default %s)", flag.DefValue)
- }
- }
- if len(flag.Deprecated) != 0 {
- line += fmt.Sprintf(" (DEPRECATED: %s)", flag.Deprecated)
- }
-
- lines = append(lines, line)
- })
-
- for _, line := range lines {
- sidx := strings.Index(line, "\x00")
- spacing := strings.Repeat(" ", maxlen-sidx)
- // maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx
- fmt.Fprintln(buf, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:]))
- }
-
- return buf.String()
-}
-
-// FlagUsages returns a string containing the usage information for all flags in
-// the FlagSet
-func (f *FlagSet) FlagUsages() string {
- return f.FlagUsagesWrapped(0)
-}
-
-// PrintDefaults prints to standard error the default values of all defined command-line flags.
-func PrintDefaults() {
- CommandLine.PrintDefaults()
-}
-
-// defaultUsage is the default function to print a usage message.
-func defaultUsage(f *FlagSet) {
- fmt.Fprintf(f.out(), "Usage of %s:\n", f.name)
- f.PrintDefaults()
-}
-
-// NOTE: Usage is not just defaultUsage(CommandLine)
-// because it serves (via godoc flag Usage) as the example
-// for how to write your own usage function.
-
-// Usage prints to standard error a usage message documenting all defined command-line flags.
-// The function is a variable that may be changed to point to a custom function.
-// By default it prints a simple header and calls PrintDefaults; for details about the
-// format of the output and how to control it, see the documentation for PrintDefaults.
-var Usage = func() {
- fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
- PrintDefaults()
-}
-
-// NFlag returns the number of flags that have been set.
-func (f *FlagSet) NFlag() int { return len(f.actual) }
-
-// NFlag returns the number of command-line flags that have been set.
-func NFlag() int { return len(CommandLine.actual) }
-
-// Arg returns the i'th argument. Arg(0) is the first remaining argument
-// after flags have been processed.
-func (f *FlagSet) Arg(i int) string {
- if i < 0 || i >= len(f.args) {
- return ""
- }
- return f.args[i]
-}
-
-// Arg returns the i'th command-line argument. Arg(0) is the first remaining argument
-// after flags have been processed.
-func Arg(i int) string {
- return CommandLine.Arg(i)
-}
-
-// NArg is the number of arguments remaining after flags have been processed.
-func (f *FlagSet) NArg() int { return len(f.args) }
-
-// NArg is the number of arguments remaining after flags have been processed.
-func NArg() int { return len(CommandLine.args) }
-
-// Args returns the non-flag arguments.
-func (f *FlagSet) Args() []string { return f.args }
-
-// Args returns the non-flag command-line arguments.
-func Args() []string { return CommandLine.args }
-
-// Var defines a flag with the specified name and usage string. The type and
-// value of the flag are represented by the first argument, of type Value, which
-// typically holds a user-defined implementation of Value. For instance, the
-// caller could create a flag that turns a comma-separated string into a slice
-// of strings by giving the slice the methods of Value; in particular, Set would
-// decompose the comma-separated string into the slice.
-func (f *FlagSet) Var(value Value, name string, usage string) {
- f.VarP(value, name, "", usage)
-}
-
-// VarPF is like VarP, but returns the flag created
-func (f *FlagSet) VarPF(value Value, name, shorthand, usage string) *Flag {
- // Remember the default value as a string; it won't change.
- flag := &Flag{
- Name: name,
- Shorthand: shorthand,
- Usage: usage,
- Value: value,
- DefValue: value.String(),
- }
- f.AddFlag(flag)
- return flag
-}
-
-// VarP is like Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
- f.VarPF(value, name, shorthand, usage)
-}
-
-// AddFlag will add the flag to the FlagSet
-func (f *FlagSet) AddFlag(flag *Flag) {
- normalizedFlagName := f.normalizeFlagName(flag.Name)
-
- _, alreadyThere := f.formal[normalizedFlagName]
- if alreadyThere {
- msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name)
- fmt.Fprintln(f.out(), msg)
- panic(msg) // Happens only if flags are declared with identical names
- }
- if f.formal == nil {
- f.formal = make(map[NormalizedName]*Flag)
- }
-
- flag.Name = string(normalizedFlagName)
- f.formal[normalizedFlagName] = flag
- f.orderedFormal = append(f.orderedFormal, flag)
-
- if flag.Shorthand == "" {
- return
- }
- if len(flag.Shorthand) > 1 {
- msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand)
- fmt.Fprintf(f.out(), msg)
- panic(msg)
- }
- if f.shorthands == nil {
- f.shorthands = make(map[byte]*Flag)
- }
- c := flag.Shorthand[0]
- used, alreadyThere := f.shorthands[c]
- if alreadyThere {
- msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name)
- fmt.Fprintf(f.out(), msg)
- panic(msg)
- }
- f.shorthands[c] = flag
-}
-
-// AddFlagSet adds one FlagSet to another. If a flag is already present in f
-// the flag from newSet will be ignored.
-func (f *FlagSet) AddFlagSet(newSet *FlagSet) {
- if newSet == nil {
- return
- }
- newSet.VisitAll(func(flag *Flag) {
- if f.Lookup(flag.Name) == nil {
- f.AddFlag(flag)
- }
- })
-}
-
-// Var defines a flag with the specified name and usage string. The type and
-// value of the flag are represented by the first argument, of type Value, which
-// typically holds a user-defined implementation of Value. For instance, the
-// caller could create a flag that turns a comma-separated string into a slice
-// of strings by giving the slice the methods of Value; in particular, Set would
-// decompose the comma-separated string into the slice.
-func Var(value Value, name string, usage string) {
- CommandLine.VarP(value, name, "", usage)
-}
-
-// VarP is like Var, but accepts a shorthand letter that can be used after a single dash.
-func VarP(value Value, name, shorthand, usage string) {
- CommandLine.VarP(value, name, shorthand, usage)
-}
-
-// failf prints to standard error a formatted error and usage message and
-// returns the error.
-func (f *FlagSet) failf(format string, a ...interface{}) error {
- err := fmt.Errorf(format, a...)
- if f.errorHandling != ContinueOnError {
- fmt.Fprintln(f.out(), err)
- f.usage()
- }
- return err
-}
-
-// usage calls the Usage method for the flag set, or the usage function if
-// the flag set is CommandLine.
-func (f *FlagSet) usage() {
- if f == CommandLine {
- Usage()
- } else if f.Usage == nil {
- defaultUsage(f)
- } else {
- f.Usage()
- }
-}
-
-//--unknown (args will be empty)
-//--unknown --next-flag ... (args will be --next-flag ...)
-//--unknown arg ... (args will be arg ...)
-func stripUnknownFlagValue(args []string) []string {
- if len(args) == 0 {
- //--unknown
- return args
- }
-
- first := args[0]
- if len(first) > 0 && first[0] == '-' {
- //--unknown --next-flag ...
- return args
- }
-
- //--unknown arg ... (args will be arg ...)
- if len(args) > 1 {
- return args[1:]
- }
- return nil
-}
-
-func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {
- a = args
- name := s[2:]
- if len(name) == 0 || name[0] == '-' || name[0] == '=' {
- err = f.failf("bad flag syntax: %s", s)
- return
- }
-
- split := strings.SplitN(name, "=", 2)
- name = split[0]
- flag, exists := f.formal[f.normalizeFlagName(name)]
-
- if !exists {
- switch {
- case name == "help":
- f.usage()
- return a, ErrHelp
- case f.ParseErrorsWhitelist.UnknownFlags:
- // --unknown=unknownval arg ...
- // we do not want to lose arg in this case
- if len(split) >= 2 {
- return a, nil
- }
-
- return stripUnknownFlagValue(a), nil
- default:
- err = f.failf("unknown flag: --%s", name)
- return
- }
- }
-
- var value string
- if len(split) == 2 {
- // '--flag=arg'
- value = split[1]
- } else if flag.NoOptDefVal != "" {
- // '--flag' (arg was optional)
- value = flag.NoOptDefVal
- } else if len(a) > 0 {
- // '--flag arg'
- value = a[0]
- a = a[1:]
- } else {
- // '--flag' (arg was required)
- err = f.failf("flag needs an argument: %s", s)
- return
- }
-
- err = fn(flag, value)
- if err != nil {
- f.failf(err.Error())
- }
- return
-}
-
-func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) {
- outArgs = args
-
- if strings.HasPrefix(shorthands, "test.") {
- return
- }
-
- outShorts = shorthands[1:]
- c := shorthands[0]
-
- flag, exists := f.shorthands[c]
- if !exists {
- switch {
- case c == 'h':
- f.usage()
- err = ErrHelp
- return
- case f.ParseErrorsWhitelist.UnknownFlags:
- // '-f=arg arg ...'
- // we do not want to lose arg in this case
- if len(shorthands) > 2 && shorthands[1] == '=' {
- outShorts = ""
- return
- }
-
- outArgs = stripUnknownFlagValue(outArgs)
- return
- default:
- err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands)
- return
- }
- }
-
- var value string
- if len(shorthands) > 2 && shorthands[1] == '=' {
- // '-f=arg'
- value = shorthands[2:]
- outShorts = ""
- } else if flag.NoOptDefVal != "" {
- // '-f' (arg was optional)
- value = flag.NoOptDefVal
- } else if len(shorthands) > 1 {
- // '-farg'
- value = shorthands[1:]
- outShorts = ""
- } else if len(args) > 0 {
- // '-f arg'
- value = args[0]
- outArgs = args[1:]
- } else {
- // '-f' (arg was required)
- err = f.failf("flag needs an argument: %q in -%s", c, shorthands)
- return
- }
-
- if flag.ShorthandDeprecated != "" {
- fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated)
- }
-
- err = fn(flag, value)
- if err != nil {
- f.failf(err.Error())
- }
- return
-}
-
-func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []string, err error) {
- a = args
- shorthands := s[1:]
-
- // "shorthands" can be a series of shorthand letters of flags (e.g. "-vvv").
- for len(shorthands) > 0 {
- shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn)
- if err != nil {
- return
- }
- }
-
- return
-}
-
-func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
- for len(args) > 0 {
- s := args[0]
- args = args[1:]
- if len(s) == 0 || s[0] != '-' || len(s) == 1 {
- if !f.interspersed {
- f.args = append(f.args, s)
- f.args = append(f.args, args...)
- return nil
- }
- f.args = append(f.args, s)
- continue
- }
-
- if s[1] == '-' {
- if len(s) == 2 { // "--" terminates the flags
- f.argsLenAtDash = len(f.args)
- f.args = append(f.args, args...)
- break
- }
- args, err = f.parseLongArg(s, args, fn)
- } else {
- args, err = f.parseShortArg(s, args, fn)
- }
- if err != nil {
- return
- }
- }
- return
-}
-
-// Parse parses flag definitions from the argument list, which should not
-// include the command name. Must be called after all flags in the FlagSet
-// are defined and before flags are accessed by the program.
-// The return value will be ErrHelp if -help was set but not defined.
-func (f *FlagSet) Parse(arguments []string) error {
- if f.addedGoFlagSets != nil {
- for _, goFlagSet := range f.addedGoFlagSets {
- goFlagSet.Parse(nil)
- }
- }
- f.parsed = true
-
- if len(arguments) < 0 {
- return nil
- }
-
- f.args = make([]string, 0, len(arguments))
-
- set := func(flag *Flag, value string) error {
- return f.Set(flag.Name, value)
- }
-
- err := f.parseArgs(arguments, set)
- if err != nil {
- switch f.errorHandling {
- case ContinueOnError:
- return err
- case ExitOnError:
- fmt.Println(err)
- os.Exit(2)
- case PanicOnError:
- panic(err)
- }
- }
- return nil
-}
-
-type parseFunc func(flag *Flag, value string) error
-
-// ParseAll parses flag definitions from the argument list, which should not
-// include the command name. The arguments for fn are flag and value. Must be
-// called after all flags in the FlagSet are defined and before flags are
-// accessed by the program. The return value will be ErrHelp if -help was set
-// but not defined.
-func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string) error) error {
- f.parsed = true
- f.args = make([]string, 0, len(arguments))
-
- err := f.parseArgs(arguments, fn)
- if err != nil {
- switch f.errorHandling {
- case ContinueOnError:
- return err
- case ExitOnError:
- os.Exit(2)
- case PanicOnError:
- panic(err)
- }
- }
- return nil
-}
-
-// Parsed reports whether f.Parse has been called.
-func (f *FlagSet) Parsed() bool {
- return f.parsed
-}
-
-// Parse parses the command-line flags from os.Args[1:]. Must be called
-// after all flags are defined and before flags are accessed by the program.
-func Parse() {
- // Ignore errors; CommandLine is set for ExitOnError.
- CommandLine.Parse(os.Args[1:])
-}
-
-// ParseAll parses the command-line flags from os.Args[1:] and called fn for each.
-// The arguments for fn are flag and value. Must be called after all flags are
-// defined and before flags are accessed by the program.
-func ParseAll(fn func(flag *Flag, value string) error) {
- // Ignore errors; CommandLine is set for ExitOnError.
- CommandLine.ParseAll(os.Args[1:], fn)
-}
-
-// SetInterspersed sets whether to support interspersed option/non-option arguments.
-func SetInterspersed(interspersed bool) {
- CommandLine.SetInterspersed(interspersed)
-}
-
-// Parsed returns true if the command-line flags have been parsed.
-func Parsed() bool {
- return CommandLine.Parsed()
-}
-
-// CommandLine is the default set of command-line flags, parsed from os.Args.
-var CommandLine = NewFlagSet(os.Args[0], ExitOnError)
-
-// NewFlagSet returns a new, empty flag set with the specified name,
-// error handling property and SortFlags set to true.
-func NewFlagSet(name string, errorHandling ErrorHandling) *FlagSet {
- f := &FlagSet{
- name: name,
- errorHandling: errorHandling,
- argsLenAtDash: -1,
- interspersed: true,
- SortFlags: true,
- }
- return f
-}
-
-// SetInterspersed sets whether to support interspersed option/non-option arguments.
-func (f *FlagSet) SetInterspersed(interspersed bool) {
- f.interspersed = interspersed
-}
-
-// Init sets the name and error handling property for a flag set.
-// By default, the zero FlagSet uses an empty name and the
-// ContinueOnError error handling policy.
-func (f *FlagSet) Init(name string, errorHandling ErrorHandling) {
- f.name = name
- f.errorHandling = errorHandling
- f.argsLenAtDash = -1
-}
diff --git a/vendor/github.com/spf13/pflag/float32.go b/vendor/github.com/spf13/pflag/float32.go
deleted file mode 100644
index a243f81f7..000000000
--- a/vendor/github.com/spf13/pflag/float32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- float32 Value
-type float32Value float32
-
-func newFloat32Value(val float32, p *float32) *float32Value {
- *p = val
- return (*float32Value)(p)
-}
-
-func (f *float32Value) Set(s string) error {
- v, err := strconv.ParseFloat(s, 32)
- *f = float32Value(v)
- return err
-}
-
-func (f *float32Value) Type() string {
- return "float32"
-}
-
-func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) }
-
-func float32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseFloat(sval, 32)
- if err != nil {
- return 0, err
- }
- return float32(v), nil
-}
-
-// GetFloat32 return the float32 value of a flag with the given name
-func (f *FlagSet) GetFloat32(name string) (float32, error) {
- val, err := f.getFlagType(name, "float32", float32Conv)
- if err != nil {
- return 0, err
- }
- return val.(float32), nil
-}
-
-// Float32Var defines a float32 flag with specified name, default value, and usage string.
-// The argument p points to a float32 variable in which to store the value of the flag.
-func (f *FlagSet) Float32Var(p *float32, name string, value float32, usage string) {
- f.VarP(newFloat32Value(value, p), name, "", usage)
-}
-
-// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float32VarP(p *float32, name, shorthand string, value float32, usage string) {
- f.VarP(newFloat32Value(value, p), name, shorthand, usage)
-}
-
-// Float32Var defines a float32 flag with specified name, default value, and usage string.
-// The argument p points to a float32 variable in which to store the value of the flag.
-func Float32Var(p *float32, name string, value float32, usage string) {
- CommandLine.VarP(newFloat32Value(value, p), name, "", usage)
-}
-
-// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash.
-func Float32VarP(p *float32, name, shorthand string, value float32, usage string) {
- CommandLine.VarP(newFloat32Value(value, p), name, shorthand, usage)
-}
-
-// Float32 defines a float32 flag with specified name, default value, and usage string.
-// The return value is the address of a float32 variable that stores the value of the flag.
-func (f *FlagSet) Float32(name string, value float32, usage string) *float32 {
- p := new(float32)
- f.Float32VarP(p, name, "", value, usage)
- return p
-}
-
-// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float32P(name, shorthand string, value float32, usage string) *float32 {
- p := new(float32)
- f.Float32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Float32 defines a float32 flag with specified name, default value, and usage string.
-// The return value is the address of a float32 variable that stores the value of the flag.
-func Float32(name string, value float32, usage string) *float32 {
- return CommandLine.Float32P(name, "", value, usage)
-}
-
-// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash.
-func Float32P(name, shorthand string, value float32, usage string) *float32 {
- return CommandLine.Float32P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/float32_slice.go b/vendor/github.com/spf13/pflag/float32_slice.go
deleted file mode 100644
index caa352741..000000000
--- a/vendor/github.com/spf13/pflag/float32_slice.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- float32Slice Value
-type float32SliceValue struct {
- value *[]float32
- changed bool
-}
-
-func newFloat32SliceValue(val []float32, p *[]float32) *float32SliceValue {
- isv := new(float32SliceValue)
- isv.value = p
- *isv.value = val
- return isv
-}
-
-func (s *float32SliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]float32, len(ss))
- for i, d := range ss {
- var err error
- var temp64 float64
- temp64, err = strconv.ParseFloat(d, 32)
- if err != nil {
- return err
- }
- out[i] = float32(temp64)
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *float32SliceValue) Type() string {
- return "float32Slice"
-}
-
-func (s *float32SliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%f", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func (s *float32SliceValue) fromString(val string) (float32, error) {
- t64, err := strconv.ParseFloat(val, 32)
- if err != nil {
- return 0, err
- }
- return float32(t64), nil
-}
-
-func (s *float32SliceValue) toString(val float32) string {
- return fmt.Sprintf("%f", val)
-}
-
-func (s *float32SliceValue) Append(val string) error {
- i, err := s.fromString(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *float32SliceValue) Replace(val []string) error {
- out := make([]float32, len(val))
- for i, d := range val {
- var err error
- out[i], err = s.fromString(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *float32SliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = s.toString(d)
- }
- return out
-}
-
-func float32SliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []float32{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]float32, len(ss))
- for i, d := range ss {
- var err error
- var temp64 float64
- temp64, err = strconv.ParseFloat(d, 32)
- if err != nil {
- return nil, err
- }
- out[i] = float32(temp64)
-
- }
- return out, nil
-}
-
-// GetFloat32Slice return the []float32 value of a flag with the given name
-func (f *FlagSet) GetFloat32Slice(name string) ([]float32, error) {
- val, err := f.getFlagType(name, "float32Slice", float32SliceConv)
- if err != nil {
- return []float32{}, err
- }
- return val.([]float32), nil
-}
-
-// Float32SliceVar defines a float32Slice flag with specified name, default value, and usage string.
-// The argument p points to a []float32 variable in which to store the value of the flag.
-func (f *FlagSet) Float32SliceVar(p *[]float32, name string, value []float32, usage string) {
- f.VarP(newFloat32SliceValue(value, p), name, "", usage)
-}
-
-// Float32SliceVarP is like Float32SliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float32SliceVarP(p *[]float32, name, shorthand string, value []float32, usage string) {
- f.VarP(newFloat32SliceValue(value, p), name, shorthand, usage)
-}
-
-// Float32SliceVar defines a float32[] flag with specified name, default value, and usage string.
-// The argument p points to a float32[] variable in which to store the value of the flag.
-func Float32SliceVar(p *[]float32, name string, value []float32, usage string) {
- CommandLine.VarP(newFloat32SliceValue(value, p), name, "", usage)
-}
-
-// Float32SliceVarP is like Float32SliceVar, but accepts a shorthand letter that can be used after a single dash.
-func Float32SliceVarP(p *[]float32, name, shorthand string, value []float32, usage string) {
- CommandLine.VarP(newFloat32SliceValue(value, p), name, shorthand, usage)
-}
-
-// Float32Slice defines a []float32 flag with specified name, default value, and usage string.
-// The return value is the address of a []float32 variable that stores the value of the flag.
-func (f *FlagSet) Float32Slice(name string, value []float32, usage string) *[]float32 {
- p := []float32{}
- f.Float32SliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// Float32SliceP is like Float32Slice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float32SliceP(name, shorthand string, value []float32, usage string) *[]float32 {
- p := []float32{}
- f.Float32SliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// Float32Slice defines a []float32 flag with specified name, default value, and usage string.
-// The return value is the address of a []float32 variable that stores the value of the flag.
-func Float32Slice(name string, value []float32, usage string) *[]float32 {
- return CommandLine.Float32SliceP(name, "", value, usage)
-}
-
-// Float32SliceP is like Float32Slice, but accepts a shorthand letter that can be used after a single dash.
-func Float32SliceP(name, shorthand string, value []float32, usage string) *[]float32 {
- return CommandLine.Float32SliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/float64.go b/vendor/github.com/spf13/pflag/float64.go
deleted file mode 100644
index 04b5492a7..000000000
--- a/vendor/github.com/spf13/pflag/float64.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- float64 Value
-type float64Value float64
-
-func newFloat64Value(val float64, p *float64) *float64Value {
- *p = val
- return (*float64Value)(p)
-}
-
-func (f *float64Value) Set(s string) error {
- v, err := strconv.ParseFloat(s, 64)
- *f = float64Value(v)
- return err
-}
-
-func (f *float64Value) Type() string {
- return "float64"
-}
-
-func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) }
-
-func float64Conv(sval string) (interface{}, error) {
- return strconv.ParseFloat(sval, 64)
-}
-
-// GetFloat64 return the float64 value of a flag with the given name
-func (f *FlagSet) GetFloat64(name string) (float64, error) {
- val, err := f.getFlagType(name, "float64", float64Conv)
- if err != nil {
- return 0, err
- }
- return val.(float64), nil
-}
-
-// Float64Var defines a float64 flag with specified name, default value, and usage string.
-// The argument p points to a float64 variable in which to store the value of the flag.
-func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string) {
- f.VarP(newFloat64Value(value, p), name, "", usage)
-}
-
-// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float64VarP(p *float64, name, shorthand string, value float64, usage string) {
- f.VarP(newFloat64Value(value, p), name, shorthand, usage)
-}
-
-// Float64Var defines a float64 flag with specified name, default value, and usage string.
-// The argument p points to a float64 variable in which to store the value of the flag.
-func Float64Var(p *float64, name string, value float64, usage string) {
- CommandLine.VarP(newFloat64Value(value, p), name, "", usage)
-}
-
-// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash.
-func Float64VarP(p *float64, name, shorthand string, value float64, usage string) {
- CommandLine.VarP(newFloat64Value(value, p), name, shorthand, usage)
-}
-
-// Float64 defines a float64 flag with specified name, default value, and usage string.
-// The return value is the address of a float64 variable that stores the value of the flag.
-func (f *FlagSet) Float64(name string, value float64, usage string) *float64 {
- p := new(float64)
- f.Float64VarP(p, name, "", value, usage)
- return p
-}
-
-// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float64P(name, shorthand string, value float64, usage string) *float64 {
- p := new(float64)
- f.Float64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Float64 defines a float64 flag with specified name, default value, and usage string.
-// The return value is the address of a float64 variable that stores the value of the flag.
-func Float64(name string, value float64, usage string) *float64 {
- return CommandLine.Float64P(name, "", value, usage)
-}
-
-// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash.
-func Float64P(name, shorthand string, value float64, usage string) *float64 {
- return CommandLine.Float64P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/float64_slice.go b/vendor/github.com/spf13/pflag/float64_slice.go
deleted file mode 100644
index 85bf3073d..000000000
--- a/vendor/github.com/spf13/pflag/float64_slice.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- float64Slice Value
-type float64SliceValue struct {
- value *[]float64
- changed bool
-}
-
-func newFloat64SliceValue(val []float64, p *[]float64) *float64SliceValue {
- isv := new(float64SliceValue)
- isv.value = p
- *isv.value = val
- return isv
-}
-
-func (s *float64SliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]float64, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.ParseFloat(d, 64)
- if err != nil {
- return err
- }
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *float64SliceValue) Type() string {
- return "float64Slice"
-}
-
-func (s *float64SliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%f", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func (s *float64SliceValue) fromString(val string) (float64, error) {
- return strconv.ParseFloat(val, 64)
-}
-
-func (s *float64SliceValue) toString(val float64) string {
- return fmt.Sprintf("%f", val)
-}
-
-func (s *float64SliceValue) Append(val string) error {
- i, err := s.fromString(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *float64SliceValue) Replace(val []string) error {
- out := make([]float64, len(val))
- for i, d := range val {
- var err error
- out[i], err = s.fromString(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *float64SliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = s.toString(d)
- }
- return out
-}
-
-func float64SliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []float64{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]float64, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.ParseFloat(d, 64)
- if err != nil {
- return nil, err
- }
-
- }
- return out, nil
-}
-
-// GetFloat64Slice return the []float64 value of a flag with the given name
-func (f *FlagSet) GetFloat64Slice(name string) ([]float64, error) {
- val, err := f.getFlagType(name, "float64Slice", float64SliceConv)
- if err != nil {
- return []float64{}, err
- }
- return val.([]float64), nil
-}
-
-// Float64SliceVar defines a float64Slice flag with specified name, default value, and usage string.
-// The argument p points to a []float64 variable in which to store the value of the flag.
-func (f *FlagSet) Float64SliceVar(p *[]float64, name string, value []float64, usage string) {
- f.VarP(newFloat64SliceValue(value, p), name, "", usage)
-}
-
-// Float64SliceVarP is like Float64SliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float64SliceVarP(p *[]float64, name, shorthand string, value []float64, usage string) {
- f.VarP(newFloat64SliceValue(value, p), name, shorthand, usage)
-}
-
-// Float64SliceVar defines a float64[] flag with specified name, default value, and usage string.
-// The argument p points to a float64[] variable in which to store the value of the flag.
-func Float64SliceVar(p *[]float64, name string, value []float64, usage string) {
- CommandLine.VarP(newFloat64SliceValue(value, p), name, "", usage)
-}
-
-// Float64SliceVarP is like Float64SliceVar, but accepts a shorthand letter that can be used after a single dash.
-func Float64SliceVarP(p *[]float64, name, shorthand string, value []float64, usage string) {
- CommandLine.VarP(newFloat64SliceValue(value, p), name, shorthand, usage)
-}
-
-// Float64Slice defines a []float64 flag with specified name, default value, and usage string.
-// The return value is the address of a []float64 variable that stores the value of the flag.
-func (f *FlagSet) Float64Slice(name string, value []float64, usage string) *[]float64 {
- p := []float64{}
- f.Float64SliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// Float64SliceP is like Float64Slice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float64SliceP(name, shorthand string, value []float64, usage string) *[]float64 {
- p := []float64{}
- f.Float64SliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// Float64Slice defines a []float64 flag with specified name, default value, and usage string.
-// The return value is the address of a []float64 variable that stores the value of the flag.
-func Float64Slice(name string, value []float64, usage string) *[]float64 {
- return CommandLine.Float64SliceP(name, "", value, usage)
-}
-
-// Float64SliceP is like Float64Slice, but accepts a shorthand letter that can be used after a single dash.
-func Float64SliceP(name, shorthand string, value []float64, usage string) *[]float64 {
- return CommandLine.Float64SliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/golangflag.go b/vendor/github.com/spf13/pflag/golangflag.go
deleted file mode 100644
index d3dd72b7f..000000000
--- a/vendor/github.com/spf13/pflag/golangflag.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- goflag "flag"
- "reflect"
- "strings"
-)
-
-// flagValueWrapper implements pflag.Value around a flag.Value. The main
-// difference here is the addition of the Type method that returns a string
-// name of the type. As this is generally unknown, we approximate that with
-// reflection.
-type flagValueWrapper struct {
- inner goflag.Value
- flagType string
-}
-
-// We are just copying the boolFlag interface out of goflag as that is what
-// they use to decide if a flag should get "true" when no arg is given.
-type goBoolFlag interface {
- goflag.Value
- IsBoolFlag() bool
-}
-
-func wrapFlagValue(v goflag.Value) Value {
- // If the flag.Value happens to also be a pflag.Value, just use it directly.
- if pv, ok := v.(Value); ok {
- return pv
- }
-
- pv := &flagValueWrapper{
- inner: v,
- }
-
- t := reflect.TypeOf(v)
- if t.Kind() == reflect.Interface || t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
-
- pv.flagType = strings.TrimSuffix(t.Name(), "Value")
- return pv
-}
-
-func (v *flagValueWrapper) String() string {
- return v.inner.String()
-}
-
-func (v *flagValueWrapper) Set(s string) error {
- return v.inner.Set(s)
-}
-
-func (v *flagValueWrapper) Type() string {
- return v.flagType
-}
-
-// PFlagFromGoFlag will return a *pflag.Flag given a *flag.Flag
-// If the *flag.Flag.Name was a single character (ex: `v`) it will be accessiblei
-// with both `-v` and `--v` in flags. If the golang flag was more than a single
-// character (ex: `verbose`) it will only be accessible via `--verbose`
-func PFlagFromGoFlag(goflag *goflag.Flag) *Flag {
- // Remember the default value as a string; it won't change.
- flag := &Flag{
- Name: goflag.Name,
- Usage: goflag.Usage,
- Value: wrapFlagValue(goflag.Value),
- // Looks like golang flags don't set DefValue correctly :-(
- //DefValue: goflag.DefValue,
- DefValue: goflag.Value.String(),
- }
- // Ex: if the golang flag was -v, allow both -v and --v to work
- if len(flag.Name) == 1 {
- flag.Shorthand = flag.Name
- }
- if fv, ok := goflag.Value.(goBoolFlag); ok && fv.IsBoolFlag() {
- flag.NoOptDefVal = "true"
- }
- return flag
-}
-
-// AddGoFlag will add the given *flag.Flag to the pflag.FlagSet
-func (f *FlagSet) AddGoFlag(goflag *goflag.Flag) {
- if f.Lookup(goflag.Name) != nil {
- return
- }
- newflag := PFlagFromGoFlag(goflag)
- f.AddFlag(newflag)
-}
-
-// AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet
-func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) {
- if newSet == nil {
- return
- }
- newSet.VisitAll(func(goflag *goflag.Flag) {
- f.AddGoFlag(goflag)
- })
- if f.addedGoFlagSets == nil {
- f.addedGoFlagSets = make([]*goflag.FlagSet, 0)
- }
- f.addedGoFlagSets = append(f.addedGoFlagSets, newSet)
-}
diff --git a/vendor/github.com/spf13/pflag/int.go b/vendor/github.com/spf13/pflag/int.go
deleted file mode 100644
index 1474b89df..000000000
--- a/vendor/github.com/spf13/pflag/int.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int Value
-type intValue int
-
-func newIntValue(val int, p *int) *intValue {
- *p = val
- return (*intValue)(p)
-}
-
-func (i *intValue) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 64)
- *i = intValue(v)
- return err
-}
-
-func (i *intValue) Type() string {
- return "int"
-}
-
-func (i *intValue) String() string { return strconv.Itoa(int(*i)) }
-
-func intConv(sval string) (interface{}, error) {
- return strconv.Atoi(sval)
-}
-
-// GetInt return the int value of a flag with the given name
-func (f *FlagSet) GetInt(name string) (int, error) {
- val, err := f.getFlagType(name, "int", intConv)
- if err != nil {
- return 0, err
- }
- return val.(int), nil
-}
-
-// IntVar defines an int flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-func (f *FlagSet) IntVar(p *int, name string, value int, usage string) {
- f.VarP(newIntValue(value, p), name, "", usage)
-}
-
-// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntVarP(p *int, name, shorthand string, value int, usage string) {
- f.VarP(newIntValue(value, p), name, shorthand, usage)
-}
-
-// IntVar defines an int flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-func IntVar(p *int, name string, value int, usage string) {
- CommandLine.VarP(newIntValue(value, p), name, "", usage)
-}
-
-// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash.
-func IntVarP(p *int, name, shorthand string, value int, usage string) {
- CommandLine.VarP(newIntValue(value, p), name, shorthand, usage)
-}
-
-// Int defines an int flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-func (f *FlagSet) Int(name string, value int, usage string) *int {
- p := new(int)
- f.IntVarP(p, name, "", value, usage)
- return p
-}
-
-// IntP is like Int, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntP(name, shorthand string, value int, usage string) *int {
- p := new(int)
- f.IntVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int defines an int flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-func Int(name string, value int, usage string) *int {
- return CommandLine.IntP(name, "", value, usage)
-}
-
-// IntP is like Int, but accepts a shorthand letter that can be used after a single dash.
-func IntP(name, shorthand string, value int, usage string) *int {
- return CommandLine.IntP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int16.go b/vendor/github.com/spf13/pflag/int16.go
deleted file mode 100644
index f1a01d05e..000000000
--- a/vendor/github.com/spf13/pflag/int16.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int16 Value
-type int16Value int16
-
-func newInt16Value(val int16, p *int16) *int16Value {
- *p = val
- return (*int16Value)(p)
-}
-
-func (i *int16Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 16)
- *i = int16Value(v)
- return err
-}
-
-func (i *int16Value) Type() string {
- return "int16"
-}
-
-func (i *int16Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int16Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseInt(sval, 0, 16)
- if err != nil {
- return 0, err
- }
- return int16(v), nil
-}
-
-// GetInt16 returns the int16 value of a flag with the given name
-func (f *FlagSet) GetInt16(name string) (int16, error) {
- val, err := f.getFlagType(name, "int16", int16Conv)
- if err != nil {
- return 0, err
- }
- return val.(int16), nil
-}
-
-// Int16Var defines an int16 flag with specified name, default value, and usage string.
-// The argument p points to an int16 variable in which to store the value of the flag.
-func (f *FlagSet) Int16Var(p *int16, name string, value int16, usage string) {
- f.VarP(newInt16Value(value, p), name, "", usage)
-}
-
-// Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int16VarP(p *int16, name, shorthand string, value int16, usage string) {
- f.VarP(newInt16Value(value, p), name, shorthand, usage)
-}
-
-// Int16Var defines an int16 flag with specified name, default value, and usage string.
-// The argument p points to an int16 variable in which to store the value of the flag.
-func Int16Var(p *int16, name string, value int16, usage string) {
- CommandLine.VarP(newInt16Value(value, p), name, "", usage)
-}
-
-// Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash.
-func Int16VarP(p *int16, name, shorthand string, value int16, usage string) {
- CommandLine.VarP(newInt16Value(value, p), name, shorthand, usage)
-}
-
-// Int16 defines an int16 flag with specified name, default value, and usage string.
-// The return value is the address of an int16 variable that stores the value of the flag.
-func (f *FlagSet) Int16(name string, value int16, usage string) *int16 {
- p := new(int16)
- f.Int16VarP(p, name, "", value, usage)
- return p
-}
-
-// Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int16P(name, shorthand string, value int16, usage string) *int16 {
- p := new(int16)
- f.Int16VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int16 defines an int16 flag with specified name, default value, and usage string.
-// The return value is the address of an int16 variable that stores the value of the flag.
-func Int16(name string, value int16, usage string) *int16 {
- return CommandLine.Int16P(name, "", value, usage)
-}
-
-// Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash.
-func Int16P(name, shorthand string, value int16, usage string) *int16 {
- return CommandLine.Int16P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int32.go b/vendor/github.com/spf13/pflag/int32.go
deleted file mode 100644
index 9b95944f0..000000000
--- a/vendor/github.com/spf13/pflag/int32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int32 Value
-type int32Value int32
-
-func newInt32Value(val int32, p *int32) *int32Value {
- *p = val
- return (*int32Value)(p)
-}
-
-func (i *int32Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 32)
- *i = int32Value(v)
- return err
-}
-
-func (i *int32Value) Type() string {
- return "int32"
-}
-
-func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseInt(sval, 0, 32)
- if err != nil {
- return 0, err
- }
- return int32(v), nil
-}
-
-// GetInt32 return the int32 value of a flag with the given name
-func (f *FlagSet) GetInt32(name string) (int32, error) {
- val, err := f.getFlagType(name, "int32", int32Conv)
- if err != nil {
- return 0, err
- }
- return val.(int32), nil
-}
-
-// Int32Var defines an int32 flag with specified name, default value, and usage string.
-// The argument p points to an int32 variable in which to store the value of the flag.
-func (f *FlagSet) Int32Var(p *int32, name string, value int32, usage string) {
- f.VarP(newInt32Value(value, p), name, "", usage)
-}
-
-// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int32VarP(p *int32, name, shorthand string, value int32, usage string) {
- f.VarP(newInt32Value(value, p), name, shorthand, usage)
-}
-
-// Int32Var defines an int32 flag with specified name, default value, and usage string.
-// The argument p points to an int32 variable in which to store the value of the flag.
-func Int32Var(p *int32, name string, value int32, usage string) {
- CommandLine.VarP(newInt32Value(value, p), name, "", usage)
-}
-
-// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash.
-func Int32VarP(p *int32, name, shorthand string, value int32, usage string) {
- CommandLine.VarP(newInt32Value(value, p), name, shorthand, usage)
-}
-
-// Int32 defines an int32 flag with specified name, default value, and usage string.
-// The return value is the address of an int32 variable that stores the value of the flag.
-func (f *FlagSet) Int32(name string, value int32, usage string) *int32 {
- p := new(int32)
- f.Int32VarP(p, name, "", value, usage)
- return p
-}
-
-// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int32P(name, shorthand string, value int32, usage string) *int32 {
- p := new(int32)
- f.Int32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int32 defines an int32 flag with specified name, default value, and usage string.
-// The return value is the address of an int32 variable that stores the value of the flag.
-func Int32(name string, value int32, usage string) *int32 {
- return CommandLine.Int32P(name, "", value, usage)
-}
-
-// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash.
-func Int32P(name, shorthand string, value int32, usage string) *int32 {
- return CommandLine.Int32P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int32_slice.go b/vendor/github.com/spf13/pflag/int32_slice.go
deleted file mode 100644
index ff128ff06..000000000
--- a/vendor/github.com/spf13/pflag/int32_slice.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- int32Slice Value
-type int32SliceValue struct {
- value *[]int32
- changed bool
-}
-
-func newInt32SliceValue(val []int32, p *[]int32) *int32SliceValue {
- isv := new(int32SliceValue)
- isv.value = p
- *isv.value = val
- return isv
-}
-
-func (s *int32SliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]int32, len(ss))
- for i, d := range ss {
- var err error
- var temp64 int64
- temp64, err = strconv.ParseInt(d, 0, 32)
- if err != nil {
- return err
- }
- out[i] = int32(temp64)
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *int32SliceValue) Type() string {
- return "int32Slice"
-}
-
-func (s *int32SliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%d", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func (s *int32SliceValue) fromString(val string) (int32, error) {
- t64, err := strconv.ParseInt(val, 0, 32)
- if err != nil {
- return 0, err
- }
- return int32(t64), nil
-}
-
-func (s *int32SliceValue) toString(val int32) string {
- return fmt.Sprintf("%d", val)
-}
-
-func (s *int32SliceValue) Append(val string) error {
- i, err := s.fromString(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *int32SliceValue) Replace(val []string) error {
- out := make([]int32, len(val))
- for i, d := range val {
- var err error
- out[i], err = s.fromString(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *int32SliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = s.toString(d)
- }
- return out
-}
-
-func int32SliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []int32{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]int32, len(ss))
- for i, d := range ss {
- var err error
- var temp64 int64
- temp64, err = strconv.ParseInt(d, 0, 32)
- if err != nil {
- return nil, err
- }
- out[i] = int32(temp64)
-
- }
- return out, nil
-}
-
-// GetInt32Slice return the []int32 value of a flag with the given name
-func (f *FlagSet) GetInt32Slice(name string) ([]int32, error) {
- val, err := f.getFlagType(name, "int32Slice", int32SliceConv)
- if err != nil {
- return []int32{}, err
- }
- return val.([]int32), nil
-}
-
-// Int32SliceVar defines a int32Slice flag with specified name, default value, and usage string.
-// The argument p points to a []int32 variable in which to store the value of the flag.
-func (f *FlagSet) Int32SliceVar(p *[]int32, name string, value []int32, usage string) {
- f.VarP(newInt32SliceValue(value, p), name, "", usage)
-}
-
-// Int32SliceVarP is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int32SliceVarP(p *[]int32, name, shorthand string, value []int32, usage string) {
- f.VarP(newInt32SliceValue(value, p), name, shorthand, usage)
-}
-
-// Int32SliceVar defines a int32[] flag with specified name, default value, and usage string.
-// The argument p points to a int32[] variable in which to store the value of the flag.
-func Int32SliceVar(p *[]int32, name string, value []int32, usage string) {
- CommandLine.VarP(newInt32SliceValue(value, p), name, "", usage)
-}
-
-// Int32SliceVarP is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash.
-func Int32SliceVarP(p *[]int32, name, shorthand string, value []int32, usage string) {
- CommandLine.VarP(newInt32SliceValue(value, p), name, shorthand, usage)
-}
-
-// Int32Slice defines a []int32 flag with specified name, default value, and usage string.
-// The return value is the address of a []int32 variable that stores the value of the flag.
-func (f *FlagSet) Int32Slice(name string, value []int32, usage string) *[]int32 {
- p := []int32{}
- f.Int32SliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// Int32SliceP is like Int32Slice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int32SliceP(name, shorthand string, value []int32, usage string) *[]int32 {
- p := []int32{}
- f.Int32SliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// Int32Slice defines a []int32 flag with specified name, default value, and usage string.
-// The return value is the address of a []int32 variable that stores the value of the flag.
-func Int32Slice(name string, value []int32, usage string) *[]int32 {
- return CommandLine.Int32SliceP(name, "", value, usage)
-}
-
-// Int32SliceP is like Int32Slice, but accepts a shorthand letter that can be used after a single dash.
-func Int32SliceP(name, shorthand string, value []int32, usage string) *[]int32 {
- return CommandLine.Int32SliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int64.go b/vendor/github.com/spf13/pflag/int64.go
deleted file mode 100644
index 0026d781d..000000000
--- a/vendor/github.com/spf13/pflag/int64.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int64 Value
-type int64Value int64
-
-func newInt64Value(val int64, p *int64) *int64Value {
- *p = val
- return (*int64Value)(p)
-}
-
-func (i *int64Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 64)
- *i = int64Value(v)
- return err
-}
-
-func (i *int64Value) Type() string {
- return "int64"
-}
-
-func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int64Conv(sval string) (interface{}, error) {
- return strconv.ParseInt(sval, 0, 64)
-}
-
-// GetInt64 return the int64 value of a flag with the given name
-func (f *FlagSet) GetInt64(name string) (int64, error) {
- val, err := f.getFlagType(name, "int64", int64Conv)
- if err != nil {
- return 0, err
- }
- return val.(int64), nil
-}
-
-// Int64Var defines an int64 flag with specified name, default value, and usage string.
-// The argument p points to an int64 variable in which to store the value of the flag.
-func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string) {
- f.VarP(newInt64Value(value, p), name, "", usage)
-}
-
-// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int64VarP(p *int64, name, shorthand string, value int64, usage string) {
- f.VarP(newInt64Value(value, p), name, shorthand, usage)
-}
-
-// Int64Var defines an int64 flag with specified name, default value, and usage string.
-// The argument p points to an int64 variable in which to store the value of the flag.
-func Int64Var(p *int64, name string, value int64, usage string) {
- CommandLine.VarP(newInt64Value(value, p), name, "", usage)
-}
-
-// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash.
-func Int64VarP(p *int64, name, shorthand string, value int64, usage string) {
- CommandLine.VarP(newInt64Value(value, p), name, shorthand, usage)
-}
-
-// Int64 defines an int64 flag with specified name, default value, and usage string.
-// The return value is the address of an int64 variable that stores the value of the flag.
-func (f *FlagSet) Int64(name string, value int64, usage string) *int64 {
- p := new(int64)
- f.Int64VarP(p, name, "", value, usage)
- return p
-}
-
-// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int64P(name, shorthand string, value int64, usage string) *int64 {
- p := new(int64)
- f.Int64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int64 defines an int64 flag with specified name, default value, and usage string.
-// The return value is the address of an int64 variable that stores the value of the flag.
-func Int64(name string, value int64, usage string) *int64 {
- return CommandLine.Int64P(name, "", value, usage)
-}
-
-// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash.
-func Int64P(name, shorthand string, value int64, usage string) *int64 {
- return CommandLine.Int64P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int64_slice.go b/vendor/github.com/spf13/pflag/int64_slice.go
deleted file mode 100644
index 25464638f..000000000
--- a/vendor/github.com/spf13/pflag/int64_slice.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- int64Slice Value
-type int64SliceValue struct {
- value *[]int64
- changed bool
-}
-
-func newInt64SliceValue(val []int64, p *[]int64) *int64SliceValue {
- isv := new(int64SliceValue)
- isv.value = p
- *isv.value = val
- return isv
-}
-
-func (s *int64SliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]int64, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.ParseInt(d, 0, 64)
- if err != nil {
- return err
- }
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *int64SliceValue) Type() string {
- return "int64Slice"
-}
-
-func (s *int64SliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%d", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func (s *int64SliceValue) fromString(val string) (int64, error) {
- return strconv.ParseInt(val, 0, 64)
-}
-
-func (s *int64SliceValue) toString(val int64) string {
- return fmt.Sprintf("%d", val)
-}
-
-func (s *int64SliceValue) Append(val string) error {
- i, err := s.fromString(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *int64SliceValue) Replace(val []string) error {
- out := make([]int64, len(val))
- for i, d := range val {
- var err error
- out[i], err = s.fromString(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *int64SliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = s.toString(d)
- }
- return out
-}
-
-func int64SliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []int64{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]int64, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.ParseInt(d, 0, 64)
- if err != nil {
- return nil, err
- }
-
- }
- return out, nil
-}
-
-// GetInt64Slice return the []int64 value of a flag with the given name
-func (f *FlagSet) GetInt64Slice(name string) ([]int64, error) {
- val, err := f.getFlagType(name, "int64Slice", int64SliceConv)
- if err != nil {
- return []int64{}, err
- }
- return val.([]int64), nil
-}
-
-// Int64SliceVar defines a int64Slice flag with specified name, default value, and usage string.
-// The argument p points to a []int64 variable in which to store the value of the flag.
-func (f *FlagSet) Int64SliceVar(p *[]int64, name string, value []int64, usage string) {
- f.VarP(newInt64SliceValue(value, p), name, "", usage)
-}
-
-// Int64SliceVarP is like Int64SliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int64SliceVarP(p *[]int64, name, shorthand string, value []int64, usage string) {
- f.VarP(newInt64SliceValue(value, p), name, shorthand, usage)
-}
-
-// Int64SliceVar defines a int64[] flag with specified name, default value, and usage string.
-// The argument p points to a int64[] variable in which to store the value of the flag.
-func Int64SliceVar(p *[]int64, name string, value []int64, usage string) {
- CommandLine.VarP(newInt64SliceValue(value, p), name, "", usage)
-}
-
-// Int64SliceVarP is like Int64SliceVar, but accepts a shorthand letter that can be used after a single dash.
-func Int64SliceVarP(p *[]int64, name, shorthand string, value []int64, usage string) {
- CommandLine.VarP(newInt64SliceValue(value, p), name, shorthand, usage)
-}
-
-// Int64Slice defines a []int64 flag with specified name, default value, and usage string.
-// The return value is the address of a []int64 variable that stores the value of the flag.
-func (f *FlagSet) Int64Slice(name string, value []int64, usage string) *[]int64 {
- p := []int64{}
- f.Int64SliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// Int64SliceP is like Int64Slice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int64SliceP(name, shorthand string, value []int64, usage string) *[]int64 {
- p := []int64{}
- f.Int64SliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// Int64Slice defines a []int64 flag with specified name, default value, and usage string.
-// The return value is the address of a []int64 variable that stores the value of the flag.
-func Int64Slice(name string, value []int64, usage string) *[]int64 {
- return CommandLine.Int64SliceP(name, "", value, usage)
-}
-
-// Int64SliceP is like Int64Slice, but accepts a shorthand letter that can be used after a single dash.
-func Int64SliceP(name, shorthand string, value []int64, usage string) *[]int64 {
- return CommandLine.Int64SliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int8.go b/vendor/github.com/spf13/pflag/int8.go
deleted file mode 100644
index 4da92228e..000000000
--- a/vendor/github.com/spf13/pflag/int8.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int8 Value
-type int8Value int8
-
-func newInt8Value(val int8, p *int8) *int8Value {
- *p = val
- return (*int8Value)(p)
-}
-
-func (i *int8Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 8)
- *i = int8Value(v)
- return err
-}
-
-func (i *int8Value) Type() string {
- return "int8"
-}
-
-func (i *int8Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int8Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseInt(sval, 0, 8)
- if err != nil {
- return 0, err
- }
- return int8(v), nil
-}
-
-// GetInt8 return the int8 value of a flag with the given name
-func (f *FlagSet) GetInt8(name string) (int8, error) {
- val, err := f.getFlagType(name, "int8", int8Conv)
- if err != nil {
- return 0, err
- }
- return val.(int8), nil
-}
-
-// Int8Var defines an int8 flag with specified name, default value, and usage string.
-// The argument p points to an int8 variable in which to store the value of the flag.
-func (f *FlagSet) Int8Var(p *int8, name string, value int8, usage string) {
- f.VarP(newInt8Value(value, p), name, "", usage)
-}
-
-// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int8VarP(p *int8, name, shorthand string, value int8, usage string) {
- f.VarP(newInt8Value(value, p), name, shorthand, usage)
-}
-
-// Int8Var defines an int8 flag with specified name, default value, and usage string.
-// The argument p points to an int8 variable in which to store the value of the flag.
-func Int8Var(p *int8, name string, value int8, usage string) {
- CommandLine.VarP(newInt8Value(value, p), name, "", usage)
-}
-
-// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash.
-func Int8VarP(p *int8, name, shorthand string, value int8, usage string) {
- CommandLine.VarP(newInt8Value(value, p), name, shorthand, usage)
-}
-
-// Int8 defines an int8 flag with specified name, default value, and usage string.
-// The return value is the address of an int8 variable that stores the value of the flag.
-func (f *FlagSet) Int8(name string, value int8, usage string) *int8 {
- p := new(int8)
- f.Int8VarP(p, name, "", value, usage)
- return p
-}
-
-// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int8P(name, shorthand string, value int8, usage string) *int8 {
- p := new(int8)
- f.Int8VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int8 defines an int8 flag with specified name, default value, and usage string.
-// The return value is the address of an int8 variable that stores the value of the flag.
-func Int8(name string, value int8, usage string) *int8 {
- return CommandLine.Int8P(name, "", value, usage)
-}
-
-// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash.
-func Int8P(name, shorthand string, value int8, usage string) *int8 {
- return CommandLine.Int8P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int_slice.go b/vendor/github.com/spf13/pflag/int_slice.go
deleted file mode 100644
index e71c39d91..000000000
--- a/vendor/github.com/spf13/pflag/int_slice.go
+++ /dev/null
@@ -1,158 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- intSlice Value
-type intSliceValue struct {
- value *[]int
- changed bool
-}
-
-func newIntSliceValue(val []int, p *[]int) *intSliceValue {
- isv := new(intSliceValue)
- isv.value = p
- *isv.value = val
- return isv
-}
-
-func (s *intSliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]int, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.Atoi(d)
- if err != nil {
- return err
- }
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *intSliceValue) Type() string {
- return "intSlice"
-}
-
-func (s *intSliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%d", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func (s *intSliceValue) Append(val string) error {
- i, err := strconv.Atoi(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *intSliceValue) Replace(val []string) error {
- out := make([]int, len(val))
- for i, d := range val {
- var err error
- out[i], err = strconv.Atoi(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *intSliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = strconv.Itoa(d)
- }
- return out
-}
-
-func intSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []int{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]int, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.Atoi(d)
- if err != nil {
- return nil, err
- }
-
- }
- return out, nil
-}
-
-// GetIntSlice return the []int value of a flag with the given name
-func (f *FlagSet) GetIntSlice(name string) ([]int, error) {
- val, err := f.getFlagType(name, "intSlice", intSliceConv)
- if err != nil {
- return []int{}, err
- }
- return val.([]int), nil
-}
-
-// IntSliceVar defines a intSlice flag with specified name, default value, and usage string.
-// The argument p points to a []int variable in which to store the value of the flag.
-func (f *FlagSet) IntSliceVar(p *[]int, name string, value []int, usage string) {
- f.VarP(newIntSliceValue(value, p), name, "", usage)
-}
-
-// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) {
- f.VarP(newIntSliceValue(value, p), name, shorthand, usage)
-}
-
-// IntSliceVar defines a int[] flag with specified name, default value, and usage string.
-// The argument p points to a int[] variable in which to store the value of the flag.
-func IntSliceVar(p *[]int, name string, value []int, usage string) {
- CommandLine.VarP(newIntSliceValue(value, p), name, "", usage)
-}
-
-// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) {
- CommandLine.VarP(newIntSliceValue(value, p), name, shorthand, usage)
-}
-
-// IntSlice defines a []int flag with specified name, default value, and usage string.
-// The return value is the address of a []int variable that stores the value of the flag.
-func (f *FlagSet) IntSlice(name string, value []int, usage string) *[]int {
- p := []int{}
- f.IntSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntSliceP(name, shorthand string, value []int, usage string) *[]int {
- p := []int{}
- f.IntSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// IntSlice defines a []int flag with specified name, default value, and usage string.
-// The return value is the address of a []int variable that stores the value of the flag.
-func IntSlice(name string, value []int, usage string) *[]int {
- return CommandLine.IntSliceP(name, "", value, usage)
-}
-
-// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash.
-func IntSliceP(name, shorthand string, value []int, usage string) *[]int {
- return CommandLine.IntSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/ip.go b/vendor/github.com/spf13/pflag/ip.go
deleted file mode 100644
index 3d414ba69..000000000
--- a/vendor/github.com/spf13/pflag/ip.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strings"
-)
-
-// -- net.IP value
-type ipValue net.IP
-
-func newIPValue(val net.IP, p *net.IP) *ipValue {
- *p = val
- return (*ipValue)(p)
-}
-
-func (i *ipValue) String() string { return net.IP(*i).String() }
-func (i *ipValue) Set(s string) error {
- ip := net.ParseIP(strings.TrimSpace(s))
- if ip == nil {
- return fmt.Errorf("failed to parse IP: %q", s)
- }
- *i = ipValue(ip)
- return nil
-}
-
-func (i *ipValue) Type() string {
- return "ip"
-}
-
-func ipConv(sval string) (interface{}, error) {
- ip := net.ParseIP(sval)
- if ip != nil {
- return ip, nil
- }
- return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval)
-}
-
-// GetIP return the net.IP value of a flag with the given name
-func (f *FlagSet) GetIP(name string) (net.IP, error) {
- val, err := f.getFlagType(name, "ip", ipConv)
- if err != nil {
- return nil, err
- }
- return val.(net.IP), nil
-}
-
-// IPVar defines an net.IP flag with specified name, default value, and usage string.
-// The argument p points to an net.IP variable in which to store the value of the flag.
-func (f *FlagSet) IPVar(p *net.IP, name string, value net.IP, usage string) {
- f.VarP(newIPValue(value, p), name, "", usage)
-}
-
-// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) {
- f.VarP(newIPValue(value, p), name, shorthand, usage)
-}
-
-// IPVar defines an net.IP flag with specified name, default value, and usage string.
-// The argument p points to an net.IP variable in which to store the value of the flag.
-func IPVar(p *net.IP, name string, value net.IP, usage string) {
- CommandLine.VarP(newIPValue(value, p), name, "", usage)
-}
-
-// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash.
-func IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) {
- CommandLine.VarP(newIPValue(value, p), name, shorthand, usage)
-}
-
-// IP defines an net.IP flag with specified name, default value, and usage string.
-// The return value is the address of an net.IP variable that stores the value of the flag.
-func (f *FlagSet) IP(name string, value net.IP, usage string) *net.IP {
- p := new(net.IP)
- f.IPVarP(p, name, "", value, usage)
- return p
-}
-
-// IPP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPP(name, shorthand string, value net.IP, usage string) *net.IP {
- p := new(net.IP)
- f.IPVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IP defines an net.IP flag with specified name, default value, and usage string.
-// The return value is the address of an net.IP variable that stores the value of the flag.
-func IP(name string, value net.IP, usage string) *net.IP {
- return CommandLine.IPP(name, "", value, usage)
-}
-
-// IPP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func IPP(name, shorthand string, value net.IP, usage string) *net.IP {
- return CommandLine.IPP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/ip_slice.go b/vendor/github.com/spf13/pflag/ip_slice.go
deleted file mode 100644
index 775faae4f..000000000
--- a/vendor/github.com/spf13/pflag/ip_slice.go
+++ /dev/null
@@ -1,186 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "io"
- "net"
- "strings"
-)
-
-// -- ipSlice Value
-type ipSliceValue struct {
- value *[]net.IP
- changed bool
-}
-
-func newIPSliceValue(val []net.IP, p *[]net.IP) *ipSliceValue {
- ipsv := new(ipSliceValue)
- ipsv.value = p
- *ipsv.value = val
- return ipsv
-}
-
-// Set converts, and assigns, the comma-separated IP argument string representation as the []net.IP value of this flag.
-// If Set is called on a flag that already has a []net.IP assigned, the newly converted values will be appended.
-func (s *ipSliceValue) Set(val string) error {
-
- // remove all quote characters
- rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "")
-
- // read flag arguments with CSV parser
- ipStrSlice, err := readAsCSV(rmQuote.Replace(val))
- if err != nil && err != io.EOF {
- return err
- }
-
- // parse ip values into slice
- out := make([]net.IP, 0, len(ipStrSlice))
- for _, ipStr := range ipStrSlice {
- ip := net.ParseIP(strings.TrimSpace(ipStr))
- if ip == nil {
- return fmt.Errorf("invalid string being converted to IP address: %s", ipStr)
- }
- out = append(out, ip)
- }
-
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
-
- s.changed = true
-
- return nil
-}
-
-// Type returns a string that uniquely represents this flag's type.
-func (s *ipSliceValue) Type() string {
- return "ipSlice"
-}
-
-// String defines a "native" format for this net.IP slice flag value.
-func (s *ipSliceValue) String() string {
-
- ipStrSlice := make([]string, len(*s.value))
- for i, ip := range *s.value {
- ipStrSlice[i] = ip.String()
- }
-
- out, _ := writeAsCSV(ipStrSlice)
-
- return "[" + out + "]"
-}
-
-func (s *ipSliceValue) fromString(val string) (net.IP, error) {
- return net.ParseIP(strings.TrimSpace(val)), nil
-}
-
-func (s *ipSliceValue) toString(val net.IP) string {
- return val.String()
-}
-
-func (s *ipSliceValue) Append(val string) error {
- i, err := s.fromString(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *ipSliceValue) Replace(val []string) error {
- out := make([]net.IP, len(val))
- for i, d := range val {
- var err error
- out[i], err = s.fromString(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *ipSliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = s.toString(d)
- }
- return out
-}
-
-func ipSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []net.IP{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]net.IP, len(ss))
- for i, sval := range ss {
- ip := net.ParseIP(strings.TrimSpace(sval))
- if ip == nil {
- return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval)
- }
- out[i] = ip
- }
- return out, nil
-}
-
-// GetIPSlice returns the []net.IP value of a flag with the given name
-func (f *FlagSet) GetIPSlice(name string) ([]net.IP, error) {
- val, err := f.getFlagType(name, "ipSlice", ipSliceConv)
- if err != nil {
- return []net.IP{}, err
- }
- return val.([]net.IP), nil
-}
-
-// IPSliceVar defines a ipSlice flag with specified name, default value, and usage string.
-// The argument p points to a []net.IP variable in which to store the value of the flag.
-func (f *FlagSet) IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) {
- f.VarP(newIPSliceValue(value, p), name, "", usage)
-}
-
-// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) {
- f.VarP(newIPSliceValue(value, p), name, shorthand, usage)
-}
-
-// IPSliceVar defines a []net.IP flag with specified name, default value, and usage string.
-// The argument p points to a []net.IP variable in which to store the value of the flag.
-func IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) {
- CommandLine.VarP(newIPSliceValue(value, p), name, "", usage)
-}
-
-// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) {
- CommandLine.VarP(newIPSliceValue(value, p), name, shorthand, usage)
-}
-
-// IPSlice defines a []net.IP flag with specified name, default value, and usage string.
-// The return value is the address of a []net.IP variable that stores the value of that flag.
-func (f *FlagSet) IPSlice(name string, value []net.IP, usage string) *[]net.IP {
- p := []net.IP{}
- f.IPSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP {
- p := []net.IP{}
- f.IPSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// IPSlice defines a []net.IP flag with specified name, default value, and usage string.
-// The return value is the address of a []net.IP variable that stores the value of the flag.
-func IPSlice(name string, value []net.IP, usage string) *[]net.IP {
- return CommandLine.IPSliceP(name, "", value, usage)
-}
-
-// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash.
-func IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP {
- return CommandLine.IPSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/ipmask.go b/vendor/github.com/spf13/pflag/ipmask.go
deleted file mode 100644
index 5bd44bd21..000000000
--- a/vendor/github.com/spf13/pflag/ipmask.go
+++ /dev/null
@@ -1,122 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strconv"
-)
-
-// -- net.IPMask value
-type ipMaskValue net.IPMask
-
-func newIPMaskValue(val net.IPMask, p *net.IPMask) *ipMaskValue {
- *p = val
- return (*ipMaskValue)(p)
-}
-
-func (i *ipMaskValue) String() string { return net.IPMask(*i).String() }
-func (i *ipMaskValue) Set(s string) error {
- ip := ParseIPv4Mask(s)
- if ip == nil {
- return fmt.Errorf("failed to parse IP mask: %q", s)
- }
- *i = ipMaskValue(ip)
- return nil
-}
-
-func (i *ipMaskValue) Type() string {
- return "ipMask"
-}
-
-// ParseIPv4Mask written in IP form (e.g. 255.255.255.0).
-// This function should really belong to the net package.
-func ParseIPv4Mask(s string) net.IPMask {
- mask := net.ParseIP(s)
- if mask == nil {
- if len(s) != 8 {
- return nil
- }
- // net.IPMask.String() actually outputs things like ffffff00
- // so write a horrible parser for that as well :-(
- m := []int{}
- for i := 0; i < 4; i++ {
- b := "0x" + s[2*i:2*i+2]
- d, err := strconv.ParseInt(b, 0, 0)
- if err != nil {
- return nil
- }
- m = append(m, int(d))
- }
- s := fmt.Sprintf("%d.%d.%d.%d", m[0], m[1], m[2], m[3])
- mask = net.ParseIP(s)
- if mask == nil {
- return nil
- }
- }
- return net.IPv4Mask(mask[12], mask[13], mask[14], mask[15])
-}
-
-func parseIPv4Mask(sval string) (interface{}, error) {
- mask := ParseIPv4Mask(sval)
- if mask == nil {
- return nil, fmt.Errorf("unable to parse %s as net.IPMask", sval)
- }
- return mask, nil
-}
-
-// GetIPv4Mask return the net.IPv4Mask value of a flag with the given name
-func (f *FlagSet) GetIPv4Mask(name string) (net.IPMask, error) {
- val, err := f.getFlagType(name, "ipMask", parseIPv4Mask)
- if err != nil {
- return nil, err
- }
- return val.(net.IPMask), nil
-}
-
-// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string.
-// The argument p points to an net.IPMask variable in which to store the value of the flag.
-func (f *FlagSet) IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) {
- f.VarP(newIPMaskValue(value, p), name, "", usage)
-}
-
-// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) {
- f.VarP(newIPMaskValue(value, p), name, shorthand, usage)
-}
-
-// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string.
-// The argument p points to an net.IPMask variable in which to store the value of the flag.
-func IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) {
- CommandLine.VarP(newIPMaskValue(value, p), name, "", usage)
-}
-
-// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash.
-func IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) {
- CommandLine.VarP(newIPMaskValue(value, p), name, shorthand, usage)
-}
-
-// IPMask defines an net.IPMask flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPMask variable that stores the value of the flag.
-func (f *FlagSet) IPMask(name string, value net.IPMask, usage string) *net.IPMask {
- p := new(net.IPMask)
- f.IPMaskVarP(p, name, "", value, usage)
- return p
-}
-
-// IPMaskP is like IPMask, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask {
- p := new(net.IPMask)
- f.IPMaskVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IPMask defines an net.IPMask flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPMask variable that stores the value of the flag.
-func IPMask(name string, value net.IPMask, usage string) *net.IPMask {
- return CommandLine.IPMaskP(name, "", value, usage)
-}
-
-// IPMaskP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask {
- return CommandLine.IPMaskP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/ipnet.go b/vendor/github.com/spf13/pflag/ipnet.go
deleted file mode 100644
index e2c1b8bcd..000000000
--- a/vendor/github.com/spf13/pflag/ipnet.go
+++ /dev/null
@@ -1,98 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strings"
-)
-
-// IPNet adapts net.IPNet for use as a flag.
-type ipNetValue net.IPNet
-
-func (ipnet ipNetValue) String() string {
- n := net.IPNet(ipnet)
- return n.String()
-}
-
-func (ipnet *ipNetValue) Set(value string) error {
- _, n, err := net.ParseCIDR(strings.TrimSpace(value))
- if err != nil {
- return err
- }
- *ipnet = ipNetValue(*n)
- return nil
-}
-
-func (*ipNetValue) Type() string {
- return "ipNet"
-}
-
-func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue {
- *p = val
- return (*ipNetValue)(p)
-}
-
-func ipNetConv(sval string) (interface{}, error) {
- _, n, err := net.ParseCIDR(strings.TrimSpace(sval))
- if err == nil {
- return *n, nil
- }
- return nil, fmt.Errorf("invalid string being converted to IPNet: %s", sval)
-}
-
-// GetIPNet return the net.IPNet value of a flag with the given name
-func (f *FlagSet) GetIPNet(name string) (net.IPNet, error) {
- val, err := f.getFlagType(name, "ipNet", ipNetConv)
- if err != nil {
- return net.IPNet{}, err
- }
- return val.(net.IPNet), nil
-}
-
-// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string.
-// The argument p points to an net.IPNet variable in which to store the value of the flag.
-func (f *FlagSet) IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) {
- f.VarP(newIPNetValue(value, p), name, "", usage)
-}
-
-// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) {
- f.VarP(newIPNetValue(value, p), name, shorthand, usage)
-}
-
-// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string.
-// The argument p points to an net.IPNet variable in which to store the value of the flag.
-func IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) {
- CommandLine.VarP(newIPNetValue(value, p), name, "", usage)
-}
-
-// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash.
-func IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) {
- CommandLine.VarP(newIPNetValue(value, p), name, shorthand, usage)
-}
-
-// IPNet defines an net.IPNet flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPNet variable that stores the value of the flag.
-func (f *FlagSet) IPNet(name string, value net.IPNet, usage string) *net.IPNet {
- p := new(net.IPNet)
- f.IPNetVarP(p, name, "", value, usage)
- return p
-}
-
-// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet {
- p := new(net.IPNet)
- f.IPNetVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IPNet defines an net.IPNet flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPNet variable that stores the value of the flag.
-func IPNet(name string, value net.IPNet, usage string) *net.IPNet {
- return CommandLine.IPNetP(name, "", value, usage)
-}
-
-// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash.
-func IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet {
- return CommandLine.IPNetP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string.go b/vendor/github.com/spf13/pflag/string.go
deleted file mode 100644
index 04e0a26ff..000000000
--- a/vendor/github.com/spf13/pflag/string.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package pflag
-
-// -- string Value
-type stringValue string
-
-func newStringValue(val string, p *string) *stringValue {
- *p = val
- return (*stringValue)(p)
-}
-
-func (s *stringValue) Set(val string) error {
- *s = stringValue(val)
- return nil
-}
-func (s *stringValue) Type() string {
- return "string"
-}
-
-func (s *stringValue) String() string { return string(*s) }
-
-func stringConv(sval string) (interface{}, error) {
- return sval, nil
-}
-
-// GetString return the string value of a flag with the given name
-func (f *FlagSet) GetString(name string) (string, error) {
- val, err := f.getFlagType(name, "string", stringConv)
- if err != nil {
- return "", err
- }
- return val.(string), nil
-}
-
-// StringVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a string variable in which to store the value of the flag.
-func (f *FlagSet) StringVar(p *string, name string, value string, usage string) {
- f.VarP(newStringValue(value, p), name, "", usage)
-}
-
-// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringVarP(p *string, name, shorthand string, value string, usage string) {
- f.VarP(newStringValue(value, p), name, shorthand, usage)
-}
-
-// StringVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a string variable in which to store the value of the flag.
-func StringVar(p *string, name string, value string, usage string) {
- CommandLine.VarP(newStringValue(value, p), name, "", usage)
-}
-
-// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash.
-func StringVarP(p *string, name, shorthand string, value string, usage string) {
- CommandLine.VarP(newStringValue(value, p), name, shorthand, usage)
-}
-
-// String defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a string variable that stores the value of the flag.
-func (f *FlagSet) String(name string, value string, usage string) *string {
- p := new(string)
- f.StringVarP(p, name, "", value, usage)
- return p
-}
-
-// StringP is like String, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringP(name, shorthand string, value string, usage string) *string {
- p := new(string)
- f.StringVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// String defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a string variable that stores the value of the flag.
-func String(name string, value string, usage string) *string {
- return CommandLine.StringP(name, "", value, usage)
-}
-
-// StringP is like String, but accepts a shorthand letter that can be used after a single dash.
-func StringP(name, shorthand string, value string, usage string) *string {
- return CommandLine.StringP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string_array.go b/vendor/github.com/spf13/pflag/string_array.go
deleted file mode 100644
index 4894af818..000000000
--- a/vendor/github.com/spf13/pflag/string_array.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package pflag
-
-// -- stringArray Value
-type stringArrayValue struct {
- value *[]string
- changed bool
-}
-
-func newStringArrayValue(val []string, p *[]string) *stringArrayValue {
- ssv := new(stringArrayValue)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-func (s *stringArrayValue) Set(val string) error {
- if !s.changed {
- *s.value = []string{val}
- s.changed = true
- } else {
- *s.value = append(*s.value, val)
- }
- return nil
-}
-
-func (s *stringArrayValue) Append(val string) error {
- *s.value = append(*s.value, val)
- return nil
-}
-
-func (s *stringArrayValue) Replace(val []string) error {
- out := make([]string, len(val))
- for i, d := range val {
- var err error
- out[i] = d
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *stringArrayValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = d
- }
- return out
-}
-
-func (s *stringArrayValue) Type() string {
- return "stringArray"
-}
-
-func (s *stringArrayValue) String() string {
- str, _ := writeAsCSV(*s.value)
- return "[" + str + "]"
-}
-
-func stringArrayConv(sval string) (interface{}, error) {
- sval = sval[1 : len(sval)-1]
- // An empty string would cause a array with one (empty) string
- if len(sval) == 0 {
- return []string{}, nil
- }
- return readAsCSV(sval)
-}
-
-// GetStringArray return the []string value of a flag with the given name
-func (f *FlagSet) GetStringArray(name string) ([]string, error) {
- val, err := f.getFlagType(name, "stringArray", stringArrayConv)
- if err != nil {
- return []string{}, err
- }
- return val.([]string), nil
-}
-
-// StringArrayVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the values of the multiple flags.
-// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
-func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) {
- f.VarP(newStringArrayValue(value, p), name, "", usage)
-}
-
-// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
- f.VarP(newStringArrayValue(value, p), name, shorthand, usage)
-}
-
-// StringArrayVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
-func StringArrayVar(p *[]string, name string, value []string, usage string) {
- CommandLine.VarP(newStringArrayValue(value, p), name, "", usage)
-}
-
-// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
-func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
- CommandLine.VarP(newStringArrayValue(value, p), name, shorthand, usage)
-}
-
-// StringArray defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
-func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string {
- p := []string{}
- f.StringArrayVarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage string) *[]string {
- p := []string{}
- f.StringArrayVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringArray defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
-func StringArray(name string, value []string, usage string) *[]string {
- return CommandLine.StringArrayP(name, "", value, usage)
-}
-
-// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
-func StringArrayP(name, shorthand string, value []string, usage string) *[]string {
- return CommandLine.StringArrayP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string_slice.go b/vendor/github.com/spf13/pflag/string_slice.go
deleted file mode 100644
index 3cb2e69db..000000000
--- a/vendor/github.com/spf13/pflag/string_slice.go
+++ /dev/null
@@ -1,163 +0,0 @@
-package pflag
-
-import (
- "bytes"
- "encoding/csv"
- "strings"
-)
-
-// -- stringSlice Value
-type stringSliceValue struct {
- value *[]string
- changed bool
-}
-
-func newStringSliceValue(val []string, p *[]string) *stringSliceValue {
- ssv := new(stringSliceValue)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-func readAsCSV(val string) ([]string, error) {
- if val == "" {
- return []string{}, nil
- }
- stringReader := strings.NewReader(val)
- csvReader := csv.NewReader(stringReader)
- return csvReader.Read()
-}
-
-func writeAsCSV(vals []string) (string, error) {
- b := &bytes.Buffer{}
- w := csv.NewWriter(b)
- err := w.Write(vals)
- if err != nil {
- return "", err
- }
- w.Flush()
- return strings.TrimSuffix(b.String(), "\n"), nil
-}
-
-func (s *stringSliceValue) Set(val string) error {
- v, err := readAsCSV(val)
- if err != nil {
- return err
- }
- if !s.changed {
- *s.value = v
- } else {
- *s.value = append(*s.value, v...)
- }
- s.changed = true
- return nil
-}
-
-func (s *stringSliceValue) Type() string {
- return "stringSlice"
-}
-
-func (s *stringSliceValue) String() string {
- str, _ := writeAsCSV(*s.value)
- return "[" + str + "]"
-}
-
-func (s *stringSliceValue) Append(val string) error {
- *s.value = append(*s.value, val)
- return nil
-}
-
-func (s *stringSliceValue) Replace(val []string) error {
- *s.value = val
- return nil
-}
-
-func (s *stringSliceValue) GetSlice() []string {
- return *s.value
-}
-
-func stringSliceConv(sval string) (interface{}, error) {
- sval = sval[1 : len(sval)-1]
- // An empty string would cause a slice with one (empty) string
- if len(sval) == 0 {
- return []string{}, nil
- }
- return readAsCSV(sval)
-}
-
-// GetStringSlice return the []string value of a flag with the given name
-func (f *FlagSet) GetStringSlice(name string) ([]string, error) {
- val, err := f.getFlagType(name, "stringSlice", stringSliceConv)
- if err != nil {
- return []string{}, err
- }
- return val.([]string), nil
-}
-
-// StringSliceVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
-// For example:
-// --ss="v1,v2" --ss="v3"
-// will result in
-// []string{"v1", "v2", "v3"}
-func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) {
- f.VarP(newStringSliceValue(value, p), name, "", usage)
-}
-
-// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) {
- f.VarP(newStringSliceValue(value, p), name, shorthand, usage)
-}
-
-// StringSliceVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
-// For example:
-// --ss="v1,v2" --ss="v3"
-// will result in
-// []string{"v1", "v2", "v3"}
-func StringSliceVar(p *[]string, name string, value []string, usage string) {
- CommandLine.VarP(newStringSliceValue(value, p), name, "", usage)
-}
-
-// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) {
- CommandLine.VarP(newStringSliceValue(value, p), name, shorthand, usage)
-}
-
-// StringSlice defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
-// For example:
-// --ss="v1,v2" --ss="v3"
-// will result in
-// []string{"v1", "v2", "v3"}
-func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string {
- p := []string{}
- f.StringSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage string) *[]string {
- p := []string{}
- f.StringSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringSlice defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
-// For example:
-// --ss="v1,v2" --ss="v3"
-// will result in
-// []string{"v1", "v2", "v3"}
-func StringSlice(name string, value []string, usage string) *[]string {
- return CommandLine.StringSliceP(name, "", value, usage)
-}
-
-// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash.
-func StringSliceP(name, shorthand string, value []string, usage string) *[]string {
- return CommandLine.StringSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string_to_int.go b/vendor/github.com/spf13/pflag/string_to_int.go
deleted file mode 100644
index 5ceda3965..000000000
--- a/vendor/github.com/spf13/pflag/string_to_int.go
+++ /dev/null
@@ -1,149 +0,0 @@
-package pflag
-
-import (
- "bytes"
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- stringToInt Value
-type stringToIntValue struct {
- value *map[string]int
- changed bool
-}
-
-func newStringToIntValue(val map[string]int, p *map[string]int) *stringToIntValue {
- ssv := new(stringToIntValue)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-// Format: a=1,b=2
-func (s *stringToIntValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make(map[string]int, len(ss))
- for _, pair := range ss {
- kv := strings.SplitN(pair, "=", 2)
- if len(kv) != 2 {
- return fmt.Errorf("%s must be formatted as key=value", pair)
- }
- var err error
- out[kv[0]], err = strconv.Atoi(kv[1])
- if err != nil {
- return err
- }
- }
- if !s.changed {
- *s.value = out
- } else {
- for k, v := range out {
- (*s.value)[k] = v
- }
- }
- s.changed = true
- return nil
-}
-
-func (s *stringToIntValue) Type() string {
- return "stringToInt"
-}
-
-func (s *stringToIntValue) String() string {
- var buf bytes.Buffer
- i := 0
- for k, v := range *s.value {
- if i > 0 {
- buf.WriteRune(',')
- }
- buf.WriteString(k)
- buf.WriteRune('=')
- buf.WriteString(strconv.Itoa(v))
- i++
- }
- return "[" + buf.String() + "]"
-}
-
-func stringToIntConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // An empty string would cause an empty map
- if len(val) == 0 {
- return map[string]int{}, nil
- }
- ss := strings.Split(val, ",")
- out := make(map[string]int, len(ss))
- for _, pair := range ss {
- kv := strings.SplitN(pair, "=", 2)
- if len(kv) != 2 {
- return nil, fmt.Errorf("%s must be formatted as key=value", pair)
- }
- var err error
- out[kv[0]], err = strconv.Atoi(kv[1])
- if err != nil {
- return nil, err
- }
- }
- return out, nil
-}
-
-// GetStringToInt return the map[string]int value of a flag with the given name
-func (f *FlagSet) GetStringToInt(name string) (map[string]int, error) {
- val, err := f.getFlagType(name, "stringToInt", stringToIntConv)
- if err != nil {
- return map[string]int{}, err
- }
- return val.(map[string]int), nil
-}
-
-// StringToIntVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a map[string]int variable in which to store the values of the multiple flags.
-// The value of each argument will not try to be separated by comma
-func (f *FlagSet) StringToIntVar(p *map[string]int, name string, value map[string]int, usage string) {
- f.VarP(newStringToIntValue(value, p), name, "", usage)
-}
-
-// StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringToIntVarP(p *map[string]int, name, shorthand string, value map[string]int, usage string) {
- f.VarP(newStringToIntValue(value, p), name, shorthand, usage)
-}
-
-// StringToIntVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a map[string]int variable in which to store the value of the flag.
-// The value of each argument will not try to be separated by comma
-func StringToIntVar(p *map[string]int, name string, value map[string]int, usage string) {
- CommandLine.VarP(newStringToIntValue(value, p), name, "", usage)
-}
-
-// StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash.
-func StringToIntVarP(p *map[string]int, name, shorthand string, value map[string]int, usage string) {
- CommandLine.VarP(newStringToIntValue(value, p), name, shorthand, usage)
-}
-
-// StringToInt defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a map[string]int variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma
-func (f *FlagSet) StringToInt(name string, value map[string]int, usage string) *map[string]int {
- p := map[string]int{}
- f.StringToIntVarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringToIntP(name, shorthand string, value map[string]int, usage string) *map[string]int {
- p := map[string]int{}
- f.StringToIntVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringToInt defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a map[string]int variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma
-func StringToInt(name string, value map[string]int, usage string) *map[string]int {
- return CommandLine.StringToIntP(name, "", value, usage)
-}
-
-// StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash.
-func StringToIntP(name, shorthand string, value map[string]int, usage string) *map[string]int {
- return CommandLine.StringToIntP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string_to_int64.go b/vendor/github.com/spf13/pflag/string_to_int64.go
deleted file mode 100644
index a807a04a0..000000000
--- a/vendor/github.com/spf13/pflag/string_to_int64.go
+++ /dev/null
@@ -1,149 +0,0 @@
-package pflag
-
-import (
- "bytes"
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- stringToInt64 Value
-type stringToInt64Value struct {
- value *map[string]int64
- changed bool
-}
-
-func newStringToInt64Value(val map[string]int64, p *map[string]int64) *stringToInt64Value {
- ssv := new(stringToInt64Value)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-// Format: a=1,b=2
-func (s *stringToInt64Value) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make(map[string]int64, len(ss))
- for _, pair := range ss {
- kv := strings.SplitN(pair, "=", 2)
- if len(kv) != 2 {
- return fmt.Errorf("%s must be formatted as key=value", pair)
- }
- var err error
- out[kv[0]], err = strconv.ParseInt(kv[1], 10, 64)
- if err != nil {
- return err
- }
- }
- if !s.changed {
- *s.value = out
- } else {
- for k, v := range out {
- (*s.value)[k] = v
- }
- }
- s.changed = true
- return nil
-}
-
-func (s *stringToInt64Value) Type() string {
- return "stringToInt64"
-}
-
-func (s *stringToInt64Value) String() string {
- var buf bytes.Buffer
- i := 0
- for k, v := range *s.value {
- if i > 0 {
- buf.WriteRune(',')
- }
- buf.WriteString(k)
- buf.WriteRune('=')
- buf.WriteString(strconv.FormatInt(v, 10))
- i++
- }
- return "[" + buf.String() + "]"
-}
-
-func stringToInt64Conv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // An empty string would cause an empty map
- if len(val) == 0 {
- return map[string]int64{}, nil
- }
- ss := strings.Split(val, ",")
- out := make(map[string]int64, len(ss))
- for _, pair := range ss {
- kv := strings.SplitN(pair, "=", 2)
- if len(kv) != 2 {
- return nil, fmt.Errorf("%s must be formatted as key=value", pair)
- }
- var err error
- out[kv[0]], err = strconv.ParseInt(kv[1], 10, 64)
- if err != nil {
- return nil, err
- }
- }
- return out, nil
-}
-
-// GetStringToInt64 return the map[string]int64 value of a flag with the given name
-func (f *FlagSet) GetStringToInt64(name string) (map[string]int64, error) {
- val, err := f.getFlagType(name, "stringToInt64", stringToInt64Conv)
- if err != nil {
- return map[string]int64{}, err
- }
- return val.(map[string]int64), nil
-}
-
-// StringToInt64Var defines a string flag with specified name, default value, and usage string.
-// The argument p point64s to a map[string]int64 variable in which to store the values of the multiple flags.
-// The value of each argument will not try to be separated by comma
-func (f *FlagSet) StringToInt64Var(p *map[string]int64, name string, value map[string]int64, usage string) {
- f.VarP(newStringToInt64Value(value, p), name, "", usage)
-}
-
-// StringToInt64VarP is like StringToInt64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringToInt64VarP(p *map[string]int64, name, shorthand string, value map[string]int64, usage string) {
- f.VarP(newStringToInt64Value(value, p), name, shorthand, usage)
-}
-
-// StringToInt64Var defines a string flag with specified name, default value, and usage string.
-// The argument p point64s to a map[string]int64 variable in which to store the value of the flag.
-// The value of each argument will not try to be separated by comma
-func StringToInt64Var(p *map[string]int64, name string, value map[string]int64, usage string) {
- CommandLine.VarP(newStringToInt64Value(value, p), name, "", usage)
-}
-
-// StringToInt64VarP is like StringToInt64Var, but accepts a shorthand letter that can be used after a single dash.
-func StringToInt64VarP(p *map[string]int64, name, shorthand string, value map[string]int64, usage string) {
- CommandLine.VarP(newStringToInt64Value(value, p), name, shorthand, usage)
-}
-
-// StringToInt64 defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a map[string]int64 variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma
-func (f *FlagSet) StringToInt64(name string, value map[string]int64, usage string) *map[string]int64 {
- p := map[string]int64{}
- f.StringToInt64VarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringToInt64P is like StringToInt64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringToInt64P(name, shorthand string, value map[string]int64, usage string) *map[string]int64 {
- p := map[string]int64{}
- f.StringToInt64VarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringToInt64 defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a map[string]int64 variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma
-func StringToInt64(name string, value map[string]int64, usage string) *map[string]int64 {
- return CommandLine.StringToInt64P(name, "", value, usage)
-}
-
-// StringToInt64P is like StringToInt64, but accepts a shorthand letter that can be used after a single dash.
-func StringToInt64P(name, shorthand string, value map[string]int64, usage string) *map[string]int64 {
- return CommandLine.StringToInt64P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string_to_string.go b/vendor/github.com/spf13/pflag/string_to_string.go
deleted file mode 100644
index 890a01afc..000000000
--- a/vendor/github.com/spf13/pflag/string_to_string.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package pflag
-
-import (
- "bytes"
- "encoding/csv"
- "fmt"
- "strings"
-)
-
-// -- stringToString Value
-type stringToStringValue struct {
- value *map[string]string
- changed bool
-}
-
-func newStringToStringValue(val map[string]string, p *map[string]string) *stringToStringValue {
- ssv := new(stringToStringValue)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-// Format: a=1,b=2
-func (s *stringToStringValue) Set(val string) error {
- var ss []string
- n := strings.Count(val, "=")
- switch n {
- case 0:
- return fmt.Errorf("%s must be formatted as key=value", val)
- case 1:
- ss = append(ss, strings.Trim(val, `"`))
- default:
- r := csv.NewReader(strings.NewReader(val))
- var err error
- ss, err = r.Read()
- if err != nil {
- return err
- }
- }
-
- out := make(map[string]string, len(ss))
- for _, pair := range ss {
- kv := strings.SplitN(pair, "=", 2)
- if len(kv) != 2 {
- return fmt.Errorf("%s must be formatted as key=value", pair)
- }
- out[kv[0]] = kv[1]
- }
- if !s.changed {
- *s.value = out
- } else {
- for k, v := range out {
- (*s.value)[k] = v
- }
- }
- s.changed = true
- return nil
-}
-
-func (s *stringToStringValue) Type() string {
- return "stringToString"
-}
-
-func (s *stringToStringValue) String() string {
- records := make([]string, 0, len(*s.value)>>1)
- for k, v := range *s.value {
- records = append(records, k+"="+v)
- }
-
- var buf bytes.Buffer
- w := csv.NewWriter(&buf)
- if err := w.Write(records); err != nil {
- panic(err)
- }
- w.Flush()
- return "[" + strings.TrimSpace(buf.String()) + "]"
-}
-
-func stringToStringConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // An empty string would cause an empty map
- if len(val) == 0 {
- return map[string]string{}, nil
- }
- r := csv.NewReader(strings.NewReader(val))
- ss, err := r.Read()
- if err != nil {
- return nil, err
- }
- out := make(map[string]string, len(ss))
- for _, pair := range ss {
- kv := strings.SplitN(pair, "=", 2)
- if len(kv) != 2 {
- return nil, fmt.Errorf("%s must be formatted as key=value", pair)
- }
- out[kv[0]] = kv[1]
- }
- return out, nil
-}
-
-// GetStringToString return the map[string]string value of a flag with the given name
-func (f *FlagSet) GetStringToString(name string) (map[string]string, error) {
- val, err := f.getFlagType(name, "stringToString", stringToStringConv)
- if err != nil {
- return map[string]string{}, err
- }
- return val.(map[string]string), nil
-}
-
-// StringToStringVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a map[string]string variable in which to store the values of the multiple flags.
-// The value of each argument will not try to be separated by comma
-func (f *FlagSet) StringToStringVar(p *map[string]string, name string, value map[string]string, usage string) {
- f.VarP(newStringToStringValue(value, p), name, "", usage)
-}
-
-// StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringToStringVarP(p *map[string]string, name, shorthand string, value map[string]string, usage string) {
- f.VarP(newStringToStringValue(value, p), name, shorthand, usage)
-}
-
-// StringToStringVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a map[string]string variable in which to store the value of the flag.
-// The value of each argument will not try to be separated by comma
-func StringToStringVar(p *map[string]string, name string, value map[string]string, usage string) {
- CommandLine.VarP(newStringToStringValue(value, p), name, "", usage)
-}
-
-// StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash.
-func StringToStringVarP(p *map[string]string, name, shorthand string, value map[string]string, usage string) {
- CommandLine.VarP(newStringToStringValue(value, p), name, shorthand, usage)
-}
-
-// StringToString defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a map[string]string variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma
-func (f *FlagSet) StringToString(name string, value map[string]string, usage string) *map[string]string {
- p := map[string]string{}
- f.StringToStringVarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringToStringP(name, shorthand string, value map[string]string, usage string) *map[string]string {
- p := map[string]string{}
- f.StringToStringVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringToString defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a map[string]string variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma
-func StringToString(name string, value map[string]string, usage string) *map[string]string {
- return CommandLine.StringToStringP(name, "", value, usage)
-}
-
-// StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash.
-func StringToStringP(name, shorthand string, value map[string]string, usage string) *map[string]string {
- return CommandLine.StringToStringP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint.go b/vendor/github.com/spf13/pflag/uint.go
deleted file mode 100644
index dcbc2b758..000000000
--- a/vendor/github.com/spf13/pflag/uint.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint Value
-type uintValue uint
-
-func newUintValue(val uint, p *uint) *uintValue {
- *p = val
- return (*uintValue)(p)
-}
-
-func (i *uintValue) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 64)
- *i = uintValue(v)
- return err
-}
-
-func (i *uintValue) Type() string {
- return "uint"
-}
-
-func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uintConv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 0)
- if err != nil {
- return 0, err
- }
- return uint(v), nil
-}
-
-// GetUint return the uint value of a flag with the given name
-func (f *FlagSet) GetUint(name string) (uint, error) {
- val, err := f.getFlagType(name, "uint", uintConv)
- if err != nil {
- return 0, err
- }
- return val.(uint), nil
-}
-
-// UintVar defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func (f *FlagSet) UintVar(p *uint, name string, value uint, usage string) {
- f.VarP(newUintValue(value, p), name, "", usage)
-}
-
-// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintVarP(p *uint, name, shorthand string, value uint, usage string) {
- f.VarP(newUintValue(value, p), name, shorthand, usage)
-}
-
-// UintVar defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func UintVar(p *uint, name string, value uint, usage string) {
- CommandLine.VarP(newUintValue(value, p), name, "", usage)
-}
-
-// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash.
-func UintVarP(p *uint, name, shorthand string, value uint, usage string) {
- CommandLine.VarP(newUintValue(value, p), name, shorthand, usage)
-}
-
-// Uint defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func (f *FlagSet) Uint(name string, value uint, usage string) *uint {
- p := new(uint)
- f.UintVarP(p, name, "", value, usage)
- return p
-}
-
-// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintP(name, shorthand string, value uint, usage string) *uint {
- p := new(uint)
- f.UintVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func Uint(name string, value uint, usage string) *uint {
- return CommandLine.UintP(name, "", value, usage)
-}
-
-// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash.
-func UintP(name, shorthand string, value uint, usage string) *uint {
- return CommandLine.UintP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint16.go b/vendor/github.com/spf13/pflag/uint16.go
deleted file mode 100644
index 7e9914edd..000000000
--- a/vendor/github.com/spf13/pflag/uint16.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint16 value
-type uint16Value uint16
-
-func newUint16Value(val uint16, p *uint16) *uint16Value {
- *p = val
- return (*uint16Value)(p)
-}
-
-func (i *uint16Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 16)
- *i = uint16Value(v)
- return err
-}
-
-func (i *uint16Value) Type() string {
- return "uint16"
-}
-
-func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint16Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 16)
- if err != nil {
- return 0, err
- }
- return uint16(v), nil
-}
-
-// GetUint16 return the uint16 value of a flag with the given name
-func (f *FlagSet) GetUint16(name string) (uint16, error) {
- val, err := f.getFlagType(name, "uint16", uint16Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint16), nil
-}
-
-// Uint16Var defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) {
- f.VarP(newUint16Value(value, p), name, "", usage)
-}
-
-// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) {
- f.VarP(newUint16Value(value, p), name, shorthand, usage)
-}
-
-// Uint16Var defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func Uint16Var(p *uint16, name string, value uint16, usage string) {
- CommandLine.VarP(newUint16Value(value, p), name, "", usage)
-}
-
-// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) {
- CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage)
-}
-
-// Uint16 defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 {
- p := new(uint16)
- f.Uint16VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 {
- p := new(uint16)
- f.Uint16VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint16 defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func Uint16(name string, value uint16, usage string) *uint16 {
- return CommandLine.Uint16P(name, "", value, usage)
-}
-
-// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash.
-func Uint16P(name, shorthand string, value uint16, usage string) *uint16 {
- return CommandLine.Uint16P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint32.go b/vendor/github.com/spf13/pflag/uint32.go
deleted file mode 100644
index d8024539b..000000000
--- a/vendor/github.com/spf13/pflag/uint32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint32 value
-type uint32Value uint32
-
-func newUint32Value(val uint32, p *uint32) *uint32Value {
- *p = val
- return (*uint32Value)(p)
-}
-
-func (i *uint32Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 32)
- *i = uint32Value(v)
- return err
-}
-
-func (i *uint32Value) Type() string {
- return "uint32"
-}
-
-func (i *uint32Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 32)
- if err != nil {
- return 0, err
- }
- return uint32(v), nil
-}
-
-// GetUint32 return the uint32 value of a flag with the given name
-func (f *FlagSet) GetUint32(name string) (uint32, error) {
- val, err := f.getFlagType(name, "uint32", uint32Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint32), nil
-}
-
-// Uint32Var defines a uint32 flag with specified name, default value, and usage string.
-// The argument p points to a uint32 variable in which to store the value of the flag.
-func (f *FlagSet) Uint32Var(p *uint32, name string, value uint32, usage string) {
- f.VarP(newUint32Value(value, p), name, "", usage)
-}
-
-// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) {
- f.VarP(newUint32Value(value, p), name, shorthand, usage)
-}
-
-// Uint32Var defines a uint32 flag with specified name, default value, and usage string.
-// The argument p points to a uint32 variable in which to store the value of the flag.
-func Uint32Var(p *uint32, name string, value uint32, usage string) {
- CommandLine.VarP(newUint32Value(value, p), name, "", usage)
-}
-
-// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) {
- CommandLine.VarP(newUint32Value(value, p), name, shorthand, usage)
-}
-
-// Uint32 defines a uint32 flag with specified name, default value, and usage string.
-// The return value is the address of a uint32 variable that stores the value of the flag.
-func (f *FlagSet) Uint32(name string, value uint32, usage string) *uint32 {
- p := new(uint32)
- f.Uint32VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint32P(name, shorthand string, value uint32, usage string) *uint32 {
- p := new(uint32)
- f.Uint32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint32 defines a uint32 flag with specified name, default value, and usage string.
-// The return value is the address of a uint32 variable that stores the value of the flag.
-func Uint32(name string, value uint32, usage string) *uint32 {
- return CommandLine.Uint32P(name, "", value, usage)
-}
-
-// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash.
-func Uint32P(name, shorthand string, value uint32, usage string) *uint32 {
- return CommandLine.Uint32P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint64.go b/vendor/github.com/spf13/pflag/uint64.go
deleted file mode 100644
index f62240f2c..000000000
--- a/vendor/github.com/spf13/pflag/uint64.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint64 Value
-type uint64Value uint64
-
-func newUint64Value(val uint64, p *uint64) *uint64Value {
- *p = val
- return (*uint64Value)(p)
-}
-
-func (i *uint64Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 64)
- *i = uint64Value(v)
- return err
-}
-
-func (i *uint64Value) Type() string {
- return "uint64"
-}
-
-func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint64Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 64)
- if err != nil {
- return 0, err
- }
- return uint64(v), nil
-}
-
-// GetUint64 return the uint64 value of a flag with the given name
-func (f *FlagSet) GetUint64(name string) (uint64, error) {
- val, err := f.getFlagType(name, "uint64", uint64Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint64), nil
-}
-
-// Uint64Var defines a uint64 flag with specified name, default value, and usage string.
-// The argument p points to a uint64 variable in which to store the value of the flag.
-func (f *FlagSet) Uint64Var(p *uint64, name string, value uint64, usage string) {
- f.VarP(newUint64Value(value, p), name, "", usage)
-}
-
-// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) {
- f.VarP(newUint64Value(value, p), name, shorthand, usage)
-}
-
-// Uint64Var defines a uint64 flag with specified name, default value, and usage string.
-// The argument p points to a uint64 variable in which to store the value of the flag.
-func Uint64Var(p *uint64, name string, value uint64, usage string) {
- CommandLine.VarP(newUint64Value(value, p), name, "", usage)
-}
-
-// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) {
- CommandLine.VarP(newUint64Value(value, p), name, shorthand, usage)
-}
-
-// Uint64 defines a uint64 flag with specified name, default value, and usage string.
-// The return value is the address of a uint64 variable that stores the value of the flag.
-func (f *FlagSet) Uint64(name string, value uint64, usage string) *uint64 {
- p := new(uint64)
- f.Uint64VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint64P(name, shorthand string, value uint64, usage string) *uint64 {
- p := new(uint64)
- f.Uint64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint64 defines a uint64 flag with specified name, default value, and usage string.
-// The return value is the address of a uint64 variable that stores the value of the flag.
-func Uint64(name string, value uint64, usage string) *uint64 {
- return CommandLine.Uint64P(name, "", value, usage)
-}
-
-// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash.
-func Uint64P(name, shorthand string, value uint64, usage string) *uint64 {
- return CommandLine.Uint64P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint8.go b/vendor/github.com/spf13/pflag/uint8.go
deleted file mode 100644
index bb0e83c1f..000000000
--- a/vendor/github.com/spf13/pflag/uint8.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint8 Value
-type uint8Value uint8
-
-func newUint8Value(val uint8, p *uint8) *uint8Value {
- *p = val
- return (*uint8Value)(p)
-}
-
-func (i *uint8Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 8)
- *i = uint8Value(v)
- return err
-}
-
-func (i *uint8Value) Type() string {
- return "uint8"
-}
-
-func (i *uint8Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint8Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 8)
- if err != nil {
- return 0, err
- }
- return uint8(v), nil
-}
-
-// GetUint8 return the uint8 value of a flag with the given name
-func (f *FlagSet) GetUint8(name string) (uint8, error) {
- val, err := f.getFlagType(name, "uint8", uint8Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint8), nil
-}
-
-// Uint8Var defines a uint8 flag with specified name, default value, and usage string.
-// The argument p points to a uint8 variable in which to store the value of the flag.
-func (f *FlagSet) Uint8Var(p *uint8, name string, value uint8, usage string) {
- f.VarP(newUint8Value(value, p), name, "", usage)
-}
-
-// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) {
- f.VarP(newUint8Value(value, p), name, shorthand, usage)
-}
-
-// Uint8Var defines a uint8 flag with specified name, default value, and usage string.
-// The argument p points to a uint8 variable in which to store the value of the flag.
-func Uint8Var(p *uint8, name string, value uint8, usage string) {
- CommandLine.VarP(newUint8Value(value, p), name, "", usage)
-}
-
-// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) {
- CommandLine.VarP(newUint8Value(value, p), name, shorthand, usage)
-}
-
-// Uint8 defines a uint8 flag with specified name, default value, and usage string.
-// The return value is the address of a uint8 variable that stores the value of the flag.
-func (f *FlagSet) Uint8(name string, value uint8, usage string) *uint8 {
- p := new(uint8)
- f.Uint8VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint8P(name, shorthand string, value uint8, usage string) *uint8 {
- p := new(uint8)
- f.Uint8VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint8 defines a uint8 flag with specified name, default value, and usage string.
-// The return value is the address of a uint8 variable that stores the value of the flag.
-func Uint8(name string, value uint8, usage string) *uint8 {
- return CommandLine.Uint8P(name, "", value, usage)
-}
-
-// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash.
-func Uint8P(name, shorthand string, value uint8, usage string) *uint8 {
- return CommandLine.Uint8P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint_slice.go b/vendor/github.com/spf13/pflag/uint_slice.go
deleted file mode 100644
index 5fa924835..000000000
--- a/vendor/github.com/spf13/pflag/uint_slice.go
+++ /dev/null
@@ -1,168 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- uintSlice Value
-type uintSliceValue struct {
- value *[]uint
- changed bool
-}
-
-func newUintSliceValue(val []uint, p *[]uint) *uintSliceValue {
- uisv := new(uintSliceValue)
- uisv.value = p
- *uisv.value = val
- return uisv
-}
-
-func (s *uintSliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]uint, len(ss))
- for i, d := range ss {
- u, err := strconv.ParseUint(d, 10, 0)
- if err != nil {
- return err
- }
- out[i] = uint(u)
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *uintSliceValue) Type() string {
- return "uintSlice"
-}
-
-func (s *uintSliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%d", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func (s *uintSliceValue) fromString(val string) (uint, error) {
- t, err := strconv.ParseUint(val, 10, 0)
- if err != nil {
- return 0, err
- }
- return uint(t), nil
-}
-
-func (s *uintSliceValue) toString(val uint) string {
- return fmt.Sprintf("%d", val)
-}
-
-func (s *uintSliceValue) Append(val string) error {
- i, err := s.fromString(val)
- if err != nil {
- return err
- }
- *s.value = append(*s.value, i)
- return nil
-}
-
-func (s *uintSliceValue) Replace(val []string) error {
- out := make([]uint, len(val))
- for i, d := range val {
- var err error
- out[i], err = s.fromString(d)
- if err != nil {
- return err
- }
- }
- *s.value = out
- return nil
-}
-
-func (s *uintSliceValue) GetSlice() []string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = s.toString(d)
- }
- return out
-}
-
-func uintSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []uint{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]uint, len(ss))
- for i, d := range ss {
- u, err := strconv.ParseUint(d, 10, 0)
- if err != nil {
- return nil, err
- }
- out[i] = uint(u)
- }
- return out, nil
-}
-
-// GetUintSlice returns the []uint value of a flag with the given name.
-func (f *FlagSet) GetUintSlice(name string) ([]uint, error) {
- val, err := f.getFlagType(name, "uintSlice", uintSliceConv)
- if err != nil {
- return []uint{}, err
- }
- return val.([]uint), nil
-}
-
-// UintSliceVar defines a uintSlice flag with specified name, default value, and usage string.
-// The argument p points to a []uint variable in which to store the value of the flag.
-func (f *FlagSet) UintSliceVar(p *[]uint, name string, value []uint, usage string) {
- f.VarP(newUintSliceValue(value, p), name, "", usage)
-}
-
-// UintSliceVarP is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) {
- f.VarP(newUintSliceValue(value, p), name, shorthand, usage)
-}
-
-// UintSliceVar defines a uint[] flag with specified name, default value, and usage string.
-// The argument p points to a uint[] variable in which to store the value of the flag.
-func UintSliceVar(p *[]uint, name string, value []uint, usage string) {
- CommandLine.VarP(newUintSliceValue(value, p), name, "", usage)
-}
-
-// UintSliceVarP is like the UintSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) {
- CommandLine.VarP(newUintSliceValue(value, p), name, shorthand, usage)
-}
-
-// UintSlice defines a []uint flag with specified name, default value, and usage string.
-// The return value is the address of a []uint variable that stores the value of the flag.
-func (f *FlagSet) UintSlice(name string, value []uint, usage string) *[]uint {
- p := []uint{}
- f.UintSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintSliceP(name, shorthand string, value []uint, usage string) *[]uint {
- p := []uint{}
- f.UintSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// UintSlice defines a []uint flag with specified name, default value, and usage string.
-// The return value is the address of a []uint variable that stores the value of the flag.
-func UintSlice(name string, value []uint, usage string) *[]uint {
- return CommandLine.UintSliceP(name, "", value, usage)
-}
-
-// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash.
-func UintSliceP(name, shorthand string, value []uint, usage string) *[]uint {
- return CommandLine.UintSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/viper/.editorconfig b/vendor/github.com/spf13/viper/.editorconfig
deleted file mode 100644
index 1f664d13a..000000000
--- a/vendor/github.com/spf13/viper/.editorconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-root = true
-
-[*]
-charset = utf-8
-end_of_line = lf
-indent_size = 4
-indent_style = space
-insert_final_newline = true
-trim_trailing_whitespace = true
-
-[*.go]
-indent_style = tab
-
-[{Makefile,*.mk}]
-indent_style = tab
-
-[*.nix]
-indent_size = 2
diff --git a/vendor/github.com/spf13/viper/.envrc b/vendor/github.com/spf13/viper/.envrc
deleted file mode 100644
index 3ce7171a3..000000000
--- a/vendor/github.com/spf13/viper/.envrc
+++ /dev/null
@@ -1,4 +0,0 @@
-if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
- source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
-fi
-use flake . --impure
diff --git a/vendor/github.com/spf13/viper/.gitignore b/vendor/github.com/spf13/viper/.gitignore
deleted file mode 100644
index f1bbd4280..000000000
--- a/vendor/github.com/spf13/viper/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-/.devenv/
-/.direnv/
-/.idea/
-/.pre-commit-config.yaml
-/bin/
-/build/
-/var/
-/vendor/
diff --git a/vendor/github.com/spf13/viper/.golangci.yaml b/vendor/github.com/spf13/viper/.golangci.yaml
deleted file mode 100644
index 1faeae42c..000000000
--- a/vendor/github.com/spf13/viper/.golangci.yaml
+++ /dev/null
@@ -1,108 +0,0 @@
-run:
- timeout: 5m
-
-linters-settings:
- gci:
- sections:
- - standard
- - default
- - prefix(github.com/spf13/viper)
- gocritic:
- # Enable multiple checks by tags. See "Tags" section in https://github.com/go-critic/go-critic#usage.
- enabled-tags:
- - diagnostic
- - experimental
- - opinionated
- - style
- disabled-checks:
- - importShadow
- - unnamedResult
- golint:
- min-confidence: 0
- goimports:
- local-prefixes: github.com/spf13/viper
-
-linters:
- disable-all: true
- enable:
- - bodyclose
- - dogsled
- - dupl
- - durationcheck
- - exhaustive
- - exportloopref
- - gci
- - gocritic
- - godot
- - gofmt
- - gofumpt
- - goimports
- - gomoddirectives
- - goprintffuncname
- - govet
- - importas
- - ineffassign
- - makezero
- - misspell
- - nakedret
- - nilerr
- - noctx
- - nolintlint
- - prealloc
- - predeclared
- - revive
- - rowserrcheck
- - sqlclosecheck
- - staticcheck
- - stylecheck
- - tparallel
- - typecheck
- - unconvert
- - unparam
- - unused
- - wastedassign
- - whitespace
-
- # fixme
- # - cyclop
- # - errcheck
- # - errorlint
- # - exhaustivestruct
- # - forbidigo
- # - forcetypeassert
- # - gochecknoglobals
- # - gochecknoinits
- # - gocognit
- # - goconst
- # - gocyclo
- # - gosec
- # - gosimple
- # - ifshort
- # - lll
- # - nlreturn
- # - paralleltest
- # - scopelint
- # - thelper
- # - wrapcheck
-
- # unused
- # - depguard
- # - goheader
- # - gomodguard
-
- # deprecated
- # - deadcode
- # - structcheck
- # - varcheck
-
- # don't enable:
- # - asciicheck
- # - funlen
- # - godox
- # - goerr113
- # - gomnd
- # - interfacer
- # - maligned
- # - nestif
- # - testpackage
- # - wsl
diff --git a/vendor/github.com/spf13/viper/.yamlignore b/vendor/github.com/spf13/viper/.yamlignore
deleted file mode 100644
index c04c4dead..000000000
--- a/vendor/github.com/spf13/viper/.yamlignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# TODO: FIXME
-/.github/
diff --git a/vendor/github.com/spf13/viper/.yamllint.yaml b/vendor/github.com/spf13/viper/.yamllint.yaml
deleted file mode 100644
index bac19ce18..000000000
--- a/vendor/github.com/spf13/viper/.yamllint.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-ignore-from-file: [.gitignore, .yamlignore]
-
-extends: default
-
-rules:
- line-length: disable
diff --git a/vendor/github.com/spf13/viper/LICENSE b/vendor/github.com/spf13/viper/LICENSE
deleted file mode 100644
index 4527efb9c..000000000
--- a/vendor/github.com/spf13/viper/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Steve Francia
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/spf13/viper/Makefile b/vendor/github.com/spf13/viper/Makefile
deleted file mode 100644
index a77b9c81c..000000000
--- a/vendor/github.com/spf13/viper/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
-
-OS = $(shell uname | tr A-Z a-z)
-export PATH := $(abspath bin/):${PATH}
-
-# Build variables
-BUILD_DIR ?= build
-export CGO_ENABLED ?= 0
-export GOOS = $(shell go env GOOS)
-ifeq (${VERBOSE}, 1)
-ifeq ($(filter -v,${GOARGS}),)
- GOARGS += -v
-endif
-TEST_FORMAT = short-verbose
-endif
-
-# Dependency versions
-GOTESTSUM_VERSION = 1.9.0
-GOLANGCI_VERSION = 1.53.3
-
-# Add the ability to override some variables
-# Use with care
--include override.mk
-
-.PHONY: clear
-clear: ## Clear the working area and the project
- rm -rf bin/
-
-.PHONY: check
-check: test lint ## Run tests and linters
-
-
-TEST_PKGS ?= ./...
-.PHONY: test
-test: TEST_FORMAT ?= short
-test: SHELL = /bin/bash
-test: export CGO_ENABLED=1
-test: bin/gotestsum ## Run tests
- @mkdir -p ${BUILD_DIR}
- bin/gotestsum --no-summary=skipped --junitfile ${BUILD_DIR}/coverage.xml --format ${TEST_FORMAT} -- -race -coverprofile=${BUILD_DIR}/coverage.txt -covermode=atomic $(filter-out -v,${GOARGS}) $(if ${TEST_PKGS},${TEST_PKGS},./...)
-
-.PHONY: lint
-lint: lint-go lint-yaml
-lint: ## Run linters
-
-.PHONY: lint-go
-lint-go:
- golangci-lint run $(if ${CI},--out-format github-actions,)
-
-.PHONY: lint-yaml
-lint-yaml:
- yamllint $(if ${CI},-f github,) --no-warnings .
-
-.PHONY: fmt
-fmt: ## Format code
- golangci-lint run --fix
-
-deps: bin/golangci-lint bin/gotestsum yamllint
-deps: ## Install dependencies
-
-bin/gotestsum:
- @mkdir -p bin
- curl -L https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_${OS}_amd64.tar.gz | tar -zOxf - gotestsum > ./bin/gotestsum && chmod +x ./bin/gotestsum
-
-bin/golangci-lint:
- @mkdir -p bin
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- v${GOLANGCI_VERSION}
-
-.PHONY: yamllint
-yamllint:
- pip3 install --user yamllint
-
-# Add custom targets here
--include custom.mk
-
-.PHONY: list
-list: ## List all make targets
- @${MAKE} -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | sort
-
-.PHONY: help
-.DEFAULT_GOAL := help
-help:
- @grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
-
-# Variable outputting/exporting rules
-var-%: ; @echo $($*)
-varexport-%: ; @echo $*=$($*)
diff --git a/vendor/github.com/spf13/viper/README.md b/vendor/github.com/spf13/viper/README.md
deleted file mode 100644
index 3fc7d84f1..000000000
--- a/vendor/github.com/spf13/viper/README.md
+++ /dev/null
@@ -1,928 +0,0 @@
-> ## Viper v2 feedback
-> Viper is heading towards v2 and we would love to hear what _**you**_ would like to see in it. Share your thoughts here: https://forms.gle/R6faU74qPRPAzchZ9
->
-> **Thank you!**
-
-
-
-[](https://github.com/avelino/awesome-go#configuration)
-[](https://repl.it/@sagikazarmark/Viper-example#main.go)
-
-[](https://github.com/spf13/viper/actions?query=workflow%3ACI)
-[](https://gitter.im/spf13/viper?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-[](https://goreportcard.com/report/github.com/spf13/viper)
-
-[](https://pkg.go.dev/mod/github.com/spf13/viper)
-
-**Go configuration with fangs!**
-
-Many Go projects are built using Viper including:
-
-* [Hugo](http://gohugo.io)
-* [EMC RexRay](http://rexray.readthedocs.org/en/stable/)
-* [Imgur’s Incus](https://github.com/Imgur/incus)
-* [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack)
-* [Docker Notary](https://github.com/docker/Notary)
-* [BloomApi](https://www.bloomapi.com/)
-* [doctl](https://github.com/digitalocean/doctl)
-* [Clairctl](https://github.com/jgsqware/clairctl)
-* [Mercure](https://mercure.rocks)
-* [Meshery](https://github.com/meshery/meshery)
-* [Bearer](https://github.com/bearer/bearer)
-* [Coder](https://github.com/coder/coder)
-* [Vitess](https://vitess.io/)
-
-
-## Install
-
-```shell
-go get github.com/spf13/viper
-```
-
-**Note:** Viper uses [Go Modules](https://go.dev/wiki/Modules) to manage dependencies.
-
-
-## What is Viper?
-
-Viper is a complete configuration solution for Go applications including [12-Factor apps](https://12factor.net/#the_twelve_factors).
-It is designed to work within an application, and can handle all types of configuration needs
-and formats. It supports:
-
-* setting defaults
-* reading from JSON, TOML, YAML, HCL, envfile and Java properties config files
-* live watching and re-reading of config files (optional)
-* reading from environment variables
-* reading from remote config systems (etcd or Consul), and watching changes
-* reading from command line flags
-* reading from buffer
-* setting explicit values
-
-Viper can be thought of as a registry for all of your applications configuration needs.
-
-
-## Why Viper?
-
-When building a modern application, you don’t want to worry about
-configuration file formats; you want to focus on building awesome software.
-Viper is here to help with that.
-
-Viper does the following for you:
-
-1. Find, load, and unmarshal a configuration file in JSON, TOML, YAML, HCL, INI, envfile or Java properties formats.
-2. Provide a mechanism to set default values for your different configuration options.
-3. Provide a mechanism to set override values for options specified through command line flags.
-4. Provide an alias system to easily rename parameters without breaking existing code.
-5. Make it easy to tell the difference between when a user has provided a command line or config file which is the same as the default.
-
-Viper uses the following precedence order. Each item takes precedence over the item below it:
-
- * explicit call to `Set`
- * flag
- * env
- * config
- * key/value store
- * default
-
-**Important:** Viper configuration keys are case insensitive.
-There are ongoing discussions about making that optional.
-
-
-## Putting Values into Viper
-
-### Establishing Defaults
-
-A good configuration system will support default values. A default value is not
-required for a key, but it’s useful in the event that a key hasn't been set via
-config file, environment variable, remote configuration or flag.
-
-Examples:
-
-```go
-viper.SetDefault("ContentDir", "content")
-viper.SetDefault("LayoutDir", "layouts")
-viper.SetDefault("Taxonomies", map[string]string{"tag": "tags", "category": "categories"})
-```
-
-### Reading Config Files
-
-Viper requires minimal configuration so it knows where to look for config files.
-Viper supports JSON, TOML, YAML, HCL, INI, envfile and Java Properties files. Viper can search multiple paths, but
-currently a single Viper instance only supports a single configuration file.
-Viper does not default to any configuration search paths leaving defaults decision
-to an application.
-
-Here is an example of how to use Viper to search for and read a configuration file.
-None of the specific paths are required, but at least one path should be provided
-where a configuration file is expected.
-
-```go
-viper.SetConfigName("config") // name of config file (without extension)
-viper.SetConfigType("yaml") // REQUIRED if the config file does not have the extension in the name
-viper.AddConfigPath("/etc/appname/") // path to look for the config file in
-viper.AddConfigPath("$HOME/.appname") // call multiple times to add many search paths
-viper.AddConfigPath(".") // optionally look for config in the working directory
-err := viper.ReadInConfig() // Find and read the config file
-if err != nil { // Handle errors reading the config file
- panic(fmt.Errorf("fatal error config file: %w", err))
-}
-```
-
-You can handle the specific case where no config file is found like this:
-
-```go
-if err := viper.ReadInConfig(); err != nil {
- if _, ok := err.(viper.ConfigFileNotFoundError); ok {
- // Config file not found; ignore error if desired
- } else {
- // Config file was found but another error was produced
- }
-}
-
-// Config file found and successfully parsed
-```
-
-*NOTE [since 1.6]:* You can also have a file without an extension and specify the format programmatically. For those configuration files that lie in the home of the user without any extension like `.bashrc`
-
-### Writing Config Files
-
-Reading from config files is useful, but at times you want to store all modifications made at run time.
-For that, a bunch of commands are available, each with its own purpose:
-
-* WriteConfig - writes the current viper configuration to the predefined path, if exists. Errors if no predefined path. Will overwrite the current config file, if it exists.
-* SafeWriteConfig - writes the current viper configuration to the predefined path. Errors if no predefined path. Will not overwrite the current config file, if it exists.
-* WriteConfigAs - writes the current viper configuration to the given filepath. Will overwrite the given file, if it exists.
-* SafeWriteConfigAs - writes the current viper configuration to the given filepath. Will not overwrite the given file, if it exists.
-
-As a rule of the thumb, everything marked with safe won't overwrite any file, but just create if not existent, whilst the default behavior is to create or truncate.
-
-A small examples section:
-
-```go
-viper.WriteConfig() // writes current config to predefined path set by 'viper.AddConfigPath()' and 'viper.SetConfigName'
-viper.SafeWriteConfig()
-viper.WriteConfigAs("/path/to/my/.config")
-viper.SafeWriteConfigAs("/path/to/my/.config") // will error since it has already been written
-viper.SafeWriteConfigAs("/path/to/my/.other_config")
-```
-
-### Watching and re-reading config files
-
-Viper supports the ability to have your application live read a config file while running.
-
-Gone are the days of needing to restart a server to have a config take effect,
-viper powered applications can read an update to a config file while running and
-not miss a beat.
-
-Simply tell the viper instance to watchConfig.
-Optionally you can provide a function for Viper to run each time a change occurs.
-
-**Make sure you add all of the configPaths prior to calling `WatchConfig()`**
-
-```go
-viper.OnConfigChange(func(e fsnotify.Event) {
- fmt.Println("Config file changed:", e.Name)
-})
-viper.WatchConfig()
-```
-
-### Reading Config from io.Reader
-
-Viper predefines many configuration sources such as files, environment
-variables, flags, and remote K/V store, but you are not bound to them. You can
-also implement your own required configuration source and feed it to viper.
-
-```go
-viper.SetConfigType("yaml") // or viper.SetConfigType("YAML")
-
-// any approach to require this configuration into your program.
-var yamlExample = []byte(`
-Hacker: true
-name: steve
-hobbies:
-- skateboarding
-- snowboarding
-- go
-clothing:
- jacket: leather
- trousers: denim
-age: 35
-eyes : brown
-beard: true
-`)
-
-viper.ReadConfig(bytes.NewBuffer(yamlExample))
-
-viper.Get("name") // this would be "steve"
-```
-
-### Setting Overrides
-
-These could be from a command line flag, or from your own application logic.
-
-```go
-viper.Set("Verbose", true)
-viper.Set("LogFile", LogFile)
-viper.Set("host.port", 5899) // set subset
-```
-
-### Registering and Using Aliases
-
-Aliases permit a single value to be referenced by multiple keys
-
-```go
-viper.RegisterAlias("loud", "Verbose")
-
-viper.Set("verbose", true) // same result as next line
-viper.Set("loud", true) // same result as prior line
-
-viper.GetBool("loud") // true
-viper.GetBool("verbose") // true
-```
-
-### Working with Environment Variables
-
-Viper has full support for environment variables. This enables 12 factor
-applications out of the box. There are five methods that exist to aid working
-with ENV:
-
- * `AutomaticEnv()`
- * `BindEnv(string...) : error`
- * `SetEnvPrefix(string)`
- * `SetEnvKeyReplacer(string...) *strings.Replacer`
- * `AllowEmptyEnv(bool)`
-
-_When working with ENV variables, it’s important to recognize that Viper
-treats ENV variables as case sensitive._
-
-Viper provides a mechanism to try to ensure that ENV variables are unique. By
-using `SetEnvPrefix`, you can tell Viper to use a prefix while reading from
-the environment variables. Both `BindEnv` and `AutomaticEnv` will use this
-prefix.
-
-`BindEnv` takes one or more parameters. The first parameter is the key name, the
-rest are the name of the environment variables to bind to this key. If more than
-one are provided, they will take precedence in the specified order. The name of
-the environment variable is case sensitive. If the ENV variable name is not provided, then
-Viper will automatically assume that the ENV variable matches the following format: prefix + "_" + the key name in ALL CAPS. When you explicitly provide the ENV variable name (the second parameter),
-it **does not** automatically add the prefix. For example if the second parameter is "id",
-Viper will look for the ENV variable "ID".
-
-One important thing to recognize when working with ENV variables is that the
-value will be read each time it is accessed. Viper does not fix the value when
-the `BindEnv` is called.
-
-`AutomaticEnv` is a powerful helper especially when combined with
-`SetEnvPrefix`. When called, Viper will check for an environment variable any
-time a `viper.Get` request is made. It will apply the following rules. It will
-check for an environment variable with a name matching the key uppercased and
-prefixed with the `EnvPrefix` if set.
-
-`SetEnvKeyReplacer` allows you to use a `strings.Replacer` object to rewrite Env
-keys to an extent. This is useful if you want to use `-` or something in your
-`Get()` calls, but want your environmental variables to use `_` delimiters. An
-example of using it can be found in `viper_test.go`.
-
-Alternatively, you can use `EnvKeyReplacer` with `NewWithOptions` factory function.
-Unlike `SetEnvKeyReplacer`, it accepts a `StringReplacer` interface allowing you to write custom string replacing logic.
-
-By default empty environment variables are considered unset and will fall back to
-the next configuration source. To treat empty environment variables as set, use
-the `AllowEmptyEnv` method.
-
-#### Env example
-
-```go
-SetEnvPrefix("spf") // will be uppercased automatically
-BindEnv("id")
-
-os.Setenv("SPF_ID", "13") // typically done outside of the app
-
-id := Get("id") // 13
-```
-
-### Working with Flags
-
-Viper has the ability to bind to flags. Specifically, Viper supports `Pflags`
-as used in the [Cobra](https://github.com/spf13/cobra) library.
-
-Like `BindEnv`, the value is not set when the binding method is called, but when
-it is accessed. This means you can bind as early as you want, even in an
-`init()` function.
-
-For individual flags, the `BindPFlag()` method provides this functionality.
-
-Example:
-
-```go
-serverCmd.Flags().Int("port", 1138, "Port to run Application server on")
-viper.BindPFlag("port", serverCmd.Flags().Lookup("port"))
-```
-
-You can also bind an existing set of pflags (pflag.FlagSet):
-
-Example:
-
-```go
-pflag.Int("flagname", 1234, "help message for flagname")
-
-pflag.Parse()
-viper.BindPFlags(pflag.CommandLine)
-
-i := viper.GetInt("flagname") // retrieve values from viper instead of pflag
-```
-
-The use of [pflag](https://github.com/spf13/pflag/) in Viper does not preclude
-the use of other packages that use the [flag](https://golang.org/pkg/flag/)
-package from the standard library. The pflag package can handle the flags
-defined for the flag package by importing these flags. This is accomplished
-by a calling a convenience function provided by the pflag package called
-AddGoFlagSet().
-
-Example:
-
-```go
-package main
-
-import (
- "flag"
- "github.com/spf13/pflag"
-)
-
-func main() {
-
- // using standard library "flag" package
- flag.Int("flagname", 1234, "help message for flagname")
-
- pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
- pflag.Parse()
- viper.BindPFlags(pflag.CommandLine)
-
- i := viper.GetInt("flagname") // retrieve value from viper
-
- // ...
-}
-```
-
-#### Flag interfaces
-
-Viper provides two Go interfaces to bind other flag systems if you don’t use `Pflags`.
-
-`FlagValue` represents a single flag. This is a very simple example on how to implement this interface:
-
-```go
-type myFlag struct {}
-func (f myFlag) HasChanged() bool { return false }
-func (f myFlag) Name() string { return "my-flag-name" }
-func (f myFlag) ValueString() string { return "my-flag-value" }
-func (f myFlag) ValueType() string { return "string" }
-```
-
-Once your flag implements this interface, you can simply tell Viper to bind it:
-
-```go
-viper.BindFlagValue("my-flag-name", myFlag{})
-```
-
-`FlagValueSet` represents a group of flags. This is a very simple example on how to implement this interface:
-
-```go
-type myFlagSet struct {
- flags []myFlag
-}
-
-func (f myFlagSet) VisitAll(fn func(FlagValue)) {
- for _, flag := range flags {
- fn(flag)
- }
-}
-```
-
-Once your flag set implements this interface, you can simply tell Viper to bind it:
-
-```go
-fSet := myFlagSet{
- flags: []myFlag{myFlag{}, myFlag{}},
-}
-viper.BindFlagValues("my-flags", fSet)
-```
-
-### Remote Key/Value Store Support
-
-To enable remote support in Viper, do a blank import of the `viper/remote`
-package:
-
-`import _ "github.com/spf13/viper/remote"`
-
-Viper will read a config string (as JSON, TOML, YAML, HCL or envfile) retrieved from a path
-in a Key/Value store such as etcd or Consul. These values take precedence over
-default values, but are overridden by configuration values retrieved from disk,
-flags, or environment variables.
-
-Viper supports multiple hosts. To use, pass a list of endpoints separated by `;`. For example `http://127.0.0.1:4001;http://127.0.0.1:4002`.
-
-Viper uses [crypt](https://github.com/sagikazarmark/crypt) to retrieve
-configuration from the K/V store, which means that you can store your
-configuration values encrypted and have them automatically decrypted if you have
-the correct gpg keyring. Encryption is optional.
-
-You can use remote configuration in conjunction with local configuration, or
-independently of it.
-
-`crypt` has a command-line helper that you can use to put configurations in your
-K/V store. `crypt` defaults to etcd on http://127.0.0.1:4001.
-
-```bash
-$ go get github.com/sagikazarmark/crypt/bin/crypt
-$ crypt set -plaintext /config/hugo.json /Users/hugo/settings/config.json
-```
-
-Confirm that your value was set:
-
-```bash
-$ crypt get -plaintext /config/hugo.json
-```
-
-See the `crypt` documentation for examples of how to set encrypted values, or
-how to use Consul.
-
-### Remote Key/Value Store Example - Unencrypted
-
-#### etcd
-```go
-viper.AddRemoteProvider("etcd", "http://127.0.0.1:4001","/config/hugo.json")
-viper.SetConfigType("json") // because there is no file extension in a stream of bytes, supported extensions are "json", "toml", "yaml", "yml", "properties", "props", "prop", "env", "dotenv"
-err := viper.ReadRemoteConfig()
-```
-
-#### etcd3
-```go
-viper.AddRemoteProvider("etcd3", "http://127.0.0.1:4001","/config/hugo.json")
-viper.SetConfigType("json") // because there is no file extension in a stream of bytes, supported extensions are "json", "toml", "yaml", "yml", "properties", "props", "prop", "env", "dotenv"
-err := viper.ReadRemoteConfig()
-```
-
-#### Consul
-You need to set a key to Consul key/value storage with JSON value containing your desired config.
-For example, create a Consul key/value store key `MY_CONSUL_KEY` with value:
-
-```json
-{
- "port": 8080,
- "hostname": "myhostname.com"
-}
-```
-
-```go
-viper.AddRemoteProvider("consul", "localhost:8500", "MY_CONSUL_KEY")
-viper.SetConfigType("json") // Need to explicitly set this to json
-err := viper.ReadRemoteConfig()
-
-fmt.Println(viper.Get("port")) // 8080
-fmt.Println(viper.Get("hostname")) // myhostname.com
-```
-
-#### Firestore
-
-```go
-viper.AddRemoteProvider("firestore", "google-cloud-project-id", "collection/document")
-viper.SetConfigType("json") // Config's format: "json", "toml", "yaml", "yml"
-err := viper.ReadRemoteConfig()
-```
-
-Of course, you're allowed to use `SecureRemoteProvider` also
-
-
-#### NATS
-
-```go
-viper.AddRemoteProvider("nats", "nats://127.0.0.1:4222", "myapp.config")
-viper.SetConfigType("json")
-err := viper.ReadRemoteConfig()
-```
-
-### Remote Key/Value Store Example - Encrypted
-
-```go
-viper.AddSecureRemoteProvider("etcd","http://127.0.0.1:4001","/config/hugo.json","/etc/secrets/mykeyring.gpg")
-viper.SetConfigType("json") // because there is no file extension in a stream of bytes, supported extensions are "json", "toml", "yaml", "yml", "properties", "props", "prop", "env", "dotenv"
-err := viper.ReadRemoteConfig()
-```
-
-### Watching Changes in etcd - Unencrypted
-
-```go
-// alternatively, you can create a new viper instance.
-var runtime_viper = viper.New()
-
-runtime_viper.AddRemoteProvider("etcd", "http://127.0.0.1:4001", "/config/hugo.yml")
-runtime_viper.SetConfigType("yaml") // because there is no file extension in a stream of bytes, supported extensions are "json", "toml", "yaml", "yml", "properties", "props", "prop", "env", "dotenv"
-
-// read from remote config the first time.
-err := runtime_viper.ReadRemoteConfig()
-
-// unmarshal config
-runtime_viper.Unmarshal(&runtime_conf)
-
-// open a goroutine to watch remote changes forever
-go func(){
- for {
- time.Sleep(time.Second * 5) // delay after each request
-
- // currently, only tested with etcd support
- err := runtime_viper.WatchRemoteConfig()
- if err != nil {
- log.Errorf("unable to read remote config: %v", err)
- continue
- }
-
- // unmarshal new config into our runtime config struct. you can also use channel
- // to implement a signal to notify the system of the changes
- runtime_viper.Unmarshal(&runtime_conf)
- }
-}()
-```
-
-## Getting Values From Viper
-
-In Viper, there are a few ways to get a value depending on the value’s type.
-The following functions and methods exist:
-
- * `Get(key string) : any`
- * `GetBool(key string) : bool`
- * `GetFloat64(key string) : float64`
- * `GetInt(key string) : int`
- * `GetIntSlice(key string) : []int`
- * `GetString(key string) : string`
- * `GetStringMap(key string) : map[string]any`
- * `GetStringMapString(key string) : map[string]string`
- * `GetStringSlice(key string) : []string`
- * `GetTime(key string) : time.Time`
- * `GetDuration(key string) : time.Duration`
- * `IsSet(key string) : bool`
- * `AllSettings() : map[string]any`
-
-One important thing to recognize is that each Get function will return a zero
-value if it’s not found. To check if a given key exists, the `IsSet()` method
-has been provided.
-
-The zero value will also be returned if the value is set, but fails to parse
-as the requested type.
-
-Example:
-```go
-viper.GetString("logfile") // case-insensitive Setting & Getting
-if viper.GetBool("verbose") {
- fmt.Println("verbose enabled")
-}
-```
-### Accessing nested keys
-
-The accessor methods also accept formatted paths to deeply nested keys. For
-example, if the following JSON file is loaded:
-
-```json
-{
- "host": {
- "address": "localhost",
- "port": 5799
- },
- "datastore": {
- "metric": {
- "host": "127.0.0.1",
- "port": 3099
- },
- "warehouse": {
- "host": "198.0.0.1",
- "port": 2112
- }
- }
-}
-
-```
-
-Viper can access a nested field by passing a `.` delimited path of keys:
-
-```go
-GetString("datastore.metric.host") // (returns "127.0.0.1")
-```
-
-This obeys the precedence rules established above; the search for the path
-will cascade through the remaining configuration registries until found.
-
-For example, given this configuration file, both `datastore.metric.host` and
-`datastore.metric.port` are already defined (and may be overridden). If in addition
-`datastore.metric.protocol` was defined in the defaults, Viper would also find it.
-
-However, if `datastore.metric` was overridden (by a flag, an environment variable,
-the `Set()` method, …) with an immediate value, then all sub-keys of
-`datastore.metric` become undefined, they are “shadowed” by the higher-priority
-configuration level.
-
-Viper can access array indices by using numbers in the path. For example:
-
-```jsonc
-{
- "host": {
- "address": "localhost",
- "ports": [
- 5799,
- 6029
- ]
- },
- "datastore": {
- "metric": {
- "host": "127.0.0.1",
- "port": 3099
- },
- "warehouse": {
- "host": "198.0.0.1",
- "port": 2112
- }
- }
-}
-
-GetInt("host.ports.1") // returns 6029
-
-```
-
-Lastly, if there exists a key that matches the delimited key path, its value
-will be returned instead. E.g.
-
-```jsonc
-{
- "datastore.metric.host": "0.0.0.0",
- "host": {
- "address": "localhost",
- "port": 5799
- },
- "datastore": {
- "metric": {
- "host": "127.0.0.1",
- "port": 3099
- },
- "warehouse": {
- "host": "198.0.0.1",
- "port": 2112
- }
- }
-}
-
-GetString("datastore.metric.host") // returns "0.0.0.0"
-```
-
-### Extracting a sub-tree
-
-When developing reusable modules, it's often useful to extract a subset of the configuration
-and pass it to a module. This way the module can be instantiated more than once, with different configurations.
-
-For example, an application might use multiple different cache stores for different purposes:
-
-```yaml
-cache:
- cache1:
- max-items: 100
- item-size: 64
- cache2:
- max-items: 200
- item-size: 80
-```
-
-We could pass the cache name to a module (eg. `NewCache("cache1")`),
-but it would require weird concatenation for accessing config keys and would be less separated from the global config.
-
-So instead of doing that let's pass a Viper instance to the constructor that represents a subset of the configuration:
-
-```go
-cache1Config := viper.Sub("cache.cache1")
-if cache1Config == nil { // Sub returns nil if the key cannot be found
- panic("cache configuration not found")
-}
-
-cache1 := NewCache(cache1Config)
-```
-
-**Note:** Always check the return value of `Sub`. It returns `nil` if a key cannot be found.
-
-Internally, the `NewCache` function can address `max-items` and `item-size` keys directly:
-
-```go
-func NewCache(v *Viper) *Cache {
- return &Cache{
- MaxItems: v.GetInt("max-items"),
- ItemSize: v.GetInt("item-size"),
- }
-}
-```
-
-The resulting code is easy to test, since it's decoupled from the main config structure,
-and easier to reuse (for the same reason).
-
-
-### Unmarshaling
-
-You also have the option of Unmarshaling all or a specific value to a struct, map,
-etc.
-
-There are two methods to do this:
-
- * `Unmarshal(rawVal any) : error`
- * `UnmarshalKey(key string, rawVal any) : error`
-
-Example:
-
-```go
-type config struct {
- Port int
- Name string
- PathMap string `mapstructure:"path_map"`
-}
-
-var C config
-
-err := viper.Unmarshal(&C)
-if err != nil {
- t.Fatalf("unable to decode into struct, %v", err)
-}
-```
-
-If you want to unmarshal configuration where the keys themselves contain dot (the default key delimiter),
-you have to change the delimiter:
-
-```go
-v := viper.NewWithOptions(viper.KeyDelimiter("::"))
-
-v.SetDefault("chart::values", map[string]any{
- "ingress": map[string]any{
- "annotations": map[string]any{
- "traefik.frontend.rule.type": "PathPrefix",
- "traefik.ingress.kubernetes.io/ssl-redirect": "true",
- },
- },
-})
-
-type config struct {
- Chart struct{
- Values map[string]any
- }
-}
-
-var C config
-
-v.Unmarshal(&C)
-```
-
-Viper also supports unmarshaling into embedded structs:
-
-```go
-/*
-Example config:
-
-module:
- enabled: true
- token: 89h3f98hbwf987h3f98wenf89ehf
-*/
-type config struct {
- Module struct {
- Enabled bool
-
- moduleConfig `mapstructure:",squash"`
- }
-}
-
-// moduleConfig could be in a module specific package
-type moduleConfig struct {
- Token string
-}
-
-var C config
-
-err := viper.Unmarshal(&C)
-if err != nil {
- t.Fatalf("unable to decode into struct, %v", err)
-}
-```
-
-Viper uses [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) under the hood for unmarshaling values which uses `mapstructure` tags by default.
-
-### Decoding custom formats
-
-A frequently requested feature for Viper is adding more value formats and decoders.
-For example, parsing character (dot, comma, semicolon, etc) separated strings into slices.
-
-This is already available in Viper using mapstructure decode hooks.
-
-Read more about the details in [this blog post](https://sagikazarmark.hu/blog/decoding-custom-formats-with-viper/).
-
-### Marshalling to string
-
-You may need to marshal all the settings held in viper into a string rather than write them to a file.
-You can use your favorite format's marshaller with the config returned by `AllSettings()`.
-
-```go
-import (
- yaml "gopkg.in/yaml.v2"
- // ...
-)
-
-func yamlStringSettings() string {
- c := viper.AllSettings()
- bs, err := yaml.Marshal(c)
- if err != nil {
- log.Fatalf("unable to marshal config to YAML: %v", err)
- }
- return string(bs)
-}
-```
-
-## Viper or Vipers?
-
-Viper comes ready to use out of the box. There is no configuration or
-initialization needed to begin using Viper. Since most applications will want
-to use a single central repository for their configuration, the viper package
-provides this. It is similar to a singleton.
-
-In all of the examples above, they demonstrate using viper in its singleton
-style approach.
-
-### Working with multiple vipers
-
-You can also create many different vipers for use in your application. Each will
-have its own unique set of configurations and values. Each can read from a
-different config file, key value store, etc. All of the functions that viper
-package supports are mirrored as methods on a viper.
-
-Example:
-
-```go
-x := viper.New()
-y := viper.New()
-
-x.SetDefault("ContentDir", "content")
-y.SetDefault("ContentDir", "foobar")
-
-//...
-```
-
-When working with multiple vipers, it is up to the user to keep track of the
-different vipers.
-
-
-## Q & A
-
-### Why is it called “Viper”?
-
-A: Viper is designed to be a [companion](http://en.wikipedia.org/wiki/Viper_(G.I._Joe))
-to [Cobra](https://github.com/spf13/cobra). While both can operate completely
-independently, together they make a powerful pair to handle much of your
-application foundation needs.
-
-### Why is it called “Cobra”?
-
-Is there a better name for a [commander](http://en.wikipedia.org/wiki/Cobra_Commander)?
-
-### Does Viper support case sensitive keys?
-
-**tl;dr:** No.
-
-Viper merges configuration from various sources, many of which are either case insensitive or uses different casing than the rest of the sources (eg. env vars).
-In order to provide the best experience when using multiple sources, the decision has been made to make all keys case insensitive.
-
-There has been several attempts to implement case sensitivity, but unfortunately it's not that trivial. We might take a stab at implementing it in [Viper v2](https://github.com/spf13/viper/issues/772), but despite the initial noise, it does not seem to be requested that much.
-
-You can vote for case sensitivity by filling out this feedback form: https://forms.gle/R6faU74qPRPAzchZ9
-
-### Is it safe to concurrently read and write to a viper?
-
-No, you will need to synchronize access to the viper yourself (for example by using the `sync` package). Concurrent reads and writes can cause a panic.
-
-## Troubleshooting
-
-See [TROUBLESHOOTING.md](TROUBLESHOOTING.md).
-
-## Development
-
-**For an optimal developer experience, it is recommended to install [Nix](https://nixos.org/download.html) and [direnv](https://direnv.net/docs/installation.html).**
-
-_Alternatively, install [Go](https://go.dev/dl/) on your computer then run `make deps` to install the rest of the dependencies._
-
-Run the test suite:
-
-```shell
-make test
-```
-
-Run linters:
-
-```shell
-make lint # pass -j option to run them in parallel
-```
-
-Some linter violations can automatically be fixed:
-
-```shell
-make fmt
-```
-
-## License
-
-The project is licensed under the [MIT License](LICENSE).
diff --git a/vendor/github.com/spf13/viper/TROUBLESHOOTING.md b/vendor/github.com/spf13/viper/TROUBLESHOOTING.md
deleted file mode 100644
index b68993d41..000000000
--- a/vendor/github.com/spf13/viper/TROUBLESHOOTING.md
+++ /dev/null
@@ -1,32 +0,0 @@
-# Troubleshooting
-
-## Unmarshaling doesn't work
-
-The most common reason for this issue is improper use of struct tags (eg. `yaml` or `json`). Viper uses [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) under the hood for unmarshaling values which uses `mapstructure` tags by default. Please refer to the library's documentation for using other struct tags.
-
-## Cannot find package
-
-Viper installation seems to fail a lot lately with the following (or a similar) error:
-
-```
-cannot find package "github.com/hashicorp/hcl/tree/hcl1" in any of:
-/usr/local/Cellar/go/1.15.7_1/libexec/src/github.com/hashicorp/hcl/tree/hcl1 (from $GOROOT)
-/Users/user/go/src/github.com/hashicorp/hcl/tree/hcl1 (from $GOPATH)
-```
-
-As the error message suggests, Go tries to look up dependencies in `GOPATH` mode (as it's commonly called) from the `GOPATH`.
-Viper opted to use [Go Modules](https://go.dev/wiki/Modules) to manage its dependencies. While in many cases the two methods are interchangeable, once a dependency releases new (major) versions, `GOPATH` mode is no longer able to decide which version to use, so it'll either use one that's already present or pick a version (usually the `master` branch).
-
-The solution is easy: switch to using Go Modules.
-Please refer to the [wiki](https://go.dev/wiki/Modules) on how to do that.
-
-**tl;dr* `export GO111MODULE=on`
-
-## Unquoted 'y' and 'n' characters get replaced with _true_ and _false_ when reading a YAML file
-
-This is a YAML 1.1 feature according to [go-yaml/yaml#740](https://github.com/go-yaml/yaml/issues/740).
-
-Potential solutions are:
-
-1. Quoting values resolved as boolean
-1. Upgrading to YAML v3 (for the time being this is possible by passing the `viper_yaml3` tag to your build)
diff --git a/vendor/github.com/spf13/viper/file.go b/vendor/github.com/spf13/viper/file.go
deleted file mode 100644
index a54fe5a7a..000000000
--- a/vendor/github.com/spf13/viper/file.go
+++ /dev/null
@@ -1,56 +0,0 @@
-//go:build !finder
-
-package viper
-
-import (
- "fmt"
- "os"
- "path/filepath"
-
- "github.com/spf13/afero"
-)
-
-// Search all configPaths for any config file.
-// Returns the first path that exists (and is a config file).
-func (v *Viper) findConfigFile() (string, error) {
- v.logger.Info("searching for config in paths", "paths", v.configPaths)
-
- for _, cp := range v.configPaths {
- file := v.searchInPath(cp)
- if file != "" {
- return file, nil
- }
- }
- return "", ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
-}
-
-func (v *Viper) searchInPath(in string) (filename string) {
- v.logger.Debug("searching for config in path", "path", in)
- for _, ext := range SupportedExts {
- v.logger.Debug("checking if file exists", "file", filepath.Join(in, v.configName+"."+ext))
- if b, _ := exists(v.fs, filepath.Join(in, v.configName+"."+ext)); b {
- v.logger.Debug("found file", "file", filepath.Join(in, v.configName+"."+ext))
- return filepath.Join(in, v.configName+"."+ext)
- }
- }
-
- if v.configType != "" {
- if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b {
- return filepath.Join(in, v.configName)
- }
- }
-
- return ""
-}
-
-// exists checks if file exists.
-func exists(fs afero.Fs, path string) (bool, error) {
- stat, err := fs.Stat(path)
- if err == nil {
- return !stat.IsDir(), nil
- }
- if os.IsNotExist(err) {
- return false, nil
- }
- return false, err
-}
diff --git a/vendor/github.com/spf13/viper/file_finder.go b/vendor/github.com/spf13/viper/file_finder.go
deleted file mode 100644
index d96a1bd22..000000000
--- a/vendor/github.com/spf13/viper/file_finder.go
+++ /dev/null
@@ -1,38 +0,0 @@
-//go:build finder
-
-package viper
-
-import (
- "fmt"
-
- "github.com/sagikazarmark/locafero"
-)
-
-// Search all configPaths for any config file.
-// Returns the first path that exists (and is a config file).
-func (v *Viper) findConfigFile() (string, error) {
- var names []string
-
- if v.configType != "" {
- names = locafero.NameWithOptionalExtensions(v.configName, SupportedExts...)
- } else {
- names = locafero.NameWithExtensions(v.configName, SupportedExts...)
- }
-
- finder := locafero.Finder{
- Paths: v.configPaths,
- Names: names,
- Type: locafero.FileTypeFile,
- }
-
- results, err := finder.Find(v.fs)
- if err != nil {
- return "", err
- }
-
- if len(results) == 0 {
- return "", ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
- }
-
- return results[0], nil
-}
diff --git a/vendor/github.com/spf13/viper/flags.go b/vendor/github.com/spf13/viper/flags.go
deleted file mode 100644
index de033ed58..000000000
--- a/vendor/github.com/spf13/viper/flags.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package viper
-
-import "github.com/spf13/pflag"
-
-// FlagValueSet is an interface that users can implement
-// to bind a set of flags to viper.
-type FlagValueSet interface {
- VisitAll(fn func(FlagValue))
-}
-
-// FlagValue is an interface that users can implement
-// to bind different flags to viper.
-type FlagValue interface {
- HasChanged() bool
- Name() string
- ValueString() string
- ValueType() string
-}
-
-// pflagValueSet is a wrapper around *pflag.ValueSet
-// that implements FlagValueSet.
-type pflagValueSet struct {
- flags *pflag.FlagSet
-}
-
-// VisitAll iterates over all *pflag.Flag inside the *pflag.FlagSet.
-func (p pflagValueSet) VisitAll(fn func(flag FlagValue)) {
- p.flags.VisitAll(func(flag *pflag.Flag) {
- fn(pflagValue{flag})
- })
-}
-
-// pflagValue is a wrapper around *pflag.flag
-// that implements FlagValue.
-type pflagValue struct {
- flag *pflag.Flag
-}
-
-// HasChanged returns whether the flag has changes or not.
-func (p pflagValue) HasChanged() bool {
- return p.flag.Changed
-}
-
-// Name returns the name of the flag.
-func (p pflagValue) Name() string {
- return p.flag.Name
-}
-
-// ValueString returns the value of the flag as a string.
-func (p pflagValue) ValueString() string {
- return p.flag.Value.String()
-}
-
-// ValueType returns the type of the flag as a string.
-func (p pflagValue) ValueType() string {
- return p.flag.Value.Type()
-}
diff --git a/vendor/github.com/spf13/viper/flake.lock b/vendor/github.com/spf13/viper/flake.lock
deleted file mode 100644
index 3840614fa..000000000
--- a/vendor/github.com/spf13/viper/flake.lock
+++ /dev/null
@@ -1,273 +0,0 @@
-{
- "nodes": {
- "devenv": {
- "inputs": {
- "flake-compat": "flake-compat",
- "nix": "nix",
- "nixpkgs": "nixpkgs",
- "pre-commit-hooks": "pre-commit-hooks"
- },
- "locked": {
- "lastModified": 1707817777,
- "narHash": "sha256-vHyIs1OULQ3/91wD6xOiuayfI71JXALGA5KLnDKAcy0=",
- "owner": "cachix",
- "repo": "devenv",
- "rev": "5a30b9e5ac7c6167e61b1f4193d5130bb9f8defa",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "repo": "devenv",
- "type": "github"
- }
- },
- "flake-compat": {
- "flake": false,
- "locked": {
- "lastModified": 1673956053,
- "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
- "owner": "edolstra",
- "repo": "flake-compat",
- "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
- "type": "github"
- },
- "original": {
- "owner": "edolstra",
- "repo": "flake-compat",
- "type": "github"
- }
- },
- "flake-parts": {
- "inputs": {
- "nixpkgs-lib": "nixpkgs-lib"
- },
- "locked": {
- "lastModified": 1706830856,
- "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "type": "github"
- }
- },
- "flake-utils": {
- "inputs": {
- "systems": "systems"
- },
- "locked": {
- "lastModified": 1685518550,
- "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "gitignore": {
- "inputs": {
- "nixpkgs": [
- "devenv",
- "pre-commit-hooks",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1660459072,
- "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
- "owner": "hercules-ci",
- "repo": "gitignore.nix",
- "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "gitignore.nix",
- "type": "github"
- }
- },
- "lowdown-src": {
- "flake": false,
- "locked": {
- "lastModified": 1633514407,
- "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=",
- "owner": "kristapsdz",
- "repo": "lowdown",
- "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8",
- "type": "github"
- },
- "original": {
- "owner": "kristapsdz",
- "repo": "lowdown",
- "type": "github"
- }
- },
- "nix": {
- "inputs": {
- "lowdown-src": "lowdown-src",
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ],
- "nixpkgs-regression": "nixpkgs-regression"
- },
- "locked": {
- "lastModified": 1676545802,
- "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=",
- "owner": "domenkozar",
- "repo": "nix",
- "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f",
- "type": "github"
- },
- "original": {
- "owner": "domenkozar",
- "ref": "relaxed-flakes",
- "repo": "nix",
- "type": "github"
- }
- },
- "nixpkgs": {
- "locked": {
- "lastModified": 1678875422,
- "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixpkgs-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs-lib": {
- "locked": {
- "dir": "lib",
- "lastModified": 1706550542,
- "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
- "type": "github"
- },
- "original": {
- "dir": "lib",
- "owner": "NixOS",
- "ref": "nixos-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs-regression": {
- "locked": {
- "lastModified": 1643052045,
- "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
- "type": "github"
- }
- },
- "nixpkgs-stable": {
- "locked": {
- "lastModified": 1685801374,
- "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixos-23.05",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "nixpkgs_2": {
- "locked": {
- "lastModified": 1707939175,
- "narHash": "sha256-D1xan0lgxbmXDyzVqXTiSYHLmAMrMRdD+alKzEO/p3w=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "f7e8132daca31b1e3859ac0fb49741754375ac3d",
- "type": "github"
- },
- "original": {
- "owner": "NixOS",
- "ref": "nixpkgs-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "pre-commit-hooks": {
- "inputs": {
- "flake-compat": [
- "devenv",
- "flake-compat"
- ],
- "flake-utils": "flake-utils",
- "gitignore": "gitignore",
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ],
- "nixpkgs-stable": "nixpkgs-stable"
- },
- "locked": {
- "lastModified": 1704725188,
- "narHash": "sha256-qq8NbkhRZF1vVYQFt1s8Mbgo8knj+83+QlL5LBnYGpI=",
- "owner": "cachix",
- "repo": "pre-commit-hooks.nix",
- "rev": "ea96f0c05924341c551a797aaba8126334c505d2",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "repo": "pre-commit-hooks.nix",
- "type": "github"
- }
- },
- "root": {
- "inputs": {
- "devenv": "devenv",
- "flake-parts": "flake-parts",
- "nixpkgs": "nixpkgs_2"
- }
- },
- "systems": {
- "locked": {
- "lastModified": 1681028828,
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
- "owner": "nix-systems",
- "repo": "default",
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
- "type": "github"
- },
- "original": {
- "owner": "nix-systems",
- "repo": "default",
- "type": "github"
- }
- }
- },
- "root": "root",
- "version": 7
-}
diff --git a/vendor/github.com/spf13/viper/flake.nix b/vendor/github.com/spf13/viper/flake.nix
deleted file mode 100644
index 0230668cf..000000000
--- a/vendor/github.com/spf13/viper/flake.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- description = "Viper";
-
- inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- flake-parts.url = "github:hercules-ci/flake-parts";
- devenv.url = "github:cachix/devenv";
- };
-
- outputs = inputs@{ flake-parts, ... }:
- flake-parts.lib.mkFlake { inherit inputs; } {
- imports = [
- inputs.devenv.flakeModule
- ];
-
- systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
-
- perSystem = { config, self', inputs', pkgs, system, ... }: rec {
- devenv.shells = {
- default = {
- languages = {
- go.enable = true;
- go.package = pkgs.go_1_22;
- };
-
- pre-commit.hooks = {
- nixpkgs-fmt.enable = true;
- yamllint.enable = true;
- };
-
- packages = with pkgs; [
- gnumake
-
- golangci-lint
- yamllint
- ];
-
- scripts = {
- versions.exec = ''
- go version
- golangci-lint version
- '';
- };
-
- enterShell = ''
- versions
- '';
-
- # https://github.com/cachix/devenv/issues/528#issuecomment-1556108767
- containers = pkgs.lib.mkForce { };
- };
-
- ci = devenv.shells.default;
- };
- };
- };
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/decoder.go b/vendor/github.com/spf13/viper/internal/encoding/decoder.go
deleted file mode 100644
index 8a7b1dbc9..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/decoder.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package encoding
-
-import (
- "sync"
-)
-
-// Decoder decodes the contents of b into v.
-// It's primarily used for decoding contents of a file into a map[string]any.
-type Decoder interface {
- Decode(b []byte, v map[string]any) error
-}
-
-const (
- // ErrDecoderNotFound is returned when there is no decoder registered for a format.
- ErrDecoderNotFound = encodingError("decoder not found for this format")
-
- // ErrDecoderFormatAlreadyRegistered is returned when an decoder is already registered for a format.
- ErrDecoderFormatAlreadyRegistered = encodingError("decoder already registered for this format")
-)
-
-// DecoderRegistry can choose an appropriate Decoder based on the provided format.
-type DecoderRegistry struct {
- decoders map[string]Decoder
-
- mu sync.RWMutex
-}
-
-// NewDecoderRegistry returns a new, initialized DecoderRegistry.
-func NewDecoderRegistry() *DecoderRegistry {
- return &DecoderRegistry{
- decoders: make(map[string]Decoder),
- }
-}
-
-// RegisterDecoder registers a Decoder for a format.
-// Registering a Decoder for an already existing format is not supported.
-func (e *DecoderRegistry) RegisterDecoder(format string, enc Decoder) error {
- e.mu.Lock()
- defer e.mu.Unlock()
-
- if _, ok := e.decoders[format]; ok {
- return ErrDecoderFormatAlreadyRegistered
- }
-
- e.decoders[format] = enc
-
- return nil
-}
-
-// Decode calls the underlying Decoder based on the format.
-func (e *DecoderRegistry) Decode(format string, b []byte, v map[string]any) error {
- e.mu.RLock()
- decoder, ok := e.decoders[format]
- e.mu.RUnlock()
-
- if !ok {
- return ErrDecoderNotFound
- }
-
- return decoder.Decode(b, v)
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/dotenv/codec.go b/vendor/github.com/spf13/viper/internal/encoding/dotenv/codec.go
deleted file mode 100644
index 3ebc76f02..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/dotenv/codec.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package dotenv
-
-import (
- "bytes"
- "fmt"
- "sort"
- "strings"
-
- "github.com/subosito/gotenv"
-)
-
-const keyDelimiter = "_"
-
-// Codec implements the encoding.Encoder and encoding.Decoder interfaces for encoding data containing environment variables
-// (commonly called as dotenv format).
-type Codec struct{}
-
-func (Codec) Encode(v map[string]any) ([]byte, error) {
- flattened := map[string]any{}
-
- flattened = flattenAndMergeMap(flattened, v, "", keyDelimiter)
-
- keys := make([]string, 0, len(flattened))
-
- for key := range flattened {
- keys = append(keys, key)
- }
-
- sort.Strings(keys)
-
- var buf bytes.Buffer
-
- for _, key := range keys {
- _, err := buf.WriteString(fmt.Sprintf("%v=%v\n", strings.ToUpper(key), flattened[key]))
- if err != nil {
- return nil, err
- }
- }
-
- return buf.Bytes(), nil
-}
-
-func (Codec) Decode(b []byte, v map[string]any) error {
- var buf bytes.Buffer
-
- _, err := buf.Write(b)
- if err != nil {
- return err
- }
-
- env, err := gotenv.StrictParse(&buf)
- if err != nil {
- return err
- }
-
- for key, value := range env {
- v[key] = value
- }
-
- return nil
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/dotenv/map_utils.go b/vendor/github.com/spf13/viper/internal/encoding/dotenv/map_utils.go
deleted file mode 100644
index 8bfe0a9de..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/dotenv/map_utils.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package dotenv
-
-import (
- "strings"
-
- "github.com/spf13/cast"
-)
-
-// flattenAndMergeMap recursively flattens the given map into a new map
-// Code is based on the function with the same name in the main package.
-// TODO: move it to a common place.
-func flattenAndMergeMap(shadow, m map[string]any, prefix, delimiter string) map[string]any {
- if shadow != nil && prefix != "" && shadow[prefix] != nil {
- // prefix is shadowed => nothing more to flatten
- return shadow
- }
- if shadow == nil {
- shadow = make(map[string]any)
- }
-
- var m2 map[string]any
- if prefix != "" {
- prefix += delimiter
- }
- for k, val := range m {
- fullKey := prefix + k
- switch val := val.(type) {
- case map[string]any:
- m2 = val
- case map[any]any:
- m2 = cast.ToStringMap(val)
- default:
- // immediate value
- shadow[strings.ToLower(fullKey)] = val
- continue
- }
- // recursively merge to shadow map
- shadow = flattenAndMergeMap(shadow, m2, fullKey, delimiter)
- }
- return shadow
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/encoder.go b/vendor/github.com/spf13/viper/internal/encoding/encoder.go
deleted file mode 100644
index 659585962..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/encoder.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package encoding
-
-import (
- "sync"
-)
-
-// Encoder encodes the contents of v into a byte representation.
-// It's primarily used for encoding a map[string]any into a file format.
-type Encoder interface {
- Encode(v map[string]any) ([]byte, error)
-}
-
-const (
- // ErrEncoderNotFound is returned when there is no encoder registered for a format.
- ErrEncoderNotFound = encodingError("encoder not found for this format")
-
- // ErrEncoderFormatAlreadyRegistered is returned when an encoder is already registered for a format.
- ErrEncoderFormatAlreadyRegistered = encodingError("encoder already registered for this format")
-)
-
-// EncoderRegistry can choose an appropriate Encoder based on the provided format.
-type EncoderRegistry struct {
- encoders map[string]Encoder
-
- mu sync.RWMutex
-}
-
-// NewEncoderRegistry returns a new, initialized EncoderRegistry.
-func NewEncoderRegistry() *EncoderRegistry {
- return &EncoderRegistry{
- encoders: make(map[string]Encoder),
- }
-}
-
-// RegisterEncoder registers an Encoder for a format.
-// Registering a Encoder for an already existing format is not supported.
-func (e *EncoderRegistry) RegisterEncoder(format string, enc Encoder) error {
- e.mu.Lock()
- defer e.mu.Unlock()
-
- if _, ok := e.encoders[format]; ok {
- return ErrEncoderFormatAlreadyRegistered
- }
-
- e.encoders[format] = enc
-
- return nil
-}
-
-func (e *EncoderRegistry) Encode(format string, v map[string]any) ([]byte, error) {
- e.mu.RLock()
- encoder, ok := e.encoders[format]
- e.mu.RUnlock()
-
- if !ok {
- return nil, ErrEncoderNotFound
- }
-
- return encoder.Encode(v)
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/error.go b/vendor/github.com/spf13/viper/internal/encoding/error.go
deleted file mode 100644
index e4cde02d7..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/error.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package encoding
-
-type encodingError string
-
-func (e encodingError) Error() string {
- return string(e)
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/hcl/codec.go b/vendor/github.com/spf13/viper/internal/encoding/hcl/codec.go
deleted file mode 100644
index d7fa8a1b7..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/hcl/codec.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package hcl
-
-import (
- "bytes"
- "encoding/json"
-
- "github.com/hashicorp/hcl"
- "github.com/hashicorp/hcl/hcl/printer"
-)
-
-// Codec implements the encoding.Encoder and encoding.Decoder interfaces for HCL encoding.
-// TODO: add printer config to the codec?
-type Codec struct{}
-
-func (Codec) Encode(v map[string]any) ([]byte, error) {
- b, err := json.Marshal(v)
- if err != nil {
- return nil, err
- }
-
- // TODO: use printer.Format? Is the trailing newline an issue?
-
- ast, err := hcl.Parse(string(b))
- if err != nil {
- return nil, err
- }
-
- var buf bytes.Buffer
-
- err = printer.Fprint(&buf, ast.Node)
- if err != nil {
- return nil, err
- }
-
- return buf.Bytes(), nil
-}
-
-func (Codec) Decode(b []byte, v map[string]any) error {
- return hcl.Unmarshal(b, &v)
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/ini/codec.go b/vendor/github.com/spf13/viper/internal/encoding/ini/codec.go
deleted file mode 100644
index d91cf59d2..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/ini/codec.go
+++ /dev/null
@@ -1,99 +0,0 @@
-package ini
-
-import (
- "bytes"
- "sort"
- "strings"
-
- "github.com/spf13/cast"
- "gopkg.in/ini.v1"
-)
-
-// LoadOptions contains all customized options used for load data source(s).
-// This type is added here for convenience: this way consumers can import a single package called "ini".
-type LoadOptions = ini.LoadOptions
-
-// Codec implements the encoding.Encoder and encoding.Decoder interfaces for INI encoding.
-type Codec struct {
- KeyDelimiter string
- LoadOptions LoadOptions
-}
-
-func (c Codec) Encode(v map[string]any) ([]byte, error) {
- cfg := ini.Empty()
- ini.PrettyFormat = false
-
- flattened := map[string]any{}
-
- flattened = flattenAndMergeMap(flattened, v, "", c.keyDelimiter())
-
- keys := make([]string, 0, len(flattened))
-
- for key := range flattened {
- keys = append(keys, key)
- }
-
- sort.Strings(keys)
-
- for _, key := range keys {
- sectionName, keyName := "", key
-
- lastSep := strings.LastIndex(key, ".")
- if lastSep != -1 {
- sectionName = key[:(lastSep)]
- keyName = key[(lastSep + 1):]
- }
-
- // TODO: is this a good idea?
- if sectionName == "default" {
- sectionName = ""
- }
-
- cfg.Section(sectionName).Key(keyName).SetValue(cast.ToString(flattened[key]))
- }
-
- var buf bytes.Buffer
-
- _, err := cfg.WriteTo(&buf)
- if err != nil {
- return nil, err
- }
-
- return buf.Bytes(), nil
-}
-
-func (c Codec) Decode(b []byte, v map[string]any) error {
- cfg := ini.Empty(c.LoadOptions)
-
- err := cfg.Append(b)
- if err != nil {
- return err
- }
-
- sections := cfg.Sections()
-
- for i := 0; i < len(sections); i++ {
- section := sections[i]
- keys := section.Keys()
-
- for j := 0; j < len(keys); j++ {
- key := keys[j]
- value := cfg.Section(section.Name()).Key(key.Name()).String()
-
- deepestMap := deepSearch(v, strings.Split(section.Name(), c.keyDelimiter()))
-
- // set innermost value
- deepestMap[key.Name()] = value
- }
- }
-
- return nil
-}
-
-func (c Codec) keyDelimiter() string {
- if c.KeyDelimiter == "" {
- return "."
- }
-
- return c.KeyDelimiter
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/ini/map_utils.go b/vendor/github.com/spf13/viper/internal/encoding/ini/map_utils.go
deleted file mode 100644
index 490ab594e..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/ini/map_utils.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package ini
-
-import (
- "strings"
-
- "github.com/spf13/cast"
-)
-
-// THIS CODE IS COPIED HERE: IT SHOULD NOT BE MODIFIED
-// AT SOME POINT IT WILL BE MOVED TO A COMMON PLACE
-// deepSearch scans deep maps, following the key indexes listed in the
-// sequence "path".
-// The last value is expected to be another map, and is returned.
-//
-// In case intermediate keys do not exist, or map to a non-map value,
-// a new map is created and inserted, and the search continues from there:
-// the initial map "m" may be modified!
-func deepSearch(m map[string]any, path []string) map[string]any {
- for _, k := range path {
- m2, ok := m[k]
- if !ok {
- // intermediate key does not exist
- // => create it and continue from there
- m3 := make(map[string]any)
- m[k] = m3
- m = m3
- continue
- }
- m3, ok := m2.(map[string]any)
- if !ok {
- // intermediate key is a value
- // => replace with a new map
- m3 = make(map[string]any)
- m[k] = m3
- }
- // continue search from here
- m = m3
- }
- return m
-}
-
-// flattenAndMergeMap recursively flattens the given map into a new map
-// Code is based on the function with the same name in the main package.
-// TODO: move it to a common place.
-func flattenAndMergeMap(shadow, m map[string]any, prefix, delimiter string) map[string]any {
- if shadow != nil && prefix != "" && shadow[prefix] != nil {
- // prefix is shadowed => nothing more to flatten
- return shadow
- }
- if shadow == nil {
- shadow = make(map[string]any)
- }
-
- var m2 map[string]any
- if prefix != "" {
- prefix += delimiter
- }
- for k, val := range m {
- fullKey := prefix + k
- switch val := val.(type) {
- case map[string]any:
- m2 = val
- case map[any]any:
- m2 = cast.ToStringMap(val)
- default:
- // immediate value
- shadow[strings.ToLower(fullKey)] = val
- continue
- }
- // recursively merge to shadow map
- shadow = flattenAndMergeMap(shadow, m2, fullKey, delimiter)
- }
- return shadow
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/javaproperties/codec.go b/vendor/github.com/spf13/viper/internal/encoding/javaproperties/codec.go
deleted file mode 100644
index e92e5172c..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/javaproperties/codec.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package javaproperties
-
-import (
- "bytes"
- "sort"
- "strings"
-
- "github.com/magiconair/properties"
- "github.com/spf13/cast"
-)
-
-// Codec implements the encoding.Encoder and encoding.Decoder interfaces for Java properties encoding.
-type Codec struct {
- KeyDelimiter string
-
- // Store read properties on the object so that we can write back in order with comments.
- // This will only be used if the configuration read is a properties file.
- // TODO: drop this feature in v2
- // TODO: make use of the global properties object optional
- Properties *properties.Properties
-}
-
-func (c *Codec) Encode(v map[string]any) ([]byte, error) {
- if c.Properties == nil {
- c.Properties = properties.NewProperties()
- }
-
- flattened := map[string]any{}
-
- flattened = flattenAndMergeMap(flattened, v, "", c.keyDelimiter())
-
- keys := make([]string, 0, len(flattened))
-
- for key := range flattened {
- keys = append(keys, key)
- }
-
- sort.Strings(keys)
-
- for _, key := range keys {
- _, _, err := c.Properties.Set(key, cast.ToString(flattened[key]))
- if err != nil {
- return nil, err
- }
- }
-
- var buf bytes.Buffer
-
- _, err := c.Properties.WriteComment(&buf, "#", properties.UTF8)
- if err != nil {
- return nil, err
- }
-
- return buf.Bytes(), nil
-}
-
-func (c *Codec) Decode(b []byte, v map[string]any) error {
- var err error
- c.Properties, err = properties.Load(b, properties.UTF8)
- if err != nil {
- return err
- }
-
- for _, key := range c.Properties.Keys() {
- // ignore existence check: we know it's there
- value, _ := c.Properties.Get(key)
-
- // recursively build nested maps
- path := strings.Split(key, c.keyDelimiter())
- lastKey := strings.ToLower(path[len(path)-1])
- deepestMap := deepSearch(v, path[0:len(path)-1])
-
- // set innermost value
- deepestMap[lastKey] = value
- }
-
- return nil
-}
-
-func (c Codec) keyDelimiter() string {
- if c.KeyDelimiter == "" {
- return "."
- }
-
- return c.KeyDelimiter
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/javaproperties/map_utils.go b/vendor/github.com/spf13/viper/internal/encoding/javaproperties/map_utils.go
deleted file mode 100644
index 6e1aff223..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/javaproperties/map_utils.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package javaproperties
-
-import (
- "strings"
-
- "github.com/spf13/cast"
-)
-
-// THIS CODE IS COPIED HERE: IT SHOULD NOT BE MODIFIED
-// AT SOME POINT IT WILL BE MOVED TO A COMMON PLACE
-// deepSearch scans deep maps, following the key indexes listed in the
-// sequence "path".
-// The last value is expected to be another map, and is returned.
-//
-// In case intermediate keys do not exist, or map to a non-map value,
-// a new map is created and inserted, and the search continues from there:
-// the initial map "m" may be modified!
-func deepSearch(m map[string]any, path []string) map[string]any {
- for _, k := range path {
- m2, ok := m[k]
- if !ok {
- // intermediate key does not exist
- // => create it and continue from there
- m3 := make(map[string]any)
- m[k] = m3
- m = m3
- continue
- }
- m3, ok := m2.(map[string]any)
- if !ok {
- // intermediate key is a value
- // => replace with a new map
- m3 = make(map[string]any)
- m[k] = m3
- }
- // continue search from here
- m = m3
- }
- return m
-}
-
-// flattenAndMergeMap recursively flattens the given map into a new map
-// Code is based on the function with the same name in the main package.
-// TODO: move it to a common place.
-func flattenAndMergeMap(shadow, m map[string]any, prefix, delimiter string) map[string]any {
- if shadow != nil && prefix != "" && shadow[prefix] != nil {
- // prefix is shadowed => nothing more to flatten
- return shadow
- }
- if shadow == nil {
- shadow = make(map[string]any)
- }
-
- var m2 map[string]any
- if prefix != "" {
- prefix += delimiter
- }
- for k, val := range m {
- fullKey := prefix + k
- switch val := val.(type) {
- case map[string]any:
- m2 = val
- case map[any]any:
- m2 = cast.ToStringMap(val)
- default:
- // immediate value
- shadow[strings.ToLower(fullKey)] = val
- continue
- }
- // recursively merge to shadow map
- shadow = flattenAndMergeMap(shadow, m2, fullKey, delimiter)
- }
- return shadow
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/json/codec.go b/vendor/github.com/spf13/viper/internal/encoding/json/codec.go
deleted file mode 100644
index da7546b5a..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/json/codec.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package json
-
-import (
- "encoding/json"
-)
-
-// Codec implements the encoding.Encoder and encoding.Decoder interfaces for JSON encoding.
-type Codec struct{}
-
-func (Codec) Encode(v map[string]any) ([]byte, error) {
- // TODO: expose prefix and indent in the Codec as setting?
- return json.MarshalIndent(v, "", " ")
-}
-
-func (Codec) Decode(b []byte, v map[string]any) error {
- return json.Unmarshal(b, &v)
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go b/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go
deleted file mode 100644
index c70aa8d28..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package toml
-
-import (
- "github.com/pelletier/go-toml/v2"
-)
-
-// Codec implements the encoding.Encoder and encoding.Decoder interfaces for TOML encoding.
-type Codec struct{}
-
-func (Codec) Encode(v map[string]any) ([]byte, error) {
- return toml.Marshal(v)
-}
-
-func (Codec) Decode(b []byte, v map[string]any) error {
- return toml.Unmarshal(b, &v)
-}
diff --git a/vendor/github.com/spf13/viper/internal/encoding/yaml/codec.go b/vendor/github.com/spf13/viper/internal/encoding/yaml/codec.go
deleted file mode 100644
index 036879249..000000000
--- a/vendor/github.com/spf13/viper/internal/encoding/yaml/codec.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package yaml
-
-import "gopkg.in/yaml.v3"
-
-// Codec implements the encoding.Encoder and encoding.Decoder interfaces for YAML encoding.
-type Codec struct{}
-
-func (Codec) Encode(v map[string]any) ([]byte, error) {
- return yaml.Marshal(v)
-}
-
-func (Codec) Decode(b []byte, v map[string]any) error {
- return yaml.Unmarshal(b, &v)
-}
diff --git a/vendor/github.com/spf13/viper/internal/features/bind_struct.go b/vendor/github.com/spf13/viper/internal/features/bind_struct.go
deleted file mode 100644
index 89302c216..000000000
--- a/vendor/github.com/spf13/viper/internal/features/bind_struct.go
+++ /dev/null
@@ -1,5 +0,0 @@
-//go:build viper_bind_struct
-
-package features
-
-const BindStruct = true
diff --git a/vendor/github.com/spf13/viper/internal/features/bind_struct_default.go b/vendor/github.com/spf13/viper/internal/features/bind_struct_default.go
deleted file mode 100644
index edfaf73b6..000000000
--- a/vendor/github.com/spf13/viper/internal/features/bind_struct_default.go
+++ /dev/null
@@ -1,5 +0,0 @@
-//go:build !viper_bind_struct
-
-package features
-
-const BindStruct = false
diff --git a/vendor/github.com/spf13/viper/logger.go b/vendor/github.com/spf13/viper/logger.go
deleted file mode 100644
index 8938053b3..000000000
--- a/vendor/github.com/spf13/viper/logger.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package viper
-
-import (
- "context"
-
- slog "github.com/sagikazarmark/slog-shim"
-)
-
-// Logger is a unified interface for various logging use cases and practices, including:
-// - leveled logging
-// - structured logging
-//
-// Deprecated: use `log/slog` instead.
-type Logger interface {
- // Trace logs a Trace event.
- //
- // Even more fine-grained information than Debug events.
- // Loggers not supporting this level should fall back to Debug.
- Trace(msg string, keyvals ...any)
-
- // Debug logs a Debug event.
- //
- // A verbose series of information events.
- // They are useful when debugging the system.
- Debug(msg string, keyvals ...any)
-
- // Info logs an Info event.
- //
- // General information about what's happening inside the system.
- Info(msg string, keyvals ...any)
-
- // Warn logs a Warn(ing) event.
- //
- // Non-critical events that should be looked at.
- Warn(msg string, keyvals ...any)
-
- // Error logs an Error event.
- //
- // Critical events that require immediate attention.
- // Loggers commonly provide Fatal and Panic levels above Error level,
- // but exiting and panicking is out of scope for a logging library.
- Error(msg string, keyvals ...any)
-}
-
-// WithLogger sets a custom logger.
-func WithLogger(l *slog.Logger) Option {
- return optionFunc(func(v *Viper) {
- v.logger = l
- })
-}
-
-type discardHandler struct{}
-
-func (n *discardHandler) Enabled(_ context.Context, _ slog.Level) bool {
- return false
-}
-
-func (n *discardHandler) Handle(_ context.Context, _ slog.Record) error {
- return nil
-}
-
-func (n *discardHandler) WithAttrs(_ []slog.Attr) slog.Handler {
- return n
-}
-
-func (n *discardHandler) WithGroup(_ string) slog.Handler {
- return n
-}
diff --git a/vendor/github.com/spf13/viper/util.go b/vendor/github.com/spf13/viper/util.go
deleted file mode 100644
index 117c6ac31..000000000
--- a/vendor/github.com/spf13/viper/util.go
+++ /dev/null
@@ -1,223 +0,0 @@
-// Copyright © 2014 Steve Francia .
-//
-// Use of this source code is governed by an MIT-style
-// license that can be found in the LICENSE file.
-
-// Viper is a application configuration system.
-// It believes that applications can be configured a variety of ways
-// via flags, ENVIRONMENT variables, configuration files retrieved
-// from the file system, or a remote key/value store.
-
-package viper
-
-import (
- "fmt"
- "os"
- "path/filepath"
- "runtime"
- "strings"
- "unicode"
-
- slog "github.com/sagikazarmark/slog-shim"
- "github.com/spf13/cast"
-)
-
-// ConfigParseError denotes failing to parse configuration file.
-type ConfigParseError struct {
- err error
-}
-
-// Error returns the formatted configuration error.
-func (pe ConfigParseError) Error() string {
- return fmt.Sprintf("While parsing config: %s", pe.err.Error())
-}
-
-// Unwrap returns the wrapped error.
-func (pe ConfigParseError) Unwrap() error {
- return pe.err
-}
-
-// toCaseInsensitiveValue checks if the value is a map;
-// if so, create a copy and lower-case the keys recursively.
-func toCaseInsensitiveValue(value any) any {
- switch v := value.(type) {
- case map[any]any:
- value = copyAndInsensitiviseMap(cast.ToStringMap(v))
- case map[string]any:
- value = copyAndInsensitiviseMap(v)
- }
-
- return value
-}
-
-// copyAndInsensitiviseMap behaves like insensitiviseMap, but creates a copy of
-// any map it makes case insensitive.
-func copyAndInsensitiviseMap(m map[string]any) map[string]any {
- nm := make(map[string]any)
-
- for key, val := range m {
- lkey := strings.ToLower(key)
- switch v := val.(type) {
- case map[any]any:
- nm[lkey] = copyAndInsensitiviseMap(cast.ToStringMap(v))
- case map[string]any:
- nm[lkey] = copyAndInsensitiviseMap(v)
- default:
- nm[lkey] = v
- }
- }
-
- return nm
-}
-
-func insensitiviseVal(val any) any {
- switch v := val.(type) {
- case map[any]any:
- // nested map: cast and recursively insensitivise
- val = cast.ToStringMap(val)
- insensitiviseMap(val.(map[string]any))
- case map[string]any:
- // nested map: recursively insensitivise
- insensitiviseMap(v)
- case []any:
- // nested array: recursively insensitivise
- insensitiveArray(v)
- }
- return val
-}
-
-func insensitiviseMap(m map[string]any) {
- for key, val := range m {
- val = insensitiviseVal(val)
- lower := strings.ToLower(key)
- if key != lower {
- // remove old key (not lower-cased)
- delete(m, key)
- }
- // update map
- m[lower] = val
- }
-}
-
-func insensitiveArray(a []any) {
- for i, val := range a {
- a[i] = insensitiviseVal(val)
- }
-}
-
-func absPathify(logger *slog.Logger, inPath string) string {
- logger.Info("trying to resolve absolute path", "path", inPath)
-
- if inPath == "$HOME" || strings.HasPrefix(inPath, "$HOME"+string(os.PathSeparator)) {
- inPath = userHomeDir() + inPath[5:]
- }
-
- inPath = os.ExpandEnv(inPath)
-
- if filepath.IsAbs(inPath) {
- return filepath.Clean(inPath)
- }
-
- p, err := filepath.Abs(inPath)
- if err == nil {
- return filepath.Clean(p)
- }
-
- logger.Error(fmt.Errorf("could not discover absolute path: %w", err).Error())
-
- return ""
-}
-
-func stringInSlice(a string, list []string) bool {
- for _, b := range list {
- if b == a {
- return true
- }
- }
- return false
-}
-
-func userHomeDir() string {
- if runtime.GOOS == "windows" {
- home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
- if home == "" {
- home = os.Getenv("USERPROFILE")
- }
- return home
- }
- return os.Getenv("HOME")
-}
-
-func safeMul(a, b uint) uint {
- c := a * b
- if a > 1 && b > 1 && c/b != a {
- return 0
- }
- return c
-}
-
-// parseSizeInBytes converts strings like 1GB or 12 mb into an unsigned integer number of bytes.
-func parseSizeInBytes(sizeStr string) uint {
- sizeStr = strings.TrimSpace(sizeStr)
- lastChar := len(sizeStr) - 1
- multiplier := uint(1)
-
- if lastChar > 0 {
- if sizeStr[lastChar] == 'b' || sizeStr[lastChar] == 'B' {
- if lastChar > 1 {
- switch unicode.ToLower(rune(sizeStr[lastChar-1])) {
- case 'k':
- multiplier = 1 << 10
- sizeStr = strings.TrimSpace(sizeStr[:lastChar-1])
- case 'm':
- multiplier = 1 << 20
- sizeStr = strings.TrimSpace(sizeStr[:lastChar-1])
- case 'g':
- multiplier = 1 << 30
- sizeStr = strings.TrimSpace(sizeStr[:lastChar-1])
- default:
- multiplier = 1
- sizeStr = strings.TrimSpace(sizeStr[:lastChar])
- }
- }
- }
- }
-
- size := cast.ToInt(sizeStr)
- if size < 0 {
- size = 0
- }
-
- return safeMul(uint(size), multiplier)
-}
-
-// deepSearch scans deep maps, following the key indexes listed in the
-// sequence "path".
-// The last value is expected to be another map, and is returned.
-//
-// In case intermediate keys do not exist, or map to a non-map value,
-// a new map is created and inserted, and the search continues from there:
-// the initial map "m" may be modified!
-func deepSearch(m map[string]any, path []string) map[string]any {
- for _, k := range path {
- m2, ok := m[k]
- if !ok {
- // intermediate key does not exist
- // => create it and continue from there
- m3 := make(map[string]any)
- m[k] = m3
- m = m3
- continue
- }
- m3, ok := m2.(map[string]any)
- if !ok {
- // intermediate key is a value
- // => replace with a new map
- m3 = make(map[string]any)
- m[k] = m3
- }
- // continue search from here
- m = m3
- }
- return m
-}
diff --git a/vendor/github.com/spf13/viper/viper.go b/vendor/github.com/spf13/viper/viper.go
deleted file mode 100644
index da68d9944..000000000
--- a/vendor/github.com/spf13/viper/viper.go
+++ /dev/null
@@ -1,2252 +0,0 @@
-// Copyright © 2014 Steve Francia .
-//
-// Use of this source code is governed by an MIT-style
-// license that can be found in the LICENSE file.
-
-// Viper is an application configuration system.
-// It believes that applications can be configured a variety of ways
-// via flags, ENVIRONMENT variables, configuration files retrieved
-// from the file system, or a remote key/value store.
-
-// Each item takes precedence over the item below it:
-
-// overrides
-// flag
-// env
-// config
-// key/value store
-// default
-
-package viper
-
-import (
- "bytes"
- "encoding/csv"
- "errors"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "reflect"
- "strconv"
- "strings"
- "sync"
- "time"
-
- "github.com/fsnotify/fsnotify"
- "github.com/mitchellh/mapstructure"
- slog "github.com/sagikazarmark/slog-shim"
- "github.com/spf13/afero"
- "github.com/spf13/cast"
- "github.com/spf13/pflag"
-
- "github.com/spf13/viper/internal/encoding"
- "github.com/spf13/viper/internal/encoding/dotenv"
- "github.com/spf13/viper/internal/encoding/hcl"
- "github.com/spf13/viper/internal/encoding/ini"
- "github.com/spf13/viper/internal/encoding/javaproperties"
- "github.com/spf13/viper/internal/encoding/json"
- "github.com/spf13/viper/internal/encoding/toml"
- "github.com/spf13/viper/internal/encoding/yaml"
- "github.com/spf13/viper/internal/features"
-)
-
-// ConfigMarshalError happens when failing to marshal the configuration.
-type ConfigMarshalError struct {
- err error
-}
-
-// Error returns the formatted configuration error.
-func (e ConfigMarshalError) Error() string {
- return fmt.Sprintf("While marshaling config: %s", e.err.Error())
-}
-
-var v *Viper
-
-type RemoteResponse struct {
- Value []byte
- Error error
-}
-
-func init() {
- v = New()
-}
-
-type remoteConfigFactory interface {
- Get(rp RemoteProvider) (io.Reader, error)
- Watch(rp RemoteProvider) (io.Reader, error)
- WatchChannel(rp RemoteProvider) (<-chan *RemoteResponse, chan bool)
-}
-
-// RemoteConfig is optional, see the remote package.
-var RemoteConfig remoteConfigFactory
-
-// UnsupportedConfigError denotes encountering an unsupported
-// configuration filetype.
-type UnsupportedConfigError string
-
-// Error returns the formatted configuration error.
-func (str UnsupportedConfigError) Error() string {
- return fmt.Sprintf("Unsupported Config Type %q", string(str))
-}
-
-// UnsupportedRemoteProviderError denotes encountering an unsupported remote
-// provider. Currently only etcd and Consul are supported.
-type UnsupportedRemoteProviderError string
-
-// Error returns the formatted remote provider error.
-func (str UnsupportedRemoteProviderError) Error() string {
- return fmt.Sprintf("Unsupported Remote Provider Type %q", string(str))
-}
-
-// RemoteConfigError denotes encountering an error while trying to
-// pull the configuration from the remote provider.
-type RemoteConfigError string
-
-// Error returns the formatted remote provider error.
-func (rce RemoteConfigError) Error() string {
- return fmt.Sprintf("Remote Configurations Error: %s", string(rce))
-}
-
-// ConfigFileNotFoundError denotes failing to find configuration file.
-type ConfigFileNotFoundError struct {
- name, locations string
-}
-
-// Error returns the formatted configuration error.
-func (fnfe ConfigFileNotFoundError) Error() string {
- return fmt.Sprintf("Config File %q Not Found in %q", fnfe.name, fnfe.locations)
-}
-
-// ConfigFileAlreadyExistsError denotes failure to write new configuration file.
-type ConfigFileAlreadyExistsError string
-
-// Error returns the formatted error when configuration already exists.
-func (faee ConfigFileAlreadyExistsError) Error() string {
- return fmt.Sprintf("Config File %q Already Exists", string(faee))
-}
-
-// A DecoderConfigOption can be passed to viper.Unmarshal to configure
-// mapstructure.DecoderConfig options.
-type DecoderConfigOption func(*mapstructure.DecoderConfig)
-
-// DecodeHook returns a DecoderConfigOption which overrides the default
-// DecoderConfig.DecodeHook value, the default is:
-//
-// mapstructure.ComposeDecodeHookFunc(
-// mapstructure.StringToTimeDurationHookFunc(),
-// mapstructure.StringToSliceHookFunc(","),
-// )
-func DecodeHook(hook mapstructure.DecodeHookFunc) DecoderConfigOption {
- return func(c *mapstructure.DecoderConfig) {
- c.DecodeHook = hook
- }
-}
-
-// Viper is a prioritized configuration registry. It
-// maintains a set of configuration sources, fetches
-// values to populate those, and provides them according
-// to the source's priority.
-// The priority of the sources is the following:
-// 1. overrides
-// 2. flags
-// 3. env. variables
-// 4. config file
-// 5. key/value store
-// 6. defaults
-//
-// For example, if values from the following sources were loaded:
-//
-// Defaults : {
-// "secret": "",
-// "user": "default",
-// "endpoint": "https://localhost"
-// }
-// Config : {
-// "user": "root"
-// "secret": "defaultsecret"
-// }
-// Env : {
-// "secret": "somesecretkey"
-// }
-//
-// The resulting config will have the following values:
-//
-// {
-// "secret": "somesecretkey",
-// "user": "root",
-// "endpoint": "https://localhost"
-// }
-//
-// Note: Vipers are not safe for concurrent Get() and Set() operations.
-type Viper struct {
- // Delimiter that separates a list of keys
- // used to access a nested value in one go
- keyDelim string
-
- // A set of paths to look for the config file in
- configPaths []string
-
- // The filesystem to read config from.
- fs afero.Fs
-
- // A set of remote providers to search for the configuration
- remoteProviders []*defaultRemoteProvider
-
- // Name of file to look for inside the path
- configName string
- configFile string
- configType string
- configPermissions os.FileMode
- envPrefix string
-
- // Specific commands for ini parsing
- iniLoadOptions ini.LoadOptions
-
- automaticEnvApplied bool
- envKeyReplacer StringReplacer
- allowEmptyEnv bool
-
- parents []string
- config map[string]any
- override map[string]any
- defaults map[string]any
- kvstore map[string]any
- pflags map[string]FlagValue
- env map[string][]string
- aliases map[string]string
- typeByDefValue bool
-
- onConfigChange func(fsnotify.Event)
-
- logger *slog.Logger
-
- // TODO: should probably be protected with a mutex
- encoderRegistry *encoding.EncoderRegistry
- decoderRegistry *encoding.DecoderRegistry
-}
-
-// New returns an initialized Viper instance.
-func New() *Viper {
- v := new(Viper)
- v.keyDelim = "."
- v.configName = "config"
- v.configPermissions = os.FileMode(0o644)
- v.fs = afero.NewOsFs()
- v.config = make(map[string]any)
- v.parents = []string{}
- v.override = make(map[string]any)
- v.defaults = make(map[string]any)
- v.kvstore = make(map[string]any)
- v.pflags = make(map[string]FlagValue)
- v.env = make(map[string][]string)
- v.aliases = make(map[string]string)
- v.typeByDefValue = false
- v.logger = slog.New(&discardHandler{})
-
- v.resetEncoding()
-
- return v
-}
-
-// Option configures Viper using the functional options paradigm popularized by Rob Pike and Dave Cheney.
-// If you're unfamiliar with this style,
-// see https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html and
-// https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis.
-type Option interface {
- apply(v *Viper)
-}
-
-type optionFunc func(v *Viper)
-
-func (fn optionFunc) apply(v *Viper) {
- fn(v)
-}
-
-// KeyDelimiter sets the delimiter used for determining key parts.
-// By default it's value is ".".
-func KeyDelimiter(d string) Option {
- return optionFunc(func(v *Viper) {
- v.keyDelim = d
- })
-}
-
-// StringReplacer applies a set of replacements to a string.
-type StringReplacer interface {
- // Replace returns a copy of s with all replacements performed.
- Replace(s string) string
-}
-
-// EnvKeyReplacer sets a replacer used for mapping environment variables to internal keys.
-func EnvKeyReplacer(r StringReplacer) Option {
- return optionFunc(func(v *Viper) {
- v.envKeyReplacer = r
- })
-}
-
-// NewWithOptions creates a new Viper instance.
-func NewWithOptions(opts ...Option) *Viper {
- v := New()
-
- for _, opt := range opts {
- opt.apply(v)
- }
-
- v.resetEncoding()
-
- return v
-}
-
-// Reset is intended for testing, will reset all to default settings.
-// In the public interface for the viper package so applications
-// can use it in their testing as well.
-func Reset() {
- v = New()
- SupportedExts = []string{"json", "toml", "yaml", "yml", "properties", "props", "prop", "hcl", "tfvars", "dotenv", "env", "ini"}
- SupportedRemoteProviders = []string{"etcd", "etcd3", "consul", "firestore", "nats"}
-}
-
-// TODO: make this lazy initialization instead.
-func (v *Viper) resetEncoding() {
- encoderRegistry := encoding.NewEncoderRegistry()
- decoderRegistry := encoding.NewDecoderRegistry()
-
- {
- codec := yaml.Codec{}
-
- encoderRegistry.RegisterEncoder("yaml", codec)
- decoderRegistry.RegisterDecoder("yaml", codec)
-
- encoderRegistry.RegisterEncoder("yml", codec)
- decoderRegistry.RegisterDecoder("yml", codec)
- }
-
- {
- codec := json.Codec{}
-
- encoderRegistry.RegisterEncoder("json", codec)
- decoderRegistry.RegisterDecoder("json", codec)
- }
-
- {
- codec := toml.Codec{}
-
- encoderRegistry.RegisterEncoder("toml", codec)
- decoderRegistry.RegisterDecoder("toml", codec)
- }
-
- {
- codec := hcl.Codec{}
-
- encoderRegistry.RegisterEncoder("hcl", codec)
- decoderRegistry.RegisterDecoder("hcl", codec)
-
- encoderRegistry.RegisterEncoder("tfvars", codec)
- decoderRegistry.RegisterDecoder("tfvars", codec)
- }
-
- {
- codec := ini.Codec{
- KeyDelimiter: v.keyDelim,
- LoadOptions: v.iniLoadOptions,
- }
-
- encoderRegistry.RegisterEncoder("ini", codec)
- decoderRegistry.RegisterDecoder("ini", codec)
- }
-
- {
- codec := &javaproperties.Codec{
- KeyDelimiter: v.keyDelim,
- }
-
- encoderRegistry.RegisterEncoder("properties", codec)
- decoderRegistry.RegisterDecoder("properties", codec)
-
- encoderRegistry.RegisterEncoder("props", codec)
- decoderRegistry.RegisterDecoder("props", codec)
-
- encoderRegistry.RegisterEncoder("prop", codec)
- decoderRegistry.RegisterDecoder("prop", codec)
- }
-
- {
- codec := &dotenv.Codec{}
-
- encoderRegistry.RegisterEncoder("dotenv", codec)
- decoderRegistry.RegisterDecoder("dotenv", codec)
-
- encoderRegistry.RegisterEncoder("env", codec)
- decoderRegistry.RegisterDecoder("env", codec)
- }
-
- v.encoderRegistry = encoderRegistry
- v.decoderRegistry = decoderRegistry
-}
-
-type defaultRemoteProvider struct {
- provider string
- endpoint string
- path string
- secretKeyring string
-}
-
-func (rp defaultRemoteProvider) Provider() string {
- return rp.provider
-}
-
-func (rp defaultRemoteProvider) Endpoint() string {
- return rp.endpoint
-}
-
-func (rp defaultRemoteProvider) Path() string {
- return rp.path
-}
-
-func (rp defaultRemoteProvider) SecretKeyring() string {
- return rp.secretKeyring
-}
-
-// RemoteProvider stores the configuration necessary
-// to connect to a remote key/value store.
-// Optional secretKeyring to unencrypt encrypted values
-// can be provided.
-type RemoteProvider interface {
- Provider() string
- Endpoint() string
- Path() string
- SecretKeyring() string
-}
-
-// SupportedExts are universally supported extensions.
-var SupportedExts = []string{"json", "toml", "yaml", "yml", "properties", "props", "prop", "hcl", "tfvars", "dotenv", "env", "ini"}
-
-// SupportedRemoteProviders are universally supported remote providers.
-var SupportedRemoteProviders = []string{"etcd", "etcd3", "consul", "firestore", "nats"}
-
-// OnConfigChange sets the event handler that is called when a config file changes.
-func OnConfigChange(run func(in fsnotify.Event)) { v.OnConfigChange(run) }
-
-// OnConfigChange sets the event handler that is called when a config file changes.
-func (v *Viper) OnConfigChange(run func(in fsnotify.Event)) {
- v.onConfigChange = run
-}
-
-// WatchConfig starts watching a config file for changes.
-func WatchConfig() { v.WatchConfig() }
-
-// WatchConfig starts watching a config file for changes.
-func (v *Viper) WatchConfig() {
- initWG := sync.WaitGroup{}
- initWG.Add(1)
- go func() {
- watcher, err := fsnotify.NewWatcher()
- if err != nil {
- v.logger.Error(fmt.Sprintf("failed to create watcher: %s", err))
- os.Exit(1)
- }
- defer watcher.Close()
- // we have to watch the entire directory to pick up renames/atomic saves in a cross-platform way
- filename, err := v.getConfigFile()
- if err != nil {
- v.logger.Error(fmt.Sprintf("get config file: %s", err))
- initWG.Done()
- return
- }
-
- configFile := filepath.Clean(filename)
- configDir, _ := filepath.Split(configFile)
- realConfigFile, _ := filepath.EvalSymlinks(filename)
-
- eventsWG := sync.WaitGroup{}
- eventsWG.Add(1)
- go func() {
- for {
- select {
- case event, ok := <-watcher.Events:
- if !ok { // 'Events' channel is closed
- eventsWG.Done()
- return
- }
- currentConfigFile, _ := filepath.EvalSymlinks(filename)
- // we only care about the config file with the following cases:
- // 1 - if the config file was modified or created
- // 2 - if the real path to the config file changed (eg: k8s ConfigMap replacement)
- if (filepath.Clean(event.Name) == configFile &&
- (event.Has(fsnotify.Write) || event.Has(fsnotify.Create))) ||
- (currentConfigFile != "" && currentConfigFile != realConfigFile) {
- realConfigFile = currentConfigFile
- err := v.ReadInConfig()
- if err != nil {
- v.logger.Error(fmt.Sprintf("read config file: %s", err))
- }
- if v.onConfigChange != nil {
- v.onConfigChange(event)
- }
- } else if filepath.Clean(event.Name) == configFile && event.Has(fsnotify.Remove) {
- eventsWG.Done()
- return
- }
-
- case err, ok := <-watcher.Errors:
- if ok { // 'Errors' channel is not closed
- v.logger.Error(fmt.Sprintf("watcher error: %s", err))
- }
- eventsWG.Done()
- return
- }
- }
- }()
- watcher.Add(configDir)
- initWG.Done() // done initializing the watch in this go routine, so the parent routine can move on...
- eventsWG.Wait() // now, wait for event loop to end in this go-routine...
- }()
- initWG.Wait() // make sure that the go routine above fully ended before returning
-}
-
-// SetConfigFile explicitly defines the path, name and extension of the config file.
-// Viper will use this and not check any of the config paths.
-func SetConfigFile(in string) { v.SetConfigFile(in) }
-
-func (v *Viper) SetConfigFile(in string) {
- if in != "" {
- v.configFile = in
- }
-}
-
-// SetEnvPrefix defines a prefix that ENVIRONMENT variables will use.
-// E.g. if your prefix is "spf", the env registry will look for env
-// variables that start with "SPF_".
-func SetEnvPrefix(in string) { v.SetEnvPrefix(in) }
-
-func (v *Viper) SetEnvPrefix(in string) {
- if in != "" {
- v.envPrefix = in
- }
-}
-
-func GetEnvPrefix() string { return v.GetEnvPrefix() }
-
-func (v *Viper) GetEnvPrefix() string {
- return v.envPrefix
-}
-
-func (v *Viper) mergeWithEnvPrefix(in string) string {
- if v.envPrefix != "" {
- return strings.ToUpper(v.envPrefix + "_" + in)
- }
-
- return strings.ToUpper(in)
-}
-
-// AllowEmptyEnv tells Viper to consider set,
-// but empty environment variables as valid values instead of falling back.
-// For backward compatibility reasons this is false by default.
-func AllowEmptyEnv(allowEmptyEnv bool) { v.AllowEmptyEnv(allowEmptyEnv) }
-
-func (v *Viper) AllowEmptyEnv(allowEmptyEnv bool) {
- v.allowEmptyEnv = allowEmptyEnv
-}
-
-// TODO: should getEnv logic be moved into find(). Can generalize the use of
-// rewriting keys many things, Ex: Get('someKey') -> some_key
-// (camel case to snake case for JSON keys perhaps)
-
-// getEnv is a wrapper around os.Getenv which replaces characters in the original
-// key. This allows env vars which have different keys than the config object
-// keys.
-func (v *Viper) getEnv(key string) (string, bool) {
- if v.envKeyReplacer != nil {
- key = v.envKeyReplacer.Replace(key)
- }
-
- val, ok := os.LookupEnv(key)
-
- return val, ok && (v.allowEmptyEnv || val != "")
-}
-
-// ConfigFileUsed returns the file used to populate the config registry.
-func ConfigFileUsed() string { return v.ConfigFileUsed() }
-func (v *Viper) ConfigFileUsed() string { return v.configFile }
-
-// AddConfigPath adds a path for Viper to search for the config file in.
-// Can be called multiple times to define multiple search paths.
-func AddConfigPath(in string) { v.AddConfigPath(in) }
-
-func (v *Viper) AddConfigPath(in string) {
- if in != "" {
- absin := absPathify(v.logger, in)
-
- v.logger.Info("adding path to search paths", "path", absin)
- if !stringInSlice(absin, v.configPaths) {
- v.configPaths = append(v.configPaths, absin)
- }
- }
-}
-
-// AddRemoteProvider adds a remote configuration source.
-// Remote Providers are searched in the order they are added.
-// provider is a string value: "etcd", "etcd3", "consul", "firestore" or "nats" are currently supported.
-// endpoint is the url. etcd requires http://ip:port, consul requires ip:port, nats requires nats://ip:port
-// path is the path in the k/v store to retrieve configuration
-// To retrieve a config file called myapp.json from /configs/myapp.json
-// you should set path to /configs and set config name (SetConfigName()) to
-// "myapp".
-func AddRemoteProvider(provider, endpoint, path string) error {
- return v.AddRemoteProvider(provider, endpoint, path)
-}
-
-func (v *Viper) AddRemoteProvider(provider, endpoint, path string) error {
- if !stringInSlice(provider, SupportedRemoteProviders) {
- return UnsupportedRemoteProviderError(provider)
- }
- if provider != "" && endpoint != "" {
- v.logger.Info("adding remote provider", "provider", provider, "endpoint", endpoint)
-
- rp := &defaultRemoteProvider{
- endpoint: endpoint,
- provider: provider,
- path: path,
- }
- if !v.providerPathExists(rp) {
- v.remoteProviders = append(v.remoteProviders, rp)
- }
- }
- return nil
-}
-
-// AddSecureRemoteProvider adds a remote configuration source.
-// Secure Remote Providers are searched in the order they are added.
-// provider is a string value: "etcd", "etcd3", "consul", "firestore" or "nats" are currently supported.
-// endpoint is the url. etcd requires http://ip:port consul requires ip:port
-// secretkeyring is the filepath to your openpgp secret keyring. e.g. /etc/secrets/myring.gpg
-// path is the path in the k/v store to retrieve configuration
-// To retrieve a config file called myapp.json from /configs/myapp.json
-// you should set path to /configs and set config name (SetConfigName()) to
-// "myapp".
-// Secure Remote Providers are implemented with github.com/sagikazarmark/crypt.
-func AddSecureRemoteProvider(provider, endpoint, path, secretkeyring string) error {
- return v.AddSecureRemoteProvider(provider, endpoint, path, secretkeyring)
-}
-
-func (v *Viper) AddSecureRemoteProvider(provider, endpoint, path, secretkeyring string) error {
- if !stringInSlice(provider, SupportedRemoteProviders) {
- return UnsupportedRemoteProviderError(provider)
- }
- if provider != "" && endpoint != "" {
- v.logger.Info("adding remote provider", "provider", provider, "endpoint", endpoint)
-
- rp := &defaultRemoteProvider{
- endpoint: endpoint,
- provider: provider,
- path: path,
- secretKeyring: secretkeyring,
- }
- if !v.providerPathExists(rp) {
- v.remoteProviders = append(v.remoteProviders, rp)
- }
- }
- return nil
-}
-
-func (v *Viper) providerPathExists(p *defaultRemoteProvider) bool {
- for _, y := range v.remoteProviders {
- if reflect.DeepEqual(y, p) {
- return true
- }
- }
- return false
-}
-
-// searchMap recursively searches for a value for path in source map.
-// Returns nil if not found.
-// Note: This assumes that the path entries and map keys are lower cased.
-func (v *Viper) searchMap(source map[string]any, path []string) any {
- if len(path) == 0 {
- return source
- }
-
- next, ok := source[path[0]]
- if ok {
- // Fast path
- if len(path) == 1 {
- return next
- }
-
- // Nested case
- switch next := next.(type) {
- case map[any]any:
- return v.searchMap(cast.ToStringMap(next), path[1:])
- case map[string]any:
- // Type assertion is safe here since it is only reached
- // if the type of `next` is the same as the type being asserted
- return v.searchMap(next, path[1:])
- default:
- // got a value but nested key expected, return "nil" for not found
- return nil
- }
- }
- return nil
-}
-
-// searchIndexableWithPathPrefixes recursively searches for a value for path in source map/slice.
-//
-// While searchMap() considers each path element as a single map key or slice index, this
-// function searches for, and prioritizes, merged path elements.
-// e.g., if in the source, "foo" is defined with a sub-key "bar", and "foo.bar"
-// is also defined, this latter value is returned for path ["foo", "bar"].
-//
-// This should be useful only at config level (other maps may not contain dots
-// in their keys).
-//
-// Note: This assumes that the path entries and map keys are lower cased.
-func (v *Viper) searchIndexableWithPathPrefixes(source any, path []string) any {
- if len(path) == 0 {
- return source
- }
-
- // search for path prefixes, starting from the longest one
- for i := len(path); i > 0; i-- {
- prefixKey := strings.ToLower(strings.Join(path[0:i], v.keyDelim))
-
- var val any
- switch sourceIndexable := source.(type) {
- case []any:
- val = v.searchSliceWithPathPrefixes(sourceIndexable, prefixKey, i, path)
- case map[string]any:
- val = v.searchMapWithPathPrefixes(sourceIndexable, prefixKey, i, path)
- }
- if val != nil {
- return val
- }
- }
-
- // not found
- return nil
-}
-
-// searchSliceWithPathPrefixes searches for a value for path in sourceSlice
-//
-// This function is part of the searchIndexableWithPathPrefixes recurring search and
-// should not be called directly from functions other than searchIndexableWithPathPrefixes.
-func (v *Viper) searchSliceWithPathPrefixes(
- sourceSlice []any,
- prefixKey string,
- pathIndex int,
- path []string,
-) any {
- // if the prefixKey is not a number or it is out of bounds of the slice
- index, err := strconv.Atoi(prefixKey)
- if err != nil || len(sourceSlice) <= index {
- return nil
- }
-
- next := sourceSlice[index]
-
- // Fast path
- if pathIndex == len(path) {
- return next
- }
-
- switch n := next.(type) {
- case map[any]any:
- return v.searchIndexableWithPathPrefixes(cast.ToStringMap(n), path[pathIndex:])
- case map[string]any, []any:
- return v.searchIndexableWithPathPrefixes(n, path[pathIndex:])
- default:
- // got a value but nested key expected, do nothing and look for next prefix
- }
-
- // not found
- return nil
-}
-
-// searchMapWithPathPrefixes searches for a value for path in sourceMap
-//
-// This function is part of the searchIndexableWithPathPrefixes recurring search and
-// should not be called directly from functions other than searchIndexableWithPathPrefixes.
-func (v *Viper) searchMapWithPathPrefixes(
- sourceMap map[string]any,
- prefixKey string,
- pathIndex int,
- path []string,
-) any {
- next, ok := sourceMap[prefixKey]
- if !ok {
- return nil
- }
-
- // Fast path
- if pathIndex == len(path) {
- return next
- }
-
- // Nested case
- switch n := next.(type) {
- case map[any]any:
- return v.searchIndexableWithPathPrefixes(cast.ToStringMap(n), path[pathIndex:])
- case map[string]any, []any:
- return v.searchIndexableWithPathPrefixes(n, path[pathIndex:])
- default:
- // got a value but nested key expected, do nothing and look for next prefix
- }
-
- // not found
- return nil
-}
-
-// isPathShadowedInDeepMap makes sure the given path is not shadowed somewhere
-// on its path in the map.
-// e.g., if "foo.bar" has a value in the given map, it “shadows”
-//
-// "foo.bar.baz" in a lower-priority map
-func (v *Viper) isPathShadowedInDeepMap(path []string, m map[string]any) string {
- var parentVal any
- for i := 1; i < len(path); i++ {
- parentVal = v.searchMap(m, path[0:i])
- if parentVal == nil {
- // not found, no need to add more path elements
- return ""
- }
- switch parentVal.(type) {
- case map[any]any:
- continue
- case map[string]any:
- continue
- default:
- // parentVal is a regular value which shadows "path"
- return strings.Join(path[0:i], v.keyDelim)
- }
- }
- return ""
-}
-
-// isPathShadowedInFlatMap makes sure the given path is not shadowed somewhere
-// in a sub-path of the map.
-// e.g., if "foo.bar" has a value in the given map, it “shadows”
-//
-// "foo.bar.baz" in a lower-priority map
-func (v *Viper) isPathShadowedInFlatMap(path []string, mi any) string {
- // unify input map
- var m map[string]interface{}
- switch miv := mi.(type) {
- case map[string]string:
- m = castMapStringToMapInterface(miv)
- case map[string]FlagValue:
- m = castMapFlagToMapInterface(miv)
- default:
- return ""
- }
-
- // scan paths
- var parentKey string
- for i := 1; i < len(path); i++ {
- parentKey = strings.Join(path[0:i], v.keyDelim)
- if _, ok := m[parentKey]; ok {
- return parentKey
- }
- }
- return ""
-}
-
-// isPathShadowedInAutoEnv makes sure the given path is not shadowed somewhere
-// in the environment, when automatic env is on.
-// e.g., if "foo.bar" has a value in the environment, it “shadows”
-//
-// "foo.bar.baz" in a lower-priority map
-func (v *Viper) isPathShadowedInAutoEnv(path []string) string {
- var parentKey string
- for i := 1; i < len(path); i++ {
- parentKey = strings.Join(path[0:i], v.keyDelim)
- if _, ok := v.getEnv(v.mergeWithEnvPrefix(parentKey)); ok {
- return parentKey
- }
- }
- return ""
-}
-
-// SetTypeByDefaultValue enables or disables the inference of a key value's
-// type when the Get function is used based upon a key's default value as
-// opposed to the value returned based on the normal fetch logic.
-//
-// For example, if a key has a default value of []string{} and the same key
-// is set via an environment variable to "a b c", a call to the Get function
-// would return a string slice for the key if the key's type is inferred by
-// the default value and the Get function would return:
-//
-// []string {"a", "b", "c"}
-//
-// Otherwise the Get function would return:
-//
-// "a b c"
-func SetTypeByDefaultValue(enable bool) { v.SetTypeByDefaultValue(enable) }
-
-func (v *Viper) SetTypeByDefaultValue(enable bool) {
- v.typeByDefValue = enable
-}
-
-// GetViper gets the global Viper instance.
-func GetViper() *Viper {
- return v
-}
-
-// Get can retrieve any value given the key to use.
-// Get is case-insensitive for a key.
-// Get has the behavior of returning the value associated with the first
-// place from where it is set. Viper will check in the following order:
-// override, flag, env, config file, key/value store, default
-//
-// Get returns an interface. For a specific value use one of the Get____ methods.
-func Get(key string) any { return v.Get(key) }
-
-func (v *Viper) Get(key string) any {
- lcaseKey := strings.ToLower(key)
- val := v.find(lcaseKey, true)
- if val == nil {
- return nil
- }
-
- if v.typeByDefValue {
- // TODO(bep) this branch isn't covered by a single test.
- valType := val
- path := strings.Split(lcaseKey, v.keyDelim)
- defVal := v.searchMap(v.defaults, path)
- if defVal != nil {
- valType = defVal
- }
-
- switch valType.(type) {
- case bool:
- return cast.ToBool(val)
- case string:
- return cast.ToString(val)
- case int32, int16, int8, int:
- return cast.ToInt(val)
- case uint:
- return cast.ToUint(val)
- case uint32:
- return cast.ToUint32(val)
- case uint64:
- return cast.ToUint64(val)
- case int64:
- return cast.ToInt64(val)
- case float64, float32:
- return cast.ToFloat64(val)
- case time.Time:
- return cast.ToTime(val)
- case time.Duration:
- return cast.ToDuration(val)
- case []string:
- return cast.ToStringSlice(val)
- case []int:
- return cast.ToIntSlice(val)
- case []time.Duration:
- return cast.ToDurationSlice(val)
- }
- }
-
- return val
-}
-
-// Sub returns new Viper instance representing a sub tree of this instance.
-// Sub is case-insensitive for a key.
-func Sub(key string) *Viper { return v.Sub(key) }
-
-func (v *Viper) Sub(key string) *Viper {
- subv := New()
- data := v.Get(key)
- if data == nil {
- return nil
- }
-
- if reflect.TypeOf(data).Kind() == reflect.Map {
- subv.parents = append([]string(nil), v.parents...)
- subv.parents = append(subv.parents, strings.ToLower(key))
- subv.automaticEnvApplied = v.automaticEnvApplied
- subv.envPrefix = v.envPrefix
- subv.envKeyReplacer = v.envKeyReplacer
- subv.config = cast.ToStringMap(data)
- return subv
- }
- return nil
-}
-
-// GetString returns the value associated with the key as a string.
-func GetString(key string) string { return v.GetString(key) }
-
-func (v *Viper) GetString(key string) string {
- return cast.ToString(v.Get(key))
-}
-
-// GetBool returns the value associated with the key as a boolean.
-func GetBool(key string) bool { return v.GetBool(key) }
-
-func (v *Viper) GetBool(key string) bool {
- return cast.ToBool(v.Get(key))
-}
-
-// GetInt returns the value associated with the key as an integer.
-func GetInt(key string) int { return v.GetInt(key) }
-
-func (v *Viper) GetInt(key string) int {
- return cast.ToInt(v.Get(key))
-}
-
-// GetInt32 returns the value associated with the key as an integer.
-func GetInt32(key string) int32 { return v.GetInt32(key) }
-
-func (v *Viper) GetInt32(key string) int32 {
- return cast.ToInt32(v.Get(key))
-}
-
-// GetInt64 returns the value associated with the key as an integer.
-func GetInt64(key string) int64 { return v.GetInt64(key) }
-
-func (v *Viper) GetInt64(key string) int64 {
- return cast.ToInt64(v.Get(key))
-}
-
-// GetUint returns the value associated with the key as an unsigned integer.
-func GetUint(key string) uint { return v.GetUint(key) }
-
-func (v *Viper) GetUint(key string) uint {
- return cast.ToUint(v.Get(key))
-}
-
-// GetUint16 returns the value associated with the key as an unsigned integer.
-func GetUint16(key string) uint16 { return v.GetUint16(key) }
-
-func (v *Viper) GetUint16(key string) uint16 {
- return cast.ToUint16(v.Get(key))
-}
-
-// GetUint32 returns the value associated with the key as an unsigned integer.
-func GetUint32(key string) uint32 { return v.GetUint32(key) }
-
-func (v *Viper) GetUint32(key string) uint32 {
- return cast.ToUint32(v.Get(key))
-}
-
-// GetUint64 returns the value associated with the key as an unsigned integer.
-func GetUint64(key string) uint64 { return v.GetUint64(key) }
-
-func (v *Viper) GetUint64(key string) uint64 {
- return cast.ToUint64(v.Get(key))
-}
-
-// GetFloat64 returns the value associated with the key as a float64.
-func GetFloat64(key string) float64 { return v.GetFloat64(key) }
-
-func (v *Viper) GetFloat64(key string) float64 {
- return cast.ToFloat64(v.Get(key))
-}
-
-// GetTime returns the value associated with the key as time.
-func GetTime(key string) time.Time { return v.GetTime(key) }
-
-func (v *Viper) GetTime(key string) time.Time {
- return cast.ToTime(v.Get(key))
-}
-
-// GetDuration returns the value associated with the key as a duration.
-func GetDuration(key string) time.Duration { return v.GetDuration(key) }
-
-func (v *Viper) GetDuration(key string) time.Duration {
- return cast.ToDuration(v.Get(key))
-}
-
-// GetIntSlice returns the value associated with the key as a slice of int values.
-func GetIntSlice(key string) []int { return v.GetIntSlice(key) }
-
-func (v *Viper) GetIntSlice(key string) []int {
- return cast.ToIntSlice(v.Get(key))
-}
-
-// GetStringSlice returns the value associated with the key as a slice of strings.
-func GetStringSlice(key string) []string { return v.GetStringSlice(key) }
-
-func (v *Viper) GetStringSlice(key string) []string {
- return cast.ToStringSlice(v.Get(key))
-}
-
-// GetStringMap returns the value associated with the key as a map of interfaces.
-func GetStringMap(key string) map[string]any { return v.GetStringMap(key) }
-
-func (v *Viper) GetStringMap(key string) map[string]any {
- return cast.ToStringMap(v.Get(key))
-}
-
-// GetStringMapString returns the value associated with the key as a map of strings.
-func GetStringMapString(key string) map[string]string { return v.GetStringMapString(key) }
-
-func (v *Viper) GetStringMapString(key string) map[string]string {
- return cast.ToStringMapString(v.Get(key))
-}
-
-// GetStringMapStringSlice returns the value associated with the key as a map to a slice of strings.
-func GetStringMapStringSlice(key string) map[string][]string { return v.GetStringMapStringSlice(key) }
-
-func (v *Viper) GetStringMapStringSlice(key string) map[string][]string {
- return cast.ToStringMapStringSlice(v.Get(key))
-}
-
-// GetSizeInBytes returns the size of the value associated with the given key
-// in bytes.
-func GetSizeInBytes(key string) uint { return v.GetSizeInBytes(key) }
-
-func (v *Viper) GetSizeInBytes(key string) uint {
- sizeStr := cast.ToString(v.Get(key))
- return parseSizeInBytes(sizeStr)
-}
-
-// UnmarshalKey takes a single key and unmarshals it into a Struct.
-func UnmarshalKey(key string, rawVal any, opts ...DecoderConfigOption) error {
- return v.UnmarshalKey(key, rawVal, opts...)
-}
-
-func (v *Viper) UnmarshalKey(key string, rawVal any, opts ...DecoderConfigOption) error {
- return decode(v.Get(key), defaultDecoderConfig(rawVal, opts...))
-}
-
-// Unmarshal unmarshals the config into a Struct. Make sure that the tags
-// on the fields of the structure are properly set.
-func Unmarshal(rawVal any, opts ...DecoderConfigOption) error {
- return v.Unmarshal(rawVal, opts...)
-}
-
-func (v *Viper) Unmarshal(rawVal any, opts ...DecoderConfigOption) error {
- keys := v.AllKeys()
-
- if features.BindStruct {
- // TODO: make this optional?
- structKeys, err := v.decodeStructKeys(rawVal, opts...)
- if err != nil {
- return err
- }
-
- keys = append(keys, structKeys...)
- }
-
- // TODO: struct keys should be enough?
- return decode(v.getSettings(keys), defaultDecoderConfig(rawVal, opts...))
-}
-
-func (v *Viper) decodeStructKeys(input any, opts ...DecoderConfigOption) ([]string, error) {
- var structKeyMap map[string]any
-
- err := decode(input, defaultDecoderConfig(&structKeyMap, opts...))
- if err != nil {
- return nil, err
- }
-
- flattenedStructKeyMap := v.flattenAndMergeMap(map[string]bool{}, structKeyMap, "")
-
- r := make([]string, 0, len(flattenedStructKeyMap))
- for v := range flattenedStructKeyMap {
- r = append(r, v)
- }
-
- return r, nil
-}
-
-// defaultDecoderConfig returns default mapstructure.DecoderConfig with support
-// of time.Duration values & string slices.
-func defaultDecoderConfig(output any, opts ...DecoderConfigOption) *mapstructure.DecoderConfig {
- c := &mapstructure.DecoderConfig{
- Metadata: nil,
- Result: output,
- WeaklyTypedInput: true,
- DecodeHook: mapstructure.ComposeDecodeHookFunc(
- mapstructure.StringToTimeDurationHookFunc(),
- mapstructure.StringToSliceHookFunc(","),
- ),
- }
- for _, opt := range opts {
- opt(c)
- }
- return c
-}
-
-// decode is a wrapper around mapstructure.Decode that mimics the WeakDecode functionality.
-func decode(input any, config *mapstructure.DecoderConfig) error {
- decoder, err := mapstructure.NewDecoder(config)
- if err != nil {
- return err
- }
- return decoder.Decode(input)
-}
-
-// UnmarshalExact unmarshals the config into a Struct, erroring if a field is nonexistent
-// in the destination struct.
-func UnmarshalExact(rawVal any, opts ...DecoderConfigOption) error {
- return v.UnmarshalExact(rawVal, opts...)
-}
-
-func (v *Viper) UnmarshalExact(rawVal any, opts ...DecoderConfigOption) error {
- config := defaultDecoderConfig(rawVal, opts...)
- config.ErrorUnused = true
-
- keys := v.AllKeys()
-
- if features.BindStruct {
- // TODO: make this optional?
- structKeys, err := v.decodeStructKeys(rawVal, opts...)
- if err != nil {
- return err
- }
-
- keys = append(keys, structKeys...)
- }
-
- // TODO: struct keys should be enough?
- return decode(v.getSettings(keys), config)
-}
-
-// BindPFlags binds a full flag set to the configuration, using each flag's long
-// name as the config key.
-func BindPFlags(flags *pflag.FlagSet) error { return v.BindPFlags(flags) }
-
-func (v *Viper) BindPFlags(flags *pflag.FlagSet) error {
- return v.BindFlagValues(pflagValueSet{flags})
-}
-
-// BindPFlag binds a specific key to a pflag (as used by cobra).
-// Example (where serverCmd is a Cobra instance):
-//
-// serverCmd.Flags().Int("port", 1138, "Port to run Application server on")
-// Viper.BindPFlag("port", serverCmd.Flags().Lookup("port"))
-func BindPFlag(key string, flag *pflag.Flag) error { return v.BindPFlag(key, flag) }
-
-func (v *Viper) BindPFlag(key string, flag *pflag.Flag) error {
- if flag == nil {
- return fmt.Errorf("flag for %q is nil", key)
- }
- return v.BindFlagValue(key, pflagValue{flag})
-}
-
-// BindFlagValues binds a full FlagValue set to the configuration, using each flag's long
-// name as the config key.
-func BindFlagValues(flags FlagValueSet) error { return v.BindFlagValues(flags) }
-
-func (v *Viper) BindFlagValues(flags FlagValueSet) (err error) {
- flags.VisitAll(func(flag FlagValue) {
- if err = v.BindFlagValue(flag.Name(), flag); err != nil {
- return
- }
- })
- return nil
-}
-
-// BindFlagValue binds a specific key to a FlagValue.
-func BindFlagValue(key string, flag FlagValue) error { return v.BindFlagValue(key, flag) }
-
-func (v *Viper) BindFlagValue(key string, flag FlagValue) error {
- if flag == nil {
- return fmt.Errorf("flag for %q is nil", key)
- }
- v.pflags[strings.ToLower(key)] = flag
- return nil
-}
-
-// BindEnv binds a Viper key to a ENV variable.
-// ENV variables are case sensitive.
-// If only a key is provided, it will use the env key matching the key, uppercased.
-// If more arguments are provided, they will represent the env variable names that
-// should bind to this key and will be taken in the specified order.
-// EnvPrefix will be used when set when env name is not provided.
-func BindEnv(input ...string) error { return v.BindEnv(input...) }
-
-func (v *Viper) BindEnv(input ...string) error {
- if len(input) == 0 {
- return fmt.Errorf("missing key to bind to")
- }
-
- key := strings.ToLower(input[0])
-
- if len(input) == 1 {
- v.env[key] = append(v.env[key], v.mergeWithEnvPrefix(key))
- } else {
- v.env[key] = append(v.env[key], input[1:]...)
- }
-
- return nil
-}
-
-// MustBindEnv wraps BindEnv in a panic.
-// If there is an error binding an environment variable, MustBindEnv will
-// panic.
-func MustBindEnv(input ...string) { v.MustBindEnv(input...) }
-
-func (v *Viper) MustBindEnv(input ...string) {
- if err := v.BindEnv(input...); err != nil {
- panic(fmt.Sprintf("error while binding environment variable: %v", err))
- }
-}
-
-// Given a key, find the value.
-//
-// Viper will check to see if an alias exists first.
-// Viper will then check in the following order:
-// flag, env, config file, key/value store.
-// Lastly, if no value was found and flagDefault is true, and if the key
-// corresponds to a flag, the flag's default value is returned.
-//
-// Note: this assumes a lower-cased key given.
-func (v *Viper) find(lcaseKey string, flagDefault bool) any {
- var (
- val any
- exists bool
- path = strings.Split(lcaseKey, v.keyDelim)
- nested = len(path) > 1
- )
-
- // compute the path through the nested maps to the nested value
- if nested && v.isPathShadowedInDeepMap(path, castMapStringToMapInterface(v.aliases)) != "" {
- return nil
- }
-
- // if the requested key is an alias, then return the proper key
- lcaseKey = v.realKey(lcaseKey)
- path = strings.Split(lcaseKey, v.keyDelim)
- nested = len(path) > 1
-
- // Set() override first
- val = v.searchMap(v.override, path)
- if val != nil {
- return val
- }
- if nested && v.isPathShadowedInDeepMap(path, v.override) != "" {
- return nil
- }
-
- // PFlag override next
- flag, exists := v.pflags[lcaseKey]
- if exists && flag.HasChanged() {
- switch flag.ValueType() {
- case "int", "int8", "int16", "int32", "int64":
- return cast.ToInt(flag.ValueString())
- case "bool":
- return cast.ToBool(flag.ValueString())
- case "stringSlice", "stringArray":
- s := strings.TrimPrefix(flag.ValueString(), "[")
- s = strings.TrimSuffix(s, "]")
- res, _ := readAsCSV(s)
- return res
- case "intSlice":
- s := strings.TrimPrefix(flag.ValueString(), "[")
- s = strings.TrimSuffix(s, "]")
- res, _ := readAsCSV(s)
- return cast.ToIntSlice(res)
- case "durationSlice":
- s := strings.TrimPrefix(flag.ValueString(), "[")
- s = strings.TrimSuffix(s, "]")
- slice := strings.Split(s, ",")
- return cast.ToDurationSlice(slice)
- case "stringToString":
- return stringToStringConv(flag.ValueString())
- case "stringToInt":
- return stringToIntConv(flag.ValueString())
- default:
- return flag.ValueString()
- }
- }
- if nested && v.isPathShadowedInFlatMap(path, v.pflags) != "" {
- return nil
- }
-
- // Env override next
- if v.automaticEnvApplied {
- envKey := strings.Join(append(v.parents, lcaseKey), ".")
- // even if it hasn't been registered, if automaticEnv is used,
- // check any Get request
- if val, ok := v.getEnv(v.mergeWithEnvPrefix(envKey)); ok {
- return val
- }
- if nested && v.isPathShadowedInAutoEnv(path) != "" {
- return nil
- }
- }
- envkeys, exists := v.env[lcaseKey]
- if exists {
- for _, envkey := range envkeys {
- if val, ok := v.getEnv(envkey); ok {
- return val
- }
- }
- }
- if nested && v.isPathShadowedInFlatMap(path, v.env) != "" {
- return nil
- }
-
- // Config file next
- val = v.searchIndexableWithPathPrefixes(v.config, path)
- if val != nil {
- return val
- }
- if nested && v.isPathShadowedInDeepMap(path, v.config) != "" {
- return nil
- }
-
- // K/V store next
- val = v.searchMap(v.kvstore, path)
- if val != nil {
- return val
- }
- if nested && v.isPathShadowedInDeepMap(path, v.kvstore) != "" {
- return nil
- }
-
- // Default next
- val = v.searchMap(v.defaults, path)
- if val != nil {
- return val
- }
- if nested && v.isPathShadowedInDeepMap(path, v.defaults) != "" {
- return nil
- }
-
- if flagDefault {
- // last chance: if no value is found and a flag does exist for the key,
- // get the flag's default value even if the flag's value has not been set.
- if flag, exists := v.pflags[lcaseKey]; exists {
- switch flag.ValueType() {
- case "int", "int8", "int16", "int32", "int64":
- return cast.ToInt(flag.ValueString())
- case "bool":
- return cast.ToBool(flag.ValueString())
- case "stringSlice", "stringArray":
- s := strings.TrimPrefix(flag.ValueString(), "[")
- s = strings.TrimSuffix(s, "]")
- res, _ := readAsCSV(s)
- return res
- case "intSlice":
- s := strings.TrimPrefix(flag.ValueString(), "[")
- s = strings.TrimSuffix(s, "]")
- res, _ := readAsCSV(s)
- return cast.ToIntSlice(res)
- case "stringToString":
- return stringToStringConv(flag.ValueString())
- case "stringToInt":
- return stringToIntConv(flag.ValueString())
- case "durationSlice":
- s := strings.TrimPrefix(flag.ValueString(), "[")
- s = strings.TrimSuffix(s, "]")
- slice := strings.Split(s, ",")
- return cast.ToDurationSlice(slice)
- default:
- return flag.ValueString()
- }
- }
- // last item, no need to check shadowing
- }
-
- return nil
-}
-
-func readAsCSV(val string) ([]string, error) {
- if val == "" {
- return []string{}, nil
- }
- stringReader := strings.NewReader(val)
- csvReader := csv.NewReader(stringReader)
- return csvReader.Read()
-}
-
-// mostly copied from pflag's implementation of this operation here https://github.com/spf13/pflag/blob/master/string_to_string.go#L79
-// alterations are: errors are swallowed, map[string]any is returned in order to enable cast.ToStringMap.
-func stringToStringConv(val string) any {
- val = strings.Trim(val, "[]")
- // An empty string would cause an empty map
- if val == "" {
- return map[string]any{}
- }
- r := csv.NewReader(strings.NewReader(val))
- ss, err := r.Read()
- if err != nil {
- return nil
- }
- out := make(map[string]any, len(ss))
- for _, pair := range ss {
- k, vv, found := strings.Cut(pair, "=")
- if !found {
- return nil
- }
- out[k] = vv
- }
- return out
-}
-
-// mostly copied from pflag's implementation of this operation here https://github.com/spf13/pflag/blob/d5e0c0615acee7028e1e2740a11102313be88de1/string_to_int.go#L68
-// alterations are: errors are swallowed, map[string]any is returned in order to enable cast.ToStringMap.
-func stringToIntConv(val string) any {
- val = strings.Trim(val, "[]")
- // An empty string would cause an empty map
- if val == "" {
- return map[string]any{}
- }
- ss := strings.Split(val, ",")
- out := make(map[string]any, len(ss))
- for _, pair := range ss {
- k, vv, found := strings.Cut(pair, "=")
- if !found {
- return nil
- }
- var err error
- out[k], err = strconv.Atoi(vv)
- if err != nil {
- return nil
- }
- }
- return out
-}
-
-// IsSet checks to see if the key has been set in any of the data locations.
-// IsSet is case-insensitive for a key.
-func IsSet(key string) bool { return v.IsSet(key) }
-
-func (v *Viper) IsSet(key string) bool {
- lcaseKey := strings.ToLower(key)
- val := v.find(lcaseKey, false)
- return val != nil
-}
-
-// AutomaticEnv makes Viper check if environment variables match any of the existing keys
-// (config, default or flags). If matching env vars are found, they are loaded into Viper.
-func AutomaticEnv() { v.AutomaticEnv() }
-
-func (v *Viper) AutomaticEnv() {
- v.automaticEnvApplied = true
-}
-
-// SetEnvKeyReplacer sets the strings.Replacer on the viper object
-// Useful for mapping an environmental variable to a key that does
-// not match it.
-func SetEnvKeyReplacer(r *strings.Replacer) { v.SetEnvKeyReplacer(r) }
-
-func (v *Viper) SetEnvKeyReplacer(r *strings.Replacer) {
- v.envKeyReplacer = r
-}
-
-// RegisterAlias creates an alias that provides another accessor for the same key.
-// This enables one to change a name without breaking the application.
-func RegisterAlias(alias, key string) { v.RegisterAlias(alias, key) }
-
-func (v *Viper) RegisterAlias(alias, key string) {
- v.registerAlias(alias, strings.ToLower(key))
-}
-
-func (v *Viper) registerAlias(alias, key string) {
- alias = strings.ToLower(alias)
- if alias != key && alias != v.realKey(key) {
- _, exists := v.aliases[alias]
-
- if !exists {
- // if we alias something that exists in one of the maps to another
- // name, we'll never be able to get that value using the original
- // name, so move the config value to the new realkey.
- if val, ok := v.config[alias]; ok {
- delete(v.config, alias)
- v.config[key] = val
- }
- if val, ok := v.kvstore[alias]; ok {
- delete(v.kvstore, alias)
- v.kvstore[key] = val
- }
- if val, ok := v.defaults[alias]; ok {
- delete(v.defaults, alias)
- v.defaults[key] = val
- }
- if val, ok := v.override[alias]; ok {
- delete(v.override, alias)
- v.override[key] = val
- }
- v.aliases[alias] = key
- }
- } else {
- v.logger.Warn("creating circular reference alias", "alias", alias, "key", key, "real_key", v.realKey(key))
- }
-}
-
-func (v *Viper) realKey(key string) string {
- newkey, exists := v.aliases[key]
- if exists {
- v.logger.Debug("key is an alias", "alias", key, "to", newkey)
-
- return v.realKey(newkey)
- }
- return key
-}
-
-// InConfig checks to see if the given key (or an alias) is in the config file.
-func InConfig(key string) bool { return v.InConfig(key) }
-
-func (v *Viper) InConfig(key string) bool {
- lcaseKey := strings.ToLower(key)
-
- // if the requested key is an alias, then return the proper key
- lcaseKey = v.realKey(lcaseKey)
- path := strings.Split(lcaseKey, v.keyDelim)
-
- return v.searchIndexableWithPathPrefixes(v.config, path) != nil
-}
-
-// SetDefault sets the default value for this key.
-// SetDefault is case-insensitive for a key.
-// Default only used when no value is provided by the user via flag, config or ENV.
-func SetDefault(key string, value any) { v.SetDefault(key, value) }
-
-func (v *Viper) SetDefault(key string, value any) {
- // If alias passed in, then set the proper default
- key = v.realKey(strings.ToLower(key))
- value = toCaseInsensitiveValue(value)
-
- path := strings.Split(key, v.keyDelim)
- lastKey := strings.ToLower(path[len(path)-1])
- deepestMap := deepSearch(v.defaults, path[0:len(path)-1])
-
- // set innermost value
- deepestMap[lastKey] = value
-}
-
-// Set sets the value for the key in the override register.
-// Set is case-insensitive for a key.
-// Will be used instead of values obtained via
-// flags, config file, ENV, default, or key/value store.
-func Set(key string, value any) { v.Set(key, value) }
-
-func (v *Viper) Set(key string, value any) {
- // If alias passed in, then set the proper override
- key = v.realKey(strings.ToLower(key))
- value = toCaseInsensitiveValue(value)
-
- path := strings.Split(key, v.keyDelim)
- lastKey := strings.ToLower(path[len(path)-1])
- deepestMap := deepSearch(v.override, path[0:len(path)-1])
-
- // set innermost value
- deepestMap[lastKey] = value
-}
-
-// ReadInConfig will discover and load the configuration file from disk
-// and key/value stores, searching in one of the defined paths.
-func ReadInConfig() error { return v.ReadInConfig() }
-
-func (v *Viper) ReadInConfig() error {
- v.logger.Info("attempting to read in config file")
- filename, err := v.getConfigFile()
- if err != nil {
- return err
- }
-
- if !stringInSlice(v.getConfigType(), SupportedExts) {
- return UnsupportedConfigError(v.getConfigType())
- }
-
- v.logger.Debug("reading file", "file", filename)
- file, err := afero.ReadFile(v.fs, filename)
- if err != nil {
- return err
- }
-
- config := make(map[string]any)
-
- err = v.unmarshalReader(bytes.NewReader(file), config)
- if err != nil {
- return err
- }
-
- v.config = config
- return nil
-}
-
-// MergeInConfig merges a new configuration with an existing config.
-func MergeInConfig() error { return v.MergeInConfig() }
-
-func (v *Viper) MergeInConfig() error {
- v.logger.Info("attempting to merge in config file")
- filename, err := v.getConfigFile()
- if err != nil {
- return err
- }
-
- if !stringInSlice(v.getConfigType(), SupportedExts) {
- return UnsupportedConfigError(v.getConfigType())
- }
-
- file, err := afero.ReadFile(v.fs, filename)
- if err != nil {
- return err
- }
-
- return v.MergeConfig(bytes.NewReader(file))
-}
-
-// ReadConfig will read a configuration file, setting existing keys to nil if the
-// key does not exist in the file.
-func ReadConfig(in io.Reader) error { return v.ReadConfig(in) }
-
-func (v *Viper) ReadConfig(in io.Reader) error {
- v.config = make(map[string]any)
- return v.unmarshalReader(in, v.config)
-}
-
-// MergeConfig merges a new configuration with an existing config.
-func MergeConfig(in io.Reader) error { return v.MergeConfig(in) }
-
-func (v *Viper) MergeConfig(in io.Reader) error {
- cfg := make(map[string]any)
- if err := v.unmarshalReader(in, cfg); err != nil {
- return err
- }
- return v.MergeConfigMap(cfg)
-}
-
-// MergeConfigMap merges the configuration from the map given with an existing config.
-// Note that the map given may be modified.
-func MergeConfigMap(cfg map[string]any) error { return v.MergeConfigMap(cfg) }
-
-func (v *Viper) MergeConfigMap(cfg map[string]any) error {
- if v.config == nil {
- v.config = make(map[string]any)
- }
- insensitiviseMap(cfg)
- mergeMaps(cfg, v.config, nil)
- return nil
-}
-
-// WriteConfig writes the current configuration to a file.
-func WriteConfig() error { return v.WriteConfig() }
-
-func (v *Viper) WriteConfig() error {
- filename, err := v.getConfigFile()
- if err != nil {
- return err
- }
- return v.writeConfig(filename, true)
-}
-
-// SafeWriteConfig writes current configuration to file only if the file does not exist.
-func SafeWriteConfig() error { return v.SafeWriteConfig() }
-
-func (v *Viper) SafeWriteConfig() error {
- if len(v.configPaths) < 1 {
- return errors.New("missing configuration for 'configPath'")
- }
- return v.SafeWriteConfigAs(filepath.Join(v.configPaths[0], v.configName+"."+v.configType))
-}
-
-// WriteConfigAs writes current configuration to a given filename.
-func WriteConfigAs(filename string) error { return v.WriteConfigAs(filename) }
-
-func (v *Viper) WriteConfigAs(filename string) error {
- return v.writeConfig(filename, true)
-}
-
-// SafeWriteConfigAs writes current configuration to a given filename if it does not exist.
-func SafeWriteConfigAs(filename string) error { return v.SafeWriteConfigAs(filename) }
-
-func (v *Viper) SafeWriteConfigAs(filename string) error {
- alreadyExists, err := afero.Exists(v.fs, filename)
- if alreadyExists && err == nil {
- return ConfigFileAlreadyExistsError(filename)
- }
- return v.writeConfig(filename, false)
-}
-
-func (v *Viper) writeConfig(filename string, force bool) error {
- v.logger.Info("attempting to write configuration to file")
-
- var configType string
-
- ext := filepath.Ext(filename)
- if ext != "" && ext != filepath.Base(filename) {
- configType = ext[1:]
- } else {
- configType = v.configType
- }
- if configType == "" {
- return fmt.Errorf("config type could not be determined for %s", filename)
- }
-
- if !stringInSlice(configType, SupportedExts) {
- return UnsupportedConfigError(configType)
- }
- if v.config == nil {
- v.config = make(map[string]any)
- }
- flags := os.O_CREATE | os.O_TRUNC | os.O_WRONLY
- if !force {
- flags |= os.O_EXCL
- }
- f, err := v.fs.OpenFile(filename, flags, v.configPermissions)
- if err != nil {
- return err
- }
- defer f.Close()
-
- if err := v.marshalWriter(f, configType); err != nil {
- return err
- }
-
- return f.Sync()
-}
-
-func (v *Viper) unmarshalReader(in io.Reader, c map[string]any) error {
- buf := new(bytes.Buffer)
- buf.ReadFrom(in)
-
- switch format := strings.ToLower(v.getConfigType()); format {
- case "yaml", "yml", "json", "toml", "hcl", "tfvars", "ini", "properties", "props", "prop", "dotenv", "env":
- err := v.decoderRegistry.Decode(format, buf.Bytes(), c)
- if err != nil {
- return ConfigParseError{err}
- }
- }
-
- insensitiviseMap(c)
- return nil
-}
-
-// Marshal a map into Writer.
-func (v *Viper) marshalWriter(f afero.File, configType string) error {
- c := v.AllSettings()
- switch configType {
- case "yaml", "yml", "json", "toml", "hcl", "tfvars", "ini", "prop", "props", "properties", "dotenv", "env":
- b, err := v.encoderRegistry.Encode(configType, c)
- if err != nil {
- return ConfigMarshalError{err}
- }
-
- _, err = f.WriteString(string(b))
- if err != nil {
- return ConfigMarshalError{err}
- }
- }
- return nil
-}
-
-func keyExists(k string, m map[string]any) string {
- lk := strings.ToLower(k)
- for mk := range m {
- lmk := strings.ToLower(mk)
- if lmk == lk {
- return mk
- }
- }
- return ""
-}
-
-func castToMapStringInterface(
- src map[any]any,
-) map[string]any {
- tgt := map[string]any{}
- for k, v := range src {
- tgt[fmt.Sprintf("%v", k)] = v
- }
- return tgt
-}
-
-func castMapStringSliceToMapInterface(src map[string][]string) map[string]any {
- tgt := map[string]any{}
- for k, v := range src {
- tgt[k] = v
- }
- return tgt
-}
-
-func castMapStringToMapInterface(src map[string]string) map[string]any {
- tgt := map[string]any{}
- for k, v := range src {
- tgt[k] = v
- }
- return tgt
-}
-
-func castMapFlagToMapInterface(src map[string]FlagValue) map[string]any {
- tgt := map[string]any{}
- for k, v := range src {
- tgt[k] = v
- }
- return tgt
-}
-
-// mergeMaps merges two maps. The `itgt` parameter is for handling go-yaml's
-// insistence on parsing nested structures as `map[any]any`
-// instead of using a `string` as the key for nest structures beyond one level
-// deep. Both map types are supported as there is a go-yaml fork that uses
-// `map[string]any` instead.
-func mergeMaps(src, tgt map[string]any, itgt map[any]any) {
- for sk, sv := range src {
- tk := keyExists(sk, tgt)
- if tk == "" {
- v.logger.Debug("", "tk", "\"\"", fmt.Sprintf("tgt[%s]", sk), sv)
- tgt[sk] = sv
- if itgt != nil {
- itgt[sk] = sv
- }
- continue
- }
-
- tv, ok := tgt[tk]
- if !ok {
- v.logger.Debug("", fmt.Sprintf("ok[%s]", tk), false, fmt.Sprintf("tgt[%s]", sk), sv)
- tgt[sk] = sv
- if itgt != nil {
- itgt[sk] = sv
- }
- continue
- }
-
- svType := reflect.TypeOf(sv)
- tvType := reflect.TypeOf(tv)
-
- v.logger.Debug(
- "processing",
- "key", sk,
- "st", svType,
- "tt", tvType,
- "sv", sv,
- "tv", tv,
- )
-
- switch ttv := tv.(type) {
- case map[any]any:
- v.logger.Debug("merging maps (must convert)")
- tsv, ok := sv.(map[any]any)
- if !ok {
- v.logger.Error(
- "Could not cast sv to map[any]any",
- "key", sk,
- "st", svType,
- "tt", tvType,
- "sv", sv,
- "tv", tv,
- )
- continue
- }
-
- ssv := castToMapStringInterface(tsv)
- stv := castToMapStringInterface(ttv)
- mergeMaps(ssv, stv, ttv)
- case map[string]any:
- v.logger.Debug("merging maps")
- tsv, ok := sv.(map[string]any)
- if !ok {
- v.logger.Error(
- "Could not cast sv to map[string]any",
- "key", sk,
- "st", svType,
- "tt", tvType,
- "sv", sv,
- "tv", tv,
- )
- continue
- }
- mergeMaps(tsv, ttv, nil)
- default:
- v.logger.Debug("setting value")
- tgt[tk] = sv
- if itgt != nil {
- itgt[tk] = sv
- }
- }
- }
-}
-
-// ReadRemoteConfig attempts to get configuration from a remote source
-// and read it in the remote configuration registry.
-func ReadRemoteConfig() error { return v.ReadRemoteConfig() }
-
-func (v *Viper) ReadRemoteConfig() error {
- return v.getKeyValueConfig()
-}
-
-func WatchRemoteConfig() error { return v.WatchRemoteConfig() }
-func (v *Viper) WatchRemoteConfig() error {
- return v.watchKeyValueConfig()
-}
-
-func (v *Viper) WatchRemoteConfigOnChannel() error {
- return v.watchKeyValueConfigOnChannel()
-}
-
-// Retrieve the first found remote configuration.
-func (v *Viper) getKeyValueConfig() error {
- if RemoteConfig == nil {
- return RemoteConfigError("Enable the remote features by doing a blank import of the viper/remote package: '_ github.com/spf13/viper/remote'")
- }
-
- if len(v.remoteProviders) == 0 {
- return RemoteConfigError("No Remote Providers")
- }
-
- for _, rp := range v.remoteProviders {
- val, err := v.getRemoteConfig(rp)
- if err != nil {
- v.logger.Error(fmt.Errorf("get remote config: %w", err).Error())
-
- continue
- }
-
- v.kvstore = val
-
- return nil
- }
- return RemoteConfigError("No Files Found")
-}
-
-func (v *Viper) getRemoteConfig(provider RemoteProvider) (map[string]any, error) {
- reader, err := RemoteConfig.Get(provider)
- if err != nil {
- return nil, err
- }
- err = v.unmarshalReader(reader, v.kvstore)
- return v.kvstore, err
-}
-
-// Retrieve the first found remote configuration.
-func (v *Viper) watchKeyValueConfigOnChannel() error {
- if len(v.remoteProviders) == 0 {
- return RemoteConfigError("No Remote Providers")
- }
-
- for _, rp := range v.remoteProviders {
- respc, _ := RemoteConfig.WatchChannel(rp)
- // Todo: Add quit channel
- go func(rc <-chan *RemoteResponse) {
- for {
- b := <-rc
- reader := bytes.NewReader(b.Value)
- v.unmarshalReader(reader, v.kvstore)
- }
- }(respc)
- return nil
- }
- return RemoteConfigError("No Files Found")
-}
-
-// Retrieve the first found remote configuration.
-func (v *Viper) watchKeyValueConfig() error {
- if len(v.remoteProviders) == 0 {
- return RemoteConfigError("No Remote Providers")
- }
-
- for _, rp := range v.remoteProviders {
- val, err := v.watchRemoteConfig(rp)
- if err != nil {
- v.logger.Error(fmt.Errorf("watch remote config: %w", err).Error())
-
- continue
- }
- v.kvstore = val
- return nil
- }
- return RemoteConfigError("No Files Found")
-}
-
-func (v *Viper) watchRemoteConfig(provider RemoteProvider) (map[string]any, error) {
- reader, err := RemoteConfig.Watch(provider)
- if err != nil {
- return nil, err
- }
- err = v.unmarshalReader(reader, v.kvstore)
- return v.kvstore, err
-}
-
-// AllKeys returns all keys holding a value, regardless of where they are set.
-// Nested keys are returned with a v.keyDelim separator.
-func AllKeys() []string { return v.AllKeys() }
-
-func (v *Viper) AllKeys() []string {
- m := map[string]bool{}
- // add all paths, by order of descending priority to ensure correct shadowing
- m = v.flattenAndMergeMap(m, castMapStringToMapInterface(v.aliases), "")
- m = v.flattenAndMergeMap(m, v.override, "")
- m = v.mergeFlatMap(m, castMapFlagToMapInterface(v.pflags))
- m = v.mergeFlatMap(m, castMapStringSliceToMapInterface(v.env))
- m = v.flattenAndMergeMap(m, v.config, "")
- m = v.flattenAndMergeMap(m, v.kvstore, "")
- m = v.flattenAndMergeMap(m, v.defaults, "")
-
- // convert set of paths to list
- a := make([]string, 0, len(m))
- for x := range m {
- a = append(a, x)
- }
- return a
-}
-
-// flattenAndMergeMap recursively flattens the given map into a map[string]bool
-// of key paths (used as a set, easier to manipulate than a []string):
-// - each path is merged into a single key string, delimited with v.keyDelim
-// - if a path is shadowed by an earlier value in the initial shadow map,
-// it is skipped.
-//
-// The resulting set of paths is merged to the given shadow set at the same time.
-func (v *Viper) flattenAndMergeMap(shadow map[string]bool, m map[string]any, prefix string) map[string]bool {
- if shadow != nil && prefix != "" && shadow[prefix] {
- // prefix is shadowed => nothing more to flatten
- return shadow
- }
- if shadow == nil {
- shadow = make(map[string]bool)
- }
-
- var m2 map[string]any
- if prefix != "" {
- prefix += v.keyDelim
- }
- for k, val := range m {
- fullKey := prefix + k
- switch val := val.(type) {
- case map[string]any:
- m2 = val
- case map[any]any:
- m2 = cast.ToStringMap(val)
- default:
- // immediate value
- shadow[strings.ToLower(fullKey)] = true
- continue
- }
- // recursively merge to shadow map
- shadow = v.flattenAndMergeMap(shadow, m2, fullKey)
- }
- return shadow
-}
-
-// mergeFlatMap merges the given maps, excluding values of the second map
-// shadowed by values from the first map.
-func (v *Viper) mergeFlatMap(shadow map[string]bool, m map[string]any) map[string]bool {
- // scan keys
-outer:
- for k := range m {
- path := strings.Split(k, v.keyDelim)
- // scan intermediate paths
- var parentKey string
- for i := 1; i < len(path); i++ {
- parentKey = strings.Join(path[0:i], v.keyDelim)
- if shadow[parentKey] {
- // path is shadowed, continue
- continue outer
- }
- }
- // add key
- shadow[strings.ToLower(k)] = true
- }
- return shadow
-}
-
-// AllSettings merges all settings and returns them as a map[string]any.
-func AllSettings() map[string]any { return v.AllSettings() }
-
-func (v *Viper) AllSettings() map[string]any {
- return v.getSettings(v.AllKeys())
-}
-
-func (v *Viper) getSettings(keys []string) map[string]any {
- m := map[string]any{}
- // start from the list of keys, and construct the map one value at a time
- for _, k := range keys {
- value := v.Get(k)
- if value == nil {
- // should not happen, since AllKeys() returns only keys holding a value,
- // check just in case anything changes
- continue
- }
- path := strings.Split(k, v.keyDelim)
- lastKey := strings.ToLower(path[len(path)-1])
- deepestMap := deepSearch(m, path[0:len(path)-1])
- // set innermost value
- deepestMap[lastKey] = value
- }
- return m
-}
-
-// SetFs sets the filesystem to use to read configuration.
-func SetFs(fs afero.Fs) { v.SetFs(fs) }
-
-func (v *Viper) SetFs(fs afero.Fs) {
- v.fs = fs
-}
-
-// SetConfigName sets name for the config file.
-// Does not include extension.
-func SetConfigName(in string) { v.SetConfigName(in) }
-
-func (v *Viper) SetConfigName(in string) {
- if in != "" {
- v.configName = in
- v.configFile = ""
- }
-}
-
-// SetConfigType sets the type of the configuration returned by the
-// remote source, e.g. "json".
-func SetConfigType(in string) { v.SetConfigType(in) }
-
-func (v *Viper) SetConfigType(in string) {
- if in != "" {
- v.configType = in
- }
-}
-
-// SetConfigPermissions sets the permissions for the config file.
-func SetConfigPermissions(perm os.FileMode) { v.SetConfigPermissions(perm) }
-
-func (v *Viper) SetConfigPermissions(perm os.FileMode) {
- v.configPermissions = perm.Perm()
-}
-
-// IniLoadOptions sets the load options for ini parsing.
-func IniLoadOptions(in ini.LoadOptions) Option {
- return optionFunc(func(v *Viper) {
- v.iniLoadOptions = in
- })
-}
-
-func (v *Viper) getConfigType() string {
- if v.configType != "" {
- return v.configType
- }
-
- cf, err := v.getConfigFile()
- if err != nil {
- return ""
- }
-
- ext := filepath.Ext(cf)
-
- if len(ext) > 1 {
- return ext[1:]
- }
-
- return ""
-}
-
-func (v *Viper) getConfigFile() (string, error) {
- if v.configFile == "" {
- cf, err := v.findConfigFile()
- if err != nil {
- return "", err
- }
- v.configFile = cf
- }
- return v.configFile, nil
-}
-
-// Debug prints all configuration registries for debugging
-// purposes.
-func Debug() { v.Debug() }
-func DebugTo(w io.Writer) { v.DebugTo(w) }
-
-func (v *Viper) Debug() { v.DebugTo(os.Stdout) }
-
-func (v *Viper) DebugTo(w io.Writer) {
- fmt.Fprintf(w, "Aliases:\n%#v\n", v.aliases)
- fmt.Fprintf(w, "Override:\n%#v\n", v.override)
- fmt.Fprintf(w, "PFlags:\n%#v\n", v.pflags)
- fmt.Fprintf(w, "Env:\n%#v\n", v.env)
- fmt.Fprintf(w, "Key/Value Store:\n%#v\n", v.kvstore)
- fmt.Fprintf(w, "Config:\n%#v\n", v.config)
- fmt.Fprintf(w, "Defaults:\n%#v\n", v.defaults)
-}
diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE
deleted file mode 100644
index 4b0421cf9..000000000
--- a/vendor/github.com/stretchr/testify/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go
deleted file mode 100644
index 7e19eba09..000000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_compare.go
+++ /dev/null
@@ -1,489 +0,0 @@
-package assert
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "time"
-)
-
-// Deprecated: CompareType has only ever been for internal use and has accidentally been published since v1.6.0. Do not use it.
-type CompareType = compareResult
-
-type compareResult int
-
-const (
- compareLess compareResult = iota - 1
- compareEqual
- compareGreater
-)
-
-var (
- intType = reflect.TypeOf(int(1))
- int8Type = reflect.TypeOf(int8(1))
- int16Type = reflect.TypeOf(int16(1))
- int32Type = reflect.TypeOf(int32(1))
- int64Type = reflect.TypeOf(int64(1))
-
- uintType = reflect.TypeOf(uint(1))
- uint8Type = reflect.TypeOf(uint8(1))
- uint16Type = reflect.TypeOf(uint16(1))
- uint32Type = reflect.TypeOf(uint32(1))
- uint64Type = reflect.TypeOf(uint64(1))
-
- uintptrType = reflect.TypeOf(uintptr(1))
-
- float32Type = reflect.TypeOf(float32(1))
- float64Type = reflect.TypeOf(float64(1))
-
- stringType = reflect.TypeOf("")
-
- timeType = reflect.TypeOf(time.Time{})
- bytesType = reflect.TypeOf([]byte{})
-)
-
-func compare(obj1, obj2 interface{}, kind reflect.Kind) (compareResult, bool) {
- obj1Value := reflect.ValueOf(obj1)
- obj2Value := reflect.ValueOf(obj2)
-
- // throughout this switch we try and avoid calling .Convert() if possible,
- // as this has a pretty big performance impact
- switch kind {
- case reflect.Int:
- {
- intobj1, ok := obj1.(int)
- if !ok {
- intobj1 = obj1Value.Convert(intType).Interface().(int)
- }
- intobj2, ok := obj2.(int)
- if !ok {
- intobj2 = obj2Value.Convert(intType).Interface().(int)
- }
- if intobj1 > intobj2 {
- return compareGreater, true
- }
- if intobj1 == intobj2 {
- return compareEqual, true
- }
- if intobj1 < intobj2 {
- return compareLess, true
- }
- }
- case reflect.Int8:
- {
- int8obj1, ok := obj1.(int8)
- if !ok {
- int8obj1 = obj1Value.Convert(int8Type).Interface().(int8)
- }
- int8obj2, ok := obj2.(int8)
- if !ok {
- int8obj2 = obj2Value.Convert(int8Type).Interface().(int8)
- }
- if int8obj1 > int8obj2 {
- return compareGreater, true
- }
- if int8obj1 == int8obj2 {
- return compareEqual, true
- }
- if int8obj1 < int8obj2 {
- return compareLess, true
- }
- }
- case reflect.Int16:
- {
- int16obj1, ok := obj1.(int16)
- if !ok {
- int16obj1 = obj1Value.Convert(int16Type).Interface().(int16)
- }
- int16obj2, ok := obj2.(int16)
- if !ok {
- int16obj2 = obj2Value.Convert(int16Type).Interface().(int16)
- }
- if int16obj1 > int16obj2 {
- return compareGreater, true
- }
- if int16obj1 == int16obj2 {
- return compareEqual, true
- }
- if int16obj1 < int16obj2 {
- return compareLess, true
- }
- }
- case reflect.Int32:
- {
- int32obj1, ok := obj1.(int32)
- if !ok {
- int32obj1 = obj1Value.Convert(int32Type).Interface().(int32)
- }
- int32obj2, ok := obj2.(int32)
- if !ok {
- int32obj2 = obj2Value.Convert(int32Type).Interface().(int32)
- }
- if int32obj1 > int32obj2 {
- return compareGreater, true
- }
- if int32obj1 == int32obj2 {
- return compareEqual, true
- }
- if int32obj1 < int32obj2 {
- return compareLess, true
- }
- }
- case reflect.Int64:
- {
- int64obj1, ok := obj1.(int64)
- if !ok {
- int64obj1 = obj1Value.Convert(int64Type).Interface().(int64)
- }
- int64obj2, ok := obj2.(int64)
- if !ok {
- int64obj2 = obj2Value.Convert(int64Type).Interface().(int64)
- }
- if int64obj1 > int64obj2 {
- return compareGreater, true
- }
- if int64obj1 == int64obj2 {
- return compareEqual, true
- }
- if int64obj1 < int64obj2 {
- return compareLess, true
- }
- }
- case reflect.Uint:
- {
- uintobj1, ok := obj1.(uint)
- if !ok {
- uintobj1 = obj1Value.Convert(uintType).Interface().(uint)
- }
- uintobj2, ok := obj2.(uint)
- if !ok {
- uintobj2 = obj2Value.Convert(uintType).Interface().(uint)
- }
- if uintobj1 > uintobj2 {
- return compareGreater, true
- }
- if uintobj1 == uintobj2 {
- return compareEqual, true
- }
- if uintobj1 < uintobj2 {
- return compareLess, true
- }
- }
- case reflect.Uint8:
- {
- uint8obj1, ok := obj1.(uint8)
- if !ok {
- uint8obj1 = obj1Value.Convert(uint8Type).Interface().(uint8)
- }
- uint8obj2, ok := obj2.(uint8)
- if !ok {
- uint8obj2 = obj2Value.Convert(uint8Type).Interface().(uint8)
- }
- if uint8obj1 > uint8obj2 {
- return compareGreater, true
- }
- if uint8obj1 == uint8obj2 {
- return compareEqual, true
- }
- if uint8obj1 < uint8obj2 {
- return compareLess, true
- }
- }
- case reflect.Uint16:
- {
- uint16obj1, ok := obj1.(uint16)
- if !ok {
- uint16obj1 = obj1Value.Convert(uint16Type).Interface().(uint16)
- }
- uint16obj2, ok := obj2.(uint16)
- if !ok {
- uint16obj2 = obj2Value.Convert(uint16Type).Interface().(uint16)
- }
- if uint16obj1 > uint16obj2 {
- return compareGreater, true
- }
- if uint16obj1 == uint16obj2 {
- return compareEqual, true
- }
- if uint16obj1 < uint16obj2 {
- return compareLess, true
- }
- }
- case reflect.Uint32:
- {
- uint32obj1, ok := obj1.(uint32)
- if !ok {
- uint32obj1 = obj1Value.Convert(uint32Type).Interface().(uint32)
- }
- uint32obj2, ok := obj2.(uint32)
- if !ok {
- uint32obj2 = obj2Value.Convert(uint32Type).Interface().(uint32)
- }
- if uint32obj1 > uint32obj2 {
- return compareGreater, true
- }
- if uint32obj1 == uint32obj2 {
- return compareEqual, true
- }
- if uint32obj1 < uint32obj2 {
- return compareLess, true
- }
- }
- case reflect.Uint64:
- {
- uint64obj1, ok := obj1.(uint64)
- if !ok {
- uint64obj1 = obj1Value.Convert(uint64Type).Interface().(uint64)
- }
- uint64obj2, ok := obj2.(uint64)
- if !ok {
- uint64obj2 = obj2Value.Convert(uint64Type).Interface().(uint64)
- }
- if uint64obj1 > uint64obj2 {
- return compareGreater, true
- }
- if uint64obj1 == uint64obj2 {
- return compareEqual, true
- }
- if uint64obj1 < uint64obj2 {
- return compareLess, true
- }
- }
- case reflect.Float32:
- {
- float32obj1, ok := obj1.(float32)
- if !ok {
- float32obj1 = obj1Value.Convert(float32Type).Interface().(float32)
- }
- float32obj2, ok := obj2.(float32)
- if !ok {
- float32obj2 = obj2Value.Convert(float32Type).Interface().(float32)
- }
- if float32obj1 > float32obj2 {
- return compareGreater, true
- }
- if float32obj1 == float32obj2 {
- return compareEqual, true
- }
- if float32obj1 < float32obj2 {
- return compareLess, true
- }
- }
- case reflect.Float64:
- {
- float64obj1, ok := obj1.(float64)
- if !ok {
- float64obj1 = obj1Value.Convert(float64Type).Interface().(float64)
- }
- float64obj2, ok := obj2.(float64)
- if !ok {
- float64obj2 = obj2Value.Convert(float64Type).Interface().(float64)
- }
- if float64obj1 > float64obj2 {
- return compareGreater, true
- }
- if float64obj1 == float64obj2 {
- return compareEqual, true
- }
- if float64obj1 < float64obj2 {
- return compareLess, true
- }
- }
- case reflect.String:
- {
- stringobj1, ok := obj1.(string)
- if !ok {
- stringobj1 = obj1Value.Convert(stringType).Interface().(string)
- }
- stringobj2, ok := obj2.(string)
- if !ok {
- stringobj2 = obj2Value.Convert(stringType).Interface().(string)
- }
- if stringobj1 > stringobj2 {
- return compareGreater, true
- }
- if stringobj1 == stringobj2 {
- return compareEqual, true
- }
- if stringobj1 < stringobj2 {
- return compareLess, true
- }
- }
- // Check for known struct types we can check for compare results.
- case reflect.Struct:
- {
- // All structs enter here. We're not interested in most types.
- if !obj1Value.CanConvert(timeType) {
- break
- }
-
- // time.Time can be compared!
- timeObj1, ok := obj1.(time.Time)
- if !ok {
- timeObj1 = obj1Value.Convert(timeType).Interface().(time.Time)
- }
-
- timeObj2, ok := obj2.(time.Time)
- if !ok {
- timeObj2 = obj2Value.Convert(timeType).Interface().(time.Time)
- }
-
- if timeObj1.Before(timeObj2) {
- return compareLess, true
- }
- if timeObj1.Equal(timeObj2) {
- return compareEqual, true
- }
- return compareGreater, true
- }
- case reflect.Slice:
- {
- // We only care about the []byte type.
- if !obj1Value.CanConvert(bytesType) {
- break
- }
-
- // []byte can be compared!
- bytesObj1, ok := obj1.([]byte)
- if !ok {
- bytesObj1 = obj1Value.Convert(bytesType).Interface().([]byte)
-
- }
- bytesObj2, ok := obj2.([]byte)
- if !ok {
- bytesObj2 = obj2Value.Convert(bytesType).Interface().([]byte)
- }
-
- return compareResult(bytes.Compare(bytesObj1, bytesObj2)), true
- }
- case reflect.Uintptr:
- {
- uintptrObj1, ok := obj1.(uintptr)
- if !ok {
- uintptrObj1 = obj1Value.Convert(uintptrType).Interface().(uintptr)
- }
- uintptrObj2, ok := obj2.(uintptr)
- if !ok {
- uintptrObj2 = obj2Value.Convert(uintptrType).Interface().(uintptr)
- }
- if uintptrObj1 > uintptrObj2 {
- return compareGreater, true
- }
- if uintptrObj1 == uintptrObj2 {
- return compareEqual, true
- }
- if uintptrObj1 < uintptrObj2 {
- return compareLess, true
- }
- }
- }
-
- return compareEqual, false
-}
-
-// Greater asserts that the first element is greater than the second
-//
-// assert.Greater(t, 2, 1)
-// assert.Greater(t, float64(2), float64(1))
-// assert.Greater(t, "b", "a")
-func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...)
-}
-
-// GreaterOrEqual asserts that the first element is greater than or equal to the second
-//
-// assert.GreaterOrEqual(t, 2, 1)
-// assert.GreaterOrEqual(t, 2, 2)
-// assert.GreaterOrEqual(t, "b", "a")
-// assert.GreaterOrEqual(t, "b", "b")
-func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...)
-}
-
-// Less asserts that the first element is less than the second
-//
-// assert.Less(t, 1, 2)
-// assert.Less(t, float64(1), float64(2))
-// assert.Less(t, "a", "b")
-func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return compareTwoValues(t, e1, e2, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...)
-}
-
-// LessOrEqual asserts that the first element is less than or equal to the second
-//
-// assert.LessOrEqual(t, 1, 2)
-// assert.LessOrEqual(t, 2, 2)
-// assert.LessOrEqual(t, "a", "b")
-// assert.LessOrEqual(t, "b", "b")
-func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...)
-}
-
-// Positive asserts that the specified element is positive
-//
-// assert.Positive(t, 1)
-// assert.Positive(t, 1.23)
-func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- zero := reflect.Zero(reflect.TypeOf(e))
- return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, "\"%v\" is not positive", msgAndArgs...)
-}
-
-// Negative asserts that the specified element is negative
-//
-// assert.Negative(t, -1)
-// assert.Negative(t, -1.23)
-func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- zero := reflect.Zero(reflect.TypeOf(e))
- return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, "\"%v\" is not negative", msgAndArgs...)
-}
-
-func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- e1Kind := reflect.ValueOf(e1).Kind()
- e2Kind := reflect.ValueOf(e2).Kind()
- if e1Kind != e2Kind {
- return Fail(t, "Elements should be the same type", msgAndArgs...)
- }
-
- compareResult, isComparable := compare(e1, e2, e1Kind)
- if !isComparable {
- return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...)
- }
-
- if !containsValue(allowedComparesResults, compareResult) {
- return Fail(t, fmt.Sprintf(failMessage, e1, e2), msgAndArgs...)
- }
-
- return true
-}
-
-func containsValue(values []compareResult, value compareResult) bool {
- for _, v := range values {
- if v == value {
- return true
- }
- }
-
- return false
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go
deleted file mode 100644
index 190634165..000000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_format.go
+++ /dev/null
@@ -1,841 +0,0 @@
-// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.
-
-package assert
-
-import (
- http "net/http"
- url "net/url"
- time "time"
-)
-
-// Conditionf uses a Comparison to assert a complex condition.
-func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Condition(t, comp, append([]interface{}{msg}, args...)...)
-}
-
-// Containsf asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
-// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
-// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
-func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
-}
-
-// DirExistsf checks whether a directory exists in the given path. It also fails
-// if the path is a file rather a directory or there is an error checking whether it exists.
-func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return DirExists(t, path, append([]interface{}{msg}, args...)...)
-}
-
-// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
-func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
-}
-
-// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// assert.Emptyf(t, obj, "error message %s", "formatted")
-func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Empty(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// Equalf asserts that two objects are equal.
-//
-// assert.Equalf(t, 123, 123, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Equal(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
-func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)
-}
-
-// EqualExportedValuesf asserts that the types of two objects are equal and their public
-// fields are also equal. This is useful for comparing structs that have private fields
-// that could potentially differ.
-//
-// type S struct {
-// Exported int
-// notExported int
-// }
-// assert.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true
-// assert.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
-func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// EqualValuesf asserts that two objects are equal or convertible to the larger
-// type and equal.
-//
-// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
-func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// Errorf asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.Errorf(t, err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
-func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Error(t, err, append([]interface{}{msg}, args...)...)
-}
-
-// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
-// This is a wrapper for errors.As.
-func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...)
-}
-
-// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
-// and that the error contains the specified substring.
-//
-// actualObj, err := SomeFunction()
-// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
-func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...)
-}
-
-// ErrorIsf asserts that at least one of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return ErrorIs(t, err, target, append([]interface{}{msg}, args...)...)
-}
-
-// Eventuallyf asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick.
-//
-// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
-func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
-}
-
-// EventuallyWithTf asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick. In contrast to Eventually,
-// it supplies a CollectT to the condition function, so that the condition
-// function can use the CollectT to call other assertions.
-// The condition is considered "met" if no errors are raised in a tick.
-// The supplied CollectT collects all errors from one tick (if there are any).
-// If the condition is not met before waitFor, the collected errors of
-// the last tick are copied to t.
-//
-// externalValue := false
-// go func() {
-// time.Sleep(8*time.Second)
-// externalValue = true
-// }()
-// assert.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") {
-// // add assertions as needed; any assertion failure will fail the current tick
-// assert.True(c, externalValue, "expected 'externalValue' to be true")
-// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
-func EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return EventuallyWithT(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
-}
-
-// Exactlyf asserts that two objects are equal in value and type.
-//
-// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
-func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// Failf reports a failure through
-func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Fail(t, failureMessage, append([]interface{}{msg}, args...)...)
-}
-
-// FailNowf fails test
-func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)
-}
-
-// Falsef asserts that the specified value is false.
-//
-// assert.Falsef(t, myBool, "error message %s", "formatted")
-func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return False(t, value, append([]interface{}{msg}, args...)...)
-}
-
-// FileExistsf checks whether a file exists in the given path. It also fails if
-// the path points to a directory or there is an error when trying to check the file.
-func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return FileExists(t, path, append([]interface{}{msg}, args...)...)
-}
-
-// Greaterf asserts that the first element is greater than the second
-//
-// assert.Greaterf(t, 2, 1, "error message %s", "formatted")
-// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
-// assert.Greaterf(t, "b", "a", "error message %s", "formatted")
-func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Greater(t, e1, e2, append([]interface{}{msg}, args...)...)
-}
-
-// GreaterOrEqualf asserts that the first element is greater than or equal to the second
-//
-// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
-// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
-// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
-// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
-func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPBodyContainsf asserts that a specified handler returns a
-// body that contains a string.
-//
-// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPBodyNotContainsf asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPErrorf asserts that a specified handler returns an error status code.
-//
-// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPRedirectf asserts that a specified handler returns a redirect status code.
-//
-// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPStatusCodef asserts that a specified handler returns a specified status code.
-//
-// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPStatusCode(t, handler, method, url, values, statuscode, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPSuccessf asserts that a specified handler returns a success status code.
-//
-// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
-}
-
-// Implementsf asserts that an object is implemented by the specified interface.
-//
-// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
-func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
-}
-
-// InDeltaf asserts that the two numerals are within delta of each other.
-//
-// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
-func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
-}
-
-// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
-}
-
-// InDeltaSlicef is the same as InDelta, except it compares two slices.
-func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
-}
-
-// InEpsilonf asserts that expected and actual have a relative error less than epsilon
-func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
-}
-
-// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
-func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
-}
-
-// IsDecreasingf asserts that the collection is decreasing
-//
-// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted")
-// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted")
-// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
-func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return IsDecreasing(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// IsIncreasingf asserts that the collection is increasing
-//
-// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted")
-// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted")
-// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
-func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return IsIncreasing(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// IsNonDecreasingf asserts that the collection is not decreasing
-//
-// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted")
-// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted")
-// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
-func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// IsNonIncreasingf asserts that the collection is not increasing
-//
-// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted")
-// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted")
-// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
-func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// IsTypef asserts that the specified objects are of the same type.
-func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)
-}
-
-// JSONEqf asserts that two JSON strings are equivalent.
-//
-// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
-func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// Lenf asserts that the specified object has specific length.
-// Lenf also fails if the object has a type that len() not accept.
-//
-// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
-func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Len(t, object, length, append([]interface{}{msg}, args...)...)
-}
-
-// Lessf asserts that the first element is less than the second
-//
-// assert.Lessf(t, 1, 2, "error message %s", "formatted")
-// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
-// assert.Lessf(t, "a", "b", "error message %s", "formatted")
-func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Less(t, e1, e2, append([]interface{}{msg}, args...)...)
-}
-
-// LessOrEqualf asserts that the first element is less than or equal to the second
-//
-// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
-// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
-// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
-// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
-func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
-}
-
-// Negativef asserts that the specified element is negative
-//
-// assert.Negativef(t, -1, "error message %s", "formatted")
-// assert.Negativef(t, -1.23, "error message %s", "formatted")
-func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Negative(t, e, append([]interface{}{msg}, args...)...)
-}
-
-// Neverf asserts that the given condition doesn't satisfy in waitFor time,
-// periodically checking the target function each tick.
-//
-// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
-func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Never(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...)
-}
-
-// Nilf asserts that the specified object is nil.
-//
-// assert.Nilf(t, err, "error message %s", "formatted")
-func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Nil(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// NoDirExistsf checks whether a directory does not exist in the given path.
-// It fails if the path points to an existing _directory_ only.
-func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NoDirExists(t, path, append([]interface{}{msg}, args...)...)
-}
-
-// NoErrorf asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.NoErrorf(t, err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NoError(t, err, append([]interface{}{msg}, args...)...)
-}
-
-// NoFileExistsf checks whether a file does not exist in a given path. It fails
-// if the path points to an existing _file_ only.
-func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NoFileExists(t, path, append([]interface{}{msg}, args...)...)
-}
-
-// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
-// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
-// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
-func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotContains(t, s, contains, append([]interface{}{msg}, args...)...)
-}
-
-// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should not match.
-// This is an inverse of ElementsMatch.
-//
-// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false
-//
-// assert.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true
-//
-// assert.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true
-func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
-}
-
-// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
-func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// NotEqualf asserts that the specified values are NOT equal.
-//
-// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// NotEqualValuesf asserts that two objects are not equal even when converted to the same type
-//
-// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted")
-func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// NotErrorAsf asserts that none of the errors in err's chain matches target,
-// but if so, sets target to that error value.
-func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotErrorAs(t, err, target, append([]interface{}{msg}, args...)...)
-}
-
-// NotErrorIsf asserts that none of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...)
-}
-
-// NotImplementsf asserts that an object does not implement the specified interface.
-//
-// assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
-func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotImplements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
-}
-
-// NotNilf asserts that the specified object is not nil.
-//
-// assert.NotNilf(t, err, "error message %s", "formatted")
-func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotNil(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
-func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotPanics(t, f, append([]interface{}{msg}, args...)...)
-}
-
-// NotRegexpf asserts that a specified regexp does not match a string.
-//
-// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
-// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
-func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)
-}
-
-// NotSamef asserts that two pointers do not reference the same object.
-//
-// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted")
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// NotSubsetf asserts that the specified list(array, slice...) or map does NOT
-// contain all elements given in the specified subset list(array, slice...) or
-// map.
-//
-// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted")
-// assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted")
-func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
-}
-
-// NotZerof asserts that i is not the zero value for its type.
-func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotZero(t, i, append([]interface{}{msg}, args...)...)
-}
-
-// Panicsf asserts that the code inside the specified PanicTestFunc panics.
-//
-// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
-func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Panics(t, f, append([]interface{}{msg}, args...)...)
-}
-
-// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
-// panics, and that the recovered panic value is an error that satisfies the
-// EqualError comparison.
-//
-// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithError(t, errString, f, append([]interface{}{msg}, args...)...)
-}
-
-// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
-}
-
-// Positivef asserts that the specified element is positive
-//
-// assert.Positivef(t, 1, "error message %s", "formatted")
-// assert.Positivef(t, 1.23, "error message %s", "formatted")
-func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Positive(t, e, append([]interface{}{msg}, args...)...)
-}
-
-// Regexpf asserts that a specified regexp matches a string.
-//
-// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
-// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
-func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Regexp(t, rx, str, append([]interface{}{msg}, args...)...)
-}
-
-// Samef asserts that two pointers reference the same object.
-//
-// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted")
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Same(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// Subsetf asserts that the specified list(array, slice...) or map contains all
-// elements given in the specified subset list(array, slice...) or map.
-//
-// assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted")
-// assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted")
-func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Subset(t, list, subset, append([]interface{}{msg}, args...)...)
-}
-
-// Truef asserts that the specified value is true.
-//
-// assert.Truef(t, myBool, "error message %s", "formatted")
-func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return True(t, value, append([]interface{}{msg}, args...)...)
-}
-
-// WithinDurationf asserts that the two times are within duration delta of each other.
-//
-// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
-func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
-}
-
-// WithinRangef asserts that a time is within a time range (inclusive).
-//
-// assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
-func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return WithinRange(t, actual, start, end, append([]interface{}{msg}, args...)...)
-}
-
-// YAMLEqf asserts that two YAML strings are equivalent.
-func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// Zerof asserts that i is the zero value for its type.
-func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Zero(t, i, append([]interface{}{msg}, args...)...)
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl
deleted file mode 100644
index d2bb0b817..000000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{.CommentFormat}}
-func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool {
- if h, ok := t.(tHelper); ok { h.Helper() }
- return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}})
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go
deleted file mode 100644
index 21629087b..000000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go
+++ /dev/null
@@ -1,1673 +0,0 @@
-// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.
-
-package assert
-
-import (
- http "net/http"
- url "net/url"
- time "time"
-)
-
-// Condition uses a Comparison to assert a complex condition.
-func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Condition(a.t, comp, msgAndArgs...)
-}
-
-// Conditionf uses a Comparison to assert a complex condition.
-func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Conditionf(a.t, comp, msg, args...)
-}
-
-// Contains asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// a.Contains("Hello World", "World")
-// a.Contains(["Hello", "World"], "World")
-// a.Contains({"Hello": "World"}, "Hello")
-func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Contains(a.t, s, contains, msgAndArgs...)
-}
-
-// Containsf asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// a.Containsf("Hello World", "World", "error message %s", "formatted")
-// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
-// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
-func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Containsf(a.t, s, contains, msg, args...)
-}
-
-// DirExists checks whether a directory exists in the given path. It also fails
-// if the path is a file rather a directory or there is an error checking whether it exists.
-func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return DirExists(a.t, path, msgAndArgs...)
-}
-
-// DirExistsf checks whether a directory exists in the given path. It also fails
-// if the path is a file rather a directory or there is an error checking whether it exists.
-func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return DirExistsf(a.t, path, msg, args...)
-}
-
-// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])
-func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ElementsMatch(a.t, listA, listB, msgAndArgs...)
-}
-
-// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
-func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ElementsMatchf(a.t, listA, listB, msg, args...)
-}
-
-// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// a.Empty(obj)
-func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Empty(a.t, object, msgAndArgs...)
-}
-
-// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// a.Emptyf(obj, "error message %s", "formatted")
-func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Emptyf(a.t, object, msg, args...)
-}
-
-// Equal asserts that two objects are equal.
-//
-// a.Equal(123, 123)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Equal(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualError asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// a.EqualError(err, expectedErrorString)
-func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualError(a.t, theError, errString, msgAndArgs...)
-}
-
-// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
-func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualErrorf(a.t, theError, errString, msg, args...)
-}
-
-// EqualExportedValues asserts that the types of two objects are equal and their public
-// fields are also equal. This is useful for comparing structs that have private fields
-// that could potentially differ.
-//
-// type S struct {
-// Exported int
-// notExported int
-// }
-// a.EqualExportedValues(S{1, 2}, S{1, 3}) => true
-// a.EqualExportedValues(S{1, 2}, S{2, 3}) => false
-func (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualExportedValues(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualExportedValuesf asserts that the types of two objects are equal and their public
-// fields are also equal. This is useful for comparing structs that have private fields
-// that could potentially differ.
-//
-// type S struct {
-// Exported int
-// notExported int
-// }
-// a.EqualExportedValuesf(S{1, 2}, S{1, 3}, "error message %s", "formatted") => true
-// a.EqualExportedValuesf(S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
-func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualExportedValuesf(a.t, expected, actual, msg, args...)
-}
-
-// EqualValues asserts that two objects are equal or convertible to the larger
-// type and equal.
-//
-// a.EqualValues(uint32(123), int32(123))
-func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualValues(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualValuesf asserts that two objects are equal or convertible to the larger
-// type and equal.
-//
-// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted")
-func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualValuesf(a.t, expected, actual, msg, args...)
-}
-
-// Equalf asserts that two objects are equal.
-//
-// a.Equalf(123, 123, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Equalf(a.t, expected, actual, msg, args...)
-}
-
-// Error asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.Error(err) {
-// assert.Equal(t, expectedError, err)
-// }
-func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Error(a.t, err, msgAndArgs...)
-}
-
-// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
-// This is a wrapper for errors.As.
-func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ErrorAs(a.t, err, target, msgAndArgs...)
-}
-
-// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
-// This is a wrapper for errors.As.
-func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ErrorAsf(a.t, err, target, msg, args...)
-}
-
-// ErrorContains asserts that a function returned an error (i.e. not `nil`)
-// and that the error contains the specified substring.
-//
-// actualObj, err := SomeFunction()
-// a.ErrorContains(err, expectedErrorSubString)
-func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ErrorContains(a.t, theError, contains, msgAndArgs...)
-}
-
-// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
-// and that the error contains the specified substring.
-//
-// actualObj, err := SomeFunction()
-// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
-func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ErrorContainsf(a.t, theError, contains, msg, args...)
-}
-
-// ErrorIs asserts that at least one of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ErrorIs(a.t, err, target, msgAndArgs...)
-}
-
-// ErrorIsf asserts that at least one of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ErrorIsf(a.t, err, target, msg, args...)
-}
-
-// Errorf asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.Errorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
-func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Errorf(a.t, err, msg, args...)
-}
-
-// Eventually asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick.
-//
-// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond)
-func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Eventually(a.t, condition, waitFor, tick, msgAndArgs...)
-}
-
-// EventuallyWithT asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick. In contrast to Eventually,
-// it supplies a CollectT to the condition function, so that the condition
-// function can use the CollectT to call other assertions.
-// The condition is considered "met" if no errors are raised in a tick.
-// The supplied CollectT collects all errors from one tick (if there are any).
-// If the condition is not met before waitFor, the collected errors of
-// the last tick are copied to t.
-//
-// externalValue := false
-// go func() {
-// time.Sleep(8*time.Second)
-// externalValue = true
-// }()
-// a.EventuallyWithT(func(c *assert.CollectT) {
-// // add assertions as needed; any assertion failure will fail the current tick
-// assert.True(c, externalValue, "expected 'externalValue' to be true")
-// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
-func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...)
-}
-
-// EventuallyWithTf asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick. In contrast to Eventually,
-// it supplies a CollectT to the condition function, so that the condition
-// function can use the CollectT to call other assertions.
-// The condition is considered "met" if no errors are raised in a tick.
-// The supplied CollectT collects all errors from one tick (if there are any).
-// If the condition is not met before waitFor, the collected errors of
-// the last tick are copied to t.
-//
-// externalValue := false
-// go func() {
-// time.Sleep(8*time.Second)
-// externalValue = true
-// }()
-// a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") {
-// // add assertions as needed; any assertion failure will fail the current tick
-// assert.True(c, externalValue, "expected 'externalValue' to be true")
-// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
-func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EventuallyWithTf(a.t, condition, waitFor, tick, msg, args...)
-}
-
-// Eventuallyf asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick.
-//
-// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
-func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Eventuallyf(a.t, condition, waitFor, tick, msg, args...)
-}
-
-// Exactly asserts that two objects are equal in value and type.
-//
-// a.Exactly(int32(123), int64(123))
-func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Exactly(a.t, expected, actual, msgAndArgs...)
-}
-
-// Exactlyf asserts that two objects are equal in value and type.
-//
-// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted")
-func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Exactlyf(a.t, expected, actual, msg, args...)
-}
-
-// Fail reports a failure through
-func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Fail(a.t, failureMessage, msgAndArgs...)
-}
-
-// FailNow fails test
-func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return FailNow(a.t, failureMessage, msgAndArgs...)
-}
-
-// FailNowf fails test
-func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return FailNowf(a.t, failureMessage, msg, args...)
-}
-
-// Failf reports a failure through
-func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Failf(a.t, failureMessage, msg, args...)
-}
-
-// False asserts that the specified value is false.
-//
-// a.False(myBool)
-func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return False(a.t, value, msgAndArgs...)
-}
-
-// Falsef asserts that the specified value is false.
-//
-// a.Falsef(myBool, "error message %s", "formatted")
-func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Falsef(a.t, value, msg, args...)
-}
-
-// FileExists checks whether a file exists in the given path. It also fails if
-// the path points to a directory or there is an error when trying to check the file.
-func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return FileExists(a.t, path, msgAndArgs...)
-}
-
-// FileExistsf checks whether a file exists in the given path. It also fails if
-// the path points to a directory or there is an error when trying to check the file.
-func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return FileExistsf(a.t, path, msg, args...)
-}
-
-// Greater asserts that the first element is greater than the second
-//
-// a.Greater(2, 1)
-// a.Greater(float64(2), float64(1))
-// a.Greater("b", "a")
-func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Greater(a.t, e1, e2, msgAndArgs...)
-}
-
-// GreaterOrEqual asserts that the first element is greater than or equal to the second
-//
-// a.GreaterOrEqual(2, 1)
-// a.GreaterOrEqual(2, 2)
-// a.GreaterOrEqual("b", "a")
-// a.GreaterOrEqual("b", "b")
-func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return GreaterOrEqual(a.t, e1, e2, msgAndArgs...)
-}
-
-// GreaterOrEqualf asserts that the first element is greater than or equal to the second
-//
-// a.GreaterOrEqualf(2, 1, "error message %s", "formatted")
-// a.GreaterOrEqualf(2, 2, "error message %s", "formatted")
-// a.GreaterOrEqualf("b", "a", "error message %s", "formatted")
-// a.GreaterOrEqualf("b", "b", "error message %s", "formatted")
-func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return GreaterOrEqualf(a.t, e1, e2, msg, args...)
-}
-
-// Greaterf asserts that the first element is greater than the second
-//
-// a.Greaterf(2, 1, "error message %s", "formatted")
-// a.Greaterf(float64(2), float64(1), "error message %s", "formatted")
-// a.Greaterf("b", "a", "error message %s", "formatted")
-func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Greaterf(a.t, e1, e2, msg, args...)
-}
-
-// HTTPBodyContains asserts that a specified handler returns a
-// body that contains a string.
-//
-// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)
-}
-
-// HTTPBodyContainsf asserts that a specified handler returns a
-// body that contains a string.
-//
-// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)
-}
-
-// HTTPBodyNotContains asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)
-}
-
-// HTTPBodyNotContainsf asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)
-}
-
-// HTTPError asserts that a specified handler returns an error status code.
-//
-// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPError(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPErrorf asserts that a specified handler returns an error status code.
-//
-// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPErrorf(a.t, handler, method, url, values, msg, args...)
-}
-
-// HTTPRedirect asserts that a specified handler returns a redirect status code.
-//
-// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPRedirectf asserts that a specified handler returns a redirect status code.
-//
-// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPRedirectf(a.t, handler, method, url, values, msg, args...)
-}
-
-// HTTPStatusCode asserts that a specified handler returns a specified status code.
-//
-// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...)
-}
-
-// HTTPStatusCodef asserts that a specified handler returns a specified status code.
-//
-// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...)
-}
-
-// HTTPSuccess asserts that a specified handler returns a success status code.
-//
-// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPSuccessf asserts that a specified handler returns a success status code.
-//
-// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
-}
-
-// Implements asserts that an object is implemented by the specified interface.
-//
-// a.Implements((*MyInterface)(nil), new(MyObject))
-func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Implements(a.t, interfaceObject, object, msgAndArgs...)
-}
-
-// Implementsf asserts that an object is implemented by the specified interface.
-//
-// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
-func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Implementsf(a.t, interfaceObject, object, msg, args...)
-}
-
-// InDelta asserts that the two numerals are within delta of each other.
-//
-// a.InDelta(math.Pi, 22/7.0, 0.01)
-func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDelta(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)
-}
-
-// InDeltaSlice is the same as InDelta, except it compares two slices.
-func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaSlicef is the same as InDelta, except it compares two slices.
-func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
-}
-
-// InDeltaf asserts that the two numerals are within delta of each other.
-//
-// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
-func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaf(a.t, expected, actual, delta, msg, args...)
-}
-
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
-func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
-}
-
-// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
-func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
-}
-
-// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
-func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
-}
-
-// InEpsilonf asserts that expected and actual have a relative error less than epsilon
-func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
-}
-
-// IsDecreasing asserts that the collection is decreasing
-//
-// a.IsDecreasing([]int{2, 1, 0})
-// a.IsDecreasing([]float{2, 1})
-// a.IsDecreasing([]string{"b", "a"})
-func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsDecreasing(a.t, object, msgAndArgs...)
-}
-
-// IsDecreasingf asserts that the collection is decreasing
-//
-// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted")
-// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted")
-// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted")
-func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsDecreasingf(a.t, object, msg, args...)
-}
-
-// IsIncreasing asserts that the collection is increasing
-//
-// a.IsIncreasing([]int{1, 2, 3})
-// a.IsIncreasing([]float{1, 2})
-// a.IsIncreasing([]string{"a", "b"})
-func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsIncreasing(a.t, object, msgAndArgs...)
-}
-
-// IsIncreasingf asserts that the collection is increasing
-//
-// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted")
-// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted")
-// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted")
-func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsIncreasingf(a.t, object, msg, args...)
-}
-
-// IsNonDecreasing asserts that the collection is not decreasing
-//
-// a.IsNonDecreasing([]int{1, 1, 2})
-// a.IsNonDecreasing([]float{1, 2})
-// a.IsNonDecreasing([]string{"a", "b"})
-func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsNonDecreasing(a.t, object, msgAndArgs...)
-}
-
-// IsNonDecreasingf asserts that the collection is not decreasing
-//
-// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted")
-// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted")
-// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted")
-func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsNonDecreasingf(a.t, object, msg, args...)
-}
-
-// IsNonIncreasing asserts that the collection is not increasing
-//
-// a.IsNonIncreasing([]int{2, 1, 1})
-// a.IsNonIncreasing([]float{2, 1})
-// a.IsNonIncreasing([]string{"b", "a"})
-func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsNonIncreasing(a.t, object, msgAndArgs...)
-}
-
-// IsNonIncreasingf asserts that the collection is not increasing
-//
-// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted")
-// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted")
-// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted")
-func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsNonIncreasingf(a.t, object, msg, args...)
-}
-
-// IsType asserts that the specified objects are of the same type.
-func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsType(a.t, expectedType, object, msgAndArgs...)
-}
-
-// IsTypef asserts that the specified objects are of the same type.
-func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsTypef(a.t, expectedType, object, msg, args...)
-}
-
-// JSONEq asserts that two JSON strings are equivalent.
-//
-// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return JSONEq(a.t, expected, actual, msgAndArgs...)
-}
-
-// JSONEqf asserts that two JSON strings are equivalent.
-//
-// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
-func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return JSONEqf(a.t, expected, actual, msg, args...)
-}
-
-// Len asserts that the specified object has specific length.
-// Len also fails if the object has a type that len() not accept.
-//
-// a.Len(mySlice, 3)
-func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Len(a.t, object, length, msgAndArgs...)
-}
-
-// Lenf asserts that the specified object has specific length.
-// Lenf also fails if the object has a type that len() not accept.
-//
-// a.Lenf(mySlice, 3, "error message %s", "formatted")
-func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Lenf(a.t, object, length, msg, args...)
-}
-
-// Less asserts that the first element is less than the second
-//
-// a.Less(1, 2)
-// a.Less(float64(1), float64(2))
-// a.Less("a", "b")
-func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Less(a.t, e1, e2, msgAndArgs...)
-}
-
-// LessOrEqual asserts that the first element is less than or equal to the second
-//
-// a.LessOrEqual(1, 2)
-// a.LessOrEqual(2, 2)
-// a.LessOrEqual("a", "b")
-// a.LessOrEqual("b", "b")
-func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return LessOrEqual(a.t, e1, e2, msgAndArgs...)
-}
-
-// LessOrEqualf asserts that the first element is less than or equal to the second
-//
-// a.LessOrEqualf(1, 2, "error message %s", "formatted")
-// a.LessOrEqualf(2, 2, "error message %s", "formatted")
-// a.LessOrEqualf("a", "b", "error message %s", "formatted")
-// a.LessOrEqualf("b", "b", "error message %s", "formatted")
-func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return LessOrEqualf(a.t, e1, e2, msg, args...)
-}
-
-// Lessf asserts that the first element is less than the second
-//
-// a.Lessf(1, 2, "error message %s", "formatted")
-// a.Lessf(float64(1), float64(2), "error message %s", "formatted")
-// a.Lessf("a", "b", "error message %s", "formatted")
-func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Lessf(a.t, e1, e2, msg, args...)
-}
-
-// Negative asserts that the specified element is negative
-//
-// a.Negative(-1)
-// a.Negative(-1.23)
-func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Negative(a.t, e, msgAndArgs...)
-}
-
-// Negativef asserts that the specified element is negative
-//
-// a.Negativef(-1, "error message %s", "formatted")
-// a.Negativef(-1.23, "error message %s", "formatted")
-func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Negativef(a.t, e, msg, args...)
-}
-
-// Never asserts that the given condition doesn't satisfy in waitFor time,
-// periodically checking the target function each tick.
-//
-// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond)
-func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Never(a.t, condition, waitFor, tick, msgAndArgs...)
-}
-
-// Neverf asserts that the given condition doesn't satisfy in waitFor time,
-// periodically checking the target function each tick.
-//
-// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
-func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Neverf(a.t, condition, waitFor, tick, msg, args...)
-}
-
-// Nil asserts that the specified object is nil.
-//
-// a.Nil(err)
-func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Nil(a.t, object, msgAndArgs...)
-}
-
-// Nilf asserts that the specified object is nil.
-//
-// a.Nilf(err, "error message %s", "formatted")
-func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Nilf(a.t, object, msg, args...)
-}
-
-// NoDirExists checks whether a directory does not exist in the given path.
-// It fails if the path points to an existing _directory_ only.
-func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NoDirExists(a.t, path, msgAndArgs...)
-}
-
-// NoDirExistsf checks whether a directory does not exist in the given path.
-// It fails if the path points to an existing _directory_ only.
-func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NoDirExistsf(a.t, path, msg, args...)
-}
-
-// NoError asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.NoError(err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NoError(a.t, err, msgAndArgs...)
-}
-
-// NoErrorf asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.NoErrorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NoErrorf(a.t, err, msg, args...)
-}
-
-// NoFileExists checks whether a file does not exist in a given path. It fails
-// if the path points to an existing _file_ only.
-func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NoFileExists(a.t, path, msgAndArgs...)
-}
-
-// NoFileExistsf checks whether a file does not exist in a given path. It fails
-// if the path points to an existing _file_ only.
-func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NoFileExistsf(a.t, path, msg, args...)
-}
-
-// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// a.NotContains("Hello World", "Earth")
-// a.NotContains(["Hello", "World"], "Earth")
-// a.NotContains({"Hello": "World"}, "Earth")
-func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotContains(a.t, s, contains, msgAndArgs...)
-}
-
-// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
-// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
-// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
-func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotContainsf(a.t, s, contains, msg, args...)
-}
-
-// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should not match.
-// This is an inverse of ElementsMatch.
-//
-// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false
-//
-// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true
-//
-// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true
-func (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotElementsMatch(a.t, listA, listB, msgAndArgs...)
-}
-
-// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should not match.
-// This is an inverse of ElementsMatch.
-//
-// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false
-//
-// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true
-//
-// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true
-func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotElementsMatchf(a.t, listA, listB, msg, args...)
-}
-
-// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if a.NotEmpty(obj) {
-// assert.Equal(t, "two", obj[1])
-// }
-func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEmpty(a.t, object, msgAndArgs...)
-}
-
-// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if a.NotEmptyf(obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
-func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEmptyf(a.t, object, msg, args...)
-}
-
-// NotEqual asserts that the specified values are NOT equal.
-//
-// a.NotEqual(obj1, obj2)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEqual(a.t, expected, actual, msgAndArgs...)
-}
-
-// NotEqualValues asserts that two objects are not equal even when converted to the same type
-//
-// a.NotEqualValues(obj1, obj2)
-func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEqualValues(a.t, expected, actual, msgAndArgs...)
-}
-
-// NotEqualValuesf asserts that two objects are not equal even when converted to the same type
-//
-// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted")
-func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEqualValuesf(a.t, expected, actual, msg, args...)
-}
-
-// NotEqualf asserts that the specified values are NOT equal.
-//
-// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEqualf(a.t, expected, actual, msg, args...)
-}
-
-// NotErrorAs asserts that none of the errors in err's chain matches target,
-// but if so, sets target to that error value.
-func (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotErrorAs(a.t, err, target, msgAndArgs...)
-}
-
-// NotErrorAsf asserts that none of the errors in err's chain matches target,
-// but if so, sets target to that error value.
-func (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotErrorAsf(a.t, err, target, msg, args...)
-}
-
-// NotErrorIs asserts that none of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotErrorIs(a.t, err, target, msgAndArgs...)
-}
-
-// NotErrorIsf asserts that none of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotErrorIsf(a.t, err, target, msg, args...)
-}
-
-// NotImplements asserts that an object does not implement the specified interface.
-//
-// a.NotImplements((*MyInterface)(nil), new(MyObject))
-func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotImplements(a.t, interfaceObject, object, msgAndArgs...)
-}
-
-// NotImplementsf asserts that an object does not implement the specified interface.
-//
-// a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
-func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotImplementsf(a.t, interfaceObject, object, msg, args...)
-}
-
-// NotNil asserts that the specified object is not nil.
-//
-// a.NotNil(err)
-func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotNil(a.t, object, msgAndArgs...)
-}
-
-// NotNilf asserts that the specified object is not nil.
-//
-// a.NotNilf(err, "error message %s", "formatted")
-func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotNilf(a.t, object, msg, args...)
-}
-
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// a.NotPanics(func(){ RemainCalm() })
-func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotPanics(a.t, f, msgAndArgs...)
-}
-
-// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
-func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotPanicsf(a.t, f, msg, args...)
-}
-
-// NotRegexp asserts that a specified regexp does not match a string.
-//
-// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
-// a.NotRegexp("^start", "it's not starting")
-func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotRegexp(a.t, rx, str, msgAndArgs...)
-}
-
-// NotRegexpf asserts that a specified regexp does not match a string.
-//
-// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
-// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
-func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotRegexpf(a.t, rx, str, msg, args...)
-}
-
-// NotSame asserts that two pointers do not reference the same object.
-//
-// a.NotSame(ptr1, ptr2)
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotSame(a.t, expected, actual, msgAndArgs...)
-}
-
-// NotSamef asserts that two pointers do not reference the same object.
-//
-// a.NotSamef(ptr1, ptr2, "error message %s", "formatted")
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotSamef(a.t, expected, actual, msg, args...)
-}
-
-// NotSubset asserts that the specified list(array, slice...) or map does NOT
-// contain all elements given in the specified subset list(array, slice...) or
-// map.
-//
-// a.NotSubset([1, 3, 4], [1, 2])
-// a.NotSubset({"x": 1, "y": 2}, {"z": 3})
-func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotSubset(a.t, list, subset, msgAndArgs...)
-}
-
-// NotSubsetf asserts that the specified list(array, slice...) or map does NOT
-// contain all elements given in the specified subset list(array, slice...) or
-// map.
-//
-// a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted")
-// a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted")
-func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotSubsetf(a.t, list, subset, msg, args...)
-}
-
-// NotZero asserts that i is not the zero value for its type.
-func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotZero(a.t, i, msgAndArgs...)
-}
-
-// NotZerof asserts that i is not the zero value for its type.
-func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotZerof(a.t, i, msg, args...)
-}
-
-// Panics asserts that the code inside the specified PanicTestFunc panics.
-//
-// a.Panics(func(){ GoCrazy() })
-func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Panics(a.t, f, msgAndArgs...)
-}
-
-// PanicsWithError asserts that the code inside the specified PanicTestFunc
-// panics, and that the recovered panic value is an error that satisfies the
-// EqualError comparison.
-//
-// a.PanicsWithError("crazy error", func(){ GoCrazy() })
-func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithError(a.t, errString, f, msgAndArgs...)
-}
-
-// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
-// panics, and that the recovered panic value is an error that satisfies the
-// EqualError comparison.
-//
-// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithErrorf(a.t, errString, f, msg, args...)
-}
-
-// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
-func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithValue(a.t, expected, f, msgAndArgs...)
-}
-
-// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithValuef(a.t, expected, f, msg, args...)
-}
-
-// Panicsf asserts that the code inside the specified PanicTestFunc panics.
-//
-// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Panicsf(a.t, f, msg, args...)
-}
-
-// Positive asserts that the specified element is positive
-//
-// a.Positive(1)
-// a.Positive(1.23)
-func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Positive(a.t, e, msgAndArgs...)
-}
-
-// Positivef asserts that the specified element is positive
-//
-// a.Positivef(1, "error message %s", "formatted")
-// a.Positivef(1.23, "error message %s", "formatted")
-func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Positivef(a.t, e, msg, args...)
-}
-
-// Regexp asserts that a specified regexp matches a string.
-//
-// a.Regexp(regexp.MustCompile("start"), "it's starting")
-// a.Regexp("start...$", "it's not starting")
-func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Regexp(a.t, rx, str, msgAndArgs...)
-}
-
-// Regexpf asserts that a specified regexp matches a string.
-//
-// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
-// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
-func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Regexpf(a.t, rx, str, msg, args...)
-}
-
-// Same asserts that two pointers reference the same object.
-//
-// a.Same(ptr1, ptr2)
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Same(a.t, expected, actual, msgAndArgs...)
-}
-
-// Samef asserts that two pointers reference the same object.
-//
-// a.Samef(ptr1, ptr2, "error message %s", "formatted")
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Samef(a.t, expected, actual, msg, args...)
-}
-
-// Subset asserts that the specified list(array, slice...) or map contains all
-// elements given in the specified subset list(array, slice...) or map.
-//
-// a.Subset([1, 2, 3], [1, 2])
-// a.Subset({"x": 1, "y": 2}, {"x": 1})
-func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Subset(a.t, list, subset, msgAndArgs...)
-}
-
-// Subsetf asserts that the specified list(array, slice...) or map contains all
-// elements given in the specified subset list(array, slice...) or map.
-//
-// a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted")
-// a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted")
-func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Subsetf(a.t, list, subset, msg, args...)
-}
-
-// True asserts that the specified value is true.
-//
-// a.True(myBool)
-func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return True(a.t, value, msgAndArgs...)
-}
-
-// Truef asserts that the specified value is true.
-//
-// a.Truef(myBool, "error message %s", "formatted")
-func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Truef(a.t, value, msg, args...)
-}
-
-// WithinDuration asserts that the two times are within duration delta of each other.
-//
-// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
-func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// WithinDurationf asserts that the two times are within duration delta of each other.
-//
-// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
-func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return WithinDurationf(a.t, expected, actual, delta, msg, args...)
-}
-
-// WithinRange asserts that a time is within a time range (inclusive).
-//
-// a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))
-func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return WithinRange(a.t, actual, start, end, msgAndArgs...)
-}
-
-// WithinRangef asserts that a time is within a time range (inclusive).
-//
-// a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
-func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return WithinRangef(a.t, actual, start, end, msg, args...)
-}
-
-// YAMLEq asserts that two YAML strings are equivalent.
-func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return YAMLEq(a.t, expected, actual, msgAndArgs...)
-}
-
-// YAMLEqf asserts that two YAML strings are equivalent.
-func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return YAMLEqf(a.t, expected, actual, msg, args...)
-}
-
-// Zero asserts that i is the zero value for its type.
-func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Zero(a.t, i, msgAndArgs...)
-}
-
-// Zerof asserts that i is the zero value for its type.
-func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Zerof(a.t, i, msg, args...)
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl
deleted file mode 100644
index 188bb9e17..000000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{.CommentWithoutT "a"}}
-func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool {
- if h, ok := a.t.(tHelper); ok { h.Helper() }
- return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}})
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go
deleted file mode 100644
index 1d2f71824..000000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_order.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package assert
-
-import (
- "fmt"
- "reflect"
-)
-
-// isOrdered checks that collection contains orderable elements.
-func isOrdered(t TestingT, object interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool {
- objKind := reflect.TypeOf(object).Kind()
- if objKind != reflect.Slice && objKind != reflect.Array {
- return false
- }
-
- objValue := reflect.ValueOf(object)
- objLen := objValue.Len()
-
- if objLen <= 1 {
- return true
- }
-
- value := objValue.Index(0)
- valueInterface := value.Interface()
- firstValueKind := value.Kind()
-
- for i := 1; i < objLen; i++ {
- prevValue := value
- prevValueInterface := valueInterface
-
- value = objValue.Index(i)
- valueInterface = value.Interface()
-
- compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind)
-
- if !isComparable {
- return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...)
- }
-
- if !containsValue(allowedComparesResults, compareResult) {
- return Fail(t, fmt.Sprintf(failMessage, prevValue, value), msgAndArgs...)
- }
- }
-
- return true
-}
-
-// IsIncreasing asserts that the collection is increasing
-//
-// assert.IsIncreasing(t, []int{1, 2, 3})
-// assert.IsIncreasing(t, []float{1, 2})
-// assert.IsIncreasing(t, []string{"a", "b"})
-func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- return isOrdered(t, object, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...)
-}
-
-// IsNonIncreasing asserts that the collection is not increasing
-//
-// assert.IsNonIncreasing(t, []int{2, 1, 1})
-// assert.IsNonIncreasing(t, []float{2, 1})
-// assert.IsNonIncreasing(t, []string{"b", "a"})
-func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- return isOrdered(t, object, []compareResult{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...)
-}
-
-// IsDecreasing asserts that the collection is decreasing
-//
-// assert.IsDecreasing(t, []int{2, 1, 0})
-// assert.IsDecreasing(t, []float{2, 1})
-// assert.IsDecreasing(t, []string{"b", "a"})
-func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- return isOrdered(t, object, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...)
-}
-
-// IsNonDecreasing asserts that the collection is not decreasing
-//
-// assert.IsNonDecreasing(t, []int{1, 1, 2})
-// assert.IsNonDecreasing(t, []float{1, 2})
-// assert.IsNonDecreasing(t, []string{"a", "b"})
-func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- return isOrdered(t, object, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...)
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go
deleted file mode 100644
index 4e91332bb..000000000
--- a/vendor/github.com/stretchr/testify/assert/assertions.go
+++ /dev/null
@@ -1,2184 +0,0 @@
-package assert
-
-import (
- "bufio"
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "math"
- "os"
- "reflect"
- "regexp"
- "runtime"
- "runtime/debug"
- "strings"
- "time"
- "unicode"
- "unicode/utf8"
-
- "github.com/davecgh/go-spew/spew"
- "github.com/pmezard/go-difflib/difflib"
-
- // Wrapper around gopkg.in/yaml.v3
- "github.com/stretchr/testify/assert/yaml"
-)
-
-//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl"
-
-// TestingT is an interface wrapper around *testing.T
-type TestingT interface {
- Errorf(format string, args ...interface{})
-}
-
-// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful
-// for table driven tests.
-type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool
-
-// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful
-// for table driven tests.
-type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool
-
-// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful
-// for table driven tests.
-type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool
-
-// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful
-// for table driven tests.
-type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool
-
-// PanicAssertionFunc is a common function prototype when validating a panic value. Can be useful
-// for table driven tests.
-type PanicAssertionFunc = func(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool
-
-// Comparison is a custom function that returns true on success and false on failure
-type Comparison func() (success bool)
-
-/*
- Helper functions
-*/
-
-// ObjectsAreEqual determines if two objects are considered equal.
-//
-// This function does no assertion of any kind.
-func ObjectsAreEqual(expected, actual interface{}) bool {
- if expected == nil || actual == nil {
- return expected == actual
- }
-
- exp, ok := expected.([]byte)
- if !ok {
- return reflect.DeepEqual(expected, actual)
- }
-
- act, ok := actual.([]byte)
- if !ok {
- return false
- }
- if exp == nil || act == nil {
- return exp == nil && act == nil
- }
- return bytes.Equal(exp, act)
-}
-
-// copyExportedFields iterates downward through nested data structures and creates a copy
-// that only contains the exported struct fields.
-func copyExportedFields(expected interface{}) interface{} {
- if isNil(expected) {
- return expected
- }
-
- expectedType := reflect.TypeOf(expected)
- expectedKind := expectedType.Kind()
- expectedValue := reflect.ValueOf(expected)
-
- switch expectedKind {
- case reflect.Struct:
- result := reflect.New(expectedType).Elem()
- for i := 0; i < expectedType.NumField(); i++ {
- field := expectedType.Field(i)
- isExported := field.IsExported()
- if isExported {
- fieldValue := expectedValue.Field(i)
- if isNil(fieldValue) || isNil(fieldValue.Interface()) {
- continue
- }
- newValue := copyExportedFields(fieldValue.Interface())
- result.Field(i).Set(reflect.ValueOf(newValue))
- }
- }
- return result.Interface()
-
- case reflect.Ptr:
- result := reflect.New(expectedType.Elem())
- unexportedRemoved := copyExportedFields(expectedValue.Elem().Interface())
- result.Elem().Set(reflect.ValueOf(unexportedRemoved))
- return result.Interface()
-
- case reflect.Array, reflect.Slice:
- var result reflect.Value
- if expectedKind == reflect.Array {
- result = reflect.New(reflect.ArrayOf(expectedValue.Len(), expectedType.Elem())).Elem()
- } else {
- result = reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len())
- }
- for i := 0; i < expectedValue.Len(); i++ {
- index := expectedValue.Index(i)
- if isNil(index) {
- continue
- }
- unexportedRemoved := copyExportedFields(index.Interface())
- result.Index(i).Set(reflect.ValueOf(unexportedRemoved))
- }
- return result.Interface()
-
- case reflect.Map:
- result := reflect.MakeMap(expectedType)
- for _, k := range expectedValue.MapKeys() {
- index := expectedValue.MapIndex(k)
- unexportedRemoved := copyExportedFields(index.Interface())
- result.SetMapIndex(k, reflect.ValueOf(unexportedRemoved))
- }
- return result.Interface()
-
- default:
- return expected
- }
-}
-
-// ObjectsExportedFieldsAreEqual determines if the exported (public) fields of two objects are
-// considered equal. This comparison of only exported fields is applied recursively to nested data
-// structures.
-//
-// This function does no assertion of any kind.
-//
-// Deprecated: Use [EqualExportedValues] instead.
-func ObjectsExportedFieldsAreEqual(expected, actual interface{}) bool {
- expectedCleaned := copyExportedFields(expected)
- actualCleaned := copyExportedFields(actual)
- return ObjectsAreEqualValues(expectedCleaned, actualCleaned)
-}
-
-// ObjectsAreEqualValues gets whether two objects are equal, or if their
-// values are equal.
-func ObjectsAreEqualValues(expected, actual interface{}) bool {
- if ObjectsAreEqual(expected, actual) {
- return true
- }
-
- expectedValue := reflect.ValueOf(expected)
- actualValue := reflect.ValueOf(actual)
- if !expectedValue.IsValid() || !actualValue.IsValid() {
- return false
- }
-
- expectedType := expectedValue.Type()
- actualType := actualValue.Type()
- if !expectedType.ConvertibleTo(actualType) {
- return false
- }
-
- if !isNumericType(expectedType) || !isNumericType(actualType) {
- // Attempt comparison after type conversion
- return reflect.DeepEqual(
- expectedValue.Convert(actualType).Interface(), actual,
- )
- }
-
- // If BOTH values are numeric, there are chances of false positives due
- // to overflow or underflow. So, we need to make sure to always convert
- // the smaller type to a larger type before comparing.
- if expectedType.Size() >= actualType.Size() {
- return actualValue.Convert(expectedType).Interface() == expected
- }
-
- return expectedValue.Convert(actualType).Interface() == actual
-}
-
-// isNumericType returns true if the type is one of:
-// int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64,
-// float32, float64, complex64, complex128
-func isNumericType(t reflect.Type) bool {
- return t.Kind() >= reflect.Int && t.Kind() <= reflect.Complex128
-}
-
-/* CallerInfo is necessary because the assert functions use the testing object
-internally, causing it to print the file:line of the assert method, rather than where
-the problem actually occurred in calling code.*/
-
-// CallerInfo returns an array of strings containing the file and line number
-// of each stack frame leading from the current test to the assert call that
-// failed.
-func CallerInfo() []string {
-
- var pc uintptr
- var ok bool
- var file string
- var line int
- var name string
-
- callers := []string{}
- for i := 0; ; i++ {
- pc, file, line, ok = runtime.Caller(i)
- if !ok {
- // The breaks below failed to terminate the loop, and we ran off the
- // end of the call stack.
- break
- }
-
- // This is a huge edge case, but it will panic if this is the case, see #180
- if file == "" {
- break
- }
-
- f := runtime.FuncForPC(pc)
- if f == nil {
- break
- }
- name = f.Name()
-
- // testing.tRunner is the standard library function that calls
- // tests. Subtests are called directly by tRunner, without going through
- // the Test/Benchmark/Example function that contains the t.Run calls, so
- // with subtests we should break when we hit tRunner, without adding it
- // to the list of callers.
- if name == "testing.tRunner" {
- break
- }
-
- parts := strings.Split(file, "/")
- if len(parts) > 1 {
- filename := parts[len(parts)-1]
- dir := parts[len(parts)-2]
- if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" {
- callers = append(callers, fmt.Sprintf("%s:%d", file, line))
- }
- }
-
- // Drop the package
- segments := strings.Split(name, ".")
- name = segments[len(segments)-1]
- if isTest(name, "Test") ||
- isTest(name, "Benchmark") ||
- isTest(name, "Example") {
- break
- }
- }
-
- return callers
-}
-
-// Stolen from the `go test` tool.
-// isTest tells whether name looks like a test (or benchmark, according to prefix).
-// It is a Test (say) if there is a character after Test that is not a lower-case letter.
-// We don't want TesticularCancer.
-func isTest(name, prefix string) bool {
- if !strings.HasPrefix(name, prefix) {
- return false
- }
- if len(name) == len(prefix) { // "Test" is ok
- return true
- }
- r, _ := utf8.DecodeRuneInString(name[len(prefix):])
- return !unicode.IsLower(r)
-}
-
-func messageFromMsgAndArgs(msgAndArgs ...interface{}) string {
- if len(msgAndArgs) == 0 || msgAndArgs == nil {
- return ""
- }
- if len(msgAndArgs) == 1 {
- msg := msgAndArgs[0]
- if msgAsStr, ok := msg.(string); ok {
- return msgAsStr
- }
- return fmt.Sprintf("%+v", msg)
- }
- if len(msgAndArgs) > 1 {
- return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...)
- }
- return ""
-}
-
-// Aligns the provided message so that all lines after the first line start at the same location as the first line.
-// Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab).
-// The longestLabelLen parameter specifies the length of the longest label in the output (required because this is the
-// basis on which the alignment occurs).
-func indentMessageLines(message string, longestLabelLen int) string {
- outBuf := new(bytes.Buffer)
-
- for i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ {
- // no need to align first line because it starts at the correct location (after the label)
- if i != 0 {
- // append alignLen+1 spaces to align with "{{longestLabel}}:" before adding tab
- outBuf.WriteString("\n\t" + strings.Repeat(" ", longestLabelLen+1) + "\t")
- }
- outBuf.WriteString(scanner.Text())
- }
-
- return outBuf.String()
-}
-
-type failNower interface {
- FailNow()
-}
-
-// FailNow fails test
-func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- Fail(t, failureMessage, msgAndArgs...)
-
- // We cannot extend TestingT with FailNow() and
- // maintain backwards compatibility, so we fallback
- // to panicking when FailNow is not available in
- // TestingT.
- // See issue #263
-
- if t, ok := t.(failNower); ok {
- t.FailNow()
- } else {
- panic("test failed and t is missing `FailNow()`")
- }
- return false
-}
-
-// Fail reports a failure through
-func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- content := []labeledContent{
- {"Error Trace", strings.Join(CallerInfo(), "\n\t\t\t")},
- {"Error", failureMessage},
- }
-
- // Add test name if the Go version supports it
- if n, ok := t.(interface {
- Name() string
- }); ok {
- content = append(content, labeledContent{"Test", n.Name()})
- }
-
- message := messageFromMsgAndArgs(msgAndArgs...)
- if len(message) > 0 {
- content = append(content, labeledContent{"Messages", message})
- }
-
- t.Errorf("\n%s", ""+labeledOutput(content...))
-
- return false
-}
-
-type labeledContent struct {
- label string
- content string
-}
-
-// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner:
-//
-// \t{{label}}:{{align_spaces}}\t{{content}}\n
-//
-// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The "\t{{label}}:" is for the label.
-// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this
-// alignment is achieved, "\t{{content}}\n" is added for the output.
-//
-// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line.
-func labeledOutput(content ...labeledContent) string {
- longestLabel := 0
- for _, v := range content {
- if len(v.label) > longestLabel {
- longestLabel = len(v.label)
- }
- }
- var output string
- for _, v := range content {
- output += "\t" + v.label + ":" + strings.Repeat(" ", longestLabel-len(v.label)) + "\t" + indentMessageLines(v.content, longestLabel) + "\n"
- }
- return output
-}
-
-// Implements asserts that an object is implemented by the specified interface.
-//
-// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
-func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- interfaceType := reflect.TypeOf(interfaceObject).Elem()
-
- if object == nil {
- return Fail(t, fmt.Sprintf("Cannot check if nil implements %v", interfaceType), msgAndArgs...)
- }
- if !reflect.TypeOf(object).Implements(interfaceType) {
- return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...)
- }
-
- return true
-}
-
-// NotImplements asserts that an object does not implement the specified interface.
-//
-// assert.NotImplements(t, (*MyInterface)(nil), new(MyObject))
-func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- interfaceType := reflect.TypeOf(interfaceObject).Elem()
-
- if object == nil {
- return Fail(t, fmt.Sprintf("Cannot check if nil does not implement %v", interfaceType), msgAndArgs...)
- }
- if reflect.TypeOf(object).Implements(interfaceType) {
- return Fail(t, fmt.Sprintf("%T implements %v", object, interfaceType), msgAndArgs...)
- }
-
- return true
-}
-
-// IsType asserts that the specified objects are of the same type.
-func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) {
- return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...)
- }
-
- return true
-}
-
-// Equal asserts that two objects are equal.
-//
-// assert.Equal(t, 123, 123)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if err := validateEqualArgs(expected, actual); err != nil {
- return Fail(t, fmt.Sprintf("Invalid operation: %#v == %#v (%s)",
- expected, actual, err), msgAndArgs...)
- }
-
- if !ObjectsAreEqual(expected, actual) {
- diff := diff(expected, actual)
- expected, actual = formatUnequalValues(expected, actual)
- return Fail(t, fmt.Sprintf("Not equal: \n"+
- "expected: %s\n"+
- "actual : %s%s", expected, actual, diff), msgAndArgs...)
- }
-
- return true
-
-}
-
-// validateEqualArgs checks whether provided arguments can be safely used in the
-// Equal/NotEqual functions.
-func validateEqualArgs(expected, actual interface{}) error {
- if expected == nil && actual == nil {
- return nil
- }
-
- if isFunction(expected) || isFunction(actual) {
- return errors.New("cannot take func type as argument")
- }
- return nil
-}
-
-// Same asserts that two pointers reference the same object.
-//
-// assert.Same(t, ptr1, ptr2)
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- same, ok := samePointers(expected, actual)
- if !ok {
- return Fail(t, "Both arguments must be pointers", msgAndArgs...)
- }
-
- if !same {
- // both are pointers but not the same type & pointing to the same address
- return Fail(t, fmt.Sprintf("Not same: \n"+
- "expected: %p %#v\n"+
- "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...)
- }
-
- return true
-}
-
-// NotSame asserts that two pointers do not reference the same object.
-//
-// assert.NotSame(t, ptr1, ptr2)
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- same, ok := samePointers(expected, actual)
- if !ok {
- //fails when the arguments are not pointers
- return !(Fail(t, "Both arguments must be pointers", msgAndArgs...))
- }
-
- if same {
- return Fail(t, fmt.Sprintf(
- "Expected and actual point to the same object: %p %#v",
- expected, expected), msgAndArgs...)
- }
- return true
-}
-
-// samePointers checks if two generic interface objects are pointers of the same
-// type pointing to the same object. It returns two values: same indicating if
-// they are the same type and point to the same object, and ok indicating that
-// both inputs are pointers.
-func samePointers(first, second interface{}) (same bool, ok bool) {
- firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second)
- if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr {
- return false, false //not both are pointers
- }
-
- firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second)
- if firstType != secondType {
- return false, true // both are pointers, but of different types
- }
-
- // compare pointer addresses
- return first == second, true
-}
-
-// formatUnequalValues takes two values of arbitrary types and returns string
-// representations appropriate to be presented to the user.
-//
-// If the values are not of like type, the returned strings will be prefixed
-// with the type name, and the value will be enclosed in parentheses similar
-// to a type conversion in the Go grammar.
-func formatUnequalValues(expected, actual interface{}) (e string, a string) {
- if reflect.TypeOf(expected) != reflect.TypeOf(actual) {
- return fmt.Sprintf("%T(%s)", expected, truncatingFormat(expected)),
- fmt.Sprintf("%T(%s)", actual, truncatingFormat(actual))
- }
- switch expected.(type) {
- case time.Duration:
- return fmt.Sprintf("%v", expected), fmt.Sprintf("%v", actual)
- }
- return truncatingFormat(expected), truncatingFormat(actual)
-}
-
-// truncatingFormat formats the data and truncates it if it's too long.
-//
-// This helps keep formatted error messages lines from exceeding the
-// bufio.MaxScanTokenSize max line length that the go testing framework imposes.
-func truncatingFormat(data interface{}) string {
- value := fmt.Sprintf("%#v", data)
- max := bufio.MaxScanTokenSize - 100 // Give us some space the type info too if needed.
- if len(value) > max {
- value = value[0:max] + "<... truncated>"
- }
- return value
-}
-
-// EqualValues asserts that two objects are equal or convertible to the larger
-// type and equal.
-//
-// assert.EqualValues(t, uint32(123), int32(123))
-func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if !ObjectsAreEqualValues(expected, actual) {
- diff := diff(expected, actual)
- expected, actual = formatUnequalValues(expected, actual)
- return Fail(t, fmt.Sprintf("Not equal: \n"+
- "expected: %s\n"+
- "actual : %s%s", expected, actual, diff), msgAndArgs...)
- }
-
- return true
-
-}
-
-// EqualExportedValues asserts that the types of two objects are equal and their public
-// fields are also equal. This is useful for comparing structs that have private fields
-// that could potentially differ.
-//
-// type S struct {
-// Exported int
-// notExported int
-// }
-// assert.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true
-// assert.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false
-func EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- aType := reflect.TypeOf(expected)
- bType := reflect.TypeOf(actual)
-
- if aType != bType {
- return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...)
- }
-
- expected = copyExportedFields(expected)
- actual = copyExportedFields(actual)
-
- if !ObjectsAreEqualValues(expected, actual) {
- diff := diff(expected, actual)
- expected, actual = formatUnequalValues(expected, actual)
- return Fail(t, fmt.Sprintf("Not equal (comparing only exported fields): \n"+
- "expected: %s\n"+
- "actual : %s%s", expected, actual, diff), msgAndArgs...)
- }
-
- return true
-}
-
-// Exactly asserts that two objects are equal in value and type.
-//
-// assert.Exactly(t, int32(123), int64(123))
-func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- aType := reflect.TypeOf(expected)
- bType := reflect.TypeOf(actual)
-
- if aType != bType {
- return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...)
- }
-
- return Equal(t, expected, actual, msgAndArgs...)
-
-}
-
-// NotNil asserts that the specified object is not nil.
-//
-// assert.NotNil(t, err)
-func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- if !isNil(object) {
- return true
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Fail(t, "Expected value not to be nil.", msgAndArgs...)
-}
-
-// isNil checks if a specified object is nil or not, without Failing.
-func isNil(object interface{}) bool {
- if object == nil {
- return true
- }
-
- value := reflect.ValueOf(object)
- switch value.Kind() {
- case
- reflect.Chan, reflect.Func,
- reflect.Interface, reflect.Map,
- reflect.Ptr, reflect.Slice, reflect.UnsafePointer:
-
- return value.IsNil()
- }
-
- return false
-}
-
-// Nil asserts that the specified object is nil.
-//
-// assert.Nil(t, err)
-func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- if isNil(object) {
- return true
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...)
-}
-
-// isEmpty gets whether the specified object is considered empty or not.
-func isEmpty(object interface{}) bool {
-
- // get nil case out of the way
- if object == nil {
- return true
- }
-
- objValue := reflect.ValueOf(object)
-
- switch objValue.Kind() {
- // collection types are empty when they have no element
- case reflect.Chan, reflect.Map, reflect.Slice:
- return objValue.Len() == 0
- // pointers are empty if nil or if the value they point to is empty
- case reflect.Ptr:
- if objValue.IsNil() {
- return true
- }
- deref := objValue.Elem().Interface()
- return isEmpty(deref)
- // for all other types, compare against the zero value
- // array types are empty when they match their zero-initialized state
- default:
- zero := reflect.Zero(objValue.Type())
- return reflect.DeepEqual(object, zero.Interface())
- }
-}
-
-// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// assert.Empty(t, obj)
-func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- pass := isEmpty(object)
- if !pass {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...)
- }
-
- return pass
-
-}
-
-// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if assert.NotEmpty(t, obj) {
-// assert.Equal(t, "two", obj[1])
-// }
-func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- pass := !isEmpty(object)
- if !pass {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...)
- }
-
- return pass
-
-}
-
-// getLen tries to get the length of an object.
-// It returns (0, false) if impossible.
-func getLen(x interface{}) (length int, ok bool) {
- v := reflect.ValueOf(x)
- defer func() {
- ok = recover() == nil
- }()
- return v.Len(), true
-}
-
-// Len asserts that the specified object has specific length.
-// Len also fails if the object has a type that len() not accept.
-//
-// assert.Len(t, mySlice, 3)
-func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- l, ok := getLen(object)
- if !ok {
- return Fail(t, fmt.Sprintf("\"%v\" could not be applied builtin len()", object), msgAndArgs...)
- }
-
- if l != length {
- return Fail(t, fmt.Sprintf("\"%v\" should have %d item(s), but has %d", object, length, l), msgAndArgs...)
- }
- return true
-}
-
-// True asserts that the specified value is true.
-//
-// assert.True(t, myBool)
-func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
- if !value {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Fail(t, "Should be true", msgAndArgs...)
- }
-
- return true
-
-}
-
-// False asserts that the specified value is false.
-//
-// assert.False(t, myBool)
-func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
- if value {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Fail(t, "Should be false", msgAndArgs...)
- }
-
- return true
-
-}
-
-// NotEqual asserts that the specified values are NOT equal.
-//
-// assert.NotEqual(t, obj1, obj2)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if err := validateEqualArgs(expected, actual); err != nil {
- return Fail(t, fmt.Sprintf("Invalid operation: %#v != %#v (%s)",
- expected, actual, err), msgAndArgs...)
- }
-
- if ObjectsAreEqual(expected, actual) {
- return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...)
- }
-
- return true
-
-}
-
-// NotEqualValues asserts that two objects are not equal even when converted to the same type
-//
-// assert.NotEqualValues(t, obj1, obj2)
-func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if ObjectsAreEqualValues(expected, actual) {
- return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...)
- }
-
- return true
-}
-
-// containsElement try loop over the list check if the list includes the element.
-// return (false, false) if impossible.
-// return (true, false) if element was not found.
-// return (true, true) if element was found.
-func containsElement(list interface{}, element interface{}) (ok, found bool) {
-
- listValue := reflect.ValueOf(list)
- listType := reflect.TypeOf(list)
- if listType == nil {
- return false, false
- }
- listKind := listType.Kind()
- defer func() {
- if e := recover(); e != nil {
- ok = false
- found = false
- }
- }()
-
- if listKind == reflect.String {
- elementValue := reflect.ValueOf(element)
- return true, strings.Contains(listValue.String(), elementValue.String())
- }
-
- if listKind == reflect.Map {
- mapKeys := listValue.MapKeys()
- for i := 0; i < len(mapKeys); i++ {
- if ObjectsAreEqual(mapKeys[i].Interface(), element) {
- return true, true
- }
- }
- return true, false
- }
-
- for i := 0; i < listValue.Len(); i++ {
- if ObjectsAreEqual(listValue.Index(i).Interface(), element) {
- return true, true
- }
- }
- return true, false
-
-}
-
-// Contains asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// assert.Contains(t, "Hello World", "World")
-// assert.Contains(t, ["Hello", "World"], "World")
-// assert.Contains(t, {"Hello": "World"}, "Hello")
-func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- ok, found := containsElement(s, contains)
- if !ok {
- return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...)
- }
- if !found {
- return Fail(t, fmt.Sprintf("%#v does not contain %#v", s, contains), msgAndArgs...)
- }
-
- return true
-
-}
-
-// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// assert.NotContains(t, "Hello World", "Earth")
-// assert.NotContains(t, ["Hello", "World"], "Earth")
-// assert.NotContains(t, {"Hello": "World"}, "Earth")
-func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- ok, found := containsElement(s, contains)
- if !ok {
- return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...)
- }
- if found {
- return Fail(t, fmt.Sprintf("%#v should not contain %#v", s, contains), msgAndArgs...)
- }
-
- return true
-
-}
-
-// Subset asserts that the specified list(array, slice...) or map contains all
-// elements given in the specified subset list(array, slice...) or map.
-//
-// assert.Subset(t, [1, 2, 3], [1, 2])
-// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1})
-func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if subset == nil {
- return true // we consider nil to be equal to the nil set
- }
-
- listKind := reflect.TypeOf(list).Kind()
- if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
- }
-
- subsetKind := reflect.TypeOf(subset).Kind()
- if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
- }
-
- if subsetKind == reflect.Map && listKind == reflect.Map {
- subsetMap := reflect.ValueOf(subset)
- actualMap := reflect.ValueOf(list)
-
- for _, k := range subsetMap.MapKeys() {
- ev := subsetMap.MapIndex(k)
- av := actualMap.MapIndex(k)
-
- if !av.IsValid() {
- return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...)
- }
- if !ObjectsAreEqual(ev.Interface(), av.Interface()) {
- return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...)
- }
- }
-
- return true
- }
-
- subsetList := reflect.ValueOf(subset)
- for i := 0; i < subsetList.Len(); i++ {
- element := subsetList.Index(i).Interface()
- ok, found := containsElement(list, element)
- if !ok {
- return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", list), msgAndArgs...)
- }
- if !found {
- return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, element), msgAndArgs...)
- }
- }
-
- return true
-}
-
-// NotSubset asserts that the specified list(array, slice...) or map does NOT
-// contain all elements given in the specified subset list(array, slice...) or
-// map.
-//
-// assert.NotSubset(t, [1, 3, 4], [1, 2])
-// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3})
-func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if subset == nil {
- return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...)
- }
-
- listKind := reflect.TypeOf(list).Kind()
- if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
- }
-
- subsetKind := reflect.TypeOf(subset).Kind()
- if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
- }
-
- if subsetKind == reflect.Map && listKind == reflect.Map {
- subsetMap := reflect.ValueOf(subset)
- actualMap := reflect.ValueOf(list)
-
- for _, k := range subsetMap.MapKeys() {
- ev := subsetMap.MapIndex(k)
- av := actualMap.MapIndex(k)
-
- if !av.IsValid() {
- return true
- }
- if !ObjectsAreEqual(ev.Interface(), av.Interface()) {
- return true
- }
- }
-
- return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
- }
-
- subsetList := reflect.ValueOf(subset)
- for i := 0; i < subsetList.Len(); i++ {
- element := subsetList.Index(i).Interface()
- ok, found := containsElement(list, element)
- if !ok {
- return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
- }
- if !found {
- return true
- }
- }
-
- return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
-}
-
-// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])
-func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if isEmpty(listA) && isEmpty(listB) {
- return true
- }
-
- if !isList(t, listA, msgAndArgs...) || !isList(t, listB, msgAndArgs...) {
- return false
- }
-
- extraA, extraB := diffLists(listA, listB)
-
- if len(extraA) == 0 && len(extraB) == 0 {
- return true
- }
-
- return Fail(t, formatListDiff(listA, listB, extraA, extraB), msgAndArgs...)
-}
-
-// isList checks that the provided value is array or slice.
-func isList(t TestingT, list interface{}, msgAndArgs ...interface{}) (ok bool) {
- kind := reflect.TypeOf(list).Kind()
- if kind != reflect.Array && kind != reflect.Slice {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s, expecting array or slice", list, kind),
- msgAndArgs...)
- }
- return true
-}
-
-// diffLists diffs two arrays/slices and returns slices of elements that are only in A and only in B.
-// If some element is present multiple times, each instance is counted separately (e.g. if something is 2x in A and
-// 5x in B, it will be 0x in extraA and 3x in extraB). The order of items in both lists is ignored.
-func diffLists(listA, listB interface{}) (extraA, extraB []interface{}) {
- aValue := reflect.ValueOf(listA)
- bValue := reflect.ValueOf(listB)
-
- aLen := aValue.Len()
- bLen := bValue.Len()
-
- // Mark indexes in bValue that we already used
- visited := make([]bool, bLen)
- for i := 0; i < aLen; i++ {
- element := aValue.Index(i).Interface()
- found := false
- for j := 0; j < bLen; j++ {
- if visited[j] {
- continue
- }
- if ObjectsAreEqual(bValue.Index(j).Interface(), element) {
- visited[j] = true
- found = true
- break
- }
- }
- if !found {
- extraA = append(extraA, element)
- }
- }
-
- for j := 0; j < bLen; j++ {
- if visited[j] {
- continue
- }
- extraB = append(extraB, bValue.Index(j).Interface())
- }
-
- return
-}
-
-func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) string {
- var msg bytes.Buffer
-
- msg.WriteString("elements differ")
- if len(extraA) > 0 {
- msg.WriteString("\n\nextra elements in list A:\n")
- msg.WriteString(spewConfig.Sdump(extraA))
- }
- if len(extraB) > 0 {
- msg.WriteString("\n\nextra elements in list B:\n")
- msg.WriteString(spewConfig.Sdump(extraB))
- }
- msg.WriteString("\n\nlistA:\n")
- msg.WriteString(spewConfig.Sdump(listA))
- msg.WriteString("\n\nlistB:\n")
- msg.WriteString(spewConfig.Sdump(listB))
-
- return msg.String()
-}
-
-// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should not match.
-// This is an inverse of ElementsMatch.
-//
-// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false
-//
-// assert.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true
-//
-// assert.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true
-func NotElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if isEmpty(listA) && isEmpty(listB) {
- return Fail(t, "listA and listB contain the same elements", msgAndArgs)
- }
-
- if !isList(t, listA, msgAndArgs...) {
- return Fail(t, "listA is not a list type", msgAndArgs...)
- }
- if !isList(t, listB, msgAndArgs...) {
- return Fail(t, "listB is not a list type", msgAndArgs...)
- }
-
- extraA, extraB := diffLists(listA, listB)
- if len(extraA) == 0 && len(extraB) == 0 {
- return Fail(t, "listA and listB contain the same elements", msgAndArgs)
- }
-
- return true
-}
-
-// Condition uses a Comparison to assert a complex condition.
-func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- result := comp()
- if !result {
- Fail(t, "Condition failed!", msgAndArgs...)
- }
- return result
-}
-
-// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics
-// methods, and represents a simple func that takes no arguments, and returns nothing.
-type PanicTestFunc func()
-
-// didPanic returns true if the function passed to it panics. Otherwise, it returns false.
-func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string) {
- didPanic = true
-
- defer func() {
- message = recover()
- if didPanic {
- stack = string(debug.Stack())
- }
- }()
-
- // call the target function
- f()
- didPanic = false
-
- return
-}
-
-// Panics asserts that the code inside the specified PanicTestFunc panics.
-//
-// assert.Panics(t, func(){ GoCrazy() })
-func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if funcDidPanic, panicValue, _ := didPanic(f); !funcDidPanic {
- return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...)
- }
-
- return true
-}
-
-// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
-func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- funcDidPanic, panicValue, panickedStack := didPanic(f)
- if !funcDidPanic {
- return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...)
- }
- if panicValue != expected {
- return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, expected, panicValue, panickedStack), msgAndArgs...)
- }
-
- return true
-}
-
-// PanicsWithError asserts that the code inside the specified PanicTestFunc
-// panics, and that the recovered panic value is an error that satisfies the
-// EqualError comparison.
-//
-// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() })
-func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- funcDidPanic, panicValue, panickedStack := didPanic(f)
- if !funcDidPanic {
- return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...)
- }
- panicErr, ok := panicValue.(error)
- if !ok || panicErr.Error() != errString {
- return Fail(t, fmt.Sprintf("func %#v should panic with error message:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, errString, panicValue, panickedStack), msgAndArgs...)
- }
-
- return true
-}
-
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// assert.NotPanics(t, func(){ RemainCalm() })
-func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic {
- return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", f, panicValue, panickedStack), msgAndArgs...)
- }
-
- return true
-}
-
-// WithinDuration asserts that the two times are within duration delta of each other.
-//
-// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
-func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- dt := expected.Sub(actual)
- if dt < -delta || dt > delta {
- return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...)
- }
-
- return true
-}
-
-// WithinRange asserts that a time is within a time range (inclusive).
-//
-// assert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))
-func WithinRange(t TestingT, actual, start, end time.Time, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if end.Before(start) {
- return Fail(t, "Start should be before end", msgAndArgs...)
- }
-
- if actual.Before(start) {
- return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is before the range", actual, start, end), msgAndArgs...)
- } else if actual.After(end) {
- return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is after the range", actual, start, end), msgAndArgs...)
- }
-
- return true
-}
-
-func toFloat(x interface{}) (float64, bool) {
- var xf float64
- xok := true
-
- switch xn := x.(type) {
- case uint:
- xf = float64(xn)
- case uint8:
- xf = float64(xn)
- case uint16:
- xf = float64(xn)
- case uint32:
- xf = float64(xn)
- case uint64:
- xf = float64(xn)
- case int:
- xf = float64(xn)
- case int8:
- xf = float64(xn)
- case int16:
- xf = float64(xn)
- case int32:
- xf = float64(xn)
- case int64:
- xf = float64(xn)
- case float32:
- xf = float64(xn)
- case float64:
- xf = xn
- case time.Duration:
- xf = float64(xn)
- default:
- xok = false
- }
-
- return xf, xok
-}
-
-// InDelta asserts that the two numerals are within delta of each other.
-//
-// assert.InDelta(t, math.Pi, 22/7.0, 0.01)
-func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- af, aok := toFloat(expected)
- bf, bok := toFloat(actual)
-
- if !aok || !bok {
- return Fail(t, "Parameters must be numerical", msgAndArgs...)
- }
-
- if math.IsNaN(af) && math.IsNaN(bf) {
- return true
- }
-
- if math.IsNaN(af) {
- return Fail(t, "Expected must not be NaN", msgAndArgs...)
- }
-
- if math.IsNaN(bf) {
- return Fail(t, fmt.Sprintf("Expected %v with delta %v, but was NaN", expected, delta), msgAndArgs...)
- }
-
- dt := af - bf
- if dt < -delta || dt > delta {
- return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...)
- }
-
- return true
-}
-
-// InDeltaSlice is the same as InDelta, except it compares two slices.
-func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if expected == nil || actual == nil ||
- reflect.TypeOf(actual).Kind() != reflect.Slice ||
- reflect.TypeOf(expected).Kind() != reflect.Slice {
- return Fail(t, "Parameters must be slice", msgAndArgs...)
- }
-
- actualSlice := reflect.ValueOf(actual)
- expectedSlice := reflect.ValueOf(expected)
-
- for i := 0; i < actualSlice.Len(); i++ {
- result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...)
- if !result {
- return result
- }
- }
-
- return true
-}
-
-// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if expected == nil || actual == nil ||
- reflect.TypeOf(actual).Kind() != reflect.Map ||
- reflect.TypeOf(expected).Kind() != reflect.Map {
- return Fail(t, "Arguments must be maps", msgAndArgs...)
- }
-
- expectedMap := reflect.ValueOf(expected)
- actualMap := reflect.ValueOf(actual)
-
- if expectedMap.Len() != actualMap.Len() {
- return Fail(t, "Arguments must have the same number of keys", msgAndArgs...)
- }
-
- for _, k := range expectedMap.MapKeys() {
- ev := expectedMap.MapIndex(k)
- av := actualMap.MapIndex(k)
-
- if !ev.IsValid() {
- return Fail(t, fmt.Sprintf("missing key %q in expected map", k), msgAndArgs...)
- }
-
- if !av.IsValid() {
- return Fail(t, fmt.Sprintf("missing key %q in actual map", k), msgAndArgs...)
- }
-
- if !InDelta(
- t,
- ev.Interface(),
- av.Interface(),
- delta,
- msgAndArgs...,
- ) {
- return false
- }
- }
-
- return true
-}
-
-func calcRelativeError(expected, actual interface{}) (float64, error) {
- af, aok := toFloat(expected)
- bf, bok := toFloat(actual)
- if !aok || !bok {
- return 0, fmt.Errorf("Parameters must be numerical")
- }
- if math.IsNaN(af) && math.IsNaN(bf) {
- return 0, nil
- }
- if math.IsNaN(af) {
- return 0, errors.New("expected value must not be NaN")
- }
- if af == 0 {
- return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error")
- }
- if math.IsNaN(bf) {
- return 0, errors.New("actual value must not be NaN")
- }
-
- return math.Abs(af-bf) / math.Abs(af), nil
-}
-
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
-func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if math.IsNaN(epsilon) {
- return Fail(t, "epsilon must not be NaN", msgAndArgs...)
- }
- actualEpsilon, err := calcRelativeError(expected, actual)
- if err != nil {
- return Fail(t, err.Error(), msgAndArgs...)
- }
- if math.IsNaN(actualEpsilon) {
- return Fail(t, "relative error is NaN", msgAndArgs...)
- }
- if actualEpsilon > epsilon {
- return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+
- " < %#v (actual)", epsilon, actualEpsilon), msgAndArgs...)
- }
-
- return true
-}
-
-// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
-func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if expected == nil || actual == nil {
- return Fail(t, "Parameters must be slice", msgAndArgs...)
- }
-
- expectedSlice := reflect.ValueOf(expected)
- actualSlice := reflect.ValueOf(actual)
-
- if expectedSlice.Type().Kind() != reflect.Slice {
- return Fail(t, "Expected value must be slice", msgAndArgs...)
- }
-
- expectedLen := expectedSlice.Len()
- if !IsType(t, expected, actual) || !Len(t, actual, expectedLen) {
- return false
- }
-
- for i := 0; i < expectedLen; i++ {
- if !InEpsilon(t, expectedSlice.Index(i).Interface(), actualSlice.Index(i).Interface(), epsilon, "at index %d", i) {
- return false
- }
- }
-
- return true
-}
-
-/*
- Errors
-*/
-
-// NoError asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.NoError(t, err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
- if err != nil {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...)
- }
-
- return true
-}
-
-// Error asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.Error(t, err) {
-// assert.Equal(t, expectedError, err)
-// }
-func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
- if err == nil {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Fail(t, "An error is expected but got nil.", msgAndArgs...)
- }
-
- return true
-}
-
-// EqualError asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// assert.EqualError(t, err, expectedErrorString)
-func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if !Error(t, theError, msgAndArgs...) {
- return false
- }
- expected := errString
- actual := theError.Error()
- // don't need to use deep equals here, we know they are both strings
- if expected != actual {
- return Fail(t, fmt.Sprintf("Error message not equal:\n"+
- "expected: %q\n"+
- "actual : %q", expected, actual), msgAndArgs...)
- }
- return true
-}
-
-// ErrorContains asserts that a function returned an error (i.e. not `nil`)
-// and that the error contains the specified substring.
-//
-// actualObj, err := SomeFunction()
-// assert.ErrorContains(t, err, expectedErrorSubString)
-func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if !Error(t, theError, msgAndArgs...) {
- return false
- }
-
- actual := theError.Error()
- if !strings.Contains(actual, contains) {
- return Fail(t, fmt.Sprintf("Error %#v does not contain %#v", actual, contains), msgAndArgs...)
- }
-
- return true
-}
-
-// matchRegexp return true if a specified regexp matches a string.
-func matchRegexp(rx interface{}, str interface{}) bool {
- var r *regexp.Regexp
- if rr, ok := rx.(*regexp.Regexp); ok {
- r = rr
- } else {
- r = regexp.MustCompile(fmt.Sprint(rx))
- }
-
- switch v := str.(type) {
- case []byte:
- return r.Match(v)
- case string:
- return r.MatchString(v)
- default:
- return r.MatchString(fmt.Sprint(v))
- }
-
-}
-
-// Regexp asserts that a specified regexp matches a string.
-//
-// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
-// assert.Regexp(t, "start...$", "it's not starting")
-func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- match := matchRegexp(rx, str)
-
- if !match {
- Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...)
- }
-
- return match
-}
-
-// NotRegexp asserts that a specified regexp does not match a string.
-//
-// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
-// assert.NotRegexp(t, "^start", "it's not starting")
-func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- match := matchRegexp(rx, str)
-
- if match {
- Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...)
- }
-
- return !match
-
-}
-
-// Zero asserts that i is the zero value for its type.
-func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {
- return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...)
- }
- return true
-}
-
-// NotZero asserts that i is not the zero value for its type.
-func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {
- return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...)
- }
- return true
-}
-
-// FileExists checks whether a file exists in the given path. It also fails if
-// the path points to a directory or there is an error when trying to check the file.
-func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- info, err := os.Lstat(path)
- if err != nil {
- if os.IsNotExist(err) {
- return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...)
- }
- return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...)
- }
- if info.IsDir() {
- return Fail(t, fmt.Sprintf("%q is a directory", path), msgAndArgs...)
- }
- return true
-}
-
-// NoFileExists checks whether a file does not exist in a given path. It fails
-// if the path points to an existing _file_ only.
-func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- info, err := os.Lstat(path)
- if err != nil {
- return true
- }
- if info.IsDir() {
- return true
- }
- return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...)
-}
-
-// DirExists checks whether a directory exists in the given path. It also fails
-// if the path is a file rather a directory or there is an error checking whether it exists.
-func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- info, err := os.Lstat(path)
- if err != nil {
- if os.IsNotExist(err) {
- return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...)
- }
- return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...)
- }
- if !info.IsDir() {
- return Fail(t, fmt.Sprintf("%q is a file", path), msgAndArgs...)
- }
- return true
-}
-
-// NoDirExists checks whether a directory does not exist in the given path.
-// It fails if the path points to an existing _directory_ only.
-func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- info, err := os.Lstat(path)
- if err != nil {
- if os.IsNotExist(err) {
- return true
- }
- return true
- }
- if !info.IsDir() {
- return true
- }
- return Fail(t, fmt.Sprintf("directory %q exists", path), msgAndArgs...)
-}
-
-// JSONEq asserts that two JSON strings are equivalent.
-//
-// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- var expectedJSONAsInterface, actualJSONAsInterface interface{}
-
- if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil {
- return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...)
- }
-
- if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil {
- return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...)
- }
-
- return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...)
-}
-
-// YAMLEq asserts that two YAML strings are equivalent.
-func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- var expectedYAMLAsInterface, actualYAMLAsInterface interface{}
-
- if err := yaml.Unmarshal([]byte(expected), &expectedYAMLAsInterface); err != nil {
- return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid yaml.\nYAML parsing error: '%s'", expected, err.Error()), msgAndArgs...)
- }
-
- if err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil {
- return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid yaml.\nYAML error: '%s'", actual, err.Error()), msgAndArgs...)
- }
-
- return Equal(t, expectedYAMLAsInterface, actualYAMLAsInterface, msgAndArgs...)
-}
-
-func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {
- t := reflect.TypeOf(v)
- k := t.Kind()
-
- if k == reflect.Ptr {
- t = t.Elem()
- k = t.Kind()
- }
- return t, k
-}
-
-// diff returns a diff of both values as long as both are of the same type and
-// are a struct, map, slice, array or string. Otherwise it returns an empty string.
-func diff(expected interface{}, actual interface{}) string {
- if expected == nil || actual == nil {
- return ""
- }
-
- et, ek := typeAndKind(expected)
- at, _ := typeAndKind(actual)
-
- if et != at {
- return ""
- }
-
- if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array && ek != reflect.String {
- return ""
- }
-
- var e, a string
-
- switch et {
- case reflect.TypeOf(""):
- e = reflect.ValueOf(expected).String()
- a = reflect.ValueOf(actual).String()
- case reflect.TypeOf(time.Time{}):
- e = spewConfigStringerEnabled.Sdump(expected)
- a = spewConfigStringerEnabled.Sdump(actual)
- default:
- e = spewConfig.Sdump(expected)
- a = spewConfig.Sdump(actual)
- }
-
- diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
- A: difflib.SplitLines(e),
- B: difflib.SplitLines(a),
- FromFile: "Expected",
- FromDate: "",
- ToFile: "Actual",
- ToDate: "",
- Context: 1,
- })
-
- return "\n\nDiff:\n" + diff
-}
-
-func isFunction(arg interface{}) bool {
- if arg == nil {
- return false
- }
- return reflect.TypeOf(arg).Kind() == reflect.Func
-}
-
-var spewConfig = spew.ConfigState{
- Indent: " ",
- DisablePointerAddresses: true,
- DisableCapacities: true,
- SortKeys: true,
- DisableMethods: true,
- MaxDepth: 10,
-}
-
-var spewConfigStringerEnabled = spew.ConfigState{
- Indent: " ",
- DisablePointerAddresses: true,
- DisableCapacities: true,
- SortKeys: true,
- MaxDepth: 10,
-}
-
-type tHelper = interface {
- Helper()
-}
-
-// Eventually asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick.
-//
-// assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond)
-func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- ch := make(chan bool, 1)
-
- timer := time.NewTimer(waitFor)
- defer timer.Stop()
-
- ticker := time.NewTicker(tick)
- defer ticker.Stop()
-
- for tick := ticker.C; ; {
- select {
- case <-timer.C:
- return Fail(t, "Condition never satisfied", msgAndArgs...)
- case <-tick:
- tick = nil
- go func() { ch <- condition() }()
- case v := <-ch:
- if v {
- return true
- }
- tick = ticker.C
- }
- }
-}
-
-// CollectT implements the TestingT interface and collects all errors.
-type CollectT struct {
- // A slice of errors. Non-nil slice denotes a failure.
- // If it's non-nil but len(c.errors) == 0, this is also a failure
- // obtained by direct c.FailNow() call.
- errors []error
-}
-
-// Errorf collects the error.
-func (c *CollectT) Errorf(format string, args ...interface{}) {
- c.errors = append(c.errors, fmt.Errorf(format, args...))
-}
-
-// FailNow stops execution by calling runtime.Goexit.
-func (c *CollectT) FailNow() {
- c.fail()
- runtime.Goexit()
-}
-
-// Deprecated: That was a method for internal usage that should not have been published. Now just panics.
-func (*CollectT) Reset() {
- panic("Reset() is deprecated")
-}
-
-// Deprecated: That was a method for internal usage that should not have been published. Now just panics.
-func (*CollectT) Copy(TestingT) {
- panic("Copy() is deprecated")
-}
-
-func (c *CollectT) fail() {
- if !c.failed() {
- c.errors = []error{} // Make it non-nil to mark a failure.
- }
-}
-
-func (c *CollectT) failed() bool {
- return c.errors != nil
-}
-
-// EventuallyWithT asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick. In contrast to Eventually,
-// it supplies a CollectT to the condition function, so that the condition
-// function can use the CollectT to call other assertions.
-// The condition is considered "met" if no errors are raised in a tick.
-// The supplied CollectT collects all errors from one tick (if there are any).
-// If the condition is not met before waitFor, the collected errors of
-// the last tick are copied to t.
-//
-// externalValue := false
-// go func() {
-// time.Sleep(8*time.Second)
-// externalValue = true
-// }()
-// assert.EventuallyWithT(t, func(c *assert.CollectT) {
-// // add assertions as needed; any assertion failure will fail the current tick
-// assert.True(c, externalValue, "expected 'externalValue' to be true")
-// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
-func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- var lastFinishedTickErrs []error
- ch := make(chan *CollectT, 1)
-
- timer := time.NewTimer(waitFor)
- defer timer.Stop()
-
- ticker := time.NewTicker(tick)
- defer ticker.Stop()
-
- for tick := ticker.C; ; {
- select {
- case <-timer.C:
- for _, err := range lastFinishedTickErrs {
- t.Errorf("%v", err)
- }
- return Fail(t, "Condition never satisfied", msgAndArgs...)
- case <-tick:
- tick = nil
- go func() {
- collect := new(CollectT)
- defer func() {
- ch <- collect
- }()
- condition(collect)
- }()
- case collect := <-ch:
- if !collect.failed() {
- return true
- }
- // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached.
- lastFinishedTickErrs = collect.errors
- tick = ticker.C
- }
- }
-}
-
-// Never asserts that the given condition doesn't satisfy in waitFor time,
-// periodically checking the target function each tick.
-//
-// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)
-func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- ch := make(chan bool, 1)
-
- timer := time.NewTimer(waitFor)
- defer timer.Stop()
-
- ticker := time.NewTicker(tick)
- defer ticker.Stop()
-
- for tick := ticker.C; ; {
- select {
- case <-timer.C:
- return true
- case <-tick:
- tick = nil
- go func() { ch <- condition() }()
- case v := <-ch:
- if v {
- return Fail(t, "Condition satisfied", msgAndArgs...)
- }
- tick = ticker.C
- }
- }
-}
-
-// ErrorIs asserts that at least one of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if errors.Is(err, target) {
- return true
- }
-
- var expectedText string
- if target != nil {
- expectedText = target.Error()
- }
-
- chain := buildErrorChainString(err)
-
- return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+
- "expected: %q\n"+
- "in chain: %s", expectedText, chain,
- ), msgAndArgs...)
-}
-
-// NotErrorIs asserts that none of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if !errors.Is(err, target) {
- return true
- }
-
- var expectedText string
- if target != nil {
- expectedText = target.Error()
- }
-
- chain := buildErrorChainString(err)
-
- return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+
- "found: %q\n"+
- "in chain: %s", expectedText, chain,
- ), msgAndArgs...)
-}
-
-// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
-// This is a wrapper for errors.As.
-func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if errors.As(err, target) {
- return true
- }
-
- chain := buildErrorChainString(err)
-
- return Fail(t, fmt.Sprintf("Should be in error chain:\n"+
- "expected: %q\n"+
- "in chain: %s", target, chain,
- ), msgAndArgs...)
-}
-
-// NotErrorAs asserts that none of the errors in err's chain matches target,
-// but if so, sets target to that error value.
-func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if !errors.As(err, target) {
- return true
- }
-
- chain := buildErrorChainString(err)
-
- return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+
- "found: %q\n"+
- "in chain: %s", target, chain,
- ), msgAndArgs...)
-}
-
-func buildErrorChainString(err error) string {
- if err == nil {
- return ""
- }
-
- e := errors.Unwrap(err)
- chain := fmt.Sprintf("%q", err.Error())
- for e != nil {
- chain += fmt.Sprintf("\n\t%q", e.Error())
- e = errors.Unwrap(e)
- }
- return chain
-}
diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go
deleted file mode 100644
index 4953981d3..000000000
--- a/vendor/github.com/stretchr/testify/assert/doc.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
-//
-// # Example Usage
-//
-// The following is a complete example using assert in a standard test function:
-//
-// import (
-// "testing"
-// "github.com/stretchr/testify/assert"
-// )
-//
-// func TestSomething(t *testing.T) {
-//
-// var a string = "Hello"
-// var b string = "Hello"
-//
-// assert.Equal(t, a, b, "The two words should be the same.")
-//
-// }
-//
-// if you assert many times, use the format below:
-//
-// import (
-// "testing"
-// "github.com/stretchr/testify/assert"
-// )
-//
-// func TestSomething(t *testing.T) {
-// assert := assert.New(t)
-//
-// var a string = "Hello"
-// var b string = "Hello"
-//
-// assert.Equal(a, b, "The two words should be the same.")
-// }
-//
-// # Assertions
-//
-// Assertions allow you to easily write test code, and are global funcs in the `assert` package.
-// All assertion functions take, as the first argument, the `*testing.T` object provided by the
-// testing framework. This allows the assertion funcs to write the failings and other details to
-// the correct place.
-//
-// Every assertion function also takes an optional string message as the final argument,
-// allowing custom error messages to be appended to the message the assertion method outputs.
-package assert
diff --git a/vendor/github.com/stretchr/testify/assert/errors.go b/vendor/github.com/stretchr/testify/assert/errors.go
deleted file mode 100644
index ac9dc9d1d..000000000
--- a/vendor/github.com/stretchr/testify/assert/errors.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package assert
-
-import (
- "errors"
-)
-
-// AnError is an error instance useful for testing. If the code does not care
-// about error specifics, and only needs to return the error for example, this
-// error should be used to make the test code more readable.
-var AnError = errors.New("assert.AnError general error for testing")
diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go
deleted file mode 100644
index df189d234..000000000
--- a/vendor/github.com/stretchr/testify/assert/forward_assertions.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package assert
-
-// Assertions provides assertion methods around the
-// TestingT interface.
-type Assertions struct {
- t TestingT
-}
-
-// New makes a new Assertions object for the specified TestingT.
-func New(t TestingT) *Assertions {
- return &Assertions{
- t: t,
- }
-}
-
-//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs"
diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go
deleted file mode 100644
index 861ed4b7c..000000000
--- a/vendor/github.com/stretchr/testify/assert/http_assertions.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package assert
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "net/url"
- "strings"
-)
-
-// httpCode is a helper that returns HTTP code of the response. It returns -1 and
-// an error if building a new request fails.
-func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) {
- w := httptest.NewRecorder()
- req, err := http.NewRequest(method, url, http.NoBody)
- if err != nil {
- return -1, err
- }
- req.URL.RawQuery = values.Encode()
- handler(w, req)
- return w.Code, nil
-}
-
-// HTTPSuccess asserts that a specified handler returns a success status code.
-//
-// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- code, err := httpCode(handler, method, url, values)
- if err != nil {
- Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...)
- }
-
- isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent
- if !isSuccessCode {
- Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...)
- }
-
- return isSuccessCode
-}
-
-// HTTPRedirect asserts that a specified handler returns a redirect status code.
-//
-// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- code, err := httpCode(handler, method, url, values)
- if err != nil {
- Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...)
- }
-
- isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect
- if !isRedirectCode {
- Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...)
- }
-
- return isRedirectCode
-}
-
-// HTTPError asserts that a specified handler returns an error status code.
-//
-// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- code, err := httpCode(handler, method, url, values)
- if err != nil {
- Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...)
- }
-
- isErrorCode := code >= http.StatusBadRequest
- if !isErrorCode {
- Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...)
- }
-
- return isErrorCode
-}
-
-// HTTPStatusCode asserts that a specified handler returns a specified status code.
-//
-// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- code, err := httpCode(handler, method, url, values)
- if err != nil {
- Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...)
- }
-
- successful := code == statuscode
- if !successful {
- Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code), msgAndArgs...)
- }
-
- return successful
-}
-
-// HTTPBody is a helper that returns HTTP body of the response. It returns
-// empty string if building a new request fails.
-func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string {
- w := httptest.NewRecorder()
- if len(values) > 0 {
- url += "?" + values.Encode()
- }
- req, err := http.NewRequest(method, url, http.NoBody)
- if err != nil {
- return ""
- }
- handler(w, req)
- return w.Body.String()
-}
-
-// HTTPBodyContains asserts that a specified handler returns a
-// body that contains a string.
-//
-// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- body := HTTPBody(handler, method, url, values)
-
- contains := strings.Contains(body, fmt.Sprint(str))
- if !contains {
- Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...)
- }
-
- return contains
-}
-
-// HTTPBodyNotContains asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- body := HTTPBody(handler, method, url, values)
-
- contains := strings.Contains(body, fmt.Sprint(str))
- if contains {
- Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...)
- }
-
- return !contains
-}
diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go
deleted file mode 100644
index baa0cc7d7..000000000
--- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go
+++ /dev/null
@@ -1,25 +0,0 @@
-//go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default
-// +build testify_yaml_custom,!testify_yaml_fail,!testify_yaml_default
-
-// Package yaml is an implementation of YAML functions that calls a pluggable implementation.
-//
-// This implementation is selected with the testify_yaml_custom build tag.
-//
-// go test -tags testify_yaml_custom
-//
-// This implementation can be used at build time to replace the default implementation
-// to avoid linking with [gopkg.in/yaml.v3].
-//
-// In your test package:
-//
-// import assertYaml "github.com/stretchr/testify/assert/yaml"
-//
-// func init() {
-// assertYaml.Unmarshal = func (in []byte, out interface{}) error {
-// // ...
-// return nil
-// }
-// }
-package yaml
-
-var Unmarshal func(in []byte, out interface{}) error
diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go
deleted file mode 100644
index b83c6cf64..000000000
--- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go
+++ /dev/null
@@ -1,37 +0,0 @@
-//go:build !testify_yaml_fail && !testify_yaml_custom
-// +build !testify_yaml_fail,!testify_yaml_custom
-
-// Package yaml is just an indirection to handle YAML deserialization.
-//
-// This package is just an indirection that allows the builder to override the
-// indirection with an alternative implementation of this package that uses
-// another implementation of YAML deserialization. This allows to not either not
-// use YAML deserialization at all, or to use another implementation than
-// [gopkg.in/yaml.v3] (for example for license compatibility reasons, see [PR #1120]).
-//
-// Alternative implementations are selected using build tags:
-//
-// - testify_yaml_fail: [Unmarshal] always fails with an error
-// - testify_yaml_custom: [Unmarshal] is a variable. Caller must initialize it
-// before calling any of [github.com/stretchr/testify/assert.YAMLEq] or
-// [github.com/stretchr/testify/assert.YAMLEqf].
-//
-// Usage:
-//
-// go test -tags testify_yaml_fail
-//
-// You can check with "go list" which implementation is linked:
-//
-// go list -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml
-// go list -tags testify_yaml_fail -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml
-// go list -tags testify_yaml_custom -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml
-//
-// [PR #1120]: https://github.com/stretchr/testify/pull/1120
-package yaml
-
-import goyaml "gopkg.in/yaml.v3"
-
-// Unmarshal is just a wrapper of [gopkg.in/yaml.v3.Unmarshal].
-func Unmarshal(in []byte, out interface{}) error {
- return goyaml.Unmarshal(in, out)
-}
diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go
deleted file mode 100644
index e78f7dfe6..000000000
--- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go
+++ /dev/null
@@ -1,18 +0,0 @@
-//go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default
-// +build testify_yaml_fail,!testify_yaml_custom,!testify_yaml_default
-
-// Package yaml is an implementation of YAML functions that always fail.
-//
-// This implementation can be used at build time to replace the default implementation
-// to avoid linking with [gopkg.in/yaml.v3]:
-//
-// go test -tags testify_yaml_fail
-package yaml
-
-import "errors"
-
-var errNotImplemented = errors.New("YAML functions are not available (see https://pkg.go.dev/github.com/stretchr/testify/assert/yaml)")
-
-func Unmarshal([]byte, interface{}) error {
- return errNotImplemented
-}
diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go
deleted file mode 100644
index 968434724..000000000
--- a/vendor/github.com/stretchr/testify/require/doc.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Package require implements the same assertions as the `assert` package but
-// stops test execution when a test fails.
-//
-// # Example Usage
-//
-// The following is a complete example using require in a standard test function:
-//
-// import (
-// "testing"
-// "github.com/stretchr/testify/require"
-// )
-//
-// func TestSomething(t *testing.T) {
-//
-// var a string = "Hello"
-// var b string = "Hello"
-//
-// require.Equal(t, a, b, "The two words should be the same.")
-//
-// }
-//
-// # Assertions
-//
-// The `require` package have same global functions as in the `assert` package,
-// but instead of returning a boolean result they call `t.FailNow()`.
-//
-// Every assertion function also takes an optional string message as the final argument,
-// allowing custom error messages to be appended to the message the assertion method outputs.
-package require
diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go
deleted file mode 100644
index 1dcb2338c..000000000
--- a/vendor/github.com/stretchr/testify/require/forward_requirements.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package require
-
-// Assertions provides assertion methods around the
-// TestingT interface.
-type Assertions struct {
- t TestingT
-}
-
-// New makes a new Assertions object for the specified TestingT.
-func New(t TestingT) *Assertions {
- return &Assertions{
- t: t,
- }
-}
-
-//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require_forward.go.tmpl -include-format-funcs"
diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go
deleted file mode 100644
index d8921950d..000000000
--- a/vendor/github.com/stretchr/testify/require/require.go
+++ /dev/null
@@ -1,2124 +0,0 @@
-// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.
-
-package require
-
-import (
- assert "github.com/stretchr/testify/assert"
- http "net/http"
- url "net/url"
- time "time"
-)
-
-// Condition uses a Comparison to assert a complex condition.
-func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Condition(t, comp, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Conditionf uses a Comparison to assert a complex condition.
-func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Conditionf(t, comp, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Contains asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// require.Contains(t, "Hello World", "World")
-// require.Contains(t, ["Hello", "World"], "World")
-// require.Contains(t, {"Hello": "World"}, "Hello")
-func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Contains(t, s, contains, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Containsf asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// require.Containsf(t, "Hello World", "World", "error message %s", "formatted")
-// require.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
-// require.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
-func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Containsf(t, s, contains, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// DirExists checks whether a directory exists in the given path. It also fails
-// if the path is a file rather a directory or there is an error checking whether it exists.
-func DirExists(t TestingT, path string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.DirExists(t, path, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// DirExistsf checks whether a directory exists in the given path. It also fails
-// if the path is a file rather a directory or there is an error checking whether it exists.
-func DirExistsf(t TestingT, path string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.DirExistsf(t, path, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// require.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])
-func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.ElementsMatch(t, listA, listB, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// require.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
-func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.ElementsMatchf(t, listA, listB, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// require.Empty(t, obj)
-func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Empty(t, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// require.Emptyf(t, obj, "error message %s", "formatted")
-func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Emptyf(t, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Equal asserts that two objects are equal.
-//
-// require.Equal(t, 123, 123)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Equal(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// EqualError asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// require.EqualError(t, err, expectedErrorString)
-func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.EqualError(t, theError, errString, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// require.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
-func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.EqualErrorf(t, theError, errString, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// EqualExportedValues asserts that the types of two objects are equal and their public
-// fields are also equal. This is useful for comparing structs that have private fields
-// that could potentially differ.
-//
-// type S struct {
-// Exported int
-// notExported int
-// }
-// require.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true
-// require.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false
-func EqualExportedValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.EqualExportedValues(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// EqualExportedValuesf asserts that the types of two objects are equal and their public
-// fields are also equal. This is useful for comparing structs that have private fields
-// that could potentially differ.
-//
-// type S struct {
-// Exported int
-// notExported int
-// }
-// require.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true
-// require.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
-func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.EqualExportedValuesf(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// EqualValues asserts that two objects are equal or convertible to the larger
-// type and equal.
-//
-// require.EqualValues(t, uint32(123), int32(123))
-func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.EqualValues(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// EqualValuesf asserts that two objects are equal or convertible to the larger
-// type and equal.
-//
-// require.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
-func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.EqualValuesf(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Equalf asserts that two objects are equal.
-//
-// require.Equalf(t, 123, 123, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Equalf(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Error asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if require.Error(t, err) {
-// require.Equal(t, expectedError, err)
-// }
-func Error(t TestingT, err error, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Error(t, err, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
-// This is a wrapper for errors.As.
-func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.ErrorAs(t, err, target, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
-// This is a wrapper for errors.As.
-func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.ErrorAsf(t, err, target, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// ErrorContains asserts that a function returned an error (i.e. not `nil`)
-// and that the error contains the specified substring.
-//
-// actualObj, err := SomeFunction()
-// require.ErrorContains(t, err, expectedErrorSubString)
-func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.ErrorContains(t, theError, contains, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
-// and that the error contains the specified substring.
-//
-// actualObj, err := SomeFunction()
-// require.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
-func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.ErrorContainsf(t, theError, contains, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// ErrorIs asserts that at least one of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func ErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.ErrorIs(t, err, target, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// ErrorIsf asserts that at least one of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.ErrorIsf(t, err, target, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Errorf asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if require.Errorf(t, err, "error message %s", "formatted") {
-// require.Equal(t, expectedErrorf, err)
-// }
-func Errorf(t TestingT, err error, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Errorf(t, err, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Eventually asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick.
-//
-// require.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond)
-func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Eventually(t, condition, waitFor, tick, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// EventuallyWithT asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick. In contrast to Eventually,
-// it supplies a CollectT to the condition function, so that the condition
-// function can use the CollectT to call other assertions.
-// The condition is considered "met" if no errors are raised in a tick.
-// The supplied CollectT collects all errors from one tick (if there are any).
-// If the condition is not met before waitFor, the collected errors of
-// the last tick are copied to t.
-//
-// externalValue := false
-// go func() {
-// time.Sleep(8*time.Second)
-// externalValue = true
-// }()
-// require.EventuallyWithT(t, func(c *require.CollectT) {
-// // add assertions as needed; any assertion failure will fail the current tick
-// require.True(c, externalValue, "expected 'externalValue' to be true")
-// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
-func EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.EventuallyWithT(t, condition, waitFor, tick, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// EventuallyWithTf asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick. In contrast to Eventually,
-// it supplies a CollectT to the condition function, so that the condition
-// function can use the CollectT to call other assertions.
-// The condition is considered "met" if no errors are raised in a tick.
-// The supplied CollectT collects all errors from one tick (if there are any).
-// If the condition is not met before waitFor, the collected errors of
-// the last tick are copied to t.
-//
-// externalValue := false
-// go func() {
-// time.Sleep(8*time.Second)
-// externalValue = true
-// }()
-// require.EventuallyWithTf(t, func(c *require.CollectT, "error message %s", "formatted") {
-// // add assertions as needed; any assertion failure will fail the current tick
-// require.True(c, externalValue, "expected 'externalValue' to be true")
-// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
-func EventuallyWithTf(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.EventuallyWithTf(t, condition, waitFor, tick, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Eventuallyf asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick.
-//
-// require.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
-func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Eventuallyf(t, condition, waitFor, tick, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Exactly asserts that two objects are equal in value and type.
-//
-// require.Exactly(t, int32(123), int64(123))
-func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Exactly(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Exactlyf asserts that two objects are equal in value and type.
-//
-// require.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
-func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Exactlyf(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Fail reports a failure through
-func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Fail(t, failureMessage, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// FailNow fails test
-func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.FailNow(t, failureMessage, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// FailNowf fails test
-func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.FailNowf(t, failureMessage, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Failf reports a failure through
-func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Failf(t, failureMessage, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// False asserts that the specified value is false.
-//
-// require.False(t, myBool)
-func False(t TestingT, value bool, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.False(t, value, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Falsef asserts that the specified value is false.
-//
-// require.Falsef(t, myBool, "error message %s", "formatted")
-func Falsef(t TestingT, value bool, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Falsef(t, value, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// FileExists checks whether a file exists in the given path. It also fails if
-// the path points to a directory or there is an error when trying to check the file.
-func FileExists(t TestingT, path string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.FileExists(t, path, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// FileExistsf checks whether a file exists in the given path. It also fails if
-// the path points to a directory or there is an error when trying to check the file.
-func FileExistsf(t TestingT, path string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.FileExistsf(t, path, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Greater asserts that the first element is greater than the second
-//
-// require.Greater(t, 2, 1)
-// require.Greater(t, float64(2), float64(1))
-// require.Greater(t, "b", "a")
-func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Greater(t, e1, e2, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// GreaterOrEqual asserts that the first element is greater than or equal to the second
-//
-// require.GreaterOrEqual(t, 2, 1)
-// require.GreaterOrEqual(t, 2, 2)
-// require.GreaterOrEqual(t, "b", "a")
-// require.GreaterOrEqual(t, "b", "b")
-func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.GreaterOrEqual(t, e1, e2, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// GreaterOrEqualf asserts that the first element is greater than or equal to the second
-//
-// require.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted")
-// require.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted")
-// require.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted")
-// require.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted")
-func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.GreaterOrEqualf(t, e1, e2, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Greaterf asserts that the first element is greater than the second
-//
-// require.Greaterf(t, 2, 1, "error message %s", "formatted")
-// require.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
-// require.Greaterf(t, "b", "a", "error message %s", "formatted")
-func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Greaterf(t, e1, e2, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPBodyContains asserts that a specified handler returns a
-// body that contains a string.
-//
-// require.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPBodyContainsf asserts that a specified handler returns a
-// body that contains a string.
-//
-// require.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPBodyNotContains asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// require.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPBodyNotContainsf asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// require.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPError asserts that a specified handler returns an error status code.
-//
-// require.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPErrorf asserts that a specified handler returns an error status code.
-//
-// require.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPRedirect asserts that a specified handler returns a redirect status code.
-//
-// require.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPRedirectf asserts that a specified handler returns a redirect status code.
-//
-// require.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPStatusCode asserts that a specified handler returns a specified status code.
-//
-// require.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPStatusCode(t, handler, method, url, values, statuscode, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPStatusCodef asserts that a specified handler returns a specified status code.
-//
-// require.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPStatusCodef(t, handler, method, url, values, statuscode, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPSuccess asserts that a specified handler returns a success status code.
-//
-// require.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// HTTPSuccessf asserts that a specified handler returns a success status code.
-//
-// require.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Implements asserts that an object is implemented by the specified interface.
-//
-// require.Implements(t, (*MyInterface)(nil), new(MyObject))
-func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Implements(t, interfaceObject, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Implementsf asserts that an object is implemented by the specified interface.
-//
-// require.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
-func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Implementsf(t, interfaceObject, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// InDelta asserts that the two numerals are within delta of each other.
-//
-// require.InDelta(t, math.Pi, 22/7.0, 0.01)
-func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// InDeltaSlice is the same as InDelta, except it compares two slices.
-func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// InDeltaSlicef is the same as InDelta, except it compares two slices.
-func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// InDeltaf asserts that the two numerals are within delta of each other.
-//
-// require.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
-func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InDeltaf(t, expected, actual, delta, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
-func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
-func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
-func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// InEpsilonf asserts that expected and actual have a relative error less than epsilon
-func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// IsDecreasing asserts that the collection is decreasing
-//
-// require.IsDecreasing(t, []int{2, 1, 0})
-// require.IsDecreasing(t, []float{2, 1})
-// require.IsDecreasing(t, []string{"b", "a"})
-func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsDecreasing(t, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// IsDecreasingf asserts that the collection is decreasing
-//
-// require.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted")
-// require.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted")
-// require.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
-func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsDecreasingf(t, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// IsIncreasing asserts that the collection is increasing
-//
-// require.IsIncreasing(t, []int{1, 2, 3})
-// require.IsIncreasing(t, []float{1, 2})
-// require.IsIncreasing(t, []string{"a", "b"})
-func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsIncreasing(t, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// IsIncreasingf asserts that the collection is increasing
-//
-// require.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted")
-// require.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted")
-// require.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
-func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsIncreasingf(t, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// IsNonDecreasing asserts that the collection is not decreasing
-//
-// require.IsNonDecreasing(t, []int{1, 1, 2})
-// require.IsNonDecreasing(t, []float{1, 2})
-// require.IsNonDecreasing(t, []string{"a", "b"})
-func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsNonDecreasing(t, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// IsNonDecreasingf asserts that the collection is not decreasing
-//
-// require.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted")
-// require.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted")
-// require.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
-func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsNonDecreasingf(t, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// IsNonIncreasing asserts that the collection is not increasing
-//
-// require.IsNonIncreasing(t, []int{2, 1, 1})
-// require.IsNonIncreasing(t, []float{2, 1})
-// require.IsNonIncreasing(t, []string{"b", "a"})
-func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsNonIncreasing(t, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// IsNonIncreasingf asserts that the collection is not increasing
-//
-// require.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted")
-// require.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted")
-// require.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
-func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsNonIncreasingf(t, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// IsType asserts that the specified objects are of the same type.
-func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsType(t, expectedType, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// IsTypef asserts that the specified objects are of the same type.
-func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.IsTypef(t, expectedType, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// JSONEq asserts that two JSON strings are equivalent.
-//
-// require.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.JSONEq(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// JSONEqf asserts that two JSON strings are equivalent.
-//
-// require.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
-func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.JSONEqf(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Len asserts that the specified object has specific length.
-// Len also fails if the object has a type that len() not accept.
-//
-// require.Len(t, mySlice, 3)
-func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Len(t, object, length, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Lenf asserts that the specified object has specific length.
-// Lenf also fails if the object has a type that len() not accept.
-//
-// require.Lenf(t, mySlice, 3, "error message %s", "formatted")
-func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Lenf(t, object, length, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Less asserts that the first element is less than the second
-//
-// require.Less(t, 1, 2)
-// require.Less(t, float64(1), float64(2))
-// require.Less(t, "a", "b")
-func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Less(t, e1, e2, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// LessOrEqual asserts that the first element is less than or equal to the second
-//
-// require.LessOrEqual(t, 1, 2)
-// require.LessOrEqual(t, 2, 2)
-// require.LessOrEqual(t, "a", "b")
-// require.LessOrEqual(t, "b", "b")
-func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.LessOrEqual(t, e1, e2, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// LessOrEqualf asserts that the first element is less than or equal to the second
-//
-// require.LessOrEqualf(t, 1, 2, "error message %s", "formatted")
-// require.LessOrEqualf(t, 2, 2, "error message %s", "formatted")
-// require.LessOrEqualf(t, "a", "b", "error message %s", "formatted")
-// require.LessOrEqualf(t, "b", "b", "error message %s", "formatted")
-func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.LessOrEqualf(t, e1, e2, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Lessf asserts that the first element is less than the second
-//
-// require.Lessf(t, 1, 2, "error message %s", "formatted")
-// require.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
-// require.Lessf(t, "a", "b", "error message %s", "formatted")
-func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Lessf(t, e1, e2, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Negative asserts that the specified element is negative
-//
-// require.Negative(t, -1)
-// require.Negative(t, -1.23)
-func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Negative(t, e, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Negativef asserts that the specified element is negative
-//
-// require.Negativef(t, -1, "error message %s", "formatted")
-// require.Negativef(t, -1.23, "error message %s", "formatted")
-func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Negativef(t, e, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Never asserts that the given condition doesn't satisfy in waitFor time,
-// periodically checking the target function each tick.
-//
-// require.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond)
-func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Never(t, condition, waitFor, tick, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Neverf asserts that the given condition doesn't satisfy in waitFor time,
-// periodically checking the target function each tick.
-//
-// require.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
-func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Neverf(t, condition, waitFor, tick, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Nil asserts that the specified object is nil.
-//
-// require.Nil(t, err)
-func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Nil(t, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Nilf asserts that the specified object is nil.
-//
-// require.Nilf(t, err, "error message %s", "formatted")
-func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Nilf(t, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NoDirExists checks whether a directory does not exist in the given path.
-// It fails if the path points to an existing _directory_ only.
-func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NoDirExists(t, path, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NoDirExistsf checks whether a directory does not exist in the given path.
-// It fails if the path points to an existing _directory_ only.
-func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NoDirExistsf(t, path, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NoError asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if require.NoError(t, err) {
-// require.Equal(t, expectedObj, actualObj)
-// }
-func NoError(t TestingT, err error, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NoError(t, err, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NoErrorf asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if require.NoErrorf(t, err, "error message %s", "formatted") {
-// require.Equal(t, expectedObj, actualObj)
-// }
-func NoErrorf(t TestingT, err error, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NoErrorf(t, err, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NoFileExists checks whether a file does not exist in a given path. It fails
-// if the path points to an existing _file_ only.
-func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NoFileExists(t, path, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NoFileExistsf checks whether a file does not exist in a given path. It fails
-// if the path points to an existing _file_ only.
-func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NoFileExistsf(t, path, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// require.NotContains(t, "Hello World", "Earth")
-// require.NotContains(t, ["Hello", "World"], "Earth")
-// require.NotContains(t, {"Hello": "World"}, "Earth")
-func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotContains(t, s, contains, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// require.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
-// require.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
-// require.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
-func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotContainsf(t, s, contains, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should not match.
-// This is an inverse of ElementsMatch.
-//
-// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 1, 2, 3]) -> false
-//
-// require.NotElementsMatch(t, [1, 1, 2, 3], [1, 2, 3]) -> true
-//
-// require.NotElementsMatch(t, [1, 2, 3], [1, 2, 4]) -> true
-func NotElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotElementsMatch(t, listA, listB, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should not match.
-// This is an inverse of ElementsMatch.
-//
-// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false
-//
-// require.NotElementsMatchf(t, [1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true
-//
-// require.NotElementsMatchf(t, [1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true
-func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotElementsMatchf(t, listA, listB, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if require.NotEmpty(t, obj) {
-// require.Equal(t, "two", obj[1])
-// }
-func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotEmpty(t, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if require.NotEmptyf(t, obj, "error message %s", "formatted") {
-// require.Equal(t, "two", obj[1])
-// }
-func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotEmptyf(t, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotEqual asserts that the specified values are NOT equal.
-//
-// require.NotEqual(t, obj1, obj2)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotEqual(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotEqualValues asserts that two objects are not equal even when converted to the same type
-//
-// require.NotEqualValues(t, obj1, obj2)
-func NotEqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotEqualValues(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotEqualValuesf asserts that two objects are not equal even when converted to the same type
-//
-// require.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted")
-func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotEqualValuesf(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotEqualf asserts that the specified values are NOT equal.
-//
-// require.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotEqualf(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotErrorAs asserts that none of the errors in err's chain matches target,
-// but if so, sets target to that error value.
-func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotErrorAs(t, err, target, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotErrorAsf asserts that none of the errors in err's chain matches target,
-// but if so, sets target to that error value.
-func NotErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotErrorAsf(t, err, target, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotErrorIs asserts that none of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func NotErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotErrorIs(t, err, target, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotErrorIsf asserts that none of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotErrorIsf(t, err, target, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotImplements asserts that an object does not implement the specified interface.
-//
-// require.NotImplements(t, (*MyInterface)(nil), new(MyObject))
-func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotImplements(t, interfaceObject, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotImplementsf asserts that an object does not implement the specified interface.
-//
-// require.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
-func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotImplementsf(t, interfaceObject, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotNil asserts that the specified object is not nil.
-//
-// require.NotNil(t, err)
-func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotNil(t, object, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotNilf asserts that the specified object is not nil.
-//
-// require.NotNilf(t, err, "error message %s", "formatted")
-func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotNilf(t, object, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// require.NotPanics(t, func(){ RemainCalm() })
-func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotPanics(t, f, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// require.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
-func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotPanicsf(t, f, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotRegexp asserts that a specified regexp does not match a string.
-//
-// require.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
-// require.NotRegexp(t, "^start", "it's not starting")
-func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotRegexp(t, rx, str, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotRegexpf asserts that a specified regexp does not match a string.
-//
-// require.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
-// require.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
-func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotRegexpf(t, rx, str, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotSame asserts that two pointers do not reference the same object.
-//
-// require.NotSame(t, ptr1, ptr2)
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func NotSame(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotSame(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotSamef asserts that two pointers do not reference the same object.
-//
-// require.NotSamef(t, ptr1, ptr2, "error message %s", "formatted")
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotSamef(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotSubset asserts that the specified list(array, slice...) or map does NOT
-// contain all elements given in the specified subset list(array, slice...) or
-// map.
-//
-// require.NotSubset(t, [1, 3, 4], [1, 2])
-// require.NotSubset(t, {"x": 1, "y": 2}, {"z": 3})
-func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotSubset(t, list, subset, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotSubsetf asserts that the specified list(array, slice...) or map does NOT
-// contain all elements given in the specified subset list(array, slice...) or
-// map.
-//
-// require.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted")
-// require.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted")
-func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotSubsetf(t, list, subset, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// NotZero asserts that i is not the zero value for its type.
-func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotZero(t, i, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// NotZerof asserts that i is not the zero value for its type.
-func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.NotZerof(t, i, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Panics asserts that the code inside the specified PanicTestFunc panics.
-//
-// require.Panics(t, func(){ GoCrazy() })
-func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Panics(t, f, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// PanicsWithError asserts that the code inside the specified PanicTestFunc
-// panics, and that the recovered panic value is an error that satisfies the
-// EqualError comparison.
-//
-// require.PanicsWithError(t, "crazy error", func(){ GoCrazy() })
-func PanicsWithError(t TestingT, errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.PanicsWithError(t, errString, f, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
-// panics, and that the recovered panic value is an error that satisfies the
-// EqualError comparison.
-//
-// require.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func PanicsWithErrorf(t TestingT, errString string, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.PanicsWithErrorf(t, errString, f, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// require.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
-func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.PanicsWithValue(t, expected, f, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// require.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.PanicsWithValuef(t, expected, f, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Panicsf asserts that the code inside the specified PanicTestFunc panics.
-//
-// require.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
-func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Panicsf(t, f, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Positive asserts that the specified element is positive
-//
-// require.Positive(t, 1)
-// require.Positive(t, 1.23)
-func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Positive(t, e, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Positivef asserts that the specified element is positive
-//
-// require.Positivef(t, 1, "error message %s", "formatted")
-// require.Positivef(t, 1.23, "error message %s", "formatted")
-func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Positivef(t, e, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Regexp asserts that a specified regexp matches a string.
-//
-// require.Regexp(t, regexp.MustCompile("start"), "it's starting")
-// require.Regexp(t, "start...$", "it's not starting")
-func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Regexp(t, rx, str, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Regexpf asserts that a specified regexp matches a string.
-//
-// require.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
-// require.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
-func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Regexpf(t, rx, str, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Same asserts that two pointers reference the same object.
-//
-// require.Same(t, ptr1, ptr2)
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func Same(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Same(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Samef asserts that two pointers reference the same object.
-//
-// require.Samef(t, ptr1, ptr2, "error message %s", "formatted")
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Samef(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Subset asserts that the specified list(array, slice...) or map contains all
-// elements given in the specified subset list(array, slice...) or map.
-//
-// require.Subset(t, [1, 2, 3], [1, 2])
-// require.Subset(t, {"x": 1, "y": 2}, {"x": 1})
-func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Subset(t, list, subset, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Subsetf asserts that the specified list(array, slice...) or map contains all
-// elements given in the specified subset list(array, slice...) or map.
-//
-// require.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted")
-// require.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted")
-func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Subsetf(t, list, subset, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// True asserts that the specified value is true.
-//
-// require.True(t, myBool)
-func True(t TestingT, value bool, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.True(t, value, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Truef asserts that the specified value is true.
-//
-// require.Truef(t, myBool, "error message %s", "formatted")
-func Truef(t TestingT, value bool, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Truef(t, value, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// WithinDuration asserts that the two times are within duration delta of each other.
-//
-// require.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
-func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// WithinDurationf asserts that the two times are within duration delta of each other.
-//
-// require.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
-func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.WithinDurationf(t, expected, actual, delta, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// WithinRange asserts that a time is within a time range (inclusive).
-//
-// require.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))
-func WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.WithinRange(t, actual, start, end, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// WithinRangef asserts that a time is within a time range (inclusive).
-//
-// require.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
-func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.WithinRangef(t, actual, start, end, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// YAMLEq asserts that two YAML strings are equivalent.
-func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.YAMLEq(t, expected, actual, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// YAMLEqf asserts that two YAML strings are equivalent.
-func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.YAMLEqf(t, expected, actual, msg, args...) {
- return
- }
- t.FailNow()
-}
-
-// Zero asserts that i is the zero value for its type.
-func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Zero(t, i, msgAndArgs...) {
- return
- }
- t.FailNow()
-}
-
-// Zerof asserts that i is the zero value for its type.
-func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if assert.Zerof(t, i, msg, args...) {
- return
- }
- t.FailNow()
-}
diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl
deleted file mode 100644
index 8b3283685..000000000
--- a/vendor/github.com/stretchr/testify/require/require.go.tmpl
+++ /dev/null
@@ -1,6 +0,0 @@
-{{ replace .Comment "assert." "require."}}
-func {{.DocInfo.Name}}(t TestingT, {{.Params}}) {
- if h, ok := t.(tHelper); ok { h.Helper() }
- if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return }
- t.FailNow()
-}
diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go
deleted file mode 100644
index 1bd87304f..000000000
--- a/vendor/github.com/stretchr/testify/require/require_forward.go
+++ /dev/null
@@ -1,1674 +0,0 @@
-// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT.
-
-package require
-
-import (
- assert "github.com/stretchr/testify/assert"
- http "net/http"
- url "net/url"
- time "time"
-)
-
-// Condition uses a Comparison to assert a complex condition.
-func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Condition(a.t, comp, msgAndArgs...)
-}
-
-// Conditionf uses a Comparison to assert a complex condition.
-func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Conditionf(a.t, comp, msg, args...)
-}
-
-// Contains asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// a.Contains("Hello World", "World")
-// a.Contains(["Hello", "World"], "World")
-// a.Contains({"Hello": "World"}, "Hello")
-func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Contains(a.t, s, contains, msgAndArgs...)
-}
-
-// Containsf asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// a.Containsf("Hello World", "World", "error message %s", "formatted")
-// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
-// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
-func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Containsf(a.t, s, contains, msg, args...)
-}
-
-// DirExists checks whether a directory exists in the given path. It also fails
-// if the path is a file rather a directory or there is an error checking whether it exists.
-func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- DirExists(a.t, path, msgAndArgs...)
-}
-
-// DirExistsf checks whether a directory exists in the given path. It also fails
-// if the path is a file rather a directory or there is an error checking whether it exists.
-func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- DirExistsf(a.t, path, msg, args...)
-}
-
-// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])
-func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ElementsMatch(a.t, listA, listB, msgAndArgs...)
-}
-
-// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
-func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ElementsMatchf(a.t, listA, listB, msg, args...)
-}
-
-// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// a.Empty(obj)
-func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Empty(a.t, object, msgAndArgs...)
-}
-
-// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// a.Emptyf(obj, "error message %s", "formatted")
-func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Emptyf(a.t, object, msg, args...)
-}
-
-// Equal asserts that two objects are equal.
-//
-// a.Equal(123, 123)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Equal(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualError asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// a.EqualError(err, expectedErrorString)
-func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualError(a.t, theError, errString, msgAndArgs...)
-}
-
-// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
-func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualErrorf(a.t, theError, errString, msg, args...)
-}
-
-// EqualExportedValues asserts that the types of two objects are equal and their public
-// fields are also equal. This is useful for comparing structs that have private fields
-// that could potentially differ.
-//
-// type S struct {
-// Exported int
-// notExported int
-// }
-// a.EqualExportedValues(S{1, 2}, S{1, 3}) => true
-// a.EqualExportedValues(S{1, 2}, S{2, 3}) => false
-func (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualExportedValues(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualExportedValuesf asserts that the types of two objects are equal and their public
-// fields are also equal. This is useful for comparing structs that have private fields
-// that could potentially differ.
-//
-// type S struct {
-// Exported int
-// notExported int
-// }
-// a.EqualExportedValuesf(S{1, 2}, S{1, 3}, "error message %s", "formatted") => true
-// a.EqualExportedValuesf(S{1, 2}, S{2, 3}, "error message %s", "formatted") => false
-func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualExportedValuesf(a.t, expected, actual, msg, args...)
-}
-
-// EqualValues asserts that two objects are equal or convertible to the larger
-// type and equal.
-//
-// a.EqualValues(uint32(123), int32(123))
-func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualValues(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualValuesf asserts that two objects are equal or convertible to the larger
-// type and equal.
-//
-// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted")
-func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualValuesf(a.t, expected, actual, msg, args...)
-}
-
-// Equalf asserts that two objects are equal.
-//
-// a.Equalf(123, 123, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Equalf(a.t, expected, actual, msg, args...)
-}
-
-// Error asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.Error(err) {
-// assert.Equal(t, expectedError, err)
-// }
-func (a *Assertions) Error(err error, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Error(a.t, err, msgAndArgs...)
-}
-
-// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
-// This is a wrapper for errors.As.
-func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ErrorAs(a.t, err, target, msgAndArgs...)
-}
-
-// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
-// This is a wrapper for errors.As.
-func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ErrorAsf(a.t, err, target, msg, args...)
-}
-
-// ErrorContains asserts that a function returned an error (i.e. not `nil`)
-// and that the error contains the specified substring.
-//
-// actualObj, err := SomeFunction()
-// a.ErrorContains(err, expectedErrorSubString)
-func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ErrorContains(a.t, theError, contains, msgAndArgs...)
-}
-
-// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
-// and that the error contains the specified substring.
-//
-// actualObj, err := SomeFunction()
-// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
-func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ErrorContainsf(a.t, theError, contains, msg, args...)
-}
-
-// ErrorIs asserts that at least one of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ErrorIs(a.t, err, target, msgAndArgs...)
-}
-
-// ErrorIsf asserts that at least one of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ErrorIsf(a.t, err, target, msg, args...)
-}
-
-// Errorf asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.Errorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
-func (a *Assertions) Errorf(err error, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Errorf(a.t, err, msg, args...)
-}
-
-// Eventually asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick.
-//
-// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond)
-func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Eventually(a.t, condition, waitFor, tick, msgAndArgs...)
-}
-
-// EventuallyWithT asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick. In contrast to Eventually,
-// it supplies a CollectT to the condition function, so that the condition
-// function can use the CollectT to call other assertions.
-// The condition is considered "met" if no errors are raised in a tick.
-// The supplied CollectT collects all errors from one tick (if there are any).
-// If the condition is not met before waitFor, the collected errors of
-// the last tick are copied to t.
-//
-// externalValue := false
-// go func() {
-// time.Sleep(8*time.Second)
-// externalValue = true
-// }()
-// a.EventuallyWithT(func(c *assert.CollectT) {
-// // add assertions as needed; any assertion failure will fail the current tick
-// assert.True(c, externalValue, "expected 'externalValue' to be true")
-// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
-func (a *Assertions) EventuallyWithT(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...)
-}
-
-// EventuallyWithTf asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick. In contrast to Eventually,
-// it supplies a CollectT to the condition function, so that the condition
-// function can use the CollectT to call other assertions.
-// The condition is considered "met" if no errors are raised in a tick.
-// The supplied CollectT collects all errors from one tick (if there are any).
-// If the condition is not met before waitFor, the collected errors of
-// the last tick are copied to t.
-//
-// externalValue := false
-// go func() {
-// time.Sleep(8*time.Second)
-// externalValue = true
-// }()
-// a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") {
-// // add assertions as needed; any assertion failure will fail the current tick
-// assert.True(c, externalValue, "expected 'externalValue' to be true")
-// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
-func (a *Assertions) EventuallyWithTf(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EventuallyWithTf(a.t, condition, waitFor, tick, msg, args...)
-}
-
-// Eventuallyf asserts that given condition will be met in waitFor time,
-// periodically checking target function each tick.
-//
-// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
-func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Eventuallyf(a.t, condition, waitFor, tick, msg, args...)
-}
-
-// Exactly asserts that two objects are equal in value and type.
-//
-// a.Exactly(int32(123), int64(123))
-func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Exactly(a.t, expected, actual, msgAndArgs...)
-}
-
-// Exactlyf asserts that two objects are equal in value and type.
-//
-// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted")
-func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Exactlyf(a.t, expected, actual, msg, args...)
-}
-
-// Fail reports a failure through
-func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Fail(a.t, failureMessage, msgAndArgs...)
-}
-
-// FailNow fails test
-func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- FailNow(a.t, failureMessage, msgAndArgs...)
-}
-
-// FailNowf fails test
-func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- FailNowf(a.t, failureMessage, msg, args...)
-}
-
-// Failf reports a failure through
-func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Failf(a.t, failureMessage, msg, args...)
-}
-
-// False asserts that the specified value is false.
-//
-// a.False(myBool)
-func (a *Assertions) False(value bool, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- False(a.t, value, msgAndArgs...)
-}
-
-// Falsef asserts that the specified value is false.
-//
-// a.Falsef(myBool, "error message %s", "formatted")
-func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Falsef(a.t, value, msg, args...)
-}
-
-// FileExists checks whether a file exists in the given path. It also fails if
-// the path points to a directory or there is an error when trying to check the file.
-func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- FileExists(a.t, path, msgAndArgs...)
-}
-
-// FileExistsf checks whether a file exists in the given path. It also fails if
-// the path points to a directory or there is an error when trying to check the file.
-func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- FileExistsf(a.t, path, msg, args...)
-}
-
-// Greater asserts that the first element is greater than the second
-//
-// a.Greater(2, 1)
-// a.Greater(float64(2), float64(1))
-// a.Greater("b", "a")
-func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Greater(a.t, e1, e2, msgAndArgs...)
-}
-
-// GreaterOrEqual asserts that the first element is greater than or equal to the second
-//
-// a.GreaterOrEqual(2, 1)
-// a.GreaterOrEqual(2, 2)
-// a.GreaterOrEqual("b", "a")
-// a.GreaterOrEqual("b", "b")
-func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- GreaterOrEqual(a.t, e1, e2, msgAndArgs...)
-}
-
-// GreaterOrEqualf asserts that the first element is greater than or equal to the second
-//
-// a.GreaterOrEqualf(2, 1, "error message %s", "formatted")
-// a.GreaterOrEqualf(2, 2, "error message %s", "formatted")
-// a.GreaterOrEqualf("b", "a", "error message %s", "formatted")
-// a.GreaterOrEqualf("b", "b", "error message %s", "formatted")
-func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- GreaterOrEqualf(a.t, e1, e2, msg, args...)
-}
-
-// Greaterf asserts that the first element is greater than the second
-//
-// a.Greaterf(2, 1, "error message %s", "formatted")
-// a.Greaterf(float64(2), float64(1), "error message %s", "formatted")
-// a.Greaterf("b", "a", "error message %s", "formatted")
-func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Greaterf(a.t, e1, e2, msg, args...)
-}
-
-// HTTPBodyContains asserts that a specified handler returns a
-// body that contains a string.
-//
-// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)
-}
-
-// HTTPBodyContainsf asserts that a specified handler returns a
-// body that contains a string.
-//
-// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)
-}
-
-// HTTPBodyNotContains asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)
-}
-
-// HTTPBodyNotContainsf asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)
-}
-
-// HTTPError asserts that a specified handler returns an error status code.
-//
-// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPError(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPErrorf asserts that a specified handler returns an error status code.
-//
-// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPErrorf(a.t, handler, method, url, values, msg, args...)
-}
-
-// HTTPRedirect asserts that a specified handler returns a redirect status code.
-//
-// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPRedirectf asserts that a specified handler returns a redirect status code.
-//
-// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPRedirectf(a.t, handler, method, url, values, msg, args...)
-}
-
-// HTTPStatusCode asserts that a specified handler returns a specified status code.
-//
-// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...)
-}
-
-// HTTPStatusCodef asserts that a specified handler returns a specified status code.
-//
-// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...)
-}
-
-// HTTPSuccess asserts that a specified handler returns a success status code.
-//
-// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPSuccessf asserts that a specified handler returns a success status code.
-//
-// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
-}
-
-// Implements asserts that an object is implemented by the specified interface.
-//
-// a.Implements((*MyInterface)(nil), new(MyObject))
-func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Implements(a.t, interfaceObject, object, msgAndArgs...)
-}
-
-// Implementsf asserts that an object is implemented by the specified interface.
-//
-// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
-func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Implementsf(a.t, interfaceObject, object, msg, args...)
-}
-
-// InDelta asserts that the two numerals are within delta of each other.
-//
-// a.InDelta(math.Pi, 22/7.0, 0.01)
-func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDelta(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)
-}
-
-// InDeltaSlice is the same as InDelta, except it compares two slices.
-func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaSlicef is the same as InDelta, except it compares two slices.
-func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
-}
-
-// InDeltaf asserts that the two numerals are within delta of each other.
-//
-// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted")
-func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaf(a.t, expected, actual, delta, msg, args...)
-}
-
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
-func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
-}
-
-// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
-func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
-}
-
-// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
-func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
-}
-
-// InEpsilonf asserts that expected and actual have a relative error less than epsilon
-func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
-}
-
-// IsDecreasing asserts that the collection is decreasing
-//
-// a.IsDecreasing([]int{2, 1, 0})
-// a.IsDecreasing([]float{2, 1})
-// a.IsDecreasing([]string{"b", "a"})
-func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsDecreasing(a.t, object, msgAndArgs...)
-}
-
-// IsDecreasingf asserts that the collection is decreasing
-//
-// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted")
-// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted")
-// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted")
-func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsDecreasingf(a.t, object, msg, args...)
-}
-
-// IsIncreasing asserts that the collection is increasing
-//
-// a.IsIncreasing([]int{1, 2, 3})
-// a.IsIncreasing([]float{1, 2})
-// a.IsIncreasing([]string{"a", "b"})
-func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsIncreasing(a.t, object, msgAndArgs...)
-}
-
-// IsIncreasingf asserts that the collection is increasing
-//
-// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted")
-// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted")
-// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted")
-func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsIncreasingf(a.t, object, msg, args...)
-}
-
-// IsNonDecreasing asserts that the collection is not decreasing
-//
-// a.IsNonDecreasing([]int{1, 1, 2})
-// a.IsNonDecreasing([]float{1, 2})
-// a.IsNonDecreasing([]string{"a", "b"})
-func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsNonDecreasing(a.t, object, msgAndArgs...)
-}
-
-// IsNonDecreasingf asserts that the collection is not decreasing
-//
-// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted")
-// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted")
-// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted")
-func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsNonDecreasingf(a.t, object, msg, args...)
-}
-
-// IsNonIncreasing asserts that the collection is not increasing
-//
-// a.IsNonIncreasing([]int{2, 1, 1})
-// a.IsNonIncreasing([]float{2, 1})
-// a.IsNonIncreasing([]string{"b", "a"})
-func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsNonIncreasing(a.t, object, msgAndArgs...)
-}
-
-// IsNonIncreasingf asserts that the collection is not increasing
-//
-// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted")
-// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted")
-// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted")
-func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsNonIncreasingf(a.t, object, msg, args...)
-}
-
-// IsType asserts that the specified objects are of the same type.
-func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsType(a.t, expectedType, object, msgAndArgs...)
-}
-
-// IsTypef asserts that the specified objects are of the same type.
-func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsTypef(a.t, expectedType, object, msg, args...)
-}
-
-// JSONEq asserts that two JSON strings are equivalent.
-//
-// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- JSONEq(a.t, expected, actual, msgAndArgs...)
-}
-
-// JSONEqf asserts that two JSON strings are equivalent.
-//
-// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
-func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- JSONEqf(a.t, expected, actual, msg, args...)
-}
-
-// Len asserts that the specified object has specific length.
-// Len also fails if the object has a type that len() not accept.
-//
-// a.Len(mySlice, 3)
-func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Len(a.t, object, length, msgAndArgs...)
-}
-
-// Lenf asserts that the specified object has specific length.
-// Lenf also fails if the object has a type that len() not accept.
-//
-// a.Lenf(mySlice, 3, "error message %s", "formatted")
-func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Lenf(a.t, object, length, msg, args...)
-}
-
-// Less asserts that the first element is less than the second
-//
-// a.Less(1, 2)
-// a.Less(float64(1), float64(2))
-// a.Less("a", "b")
-func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Less(a.t, e1, e2, msgAndArgs...)
-}
-
-// LessOrEqual asserts that the first element is less than or equal to the second
-//
-// a.LessOrEqual(1, 2)
-// a.LessOrEqual(2, 2)
-// a.LessOrEqual("a", "b")
-// a.LessOrEqual("b", "b")
-func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- LessOrEqual(a.t, e1, e2, msgAndArgs...)
-}
-
-// LessOrEqualf asserts that the first element is less than or equal to the second
-//
-// a.LessOrEqualf(1, 2, "error message %s", "formatted")
-// a.LessOrEqualf(2, 2, "error message %s", "formatted")
-// a.LessOrEqualf("a", "b", "error message %s", "formatted")
-// a.LessOrEqualf("b", "b", "error message %s", "formatted")
-func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- LessOrEqualf(a.t, e1, e2, msg, args...)
-}
-
-// Lessf asserts that the first element is less than the second
-//
-// a.Lessf(1, 2, "error message %s", "formatted")
-// a.Lessf(float64(1), float64(2), "error message %s", "formatted")
-// a.Lessf("a", "b", "error message %s", "formatted")
-func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Lessf(a.t, e1, e2, msg, args...)
-}
-
-// Negative asserts that the specified element is negative
-//
-// a.Negative(-1)
-// a.Negative(-1.23)
-func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Negative(a.t, e, msgAndArgs...)
-}
-
-// Negativef asserts that the specified element is negative
-//
-// a.Negativef(-1, "error message %s", "formatted")
-// a.Negativef(-1.23, "error message %s", "formatted")
-func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Negativef(a.t, e, msg, args...)
-}
-
-// Never asserts that the given condition doesn't satisfy in waitFor time,
-// periodically checking the target function each tick.
-//
-// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond)
-func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Never(a.t, condition, waitFor, tick, msgAndArgs...)
-}
-
-// Neverf asserts that the given condition doesn't satisfy in waitFor time,
-// periodically checking the target function each tick.
-//
-// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted")
-func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Neverf(a.t, condition, waitFor, tick, msg, args...)
-}
-
-// Nil asserts that the specified object is nil.
-//
-// a.Nil(err)
-func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Nil(a.t, object, msgAndArgs...)
-}
-
-// Nilf asserts that the specified object is nil.
-//
-// a.Nilf(err, "error message %s", "formatted")
-func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Nilf(a.t, object, msg, args...)
-}
-
-// NoDirExists checks whether a directory does not exist in the given path.
-// It fails if the path points to an existing _directory_ only.
-func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NoDirExists(a.t, path, msgAndArgs...)
-}
-
-// NoDirExistsf checks whether a directory does not exist in the given path.
-// It fails if the path points to an existing _directory_ only.
-func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NoDirExistsf(a.t, path, msg, args...)
-}
-
-// NoError asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.NoError(err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NoError(a.t, err, msgAndArgs...)
-}
-
-// NoErrorf asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.NoErrorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NoErrorf(a.t, err, msg, args...)
-}
-
-// NoFileExists checks whether a file does not exist in a given path. It fails
-// if the path points to an existing _file_ only.
-func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NoFileExists(a.t, path, msgAndArgs...)
-}
-
-// NoFileExistsf checks whether a file does not exist in a given path. It fails
-// if the path points to an existing _file_ only.
-func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NoFileExistsf(a.t, path, msg, args...)
-}
-
-// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// a.NotContains("Hello World", "Earth")
-// a.NotContains(["Hello", "World"], "Earth")
-// a.NotContains({"Hello": "World"}, "Earth")
-func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotContains(a.t, s, contains, msgAndArgs...)
-}
-
-// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
-// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
-// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
-func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotContainsf(a.t, s, contains, msg, args...)
-}
-
-// NotElementsMatch asserts that the specified listA(array, slice...) is NOT equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should not match.
-// This is an inverse of ElementsMatch.
-//
-// a.NotElementsMatch([1, 1, 2, 3], [1, 1, 2, 3]) -> false
-//
-// a.NotElementsMatch([1, 1, 2, 3], [1, 2, 3]) -> true
-//
-// a.NotElementsMatch([1, 2, 3], [1, 2, 4]) -> true
-func (a *Assertions) NotElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotElementsMatch(a.t, listA, listB, msgAndArgs...)
-}
-
-// NotElementsMatchf asserts that the specified listA(array, slice...) is NOT equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should not match.
-// This is an inverse of ElementsMatch.
-//
-// a.NotElementsMatchf([1, 1, 2, 3], [1, 1, 2, 3], "error message %s", "formatted") -> false
-//
-// a.NotElementsMatchf([1, 1, 2, 3], [1, 2, 3], "error message %s", "formatted") -> true
-//
-// a.NotElementsMatchf([1, 2, 3], [1, 2, 4], "error message %s", "formatted") -> true
-func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotElementsMatchf(a.t, listA, listB, msg, args...)
-}
-
-// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if a.NotEmpty(obj) {
-// assert.Equal(t, "two", obj[1])
-// }
-func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEmpty(a.t, object, msgAndArgs...)
-}
-
-// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if a.NotEmptyf(obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
-func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEmptyf(a.t, object, msg, args...)
-}
-
-// NotEqual asserts that the specified values are NOT equal.
-//
-// a.NotEqual(obj1, obj2)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEqual(a.t, expected, actual, msgAndArgs...)
-}
-
-// NotEqualValues asserts that two objects are not equal even when converted to the same type
-//
-// a.NotEqualValues(obj1, obj2)
-func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEqualValues(a.t, expected, actual, msgAndArgs...)
-}
-
-// NotEqualValuesf asserts that two objects are not equal even when converted to the same type
-//
-// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted")
-func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEqualValuesf(a.t, expected, actual, msg, args...)
-}
-
-// NotEqualf asserts that the specified values are NOT equal.
-//
-// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEqualf(a.t, expected, actual, msg, args...)
-}
-
-// NotErrorAs asserts that none of the errors in err's chain matches target,
-// but if so, sets target to that error value.
-func (a *Assertions) NotErrorAs(err error, target interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotErrorAs(a.t, err, target, msgAndArgs...)
-}
-
-// NotErrorAsf asserts that none of the errors in err's chain matches target,
-// but if so, sets target to that error value.
-func (a *Assertions) NotErrorAsf(err error, target interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotErrorAsf(a.t, err, target, msg, args...)
-}
-
-// NotErrorIs asserts that none of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotErrorIs(a.t, err, target, msgAndArgs...)
-}
-
-// NotErrorIsf asserts that none of the errors in err's chain matches target.
-// This is a wrapper for errors.Is.
-func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotErrorIsf(a.t, err, target, msg, args...)
-}
-
-// NotImplements asserts that an object does not implement the specified interface.
-//
-// a.NotImplements((*MyInterface)(nil), new(MyObject))
-func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotImplements(a.t, interfaceObject, object, msgAndArgs...)
-}
-
-// NotImplementsf asserts that an object does not implement the specified interface.
-//
-// a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
-func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotImplementsf(a.t, interfaceObject, object, msg, args...)
-}
-
-// NotNil asserts that the specified object is not nil.
-//
-// a.NotNil(err)
-func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotNil(a.t, object, msgAndArgs...)
-}
-
-// NotNilf asserts that the specified object is not nil.
-//
-// a.NotNilf(err, "error message %s", "formatted")
-func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotNilf(a.t, object, msg, args...)
-}
-
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// a.NotPanics(func(){ RemainCalm() })
-func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotPanics(a.t, f, msgAndArgs...)
-}
-
-// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
-func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotPanicsf(a.t, f, msg, args...)
-}
-
-// NotRegexp asserts that a specified regexp does not match a string.
-//
-// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
-// a.NotRegexp("^start", "it's not starting")
-func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotRegexp(a.t, rx, str, msgAndArgs...)
-}
-
-// NotRegexpf asserts that a specified regexp does not match a string.
-//
-// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
-// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
-func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotRegexpf(a.t, rx, str, msg, args...)
-}
-
-// NotSame asserts that two pointers do not reference the same object.
-//
-// a.NotSame(ptr1, ptr2)
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotSame(a.t, expected, actual, msgAndArgs...)
-}
-
-// NotSamef asserts that two pointers do not reference the same object.
-//
-// a.NotSamef(ptr1, ptr2, "error message %s", "formatted")
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotSamef(a.t, expected, actual, msg, args...)
-}
-
-// NotSubset asserts that the specified list(array, slice...) or map does NOT
-// contain all elements given in the specified subset list(array, slice...) or
-// map.
-//
-// a.NotSubset([1, 3, 4], [1, 2])
-// a.NotSubset({"x": 1, "y": 2}, {"z": 3})
-func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotSubset(a.t, list, subset, msgAndArgs...)
-}
-
-// NotSubsetf asserts that the specified list(array, slice...) or map does NOT
-// contain all elements given in the specified subset list(array, slice...) or
-// map.
-//
-// a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted")
-// a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted")
-func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotSubsetf(a.t, list, subset, msg, args...)
-}
-
-// NotZero asserts that i is not the zero value for its type.
-func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotZero(a.t, i, msgAndArgs...)
-}
-
-// NotZerof asserts that i is not the zero value for its type.
-func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotZerof(a.t, i, msg, args...)
-}
-
-// Panics asserts that the code inside the specified PanicTestFunc panics.
-//
-// a.Panics(func(){ GoCrazy() })
-func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Panics(a.t, f, msgAndArgs...)
-}
-
-// PanicsWithError asserts that the code inside the specified PanicTestFunc
-// panics, and that the recovered panic value is an error that satisfies the
-// EqualError comparison.
-//
-// a.PanicsWithError("crazy error", func(){ GoCrazy() })
-func (a *Assertions) PanicsWithError(errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- PanicsWithError(a.t, errString, f, msgAndArgs...)
-}
-
-// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc
-// panics, and that the recovered panic value is an error that satisfies the
-// EqualError comparison.
-//
-// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) PanicsWithErrorf(errString string, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- PanicsWithErrorf(a.t, errString, f, msg, args...)
-}
-
-// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
-func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- PanicsWithValue(a.t, expected, f, msgAndArgs...)
-}
-
-// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- PanicsWithValuef(a.t, expected, f, msg, args...)
-}
-
-// Panicsf asserts that the code inside the specified PanicTestFunc panics.
-//
-// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Panicsf(a.t, f, msg, args...)
-}
-
-// Positive asserts that the specified element is positive
-//
-// a.Positive(1)
-// a.Positive(1.23)
-func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Positive(a.t, e, msgAndArgs...)
-}
-
-// Positivef asserts that the specified element is positive
-//
-// a.Positivef(1, "error message %s", "formatted")
-// a.Positivef(1.23, "error message %s", "formatted")
-func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Positivef(a.t, e, msg, args...)
-}
-
-// Regexp asserts that a specified regexp matches a string.
-//
-// a.Regexp(regexp.MustCompile("start"), "it's starting")
-// a.Regexp("start...$", "it's not starting")
-func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Regexp(a.t, rx, str, msgAndArgs...)
-}
-
-// Regexpf asserts that a specified regexp matches a string.
-//
-// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
-// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
-func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Regexpf(a.t, rx, str, msg, args...)
-}
-
-// Same asserts that two pointers reference the same object.
-//
-// a.Same(ptr1, ptr2)
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Same(a.t, expected, actual, msgAndArgs...)
-}
-
-// Samef asserts that two pointers reference the same object.
-//
-// a.Samef(ptr1, ptr2, "error message %s", "formatted")
-//
-// Both arguments must be pointer variables. Pointer variable sameness is
-// determined based on the equality of both type and value.
-func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Samef(a.t, expected, actual, msg, args...)
-}
-
-// Subset asserts that the specified list(array, slice...) or map contains all
-// elements given in the specified subset list(array, slice...) or map.
-//
-// a.Subset([1, 2, 3], [1, 2])
-// a.Subset({"x": 1, "y": 2}, {"x": 1})
-func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Subset(a.t, list, subset, msgAndArgs...)
-}
-
-// Subsetf asserts that the specified list(array, slice...) or map contains all
-// elements given in the specified subset list(array, slice...) or map.
-//
-// a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted")
-// a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted")
-func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Subsetf(a.t, list, subset, msg, args...)
-}
-
-// True asserts that the specified value is true.
-//
-// a.True(myBool)
-func (a *Assertions) True(value bool, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- True(a.t, value, msgAndArgs...)
-}
-
-// Truef asserts that the specified value is true.
-//
-// a.Truef(myBool, "error message %s", "formatted")
-func (a *Assertions) Truef(value bool, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Truef(a.t, value, msg, args...)
-}
-
-// WithinDuration asserts that the two times are within duration delta of each other.
-//
-// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
-func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// WithinDurationf asserts that the two times are within duration delta of each other.
-//
-// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
-func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- WithinDurationf(a.t, expected, actual, delta, msg, args...)
-}
-
-// WithinRange asserts that a time is within a time range (inclusive).
-//
-// a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second))
-func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- WithinRange(a.t, actual, start, end, msgAndArgs...)
-}
-
-// WithinRangef asserts that a time is within a time range (inclusive).
-//
-// a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted")
-func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- WithinRangef(a.t, actual, start, end, msg, args...)
-}
-
-// YAMLEq asserts that two YAML strings are equivalent.
-func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- YAMLEq(a.t, expected, actual, msgAndArgs...)
-}
-
-// YAMLEqf asserts that two YAML strings are equivalent.
-func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- YAMLEqf(a.t, expected, actual, msg, args...)
-}
-
-// Zero asserts that i is the zero value for its type.
-func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Zero(a.t, i, msgAndArgs...)
-}
-
-// Zerof asserts that i is the zero value for its type.
-func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Zerof(a.t, i, msg, args...)
-}
diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl
deleted file mode 100644
index 54124df1d..000000000
--- a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{.CommentWithoutT "a"}}
-func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) {
- if h, ok := a.t.(tHelper); ok { h.Helper() }
- {{.DocInfo.Name}}(a.t, {{.ForwardedParams}})
-}
diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go
deleted file mode 100644
index 6b7ce929e..000000000
--- a/vendor/github.com/stretchr/testify/require/requirements.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package require
-
-// TestingT is an interface wrapper around *testing.T
-type TestingT interface {
- Errorf(format string, args ...interface{})
- FailNow()
-}
-
-type tHelper = interface {
- Helper()
-}
-
-// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful
-// for table driven tests.
-type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{})
-
-// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful
-// for table driven tests.
-type ValueAssertionFunc func(TestingT, interface{}, ...interface{})
-
-// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful
-// for table driven tests.
-type BoolAssertionFunc func(TestingT, bool, ...interface{})
-
-// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful
-// for table driven tests.
-type ErrorAssertionFunc func(TestingT, error, ...interface{})
-
-//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require.go.tmpl -include-format-funcs"
diff --git a/vendor/github.com/subosito/gotenv/.env b/vendor/github.com/subosito/gotenv/.env
deleted file mode 100644
index 6405eca71..000000000
--- a/vendor/github.com/subosito/gotenv/.env
+++ /dev/null
@@ -1 +0,0 @@
-HELLO=world
diff --git a/vendor/github.com/subosito/gotenv/.env.invalid b/vendor/github.com/subosito/gotenv/.env.invalid
deleted file mode 100644
index 016d5e0ce..000000000
--- a/vendor/github.com/subosito/gotenv/.env.invalid
+++ /dev/null
@@ -1 +0,0 @@
-lol$wut
diff --git a/vendor/github.com/subosito/gotenv/.gitignore b/vendor/github.com/subosito/gotenv/.gitignore
deleted file mode 100644
index 7db37c1db..000000000
--- a/vendor/github.com/subosito/gotenv/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.test
-*.out
-annotate.json
-profile.cov
diff --git a/vendor/github.com/subosito/gotenv/.golangci.yaml b/vendor/github.com/subosito/gotenv/.golangci.yaml
deleted file mode 100644
index 8c82a762e..000000000
--- a/vendor/github.com/subosito/gotenv/.golangci.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-# Options for analysis running.
-run:
- timeout: 1m
-
-linters-settings:
- gofmt:
- simplify: true
diff --git a/vendor/github.com/subosito/gotenv/CHANGELOG.md b/vendor/github.com/subosito/gotenv/CHANGELOG.md
deleted file mode 100644
index c4fe7d326..000000000
--- a/vendor/github.com/subosito/gotenv/CHANGELOG.md
+++ /dev/null
@@ -1,105 +0,0 @@
-# Changelog
-
-## [1.5.0] - 2023-08-15
-
-### Fixed
-
-- Use io.Reader instead of custom Reader
-
-## [1.5.0] - 2023-08-15
-
-### Added
-
-- Support for reading UTF16 files
-
-### Fixed
-
-- Scanner error handling
-- Reader error handling
-
-## [1.4.2] - 2023-01-11
-
-### Fixed
-
-- Env var initialization
-
-### Changed
-
-- More consitent line splitting
-
-## [1.4.1] - 2022-08-23
-
-### Fixed
-
-- Missing file close
-
-### Changed
-
-- Updated dependencies
-
-## [1.4.0] - 2022-06-02
-
-### Added
-
-- Add `Marshal` and `Unmarshal` helpers
-
-### Changed
-
-- The CI will now run a linter and the tests on PRs.
-
-## [1.3.0] - 2022-05-23
-
-### Added
-
-- Support = within double-quoted strings
-- Add support for multiline values
-
-### Changed
-
-- `OverLoad` prefer environment variables over local variables
-
-## [1.2.0] - 2019-08-03
-
-### Added
-
-- Add `Must` helper to raise an error as panic. It can be used with `Load` and `OverLoad`.
-- Add more tests to be 100% coverage.
-- Add CHANGELOG
-- Add more OS for the test: OSX and Windows
-
-### Changed
-
-- Reduce complexity and improve source code for having `A+` score in [goreportcard](https://goreportcard.com/report/github.com/subosito/gotenv).
-- Updated README with mentions to all available functions
-
-### Removed
-
-- Remove `ErrFormat`
-- Remove `MustLoad` and `MustOverload`, replaced with `Must` helper.
-
-## [1.1.1] - 2018-06-05
-
-### Changed
-
-- Replace `os.Getenv` with `os.LookupEnv` to ensure that the environment variable is not set, by [radding](https://github.com/radding)
-
-## [1.1.0] - 2017-03-20
-
-### Added
-
-- Supports carriage return in env
-- Handle files with UTF-8 BOM
-
-### Changed
-
-- Whitespace handling
-
-### Fixed
-
-- Incorrect variable expansion
-- Handling escaped '$' characters
-
-## [1.0.0] - 2014-10-05
-
-First stable release.
-
diff --git a/vendor/github.com/subosito/gotenv/LICENSE b/vendor/github.com/subosito/gotenv/LICENSE
deleted file mode 100644
index f64ccaedc..000000000
--- a/vendor/github.com/subosito/gotenv/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Alif Rachmawadi
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/github.com/subosito/gotenv/README.md b/vendor/github.com/subosito/gotenv/README.md
deleted file mode 100644
index fc9616e3b..000000000
--- a/vendor/github.com/subosito/gotenv/README.md
+++ /dev/null
@@ -1,129 +0,0 @@
-# gotenv
-
-[](https://github.com/subosito/gotenv/actions)
-[](https://codecov.io/gh/subosito/gotenv)
-[](https://goreportcard.com/report/github.com/subosito/gotenv)
-[](https://godoc.org/github.com/subosito/gotenv)
-
-Load environment variables from `.env` or `io.Reader` in Go.
-
-## Usage
-
-Put the gotenv package on your `import` statement:
-
-```go
-import "github.com/subosito/gotenv"
-```
-
-To modify your app environment variables, `gotenv` expose 2 main functions:
-
-- `gotenv.Load`
-- `gotenv.Apply`
-
-By default, `gotenv.Load` will look for a file called `.env` in the current working directory.
-
-Behind the scene, it will then load `.env` file and export the valid variables to the environment variables. Make sure you call the method as soon as possible to ensure it loads all variables, say, put it on `init()` function.
-
-Once loaded you can use `os.Getenv()` to get the value of the variable.
-
-Let's say you have `.env` file:
-
-```sh
-APP_ID=1234567
-APP_SECRET=abcdef
-```
-
-Here's the example of your app:
-
-```go
-package main
-
-import (
- "github.com/subosito/gotenv"
- "log"
- "os"
-)
-
-func init() {
- gotenv.Load()
-}
-
-func main() {
- log.Println(os.Getenv("APP_ID")) // "1234567"
- log.Println(os.Getenv("APP_SECRET")) // "abcdef"
-}
-```
-
-You can also load other than `.env` file if you wish. Just supply filenames when calling `Load()`. It will load them in order and the first value set for a variable will win.:
-
-```go
-gotenv.Load(".env.production", "credentials")
-```
-
-While `gotenv.Load` loads entries from `.env` file, `gotenv.Apply` allows you to use any `io.Reader`:
-
-```go
-gotenv.Apply(strings.NewReader("APP_ID=1234567"))
-
-log.Println(os.Getenv("APP_ID"))
-// Output: "1234567"
-```
-
-Both `gotenv.Load` and `gotenv.Apply` **DO NOT** overrides existing environment variables. If you want to override existing ones, you can see section below.
-
-### Environment Overrides
-
-Besides above functions, `gotenv` also provides another functions that overrides existing:
-
-- `gotenv.OverLoad`
-- `gotenv.OverApply`
-
-Here's the example of this overrides behavior:
-
-```go
-os.Setenv("HELLO", "world")
-
-// NOTE: using Apply existing value will be reserved
-gotenv.Apply(strings.NewReader("HELLO=universe"))
-fmt.Println(os.Getenv("HELLO"))
-// Output: "world"
-
-// NOTE: using OverApply existing value will be overridden
-gotenv.OverApply(strings.NewReader("HELLO=universe"))
-fmt.Println(os.Getenv("HELLO"))
-// Output: "universe"
-```
-
-### Throw a Panic
-
-Both `gotenv.Load` and `gotenv.OverLoad` returns an error on something wrong occurred, like your env file is not exist, and so on. To make it easier to use, `gotenv` also provides `gotenv.Must` helper, to let it panic when an error returned.
-
-```go
-err := gotenv.Load(".env-is-not-exist")
-fmt.Println("error", err)
-// error: open .env-is-not-exist: no such file or directory
-
-gotenv.Must(gotenv.Load, ".env-is-not-exist")
-// it will throw a panic
-// panic: open .env-is-not-exist: no such file or directory
-```
-
-### Another Scenario
-
-Just in case you want to parse environment variables from any `io.Reader`, gotenv keeps its `Parse` and `StrictParse` function as public API so you can use that.
-
-```go
-// import "strings"
-
-pairs := gotenv.Parse(strings.NewReader("FOO=test\nBAR=$FOO"))
-// gotenv.Env{"FOO": "test", "BAR": "test"}
-
-pairs, err := gotenv.StrictParse(strings.NewReader(`FOO="bar"`))
-// gotenv.Env{"FOO": "bar"}
-```
-
-`Parse` ignores invalid lines and returns `Env` of valid environment variables, while `StrictParse` returns an error for invalid lines.
-
-## Notes
-
-The gotenv package is a Go port of [`dotenv`](https://github.com/bkeepers/dotenv) project with some additions made for Go. For general features, it aims to be compatible as close as possible.
diff --git a/vendor/github.com/subosito/gotenv/gotenv.go b/vendor/github.com/subosito/gotenv/gotenv.go
deleted file mode 100644
index 1191d3587..000000000
--- a/vendor/github.com/subosito/gotenv/gotenv.go
+++ /dev/null
@@ -1,409 +0,0 @@
-// Package gotenv provides functionality to dynamically load the environment variables
-package gotenv
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "regexp"
- "sort"
- "strconv"
- "strings"
-
- "golang.org/x/text/encoding/unicode"
- "golang.org/x/text/transform"
-)
-
-const (
- // Pattern for detecting valid line format
- linePattern = `\A\s*(?:export\s+)?([\w\.]+)(?:\s*=\s*|:\s+?)('(?:\'|[^'])*'|"(?:\"|[^"])*"|[^#\n]+)?\s*(?:\s*\#.*)?\z`
-
- // Pattern for detecting valid variable within a value
- variablePattern = `(\\)?(\$)(\{?([A-Z0-9_]+)?\}?)`
-)
-
-// Byte order mark character
-var (
- bomUTF8 = []byte("\xEF\xBB\xBF")
- bomUTF16LE = []byte("\xFF\xFE")
- bomUTF16BE = []byte("\xFE\xFF")
-)
-
-// Env holds key/value pair of valid environment variable
-type Env map[string]string
-
-// Load is a function to load a file or multiple files and then export the valid variables into environment variables if they do not exist.
-// When it's called with no argument, it will load `.env` file on the current path and set the environment variables.
-// Otherwise, it will loop over the filenames parameter and set the proper environment variables.
-func Load(filenames ...string) error {
- return loadenv(false, filenames...)
-}
-
-// OverLoad is a function to load a file or multiple files and then export and override the valid variables into environment variables.
-func OverLoad(filenames ...string) error {
- return loadenv(true, filenames...)
-}
-
-// Must is wrapper function that will panic when supplied function returns an error.
-func Must(fn func(filenames ...string) error, filenames ...string) {
- if err := fn(filenames...); err != nil {
- panic(err.Error())
- }
-}
-
-// Apply is a function to load an io Reader then export the valid variables into environment variables if they do not exist.
-func Apply(r io.Reader) error {
- return parset(r, false)
-}
-
-// OverApply is a function to load an io Reader then export and override the valid variables into environment variables.
-func OverApply(r io.Reader) error {
- return parset(r, true)
-}
-
-func loadenv(override bool, filenames ...string) error {
- if len(filenames) == 0 {
- filenames = []string{".env"}
- }
-
- for _, filename := range filenames {
- f, err := os.Open(filename)
- if err != nil {
- return err
- }
-
- err = parset(f, override)
- f.Close()
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// parse and set :)
-func parset(r io.Reader, override bool) error {
- env, err := strictParse(r, override)
- if err != nil {
- return err
- }
-
- for key, val := range env {
- setenv(key, val, override)
- }
-
- return nil
-}
-
-func setenv(key, val string, override bool) {
- if override {
- os.Setenv(key, val)
- } else {
- if _, present := os.LookupEnv(key); !present {
- os.Setenv(key, val)
- }
- }
-}
-
-// Parse is a function to parse line by line any io.Reader supplied and returns the valid Env key/value pair of valid variables.
-// It expands the value of a variable from the environment variable but does not set the value to the environment itself.
-// This function is skipping any invalid lines and only processing the valid one.
-func Parse(r io.Reader) Env {
- env, _ := strictParse(r, false)
- return env
-}
-
-// StrictParse is a function to parse line by line any io.Reader supplied and returns the valid Env key/value pair of valid variables.
-// It expands the value of a variable from the environment variable but does not set the value to the environment itself.
-// This function is returning an error if there are any invalid lines.
-func StrictParse(r io.Reader) (Env, error) {
- return strictParse(r, false)
-}
-
-// Read is a function to parse a file line by line and returns the valid Env key/value pair of valid variables.
-// It expands the value of a variable from the environment variable but does not set the value to the environment itself.
-// This function is skipping any invalid lines and only processing the valid one.
-func Read(filename string) (Env, error) {
- f, err := os.Open(filename)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- return strictParse(f, false)
-}
-
-// Unmarshal reads a string line by line and returns the valid Env key/value pair of valid variables.
-// It expands the value of a variable from the environment variable but does not set the value to the environment itself.
-// This function is returning an error if there are any invalid lines.
-func Unmarshal(str string) (Env, error) {
- return strictParse(strings.NewReader(str), false)
-}
-
-// Marshal outputs the given environment as a env file.
-// Variables will be sorted by name.
-func Marshal(env Env) (string, error) {
- lines := make([]string, 0, len(env))
- for k, v := range env {
- if d, err := strconv.Atoi(v); err == nil {
- lines = append(lines, fmt.Sprintf(`%s=%d`, k, d))
- } else {
- lines = append(lines, fmt.Sprintf(`%s=%q`, k, v))
- }
- }
- sort.Strings(lines)
- return strings.Join(lines, "\n"), nil
-}
-
-// Write serializes the given environment and writes it to a file
-func Write(env Env, filename string) error {
- content, err := Marshal(env)
- if err != nil {
- return err
- }
- // ensure the path exists
- if err := os.MkdirAll(filepath.Dir(filename), 0o775); err != nil {
- return err
- }
- // create or truncate the file
- file, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer file.Close()
- _, err = file.WriteString(content + "\n")
- if err != nil {
- return err
- }
-
- return file.Sync()
-}
-
-// splitLines is a valid SplitFunc for a bufio.Scanner. It will split lines on CR ('\r'), LF ('\n') or CRLF (any of the three sequences).
-// If a CR is immediately followed by a LF, it is treated as a CRLF (one single line break).
-func splitLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
- if atEOF && len(data) == 0 {
- return 0, nil, bufio.ErrFinalToken
- }
-
- idx := bytes.IndexAny(data, "\r\n")
- switch {
- case atEOF && idx < 0:
- return len(data), data, bufio.ErrFinalToken
-
- case idx < 0:
- return 0, nil, nil
- }
-
- // consume CR or LF
- eol := idx + 1
- // detect CRLF
- if len(data) > eol && data[eol-1] == '\r' && data[eol] == '\n' {
- eol++
- }
-
- return eol, data[:idx], nil
-}
-
-func strictParse(r io.Reader, override bool) (Env, error) {
- env := make(Env)
-
- buf := new(bytes.Buffer)
- tee := io.TeeReader(r, buf)
-
- // There can be a maximum of 3 BOM bytes.
- bomByteBuffer := make([]byte, 3)
- _, err := tee.Read(bomByteBuffer)
- if err != nil && err != io.EOF {
- return env, err
- }
-
- z := io.MultiReader(buf, r)
-
- // We chooes a different scanner depending on file encoding.
- var scanner *bufio.Scanner
-
- if bytes.HasPrefix(bomByteBuffer, bomUTF8) {
- scanner = bufio.NewScanner(transform.NewReader(z, unicode.UTF8BOM.NewDecoder()))
- } else if bytes.HasPrefix(bomByteBuffer, bomUTF16LE) {
- scanner = bufio.NewScanner(transform.NewReader(z, unicode.UTF16(unicode.LittleEndian, unicode.ExpectBOM).NewDecoder()))
- } else if bytes.HasPrefix(bomByteBuffer, bomUTF16BE) {
- scanner = bufio.NewScanner(transform.NewReader(z, unicode.UTF16(unicode.BigEndian, unicode.ExpectBOM).NewDecoder()))
- } else {
- scanner = bufio.NewScanner(z)
- }
-
- scanner.Split(splitLines)
-
- for scanner.Scan() {
- if err := scanner.Err(); err != nil {
- return env, err
- }
-
- line := strings.TrimSpace(scanner.Text())
- if line == "" || line[0] == '#' {
- continue
- }
-
- quote := ""
- // look for the delimiter character
- idx := strings.Index(line, "=")
- if idx == -1 {
- idx = strings.Index(line, ":")
- }
- // look for a quote character
- if idx > 0 && idx < len(line)-1 {
- val := strings.TrimSpace(line[idx+1:])
- if val[0] == '"' || val[0] == '\'' {
- quote = val[:1]
- // look for the closing quote character within the same line
- idx = strings.LastIndex(strings.TrimSpace(val[1:]), quote)
- if idx >= 0 && val[idx] != '\\' {
- quote = ""
- }
- }
- }
- // look for the closing quote character
- for quote != "" && scanner.Scan() {
- l := scanner.Text()
- line += "\n" + l
- idx := strings.LastIndex(l, quote)
- if idx > 0 && l[idx-1] == '\\' {
- // foud a matching quote character but it's escaped
- continue
- }
- if idx >= 0 {
- // foud a matching quote
- quote = ""
- }
- }
-
- if quote != "" {
- return env, fmt.Errorf("missing quotes")
- }
-
- err := parseLine(line, env, override)
- if err != nil {
- return env, err
- }
- }
-
- return env, scanner.Err()
-}
-
-var (
- lineRgx = regexp.MustCompile(linePattern)
- unescapeRgx = regexp.MustCompile(`\\([^$])`)
- varRgx = regexp.MustCompile(variablePattern)
-)
-
-func parseLine(s string, env Env, override bool) error {
- rm := lineRgx.FindStringSubmatch(s)
-
- if len(rm) == 0 {
- return checkFormat(s, env)
- }
-
- key := strings.TrimSpace(rm[1])
- val := strings.TrimSpace(rm[2])
-
- var hsq, hdq bool
-
- // check if the value is quoted
- if l := len(val); l >= 2 {
- l -= 1
- // has double quotes
- hdq = val[0] == '"' && val[l] == '"'
- // has single quotes
- hsq = val[0] == '\'' && val[l] == '\''
-
- // remove quotes '' or ""
- if hsq || hdq {
- val = val[1:l]
- }
- }
-
- if hdq {
- val = strings.ReplaceAll(val, `\n`, "\n")
- val = strings.ReplaceAll(val, `\r`, "\r")
-
- // Unescape all characters except $ so variables can be escaped properly
- val = unescapeRgx.ReplaceAllString(val, "$1")
- }
-
- if !hsq {
- fv := func(s string) string {
- return varReplacement(s, hsq, env, override)
- }
- val = varRgx.ReplaceAllStringFunc(val, fv)
- }
-
- env[key] = val
- return nil
-}
-
-func parseExport(st string, env Env) error {
- if strings.HasPrefix(st, "export") {
- vs := strings.SplitN(st, " ", 2)
-
- if len(vs) > 1 {
- if _, ok := env[vs[1]]; !ok {
- return fmt.Errorf("line `%s` has an unset variable", st)
- }
- }
- }
-
- return nil
-}
-
-var varNameRgx = regexp.MustCompile(`(\$)(\{?([A-Z0-9_]+)\}?)`)
-
-func varReplacement(s string, hsq bool, env Env, override bool) string {
- if s == "" {
- return s
- }
-
- if s[0] == '\\' {
- // the dollar sign is escaped
- return s[1:]
- }
-
- if hsq {
- return s
- }
-
- mn := varNameRgx.FindStringSubmatch(s)
-
- if len(mn) == 0 {
- return s
- }
-
- v := mn[3]
-
- if replace, ok := os.LookupEnv(v); ok && !override {
- return replace
- }
-
- if replace, ok := env[v]; ok {
- return replace
- }
-
- return os.Getenv(v)
-}
-
-func checkFormat(s string, env Env) error {
- st := strings.TrimSpace(s)
-
- if st == "" || st[0] == '#' {
- return nil
- }
-
- if err := parseExport(st, env); err != nil {
- return err
- }
-
- return fmt.Errorf("line `%s` doesn't match format", s)
-}
diff --git a/vendor/github.com/xanzy/ssh-agent/.gitignore b/vendor/github.com/xanzy/ssh-agent/.gitignore
deleted file mode 100644
index daf913b1b..000000000
--- a/vendor/github.com/xanzy/ssh-agent/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/xanzy/ssh-agent/LICENSE b/vendor/github.com/xanzy/ssh-agent/LICENSE
deleted file mode 100644
index 8f71f43fe..000000000
--- a/vendor/github.com/xanzy/ssh-agent/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/vendor/github.com/xanzy/ssh-agent/README.md b/vendor/github.com/xanzy/ssh-agent/README.md
deleted file mode 100644
index e2dfcedca..000000000
--- a/vendor/github.com/xanzy/ssh-agent/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# ssh-agent
-
-Create a new [agent.Agent](https://godoc.org/golang.org/x/crypto/ssh/agent#Agent) on any type of OS (so including Windows) from any [Go](https://golang.org) application.
-
-## Limitations
-
-When compiled for Windows, it will only support [Pageant](http://the.earth.li/~sgtatham/putty/0.66/htmldoc/Chapter9.html#pageant) as the SSH authentication agent.
-
-## Credits
-
-Big thanks to [Давид Мзареулян (David Mzareulyan)](https://github.com/davidmz) for creating the [go-pageant](https://github.com/davidmz/go-pageant) package!
-
-## Issues
-
-If you have an issue: report it on the [issue tracker](https://github.com/xanzy/ssh-agent/issues)
-
-## Author
-
-Sander van Harmelen ()
-
-## License
-
-The files `pageant_windows.go` and `sshagent_windows.go` have their own license (see file headers). The rest of this package is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
diff --git a/vendor/github.com/xanzy/ssh-agent/pageant_windows.go b/vendor/github.com/xanzy/ssh-agent/pageant_windows.go
deleted file mode 100644
index 1608e54cc..000000000
--- a/vendor/github.com/xanzy/ssh-agent/pageant_windows.go
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// Copyright (c) 2014 David Mzareulyan
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-// and associated documentation files (the "Software"), to deal in the Software without restriction,
-// including without limitation the rights to use, copy, modify, merge, publish, distribute,
-// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
-// is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all copies or substantial
-// portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
-// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-//go:build windows
-// +build windows
-
-package sshagent
-
-// see https://github.com/Yasushi/putty/blob/master/windows/winpgntc.c#L155
-// see https://github.com/paramiko/paramiko/blob/master/paramiko/win_pageant.py
-
-import (
- "encoding/binary"
- "errors"
- "fmt"
- "sync"
- "syscall"
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-// Maximum size of message can be sent to pageant
-const MaxMessageLen = 8192
-
-var (
- ErrPageantNotFound = errors.New("pageant process not found")
- ErrSendMessage = errors.New("error sending message")
-
- ErrMessageTooLong = errors.New("message too long")
- ErrInvalidMessageFormat = errors.New("invalid message format")
- ErrResponseTooLong = errors.New("response too long")
-)
-
-const (
- agentCopydataID = 0x804e50ba
- wmCopydata = 74
-)
-
-type copyData struct {
- dwData uintptr
- cbData uint32
- lpData unsafe.Pointer
-}
-
-var (
- lock sync.Mutex
-
- user32dll = windows.NewLazySystemDLL("user32.dll")
- winFindWindow = winAPI(user32dll, "FindWindowW")
- winSendMessage = winAPI(user32dll, "SendMessageW")
-
- kernel32dll = windows.NewLazySystemDLL("kernel32.dll")
- winGetCurrentThreadID = winAPI(kernel32dll, "GetCurrentThreadId")
-)
-
-func winAPI(dll *windows.LazyDLL, funcName string) func(...uintptr) (uintptr, uintptr, error) {
- proc := dll.NewProc(funcName)
- return func(a ...uintptr) (uintptr, uintptr, error) { return proc.Call(a...) }
-}
-
-// Query sends message msg to Pageant and returns response or error.
-// 'msg' is raw agent request with length prefix
-// Response is raw agent response with length prefix
-func query(msg []byte) ([]byte, error) {
- if len(msg) > MaxMessageLen {
- return nil, ErrMessageTooLong
- }
-
- msgLen := binary.BigEndian.Uint32(msg[:4])
- if len(msg) != int(msgLen)+4 {
- return nil, ErrInvalidMessageFormat
- }
-
- lock.Lock()
- defer lock.Unlock()
-
- paWin := pageantWindow()
-
- if paWin == 0 {
- return nil, ErrPageantNotFound
- }
-
- thID, _, _ := winGetCurrentThreadID()
- mapName := fmt.Sprintf("PageantRequest%08x", thID)
- pMapName, _ := syscall.UTF16PtrFromString(mapName)
-
- mmap, err := syscall.CreateFileMapping(syscall.InvalidHandle, nil, syscall.PAGE_READWRITE, 0, MaxMessageLen+4, pMapName)
- if err != nil {
- return nil, err
- }
- defer syscall.CloseHandle(mmap)
-
- ptr, err := syscall.MapViewOfFile(mmap, syscall.FILE_MAP_WRITE, 0, 0, 0)
- if err != nil {
- return nil, err
- }
- defer syscall.UnmapViewOfFile(ptr)
-
- mmSlice := (*(*[MaxMessageLen]byte)(unsafe.Pointer(ptr)))[:]
-
- copy(mmSlice, msg)
-
- mapNameBytesZ := append([]byte(mapName), 0)
-
- cds := copyData{
- dwData: agentCopydataID,
- cbData: uint32(len(mapNameBytesZ)),
- lpData: unsafe.Pointer(&(mapNameBytesZ[0])),
- }
-
- resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(unsafe.Pointer(&cds)))
-
- if resp == 0 {
- return nil, ErrSendMessage
- }
-
- respLen := binary.BigEndian.Uint32(mmSlice[:4])
- if respLen > MaxMessageLen-4 {
- return nil, ErrResponseTooLong
- }
-
- respData := make([]byte, respLen+4)
- copy(respData, mmSlice)
-
- return respData, nil
-}
-
-func pageantWindow() uintptr {
- nameP, _ := syscall.UTF16PtrFromString("Pageant")
- h, _, _ := winFindWindow(uintptr(unsafe.Pointer(nameP)), uintptr(unsafe.Pointer(nameP)))
- return h
-}
diff --git a/vendor/github.com/xanzy/ssh-agent/sshagent.go b/vendor/github.com/xanzy/ssh-agent/sshagent.go
deleted file mode 100644
index 4a4ee30c9..000000000
--- a/vendor/github.com/xanzy/ssh-agent/sshagent.go
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Copyright 2015, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-//go:build !windows
-// +build !windows
-
-package sshagent
-
-import (
- "errors"
- "fmt"
- "net"
- "os"
-
- "golang.org/x/crypto/ssh/agent"
-)
-
-// New returns a new agent.Agent that uses a unix socket
-func New() (agent.Agent, net.Conn, error) {
- if !Available() {
- return nil, nil, errors.New("SSH agent requested but SSH_AUTH_SOCK not-specified")
- }
-
- sshAuthSock := os.Getenv("SSH_AUTH_SOCK")
-
- conn, err := net.Dial("unix", sshAuthSock)
- if err != nil {
- return nil, nil, fmt.Errorf("Error connecting to SSH_AUTH_SOCK: %v", err)
- }
-
- return agent.NewClient(conn), conn, nil
-}
-
-// Available returns true is a auth socket is defined
-func Available() bool {
- return os.Getenv("SSH_AUTH_SOCK") != ""
-}
diff --git a/vendor/github.com/xanzy/ssh-agent/sshagent_windows.go b/vendor/github.com/xanzy/ssh-agent/sshagent_windows.go
deleted file mode 100644
index 175d1619d..000000000
--- a/vendor/github.com/xanzy/ssh-agent/sshagent_windows.go
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-// Copyright (c) 2014 David Mzareulyan
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-// and associated documentation files (the "Software"), to deal in the Software without restriction,
-// including without limitation the rights to use, copy, modify, merge, publish, distribute,
-// sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
-// is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all copies or substantial
-// portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
-// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-//go:build windows
-// +build windows
-
-package sshagent
-
-import (
- "errors"
- "io"
- "net"
- "sync"
-
- "github.com/Microsoft/go-winio"
- "golang.org/x/crypto/ssh/agent"
-)
-
-const (
- sshAgentPipe = `\\.\pipe\openssh-ssh-agent`
-)
-
-// Available returns true if Pageant is running
-func Available() bool {
- if pageantWindow() != 0 {
- return true
- }
- conn, err := winio.DialPipe(sshAgentPipe, nil)
- if err != nil {
- return false
- }
- conn.Close()
- return true
-}
-
-// New returns a new agent.Agent and the (custom) connection it uses
-// to communicate with a running pagent.exe instance (see README.md)
-func New() (agent.Agent, net.Conn, error) {
- if pageantWindow() != 0 {
- return agent.NewClient(&conn{}), nil, nil
- }
- conn, err := winio.DialPipe(sshAgentPipe, nil)
- if err != nil {
- return nil, nil, errors.New(
- "SSH agent requested, but could not detect Pageant or Windows native SSH agent",
- )
- }
- return agent.NewClient(conn), nil, nil
-}
-
-type conn struct {
- sync.Mutex
- buf []byte
-}
-
-func (c *conn) Close() {
- c.Lock()
- defer c.Unlock()
- c.buf = nil
-}
-
-func (c *conn) Write(p []byte) (int, error) {
- c.Lock()
- defer c.Unlock()
-
- resp, err := query(p)
- if err != nil {
- return 0, err
- }
-
- c.buf = append(c.buf, resp...)
-
- return len(p), nil
-}
-
-func (c *conn) Read(p []byte) (int, error) {
- c.Lock()
- defer c.Unlock()
-
- if len(c.buf) == 0 {
- return 0, io.EOF
- }
-
- n := copy(p, c.buf)
- c.buf = c.buf[n:]
-
- return n, nil
-}
diff --git a/vendor/go.uber.org/atomic/.codecov.yml b/vendor/go.uber.org/atomic/.codecov.yml
deleted file mode 100644
index 571116cc3..000000000
--- a/vendor/go.uber.org/atomic/.codecov.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-coverage:
- range: 80..100
- round: down
- precision: 2
-
- status:
- project: # measuring the overall project coverage
- default: # context, you can create multiple ones with custom titles
- enabled: yes # must be yes|true to enable this status
- target: 100 # specify the target coverage for each commit status
- # option: "auto" (must increase from parent commit or pull request base)
- # option: "X%" a static target percentage to hit
- if_not_found: success # if parent is not found report status as success, error, or failure
- if_ci_failed: error # if ci fails report status as success, error, or failure
-
-# Also update COVER_IGNORE_PKGS in the Makefile.
-ignore:
- - /internal/gen-atomicint/
- - /internal/gen-valuewrapper/
diff --git a/vendor/go.uber.org/atomic/.gitignore b/vendor/go.uber.org/atomic/.gitignore
deleted file mode 100644
index 2e337a0ed..000000000
--- a/vendor/go.uber.org/atomic/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-/bin
-.DS_Store
-/vendor
-cover.html
-cover.out
-lint.log
-
-# Binaries
-*.test
-
-# Profiling output
-*.prof
-
-# Output of fossa analyzer
-/fossa
diff --git a/vendor/go.uber.org/atomic/CHANGELOG.md b/vendor/go.uber.org/atomic/CHANGELOG.md
deleted file mode 100644
index 38f564e2b..000000000
--- a/vendor/go.uber.org/atomic/CHANGELOG.md
+++ /dev/null
@@ -1,100 +0,0 @@
-# Changelog
-All notable changes to this project will be documented in this file.
-
-The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
-and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-
-## [1.9.0] - 2021-07-15
-### Added
-- Add `Float64.Swap` to match int atomic operations.
-- Add `atomic.Time` type for atomic operations on `time.Time` values.
-
-[1.9.0]: https://github.com/uber-go/atomic/compare/v1.8.0...v1.9.0
-
-## [1.8.0] - 2021-06-09
-### Added
-- Add `atomic.Uintptr` type for atomic operations on `uintptr` values.
-- Add `atomic.UnsafePointer` type for atomic operations on `unsafe.Pointer` values.
-
-[1.8.0]: https://github.com/uber-go/atomic/compare/v1.7.0...v1.8.0
-
-## [1.7.0] - 2020-09-14
-### Added
-- Support JSON serialization and deserialization of primitive atomic types.
-- Support Text marshalling and unmarshalling for string atomics.
-
-### Changed
-- Disallow incorrect comparison of atomic values in a non-atomic way.
-
-### Removed
-- Remove dependency on `golang.org/x/{lint, tools}`.
-
-[1.7.0]: https://github.com/uber-go/atomic/compare/v1.6.0...v1.7.0
-
-## [1.6.0] - 2020-02-24
-### Changed
-- Drop library dependency on `golang.org/x/{lint, tools}`.
-
-[1.6.0]: https://github.com/uber-go/atomic/compare/v1.5.1...v1.6.0
-
-## [1.5.1] - 2019-11-19
-- Fix bug where `Bool.CAS` and `Bool.Toggle` do work correctly together
- causing `CAS` to fail even though the old value matches.
-
-[1.5.1]: https://github.com/uber-go/atomic/compare/v1.5.0...v1.5.1
-
-## [1.5.0] - 2019-10-29
-### Changed
-- With Go modules, only the `go.uber.org/atomic` import path is supported now.
- If you need to use the old import path, please add a `replace` directive to
- your `go.mod`.
-
-[1.5.0]: https://github.com/uber-go/atomic/compare/v1.4.0...v1.5.0
-
-## [1.4.0] - 2019-05-01
-### Added
- - Add `atomic.Error` type for atomic operations on `error` values.
-
-[1.4.0]: https://github.com/uber-go/atomic/compare/v1.3.2...v1.4.0
-
-## [1.3.2] - 2018-05-02
-### Added
-- Add `atomic.Duration` type for atomic operations on `time.Duration` values.
-
-[1.3.2]: https://github.com/uber-go/atomic/compare/v1.3.1...v1.3.2
-
-## [1.3.1] - 2017-11-14
-### Fixed
-- Revert optimization for `atomic.String.Store("")` which caused data races.
-
-[1.3.1]: https://github.com/uber-go/atomic/compare/v1.3.0...v1.3.1
-
-## [1.3.0] - 2017-11-13
-### Added
-- Add `atomic.Bool.CAS` for compare-and-swap semantics on bools.
-
-### Changed
-- Optimize `atomic.String.Store("")` by avoiding an allocation.
-
-[1.3.0]: https://github.com/uber-go/atomic/compare/v1.2.0...v1.3.0
-
-## [1.2.0] - 2017-04-12
-### Added
-- Shadow `atomic.Value` from `sync/atomic`.
-
-[1.2.0]: https://github.com/uber-go/atomic/compare/v1.1.0...v1.2.0
-
-## [1.1.0] - 2017-03-10
-### Added
-- Add atomic `Float64` type.
-
-### Changed
-- Support new `go.uber.org/atomic` import path.
-
-[1.1.0]: https://github.com/uber-go/atomic/compare/v1.0.0...v1.1.0
-
-## [1.0.0] - 2016-07-18
-
-- Initial release.
-
-[1.0.0]: https://github.com/uber-go/atomic/releases/tag/v1.0.0
diff --git a/vendor/go.uber.org/atomic/LICENSE.txt b/vendor/go.uber.org/atomic/LICENSE.txt
deleted file mode 100644
index 8765c9fbc..000000000
--- a/vendor/go.uber.org/atomic/LICENSE.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2016 Uber Technologies, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/go.uber.org/atomic/Makefile b/vendor/go.uber.org/atomic/Makefile
deleted file mode 100644
index 46c945b32..000000000
--- a/vendor/go.uber.org/atomic/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-# Directory to place `go install`ed binaries into.
-export GOBIN ?= $(shell pwd)/bin
-
-GOLINT = $(GOBIN)/golint
-GEN_ATOMICINT = $(GOBIN)/gen-atomicint
-GEN_ATOMICWRAPPER = $(GOBIN)/gen-atomicwrapper
-STATICCHECK = $(GOBIN)/staticcheck
-
-GO_FILES ?= $(shell find . '(' -path .git -o -path vendor ')' -prune -o -name '*.go' -print)
-
-# Also update ignore section in .codecov.yml.
-COVER_IGNORE_PKGS = \
- go.uber.org/atomic/internal/gen-atomicint \
- go.uber.org/atomic/internal/gen-atomicwrapper
-
-.PHONY: build
-build:
- go build ./...
-
-.PHONY: test
-test:
- go test -race ./...
-
-.PHONY: gofmt
-gofmt:
- $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX))
- gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true
- @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" && cat $(FMT_LOG) && false)
-
-$(GOLINT):
- cd tools && go install golang.org/x/lint/golint
-
-$(STATICCHECK):
- cd tools && go install honnef.co/go/tools/cmd/staticcheck
-
-$(GEN_ATOMICWRAPPER): $(wildcard ./internal/gen-atomicwrapper/*)
- go build -o $@ ./internal/gen-atomicwrapper
-
-$(GEN_ATOMICINT): $(wildcard ./internal/gen-atomicint/*)
- go build -o $@ ./internal/gen-atomicint
-
-.PHONY: golint
-golint: $(GOLINT)
- $(GOLINT) ./...
-
-.PHONY: staticcheck
-staticcheck: $(STATICCHECK)
- $(STATICCHECK) ./...
-
-.PHONY: lint
-lint: gofmt golint staticcheck generatenodirty
-
-# comma separated list of packages to consider for code coverage.
-COVER_PKG = $(shell \
- go list -find ./... | \
- grep -v $(foreach pkg,$(COVER_IGNORE_PKGS),-e "^$(pkg)$$") | \
- paste -sd, -)
-
-.PHONY: cover
-cover:
- go test -coverprofile=cover.out -coverpkg $(COVER_PKG) -v ./...
- go tool cover -html=cover.out -o cover.html
-
-.PHONY: generate
-generate: $(GEN_ATOMICINT) $(GEN_ATOMICWRAPPER)
- go generate ./...
-
-.PHONY: generatenodirty
-generatenodirty:
- @[ -z "$$(git status --porcelain)" ] || ( \
- echo "Working tree is dirty. Commit your changes first."; \
- git status; \
- exit 1 )
- @make generate
- @status=$$(git status --porcelain); \
- [ -z "$$status" ] || ( \
- echo "Working tree is dirty after `make generate`:"; \
- echo "$$status"; \
- echo "Please ensure that the generated code is up-to-date." )
diff --git a/vendor/go.uber.org/atomic/README.md b/vendor/go.uber.org/atomic/README.md
deleted file mode 100644
index 96b47a1f1..000000000
--- a/vendor/go.uber.org/atomic/README.md
+++ /dev/null
@@ -1,63 +0,0 @@
-# atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard]
-
-Simple wrappers for primitive types to enforce atomic access.
-
-## Installation
-
-```shell
-$ go get -u go.uber.org/atomic@v1
-```
-
-### Legacy Import Path
-
-As of v1.5.0, the import path `go.uber.org/atomic` is the only supported way
-of using this package. If you are using Go modules, this package will fail to
-compile with the legacy import path path `github.com/uber-go/atomic`.
-
-We recommend migrating your code to the new import path but if you're unable
-to do so, or if your dependencies are still using the old import path, you
-will have to add a `replace` directive to your `go.mod` file downgrading the
-legacy import path to an older version.
-
-```
-replace github.com/uber-go/atomic => github.com/uber-go/atomic v1.4.0
-```
-
-You can do so automatically by running the following command.
-
-```shell
-$ go mod edit -replace github.com/uber-go/atomic=github.com/uber-go/atomic@v1.4.0
-```
-
-## Usage
-
-The standard library's `sync/atomic` is powerful, but it's easy to forget which
-variables must be accessed atomically. `go.uber.org/atomic` preserves all the
-functionality of the standard library, but wraps the primitive types to
-provide a safer, more convenient API.
-
-```go
-var atom atomic.Uint32
-atom.Store(42)
-atom.Sub(2)
-atom.CAS(40, 11)
-```
-
-See the [documentation][doc] for a complete API specification.
-
-## Development Status
-
-Stable.
-
----
-
-Released under the [MIT License](LICENSE.txt).
-
-[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg
-[doc]: https://godoc.org/go.uber.org/atomic
-[ci-img]: https://github.com/uber-go/atomic/actions/workflows/go.yml/badge.svg
-[ci]: https://github.com/uber-go/atomic/actions/workflows/go.yml
-[cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg
-[cov]: https://codecov.io/gh/uber-go/atomic
-[reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic
-[reportcard]: https://goreportcard.com/report/go.uber.org/atomic
diff --git a/vendor/go.uber.org/atomic/bool.go b/vendor/go.uber.org/atomic/bool.go
deleted file mode 100644
index 209df7bbc..000000000
--- a/vendor/go.uber.org/atomic/bool.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// @generated Code generated by gen-atomicwrapper.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "encoding/json"
-)
-
-// Bool is an atomic type-safe wrapper for bool values.
-type Bool struct {
- _ nocmp // disallow non-atomic comparison
-
- v Uint32
-}
-
-var _zeroBool bool
-
-// NewBool creates a new Bool.
-func NewBool(val bool) *Bool {
- x := &Bool{}
- if val != _zeroBool {
- x.Store(val)
- }
- return x
-}
-
-// Load atomically loads the wrapped bool.
-func (x *Bool) Load() bool {
- return truthy(x.v.Load())
-}
-
-// Store atomically stores the passed bool.
-func (x *Bool) Store(val bool) {
- x.v.Store(boolToInt(val))
-}
-
-// CAS is an atomic compare-and-swap for bool values.
-func (x *Bool) CAS(old, new bool) (swapped bool) {
- return x.v.CAS(boolToInt(old), boolToInt(new))
-}
-
-// Swap atomically stores the given bool and returns the old
-// value.
-func (x *Bool) Swap(val bool) (old bool) {
- return truthy(x.v.Swap(boolToInt(val)))
-}
-
-// MarshalJSON encodes the wrapped bool into JSON.
-func (x *Bool) MarshalJSON() ([]byte, error) {
- return json.Marshal(x.Load())
-}
-
-// UnmarshalJSON decodes a bool from JSON.
-func (x *Bool) UnmarshalJSON(b []byte) error {
- var v bool
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
- x.Store(v)
- return nil
-}
diff --git a/vendor/go.uber.org/atomic/bool_ext.go b/vendor/go.uber.org/atomic/bool_ext.go
deleted file mode 100644
index a2e60e987..000000000
--- a/vendor/go.uber.org/atomic/bool_ext.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "strconv"
-)
-
-//go:generate bin/gen-atomicwrapper -name=Bool -type=bool -wrapped=Uint32 -pack=boolToInt -unpack=truthy -cas -swap -json -file=bool.go
-
-func truthy(n uint32) bool {
- return n == 1
-}
-
-func boolToInt(b bool) uint32 {
- if b {
- return 1
- }
- return 0
-}
-
-// Toggle atomically negates the Boolean and returns the previous value.
-func (b *Bool) Toggle() (old bool) {
- for {
- old := b.Load()
- if b.CAS(old, !old) {
- return old
- }
- }
-}
-
-// String encodes the wrapped value as a string.
-func (b *Bool) String() string {
- return strconv.FormatBool(b.Load())
-}
diff --git a/vendor/go.uber.org/atomic/doc.go b/vendor/go.uber.org/atomic/doc.go
deleted file mode 100644
index ae7390ee6..000000000
--- a/vendor/go.uber.org/atomic/doc.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-// Package atomic provides simple wrappers around numerics to enforce atomic
-// access.
-package atomic
diff --git a/vendor/go.uber.org/atomic/duration.go b/vendor/go.uber.org/atomic/duration.go
deleted file mode 100644
index 207594f5e..000000000
--- a/vendor/go.uber.org/atomic/duration.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// @generated Code generated by gen-atomicwrapper.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "encoding/json"
- "time"
-)
-
-// Duration is an atomic type-safe wrapper for time.Duration values.
-type Duration struct {
- _ nocmp // disallow non-atomic comparison
-
- v Int64
-}
-
-var _zeroDuration time.Duration
-
-// NewDuration creates a new Duration.
-func NewDuration(val time.Duration) *Duration {
- x := &Duration{}
- if val != _zeroDuration {
- x.Store(val)
- }
- return x
-}
-
-// Load atomically loads the wrapped time.Duration.
-func (x *Duration) Load() time.Duration {
- return time.Duration(x.v.Load())
-}
-
-// Store atomically stores the passed time.Duration.
-func (x *Duration) Store(val time.Duration) {
- x.v.Store(int64(val))
-}
-
-// CAS is an atomic compare-and-swap for time.Duration values.
-func (x *Duration) CAS(old, new time.Duration) (swapped bool) {
- return x.v.CAS(int64(old), int64(new))
-}
-
-// Swap atomically stores the given time.Duration and returns the old
-// value.
-func (x *Duration) Swap(val time.Duration) (old time.Duration) {
- return time.Duration(x.v.Swap(int64(val)))
-}
-
-// MarshalJSON encodes the wrapped time.Duration into JSON.
-func (x *Duration) MarshalJSON() ([]byte, error) {
- return json.Marshal(x.Load())
-}
-
-// UnmarshalJSON decodes a time.Duration from JSON.
-func (x *Duration) UnmarshalJSON(b []byte) error {
- var v time.Duration
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
- x.Store(v)
- return nil
-}
diff --git a/vendor/go.uber.org/atomic/duration_ext.go b/vendor/go.uber.org/atomic/duration_ext.go
deleted file mode 100644
index 4c18b0a9e..000000000
--- a/vendor/go.uber.org/atomic/duration_ext.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import "time"
-
-//go:generate bin/gen-atomicwrapper -name=Duration -type=time.Duration -wrapped=Int64 -pack=int64 -unpack=time.Duration -cas -swap -json -imports time -file=duration.go
-
-// Add atomically adds to the wrapped time.Duration and returns the new value.
-func (d *Duration) Add(delta time.Duration) time.Duration {
- return time.Duration(d.v.Add(int64(delta)))
-}
-
-// Sub atomically subtracts from the wrapped time.Duration and returns the new value.
-func (d *Duration) Sub(delta time.Duration) time.Duration {
- return time.Duration(d.v.Sub(int64(delta)))
-}
-
-// String encodes the wrapped value as a string.
-func (d *Duration) String() string {
- return d.Load().String()
-}
diff --git a/vendor/go.uber.org/atomic/error.go b/vendor/go.uber.org/atomic/error.go
deleted file mode 100644
index 3be19c35e..000000000
--- a/vendor/go.uber.org/atomic/error.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// @generated Code generated by gen-atomicwrapper.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-// Error is an atomic type-safe wrapper for error values.
-type Error struct {
- _ nocmp // disallow non-atomic comparison
-
- v Value
-}
-
-var _zeroError error
-
-// NewError creates a new Error.
-func NewError(val error) *Error {
- x := &Error{}
- if val != _zeroError {
- x.Store(val)
- }
- return x
-}
-
-// Load atomically loads the wrapped error.
-func (x *Error) Load() error {
- return unpackError(x.v.Load())
-}
-
-// Store atomically stores the passed error.
-func (x *Error) Store(val error) {
- x.v.Store(packError(val))
-}
diff --git a/vendor/go.uber.org/atomic/error_ext.go b/vendor/go.uber.org/atomic/error_ext.go
deleted file mode 100644
index ffe0be21c..000000000
--- a/vendor/go.uber.org/atomic/error_ext.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-// atomic.Value panics on nil inputs, or if the underlying type changes.
-// Stabilize by always storing a custom struct that we control.
-
-//go:generate bin/gen-atomicwrapper -name=Error -type=error -wrapped=Value -pack=packError -unpack=unpackError -file=error.go
-
-type packedError struct{ Value error }
-
-func packError(v error) interface{} {
- return packedError{v}
-}
-
-func unpackError(v interface{}) error {
- if err, ok := v.(packedError); ok {
- return err.Value
- }
- return nil
-}
diff --git a/vendor/go.uber.org/atomic/float64.go b/vendor/go.uber.org/atomic/float64.go
deleted file mode 100644
index 8a1367184..000000000
--- a/vendor/go.uber.org/atomic/float64.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// @generated Code generated by gen-atomicwrapper.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "encoding/json"
- "math"
-)
-
-// Float64 is an atomic type-safe wrapper for float64 values.
-type Float64 struct {
- _ nocmp // disallow non-atomic comparison
-
- v Uint64
-}
-
-var _zeroFloat64 float64
-
-// NewFloat64 creates a new Float64.
-func NewFloat64(val float64) *Float64 {
- x := &Float64{}
- if val != _zeroFloat64 {
- x.Store(val)
- }
- return x
-}
-
-// Load atomically loads the wrapped float64.
-func (x *Float64) Load() float64 {
- return math.Float64frombits(x.v.Load())
-}
-
-// Store atomically stores the passed float64.
-func (x *Float64) Store(val float64) {
- x.v.Store(math.Float64bits(val))
-}
-
-// Swap atomically stores the given float64 and returns the old
-// value.
-func (x *Float64) Swap(val float64) (old float64) {
- return math.Float64frombits(x.v.Swap(math.Float64bits(val)))
-}
-
-// MarshalJSON encodes the wrapped float64 into JSON.
-func (x *Float64) MarshalJSON() ([]byte, error) {
- return json.Marshal(x.Load())
-}
-
-// UnmarshalJSON decodes a float64 from JSON.
-func (x *Float64) UnmarshalJSON(b []byte) error {
- var v float64
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
- x.Store(v)
- return nil
-}
diff --git a/vendor/go.uber.org/atomic/float64_ext.go b/vendor/go.uber.org/atomic/float64_ext.go
deleted file mode 100644
index df36b0107..000000000
--- a/vendor/go.uber.org/atomic/float64_ext.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "math"
- "strconv"
-)
-
-//go:generate bin/gen-atomicwrapper -name=Float64 -type=float64 -wrapped=Uint64 -pack=math.Float64bits -unpack=math.Float64frombits -swap -json -imports math -file=float64.go
-
-// Add atomically adds to the wrapped float64 and returns the new value.
-func (f *Float64) Add(delta float64) float64 {
- for {
- old := f.Load()
- new := old + delta
- if f.CAS(old, new) {
- return new
- }
- }
-}
-
-// Sub atomically subtracts from the wrapped float64 and returns the new value.
-func (f *Float64) Sub(delta float64) float64 {
- return f.Add(-delta)
-}
-
-// CAS is an atomic compare-and-swap for float64 values.
-//
-// Note: CAS handles NaN incorrectly. NaN != NaN using Go's inbuilt operators
-// but CAS allows a stored NaN to compare equal to a passed in NaN.
-// This avoids typical CAS loops from blocking forever, e.g.,
-//
-// for {
-// old := atom.Load()
-// new = f(old)
-// if atom.CAS(old, new) {
-// break
-// }
-// }
-//
-// If CAS did not match NaN to match, then the above would loop forever.
-func (f *Float64) CAS(old, new float64) (swapped bool) {
- return f.v.CAS(math.Float64bits(old), math.Float64bits(new))
-}
-
-// String encodes the wrapped value as a string.
-func (f *Float64) String() string {
- // 'g' is the behavior for floats with %v.
- return strconv.FormatFloat(f.Load(), 'g', -1, 64)
-}
diff --git a/vendor/go.uber.org/atomic/gen.go b/vendor/go.uber.org/atomic/gen.go
deleted file mode 100644
index 1e9ef4f87..000000000
--- a/vendor/go.uber.org/atomic/gen.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-//go:generate bin/gen-atomicint -name=Int32 -wrapped=int32 -file=int32.go
-//go:generate bin/gen-atomicint -name=Int64 -wrapped=int64 -file=int64.go
-//go:generate bin/gen-atomicint -name=Uint32 -wrapped=uint32 -unsigned -file=uint32.go
-//go:generate bin/gen-atomicint -name=Uint64 -wrapped=uint64 -unsigned -file=uint64.go
-//go:generate bin/gen-atomicint -name=Uintptr -wrapped=uintptr -unsigned -file=uintptr.go
diff --git a/vendor/go.uber.org/atomic/int32.go b/vendor/go.uber.org/atomic/int32.go
deleted file mode 100644
index 640ea36a1..000000000
--- a/vendor/go.uber.org/atomic/int32.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// @generated Code generated by gen-atomicint.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "encoding/json"
- "strconv"
- "sync/atomic"
-)
-
-// Int32 is an atomic wrapper around int32.
-type Int32 struct {
- _ nocmp // disallow non-atomic comparison
-
- v int32
-}
-
-// NewInt32 creates a new Int32.
-func NewInt32(val int32) *Int32 {
- return &Int32{v: val}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Int32) Load() int32 {
- return atomic.LoadInt32(&i.v)
-}
-
-// Add atomically adds to the wrapped int32 and returns the new value.
-func (i *Int32) Add(delta int32) int32 {
- return atomic.AddInt32(&i.v, delta)
-}
-
-// Sub atomically subtracts from the wrapped int32 and returns the new value.
-func (i *Int32) Sub(delta int32) int32 {
- return atomic.AddInt32(&i.v, -delta)
-}
-
-// Inc atomically increments the wrapped int32 and returns the new value.
-func (i *Int32) Inc() int32 {
- return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped int32 and returns the new value.
-func (i *Int32) Dec() int32 {
- return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Int32) CAS(old, new int32) (swapped bool) {
- return atomic.CompareAndSwapInt32(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Int32) Store(val int32) {
- atomic.StoreInt32(&i.v, val)
-}
-
-// Swap atomically swaps the wrapped int32 and returns the old value.
-func (i *Int32) Swap(val int32) (old int32) {
- return atomic.SwapInt32(&i.v, val)
-}
-
-// MarshalJSON encodes the wrapped int32 into JSON.
-func (i *Int32) MarshalJSON() ([]byte, error) {
- return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped int32.
-func (i *Int32) UnmarshalJSON(b []byte) error {
- var v int32
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
- i.Store(v)
- return nil
-}
-
-// String encodes the wrapped value as a string.
-func (i *Int32) String() string {
- v := i.Load()
- return strconv.FormatInt(int64(v), 10)
-}
diff --git a/vendor/go.uber.org/atomic/int64.go b/vendor/go.uber.org/atomic/int64.go
deleted file mode 100644
index 9ab66b980..000000000
--- a/vendor/go.uber.org/atomic/int64.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// @generated Code generated by gen-atomicint.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "encoding/json"
- "strconv"
- "sync/atomic"
-)
-
-// Int64 is an atomic wrapper around int64.
-type Int64 struct {
- _ nocmp // disallow non-atomic comparison
-
- v int64
-}
-
-// NewInt64 creates a new Int64.
-func NewInt64(val int64) *Int64 {
- return &Int64{v: val}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Int64) Load() int64 {
- return atomic.LoadInt64(&i.v)
-}
-
-// Add atomically adds to the wrapped int64 and returns the new value.
-func (i *Int64) Add(delta int64) int64 {
- return atomic.AddInt64(&i.v, delta)
-}
-
-// Sub atomically subtracts from the wrapped int64 and returns the new value.
-func (i *Int64) Sub(delta int64) int64 {
- return atomic.AddInt64(&i.v, -delta)
-}
-
-// Inc atomically increments the wrapped int64 and returns the new value.
-func (i *Int64) Inc() int64 {
- return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped int64 and returns the new value.
-func (i *Int64) Dec() int64 {
- return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Int64) CAS(old, new int64) (swapped bool) {
- return atomic.CompareAndSwapInt64(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Int64) Store(val int64) {
- atomic.StoreInt64(&i.v, val)
-}
-
-// Swap atomically swaps the wrapped int64 and returns the old value.
-func (i *Int64) Swap(val int64) (old int64) {
- return atomic.SwapInt64(&i.v, val)
-}
-
-// MarshalJSON encodes the wrapped int64 into JSON.
-func (i *Int64) MarshalJSON() ([]byte, error) {
- return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped int64.
-func (i *Int64) UnmarshalJSON(b []byte) error {
- var v int64
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
- i.Store(v)
- return nil
-}
-
-// String encodes the wrapped value as a string.
-func (i *Int64) String() string {
- v := i.Load()
- return strconv.FormatInt(int64(v), 10)
-}
diff --git a/vendor/go.uber.org/atomic/nocmp.go b/vendor/go.uber.org/atomic/nocmp.go
deleted file mode 100644
index a8201cb4a..000000000
--- a/vendor/go.uber.org/atomic/nocmp.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-// nocmp is an uncomparable struct. Embed this inside another struct to make
-// it uncomparable.
-//
-// type Foo struct {
-// nocmp
-// // ...
-// }
-//
-// This DOES NOT:
-//
-// - Disallow shallow copies of structs
-// - Disallow comparison of pointers to uncomparable structs
-type nocmp [0]func()
diff --git a/vendor/go.uber.org/atomic/string.go b/vendor/go.uber.org/atomic/string.go
deleted file mode 100644
index 80df93d09..000000000
--- a/vendor/go.uber.org/atomic/string.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// @generated Code generated by gen-atomicwrapper.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-// String is an atomic type-safe wrapper for string values.
-type String struct {
- _ nocmp // disallow non-atomic comparison
-
- v Value
-}
-
-var _zeroString string
-
-// NewString creates a new String.
-func NewString(val string) *String {
- x := &String{}
- if val != _zeroString {
- x.Store(val)
- }
- return x
-}
-
-// Load atomically loads the wrapped string.
-func (x *String) Load() string {
- if v := x.v.Load(); v != nil {
- return v.(string)
- }
- return _zeroString
-}
-
-// Store atomically stores the passed string.
-func (x *String) Store(val string) {
- x.v.Store(val)
-}
diff --git a/vendor/go.uber.org/atomic/string_ext.go b/vendor/go.uber.org/atomic/string_ext.go
deleted file mode 100644
index 83d92edaf..000000000
--- a/vendor/go.uber.org/atomic/string_ext.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-//go:generate bin/gen-atomicwrapper -name=String -type=string -wrapped=Value -file=string.go
-// Note: No Swap as String wraps Value, which wraps the stdlib sync/atomic.Value which
-// only supports Swap as of go1.17: https://github.com/golang/go/issues/39351
-
-// String returns the wrapped value.
-func (s *String) String() string {
- return s.Load()
-}
-
-// MarshalText encodes the wrapped string into a textual form.
-//
-// This makes it encodable as JSON, YAML, XML, and more.
-func (s *String) MarshalText() ([]byte, error) {
- return []byte(s.Load()), nil
-}
-
-// UnmarshalText decodes text and replaces the wrapped string with it.
-//
-// This makes it decodable from JSON, YAML, XML, and more.
-func (s *String) UnmarshalText(b []byte) error {
- s.Store(string(b))
- return nil
-}
diff --git a/vendor/go.uber.org/atomic/time.go b/vendor/go.uber.org/atomic/time.go
deleted file mode 100644
index 33460fc37..000000000
--- a/vendor/go.uber.org/atomic/time.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// @generated Code generated by gen-atomicwrapper.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "time"
-)
-
-// Time is an atomic type-safe wrapper for time.Time values.
-type Time struct {
- _ nocmp // disallow non-atomic comparison
-
- v Value
-}
-
-var _zeroTime time.Time
-
-// NewTime creates a new Time.
-func NewTime(val time.Time) *Time {
- x := &Time{}
- if val != _zeroTime {
- x.Store(val)
- }
- return x
-}
-
-// Load atomically loads the wrapped time.Time.
-func (x *Time) Load() time.Time {
- return unpackTime(x.v.Load())
-}
-
-// Store atomically stores the passed time.Time.
-func (x *Time) Store(val time.Time) {
- x.v.Store(packTime(val))
-}
diff --git a/vendor/go.uber.org/atomic/time_ext.go b/vendor/go.uber.org/atomic/time_ext.go
deleted file mode 100644
index 1e3dc978a..000000000
--- a/vendor/go.uber.org/atomic/time_ext.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import "time"
-
-//go:generate bin/gen-atomicwrapper -name=Time -type=time.Time -wrapped=Value -pack=packTime -unpack=unpackTime -imports time -file=time.go
-
-func packTime(t time.Time) interface{} {
- return t
-}
-
-func unpackTime(v interface{}) time.Time {
- if t, ok := v.(time.Time); ok {
- return t
- }
- return time.Time{}
-}
diff --git a/vendor/go.uber.org/atomic/uint32.go b/vendor/go.uber.org/atomic/uint32.go
deleted file mode 100644
index 7859a9cc3..000000000
--- a/vendor/go.uber.org/atomic/uint32.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// @generated Code generated by gen-atomicint.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "encoding/json"
- "strconv"
- "sync/atomic"
-)
-
-// Uint32 is an atomic wrapper around uint32.
-type Uint32 struct {
- _ nocmp // disallow non-atomic comparison
-
- v uint32
-}
-
-// NewUint32 creates a new Uint32.
-func NewUint32(val uint32) *Uint32 {
- return &Uint32{v: val}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Uint32) Load() uint32 {
- return atomic.LoadUint32(&i.v)
-}
-
-// Add atomically adds to the wrapped uint32 and returns the new value.
-func (i *Uint32) Add(delta uint32) uint32 {
- return atomic.AddUint32(&i.v, delta)
-}
-
-// Sub atomically subtracts from the wrapped uint32 and returns the new value.
-func (i *Uint32) Sub(delta uint32) uint32 {
- return atomic.AddUint32(&i.v, ^(delta - 1))
-}
-
-// Inc atomically increments the wrapped uint32 and returns the new value.
-func (i *Uint32) Inc() uint32 {
- return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped uint32 and returns the new value.
-func (i *Uint32) Dec() uint32 {
- return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Uint32) CAS(old, new uint32) (swapped bool) {
- return atomic.CompareAndSwapUint32(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Uint32) Store(val uint32) {
- atomic.StoreUint32(&i.v, val)
-}
-
-// Swap atomically swaps the wrapped uint32 and returns the old value.
-func (i *Uint32) Swap(val uint32) (old uint32) {
- return atomic.SwapUint32(&i.v, val)
-}
-
-// MarshalJSON encodes the wrapped uint32 into JSON.
-func (i *Uint32) MarshalJSON() ([]byte, error) {
- return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped uint32.
-func (i *Uint32) UnmarshalJSON(b []byte) error {
- var v uint32
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
- i.Store(v)
- return nil
-}
-
-// String encodes the wrapped value as a string.
-func (i *Uint32) String() string {
- v := i.Load()
- return strconv.FormatUint(uint64(v), 10)
-}
diff --git a/vendor/go.uber.org/atomic/uint64.go b/vendor/go.uber.org/atomic/uint64.go
deleted file mode 100644
index 2f2a7db63..000000000
--- a/vendor/go.uber.org/atomic/uint64.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// @generated Code generated by gen-atomicint.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "encoding/json"
- "strconv"
- "sync/atomic"
-)
-
-// Uint64 is an atomic wrapper around uint64.
-type Uint64 struct {
- _ nocmp // disallow non-atomic comparison
-
- v uint64
-}
-
-// NewUint64 creates a new Uint64.
-func NewUint64(val uint64) *Uint64 {
- return &Uint64{v: val}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Uint64) Load() uint64 {
- return atomic.LoadUint64(&i.v)
-}
-
-// Add atomically adds to the wrapped uint64 and returns the new value.
-func (i *Uint64) Add(delta uint64) uint64 {
- return atomic.AddUint64(&i.v, delta)
-}
-
-// Sub atomically subtracts from the wrapped uint64 and returns the new value.
-func (i *Uint64) Sub(delta uint64) uint64 {
- return atomic.AddUint64(&i.v, ^(delta - 1))
-}
-
-// Inc atomically increments the wrapped uint64 and returns the new value.
-func (i *Uint64) Inc() uint64 {
- return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped uint64 and returns the new value.
-func (i *Uint64) Dec() uint64 {
- return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Uint64) CAS(old, new uint64) (swapped bool) {
- return atomic.CompareAndSwapUint64(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Uint64) Store(val uint64) {
- atomic.StoreUint64(&i.v, val)
-}
-
-// Swap atomically swaps the wrapped uint64 and returns the old value.
-func (i *Uint64) Swap(val uint64) (old uint64) {
- return atomic.SwapUint64(&i.v, val)
-}
-
-// MarshalJSON encodes the wrapped uint64 into JSON.
-func (i *Uint64) MarshalJSON() ([]byte, error) {
- return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped uint64.
-func (i *Uint64) UnmarshalJSON(b []byte) error {
- var v uint64
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
- i.Store(v)
- return nil
-}
-
-// String encodes the wrapped value as a string.
-func (i *Uint64) String() string {
- v := i.Load()
- return strconv.FormatUint(uint64(v), 10)
-}
diff --git a/vendor/go.uber.org/atomic/uintptr.go b/vendor/go.uber.org/atomic/uintptr.go
deleted file mode 100644
index ecf7a7727..000000000
--- a/vendor/go.uber.org/atomic/uintptr.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// @generated Code generated by gen-atomicint.
-
-// Copyright (c) 2020-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "encoding/json"
- "strconv"
- "sync/atomic"
-)
-
-// Uintptr is an atomic wrapper around uintptr.
-type Uintptr struct {
- _ nocmp // disallow non-atomic comparison
-
- v uintptr
-}
-
-// NewUintptr creates a new Uintptr.
-func NewUintptr(val uintptr) *Uintptr {
- return &Uintptr{v: val}
-}
-
-// Load atomically loads the wrapped value.
-func (i *Uintptr) Load() uintptr {
- return atomic.LoadUintptr(&i.v)
-}
-
-// Add atomically adds to the wrapped uintptr and returns the new value.
-func (i *Uintptr) Add(delta uintptr) uintptr {
- return atomic.AddUintptr(&i.v, delta)
-}
-
-// Sub atomically subtracts from the wrapped uintptr and returns the new value.
-func (i *Uintptr) Sub(delta uintptr) uintptr {
- return atomic.AddUintptr(&i.v, ^(delta - 1))
-}
-
-// Inc atomically increments the wrapped uintptr and returns the new value.
-func (i *Uintptr) Inc() uintptr {
- return i.Add(1)
-}
-
-// Dec atomically decrements the wrapped uintptr and returns the new value.
-func (i *Uintptr) Dec() uintptr {
- return i.Sub(1)
-}
-
-// CAS is an atomic compare-and-swap.
-func (i *Uintptr) CAS(old, new uintptr) (swapped bool) {
- return atomic.CompareAndSwapUintptr(&i.v, old, new)
-}
-
-// Store atomically stores the passed value.
-func (i *Uintptr) Store(val uintptr) {
- atomic.StoreUintptr(&i.v, val)
-}
-
-// Swap atomically swaps the wrapped uintptr and returns the old value.
-func (i *Uintptr) Swap(val uintptr) (old uintptr) {
- return atomic.SwapUintptr(&i.v, val)
-}
-
-// MarshalJSON encodes the wrapped uintptr into JSON.
-func (i *Uintptr) MarshalJSON() ([]byte, error) {
- return json.Marshal(i.Load())
-}
-
-// UnmarshalJSON decodes JSON into the wrapped uintptr.
-func (i *Uintptr) UnmarshalJSON(b []byte) error {
- var v uintptr
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
- i.Store(v)
- return nil
-}
-
-// String encodes the wrapped value as a string.
-func (i *Uintptr) String() string {
- v := i.Load()
- return strconv.FormatUint(uint64(v), 10)
-}
diff --git a/vendor/go.uber.org/atomic/unsafe_pointer.go b/vendor/go.uber.org/atomic/unsafe_pointer.go
deleted file mode 100644
index 169f793dc..000000000
--- a/vendor/go.uber.org/atomic/unsafe_pointer.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import (
- "sync/atomic"
- "unsafe"
-)
-
-// UnsafePointer is an atomic wrapper around unsafe.Pointer.
-type UnsafePointer struct {
- _ nocmp // disallow non-atomic comparison
-
- v unsafe.Pointer
-}
-
-// NewUnsafePointer creates a new UnsafePointer.
-func NewUnsafePointer(val unsafe.Pointer) *UnsafePointer {
- return &UnsafePointer{v: val}
-}
-
-// Load atomically loads the wrapped value.
-func (p *UnsafePointer) Load() unsafe.Pointer {
- return atomic.LoadPointer(&p.v)
-}
-
-// Store atomically stores the passed value.
-func (p *UnsafePointer) Store(val unsafe.Pointer) {
- atomic.StorePointer(&p.v, val)
-}
-
-// Swap atomically swaps the wrapped unsafe.Pointer and returns the old value.
-func (p *UnsafePointer) Swap(val unsafe.Pointer) (old unsafe.Pointer) {
- return atomic.SwapPointer(&p.v, val)
-}
-
-// CAS is an atomic compare-and-swap.
-func (p *UnsafePointer) CAS(old, new unsafe.Pointer) (swapped bool) {
- return atomic.CompareAndSwapPointer(&p.v, old, new)
-}
diff --git a/vendor/go.uber.org/atomic/value.go b/vendor/go.uber.org/atomic/value.go
deleted file mode 100644
index 671f3a382..000000000
--- a/vendor/go.uber.org/atomic/value.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2020 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-package atomic
-
-import "sync/atomic"
-
-// Value shadows the type of the same name from sync/atomic
-// https://godoc.org/sync/atomic#Value
-type Value struct {
- atomic.Value
-
- _ nocmp // disallow non-atomic comparison
-}
diff --git a/vendor/go.uber.org/multierr/.codecov.yml b/vendor/go.uber.org/multierr/.codecov.yml
deleted file mode 100644
index 6d4d1be7b..000000000
--- a/vendor/go.uber.org/multierr/.codecov.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-coverage:
- range: 80..100
- round: down
- precision: 2
-
- status:
- project: # measuring the overall project coverage
- default: # context, you can create multiple ones with custom titles
- enabled: yes # must be yes|true to enable this status
- target: 100 # specify the target coverage for each commit status
- # option: "auto" (must increase from parent commit or pull request base)
- # option: "X%" a static target percentage to hit
- if_not_found: success # if parent is not found report status as success, error, or failure
- if_ci_failed: error # if ci fails report status as success, error, or failure
-
diff --git a/vendor/go.uber.org/multierr/.gitignore b/vendor/go.uber.org/multierr/.gitignore
deleted file mode 100644
index b9a05e3da..000000000
--- a/vendor/go.uber.org/multierr/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/vendor
-cover.html
-cover.out
-/bin
diff --git a/vendor/go.uber.org/multierr/CHANGELOG.md b/vendor/go.uber.org/multierr/CHANGELOG.md
deleted file mode 100644
index d2c8aadaf..000000000
--- a/vendor/go.uber.org/multierr/CHANGELOG.md
+++ /dev/null
@@ -1,80 +0,0 @@
-Releases
-========
-
-v1.9.0 (2022-12-12)
-===================
-
-- Add `AppendFunc` that allow passsing functions to similar to
- `AppendInvoke`.
-
-- Bump up yaml.v3 dependency to 3.0.1.
-
-v1.8.0 (2022-02-28)
-===================
-
-- `Combine`: perform zero allocations when there are no errors.
-
-
-v1.7.0 (2021-05-06)
-===================
-
-- Add `AppendInvoke` to append into errors from `defer` blocks.
-
-
-v1.6.0 (2020-09-14)
-===================
-
-- Actually drop library dependency on development-time tooling.
-
-
-v1.5.0 (2020-02-24)
-===================
-
-- Drop library dependency on development-time tooling.
-
-
-v1.4.0 (2019-11-04)
-===================
-
-- Add `AppendInto` function to more ergonomically build errors inside a
- loop.
-
-
-v1.3.0 (2019-10-29)
-===================
-
-- Switch to Go modules.
-
-
-v1.2.0 (2019-09-26)
-===================
-
-- Support extracting and matching against wrapped errors with `errors.As`
- and `errors.Is`.
-
-
-v1.1.0 (2017-06-30)
-===================
-
-- Added an `Errors(error) []error` function to extract the underlying list of
- errors for a multierr error.
-
-
-v1.0.0 (2017-05-31)
-===================
-
-No changes since v0.2.0. This release is committing to making no breaking
-changes to the current API in the 1.X series.
-
-
-v0.2.0 (2017-04-11)
-===================
-
-- Repeatedly appending to the same error is now faster due to fewer
- allocations.
-
-
-v0.1.0 (2017-31-03)
-===================
-
-- Initial release
diff --git a/vendor/go.uber.org/multierr/LICENSE.txt b/vendor/go.uber.org/multierr/LICENSE.txt
deleted file mode 100644
index 413e30f7c..000000000
--- a/vendor/go.uber.org/multierr/LICENSE.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2017-2021 Uber Technologies, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/go.uber.org/multierr/Makefile b/vendor/go.uber.org/multierr/Makefile
deleted file mode 100644
index dcb6fe723..000000000
--- a/vendor/go.uber.org/multierr/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# Directory to put `go install`ed binaries in.
-export GOBIN ?= $(shell pwd)/bin
-
-GO_FILES := $(shell \
- find . '(' -path '*/.*' -o -path './vendor' ')' -prune \
- -o -name '*.go' -print | cut -b3-)
-
-.PHONY: build
-build:
- go build ./...
-
-.PHONY: test
-test:
- go test -race ./...
-
-.PHONY: gofmt
-gofmt:
- $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX))
- @gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true
- @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" | cat - $(FMT_LOG) && false)
-
-.PHONY: golint
-golint:
- @cd tools && go install golang.org/x/lint/golint
- @$(GOBIN)/golint ./...
-
-.PHONY: staticcheck
-staticcheck:
- @cd tools && go install honnef.co/go/tools/cmd/staticcheck
- @$(GOBIN)/staticcheck ./...
-
-.PHONY: lint
-lint: gofmt golint staticcheck
-
-.PHONY: cover
-cover:
- go test -race -coverprofile=cover.out -coverpkg=./... -v ./...
- go tool cover -html=cover.out -o cover.html
diff --git a/vendor/go.uber.org/multierr/README.md b/vendor/go.uber.org/multierr/README.md
deleted file mode 100644
index 70aacecd7..000000000
--- a/vendor/go.uber.org/multierr/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# multierr [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
-
-`multierr` allows combining one or more Go `error`s together.
-
-## Installation
-
- go get -u go.uber.org/multierr
-
-## Status
-
-Stable: No breaking changes will be made before 2.0.
-
--------------------------------------------------------------------------------
-
-Released under the [MIT License].
-
-[MIT License]: LICENSE.txt
-[doc-img]: https://pkg.go.dev/badge/go.uber.org/multierr
-[doc]: https://pkg.go.dev/go.uber.org/multierr
-[ci-img]: https://github.com/uber-go/multierr/actions/workflows/go.yml/badge.svg
-[cov-img]: https://codecov.io/gh/uber-go/multierr/branch/master/graph/badge.svg
-[ci]: https://github.com/uber-go/multierr/actions/workflows/go.yml
-[cov]: https://codecov.io/gh/uber-go/multierr
diff --git a/vendor/go.uber.org/multierr/error.go b/vendor/go.uber.org/multierr/error.go
deleted file mode 100644
index cdd91ae56..000000000
--- a/vendor/go.uber.org/multierr/error.go
+++ /dev/null
@@ -1,681 +0,0 @@
-// Copyright (c) 2017-2021 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-// Package multierr allows combining one or more errors together.
-//
-// # Overview
-//
-// Errors can be combined with the use of the Combine function.
-//
-// multierr.Combine(
-// reader.Close(),
-// writer.Close(),
-// conn.Close(),
-// )
-//
-// If only two errors are being combined, the Append function may be used
-// instead.
-//
-// err = multierr.Append(reader.Close(), writer.Close())
-//
-// The underlying list of errors for a returned error object may be retrieved
-// with the Errors function.
-//
-// errors := multierr.Errors(err)
-// if len(errors) > 0 {
-// fmt.Println("The following errors occurred:", errors)
-// }
-//
-// # Appending from a loop
-//
-// You sometimes need to append into an error from a loop.
-//
-// var err error
-// for _, item := range items {
-// err = multierr.Append(err, process(item))
-// }
-//
-// Cases like this may require knowledge of whether an individual instance
-// failed. This usually requires introduction of a new variable.
-//
-// var err error
-// for _, item := range items {
-// if perr := process(item); perr != nil {
-// log.Warn("skipping item", item)
-// err = multierr.Append(err, perr)
-// }
-// }
-//
-// multierr includes AppendInto to simplify cases like this.
-//
-// var err error
-// for _, item := range items {
-// if multierr.AppendInto(&err, process(item)) {
-// log.Warn("skipping item", item)
-// }
-// }
-//
-// This will append the error into the err variable, and return true if that
-// individual error was non-nil.
-//
-// See [AppendInto] for more information.
-//
-// # Deferred Functions
-//
-// Go makes it possible to modify the return value of a function in a defer
-// block if the function was using named returns. This makes it possible to
-// record resource cleanup failures from deferred blocks.
-//
-// func sendRequest(req Request) (err error) {
-// conn, err := openConnection()
-// if err != nil {
-// return err
-// }
-// defer func() {
-// err = multierr.Append(err, conn.Close())
-// }()
-// // ...
-// }
-//
-// multierr provides the Invoker type and AppendInvoke function to make cases
-// like the above simpler and obviate the need for a closure. The following is
-// roughly equivalent to the example above.
-//
-// func sendRequest(req Request) (err error) {
-// conn, err := openConnection()
-// if err != nil {
-// return err
-// }
-// defer multierr.AppendInvoke(&err, multierr.Close(conn))
-// // ...
-// }
-//
-// See [AppendInvoke] and [Invoker] for more information.
-//
-// NOTE: If you're modifying an error from inside a defer, you MUST use a named
-// return value for that function.
-//
-// # Advanced Usage
-//
-// Errors returned by Combine and Append MAY implement the following
-// interface.
-//
-// type errorGroup interface {
-// // Returns a slice containing the underlying list of errors.
-// //
-// // This slice MUST NOT be modified by the caller.
-// Errors() []error
-// }
-//
-// Note that if you need access to list of errors behind a multierr error, you
-// should prefer using the Errors function. That said, if you need cheap
-// read-only access to the underlying errors slice, you can attempt to cast
-// the error to this interface. You MUST handle the failure case gracefully
-// because errors returned by Combine and Append are not guaranteed to
-// implement this interface.
-//
-// var errors []error
-// group, ok := err.(errorGroup)
-// if ok {
-// errors = group.Errors()
-// } else {
-// errors = []error{err}
-// }
-package multierr // import "go.uber.org/multierr"
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "strings"
- "sync"
-
- "go.uber.org/atomic"
-)
-
-var (
- // Separator for single-line error messages.
- _singlelineSeparator = []byte("; ")
-
- // Prefix for multi-line messages
- _multilinePrefix = []byte("the following errors occurred:")
-
- // Prefix for the first and following lines of an item in a list of
- // multi-line error messages.
- //
- // For example, if a single item is:
- //
- // foo
- // bar
- //
- // It will become,
- //
- // - foo
- // bar
- _multilineSeparator = []byte("\n - ")
- _multilineIndent = []byte(" ")
-)
-
-// _bufferPool is a pool of bytes.Buffers.
-var _bufferPool = sync.Pool{
- New: func() interface{} {
- return &bytes.Buffer{}
- },
-}
-
-type errorGroup interface {
- Errors() []error
-}
-
-// Errors returns a slice containing zero or more errors that the supplied
-// error is composed of. If the error is nil, a nil slice is returned.
-//
-// err := multierr.Append(r.Close(), w.Close())
-// errors := multierr.Errors(err)
-//
-// If the error is not composed of other errors, the returned slice contains
-// just the error that was passed in.
-//
-// Callers of this function are free to modify the returned slice.
-func Errors(err error) []error {
- if err == nil {
- return nil
- }
-
- // Note that we're casting to multiError, not errorGroup. Our contract is
- // that returned errors MAY implement errorGroup. Errors, however, only
- // has special behavior for multierr-specific error objects.
- //
- // This behavior can be expanded in the future but I think it's prudent to
- // start with as little as possible in terms of contract and possibility
- // of misuse.
- eg, ok := err.(*multiError)
- if !ok {
- return []error{err}
- }
-
- return append(([]error)(nil), eg.Errors()...)
-}
-
-// multiError is an error that holds one or more errors.
-//
-// An instance of this is guaranteed to be non-empty and flattened. That is,
-// none of the errors inside multiError are other multiErrors.
-//
-// multiError formats to a semi-colon delimited list of error messages with
-// %v and with a more readable multi-line format with %+v.
-type multiError struct {
- copyNeeded atomic.Bool
- errors []error
-}
-
-var _ errorGroup = (*multiError)(nil)
-
-// Errors returns the list of underlying errors.
-//
-// This slice MUST NOT be modified.
-func (merr *multiError) Errors() []error {
- if merr == nil {
- return nil
- }
- return merr.errors
-}
-
-// As attempts to find the first error in the error list that matches the type
-// of the value that target points to.
-//
-// This function allows errors.As to traverse the values stored on the
-// multierr error.
-func (merr *multiError) As(target interface{}) bool {
- for _, err := range merr.Errors() {
- if errors.As(err, target) {
- return true
- }
- }
- return false
-}
-
-// Is attempts to match the provided error against errors in the error list.
-//
-// This function allows errors.Is to traverse the values stored on the
-// multierr error.
-func (merr *multiError) Is(target error) bool {
- for _, err := range merr.Errors() {
- if errors.Is(err, target) {
- return true
- }
- }
- return false
-}
-
-func (merr *multiError) Error() string {
- if merr == nil {
- return ""
- }
-
- buff := _bufferPool.Get().(*bytes.Buffer)
- buff.Reset()
-
- merr.writeSingleline(buff)
-
- result := buff.String()
- _bufferPool.Put(buff)
- return result
-}
-
-func (merr *multiError) Format(f fmt.State, c rune) {
- if c == 'v' && f.Flag('+') {
- merr.writeMultiline(f)
- } else {
- merr.writeSingleline(f)
- }
-}
-
-func (merr *multiError) writeSingleline(w io.Writer) {
- first := true
- for _, item := range merr.errors {
- if first {
- first = false
- } else {
- w.Write(_singlelineSeparator)
- }
- io.WriteString(w, item.Error())
- }
-}
-
-func (merr *multiError) writeMultiline(w io.Writer) {
- w.Write(_multilinePrefix)
- for _, item := range merr.errors {
- w.Write(_multilineSeparator)
- writePrefixLine(w, _multilineIndent, fmt.Sprintf("%+v", item))
- }
-}
-
-// Writes s to the writer with the given prefix added before each line after
-// the first.
-func writePrefixLine(w io.Writer, prefix []byte, s string) {
- first := true
- for len(s) > 0 {
- if first {
- first = false
- } else {
- w.Write(prefix)
- }
-
- idx := strings.IndexByte(s, '\n')
- if idx < 0 {
- idx = len(s) - 1
- }
-
- io.WriteString(w, s[:idx+1])
- s = s[idx+1:]
- }
-}
-
-type inspectResult struct {
- // Number of top-level non-nil errors
- Count int
-
- // Total number of errors including multiErrors
- Capacity int
-
- // Index of the first non-nil error in the list. Value is meaningless if
- // Count is zero.
- FirstErrorIdx int
-
- // Whether the list contains at least one multiError
- ContainsMultiError bool
-}
-
-// Inspects the given slice of errors so that we can efficiently allocate
-// space for it.
-func inspect(errors []error) (res inspectResult) {
- first := true
- for i, err := range errors {
- if err == nil {
- continue
- }
-
- res.Count++
- if first {
- first = false
- res.FirstErrorIdx = i
- }
-
- if merr, ok := err.(*multiError); ok {
- res.Capacity += len(merr.errors)
- res.ContainsMultiError = true
- } else {
- res.Capacity++
- }
- }
- return
-}
-
-// fromSlice converts the given list of errors into a single error.
-func fromSlice(errors []error) error {
- // Don't pay to inspect small slices.
- switch len(errors) {
- case 0:
- return nil
- case 1:
- return errors[0]
- }
-
- res := inspect(errors)
- switch res.Count {
- case 0:
- return nil
- case 1:
- // only one non-nil entry
- return errors[res.FirstErrorIdx]
- case len(errors):
- if !res.ContainsMultiError {
- // Error list is flat. Make a copy of it
- // Otherwise "errors" escapes to the heap
- // unconditionally for all other cases.
- // This lets us optimize for the "no errors" case.
- out := append(([]error)(nil), errors...)
- return &multiError{errors: out}
- }
- }
-
- nonNilErrs := make([]error, 0, res.Capacity)
- for _, err := range errors[res.FirstErrorIdx:] {
- if err == nil {
- continue
- }
-
- if nested, ok := err.(*multiError); ok {
- nonNilErrs = append(nonNilErrs, nested.errors...)
- } else {
- nonNilErrs = append(nonNilErrs, err)
- }
- }
-
- return &multiError{errors: nonNilErrs}
-}
-
-// Combine combines the passed errors into a single error.
-//
-// If zero arguments were passed or if all items are nil, a nil error is
-// returned.
-//
-// Combine(nil, nil) // == nil
-//
-// If only a single error was passed, it is returned as-is.
-//
-// Combine(err) // == err
-//
-// Combine skips over nil arguments so this function may be used to combine
-// together errors from operations that fail independently of each other.
-//
-// multierr.Combine(
-// reader.Close(),
-// writer.Close(),
-// pipe.Close(),
-// )
-//
-// If any of the passed errors is a multierr error, it will be flattened along
-// with the other errors.
-//
-// multierr.Combine(multierr.Combine(err1, err2), err3)
-// // is the same as
-// multierr.Combine(err1, err2, err3)
-//
-// The returned error formats into a readable multi-line error message if
-// formatted with %+v.
-//
-// fmt.Sprintf("%+v", multierr.Combine(err1, err2))
-func Combine(errors ...error) error {
- return fromSlice(errors)
-}
-
-// Append appends the given errors together. Either value may be nil.
-//
-// This function is a specialization of Combine for the common case where
-// there are only two errors.
-//
-// err = multierr.Append(reader.Close(), writer.Close())
-//
-// The following pattern may also be used to record failure of deferred
-// operations without losing information about the original error.
-//
-// func doSomething(..) (err error) {
-// f := acquireResource()
-// defer func() {
-// err = multierr.Append(err, f.Close())
-// }()
-//
-// Note that the variable MUST be a named return to append an error to it from
-// the defer statement. See also [AppendInvoke].
-func Append(left error, right error) error {
- switch {
- case left == nil:
- return right
- case right == nil:
- return left
- }
-
- if _, ok := right.(*multiError); !ok {
- if l, ok := left.(*multiError); ok && !l.copyNeeded.Swap(true) {
- // Common case where the error on the left is constantly being
- // appended to.
- errs := append(l.errors, right)
- return &multiError{errors: errs}
- } else if !ok {
- // Both errors are single errors.
- return &multiError{errors: []error{left, right}}
- }
- }
-
- // Either right or both, left and right, are multiErrors. Rely on usual
- // expensive logic.
- errors := [2]error{left, right}
- return fromSlice(errors[0:])
-}
-
-// AppendInto appends an error into the destination of an error pointer and
-// returns whether the error being appended was non-nil.
-//
-// var err error
-// multierr.AppendInto(&err, r.Close())
-// multierr.AppendInto(&err, w.Close())
-//
-// The above is equivalent to,
-//
-// err := multierr.Append(r.Close(), w.Close())
-//
-// As AppendInto reports whether the provided error was non-nil, it may be
-// used to build a multierr error in a loop more ergonomically. For example:
-//
-// var err error
-// for line := range lines {
-// var item Item
-// if multierr.AppendInto(&err, parse(line, &item)) {
-// continue
-// }
-// items = append(items, item)
-// }
-//
-// Compare this with a version that relies solely on Append:
-//
-// var err error
-// for line := range lines {
-// var item Item
-// if parseErr := parse(line, &item); parseErr != nil {
-// err = multierr.Append(err, parseErr)
-// continue
-// }
-// items = append(items, item)
-// }
-func AppendInto(into *error, err error) (errored bool) {
- if into == nil {
- // We panic if 'into' is nil. This is not documented above
- // because suggesting that the pointer must be non-nil may
- // confuse users into thinking that the error that it points
- // to must be non-nil.
- panic("misuse of multierr.AppendInto: into pointer must not be nil")
- }
-
- if err == nil {
- return false
- }
- *into = Append(*into, err)
- return true
-}
-
-// Invoker is an operation that may fail with an error. Use it with
-// AppendInvoke to append the result of calling the function into an error.
-// This allows you to conveniently defer capture of failing operations.
-//
-// See also, [Close] and [Invoke].
-type Invoker interface {
- Invoke() error
-}
-
-// Invoke wraps a function which may fail with an error to match the Invoker
-// interface. Use it to supply functions matching this signature to
-// AppendInvoke.
-//
-// For example,
-//
-// func processReader(r io.Reader) (err error) {
-// scanner := bufio.NewScanner(r)
-// defer multierr.AppendInvoke(&err, multierr.Invoke(scanner.Err))
-// for scanner.Scan() {
-// // ...
-// }
-// // ...
-// }
-//
-// In this example, the following line will construct the Invoker right away,
-// but defer the invocation of scanner.Err() until the function returns.
-//
-// defer multierr.AppendInvoke(&err, multierr.Invoke(scanner.Err))
-//
-// Note that the error you're appending to from the defer statement MUST be a
-// named return.
-type Invoke func() error
-
-// Invoke calls the supplied function and returns its result.
-func (i Invoke) Invoke() error { return i() }
-
-// Close builds an Invoker that closes the provided io.Closer. Use it with
-// AppendInvoke to close io.Closers and append their results into an error.
-//
-// For example,
-//
-// func processFile(path string) (err error) {
-// f, err := os.Open(path)
-// if err != nil {
-// return err
-// }
-// defer multierr.AppendInvoke(&err, multierr.Close(f))
-// return processReader(f)
-// }
-//
-// In this example, multierr.Close will construct the Invoker right away, but
-// defer the invocation of f.Close until the function returns.
-//
-// defer multierr.AppendInvoke(&err, multierr.Close(f))
-//
-// Note that the error you're appending to from the defer statement MUST be a
-// named return.
-func Close(closer io.Closer) Invoker {
- return Invoke(closer.Close)
-}
-
-// AppendInvoke appends the result of calling the given Invoker into the
-// provided error pointer. Use it with named returns to safely defer
-// invocation of fallible operations until a function returns, and capture the
-// resulting errors.
-//
-// func doSomething(...) (err error) {
-// // ...
-// f, err := openFile(..)
-// if err != nil {
-// return err
-// }
-//
-// // multierr will call f.Close() when this function returns and
-// // if the operation fails, its append its error into the
-// // returned error.
-// defer multierr.AppendInvoke(&err, multierr.Close(f))
-//
-// scanner := bufio.NewScanner(f)
-// // Similarly, this scheduled scanner.Err to be called and
-// // inspected when the function returns and append its error
-// // into the returned error.
-// defer multierr.AppendInvoke(&err, multierr.Invoke(scanner.Err))
-//
-// // ...
-// }
-//
-// NOTE: If used with a defer, the error variable MUST be a named return.
-//
-// Without defer, AppendInvoke behaves exactly like AppendInto.
-//
-// err := // ...
-// multierr.AppendInvoke(&err, mutltierr.Invoke(foo))
-//
-// // ...is roughly equivalent to...
-//
-// err := // ...
-// multierr.AppendInto(&err, foo())
-//
-// The advantage of the indirection introduced by Invoker is to make it easy
-// to defer the invocation of a function. Without this indirection, the
-// invoked function will be evaluated at the time of the defer block rather
-// than when the function returns.
-//
-// // BAD: This is likely not what the caller intended. This will evaluate
-// // foo() right away and append its result into the error when the
-// // function returns.
-// defer multierr.AppendInto(&err, foo())
-//
-// // GOOD: This will defer invocation of foo unutil the function returns.
-// defer multierr.AppendInvoke(&err, multierr.Invoke(foo))
-//
-// multierr provides a few Invoker implementations out of the box for
-// convenience. See [Invoker] for more information.
-func AppendInvoke(into *error, invoker Invoker) {
- AppendInto(into, invoker.Invoke())
-}
-
-// AppendFunc is a shorthand for [AppendInvoke].
-// It allows using function or method value directly
-// without having to wrap it into an [Invoker] interface.
-//
-// func doSomething(...) (err error) {
-// w, err := startWorker(...)
-// if err != nil {
-// return err
-// }
-//
-// // multierr will call w.Stop() when this function returns and
-// // if the operation fails, it appends its error into the
-// // returned error.
-// defer multierr.AppendFunc(&err, w.Stop)
-// }
-func AppendFunc(into *error, fn func() error) {
- AppendInvoke(into, Invoke(fn))
-}
diff --git a/vendor/go.uber.org/multierr/glide.yaml b/vendor/go.uber.org/multierr/glide.yaml
deleted file mode 100644
index 6ef084ec2..000000000
--- a/vendor/go.uber.org/multierr/glide.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-package: go.uber.org/multierr
-import:
-- package: go.uber.org/atomic
- version: ^1
-testImport:
-- package: github.com/stretchr/testify
- subpackages:
- - assert
diff --git a/vendor/golang.org/x/crypto/LICENSE b/vendor/golang.org/x/crypto/LICENSE
deleted file mode 100644
index 2a7cf70da..000000000
--- a/vendor/golang.org/x/crypto/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright 2009 The Go Authors.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google LLC nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/crypto/PATENTS b/vendor/golang.org/x/crypto/PATENTS
deleted file mode 100644
index 733099041..000000000
--- a/vendor/golang.org/x/crypto/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/crypto/argon2/argon2.go b/vendor/golang.org/x/crypto/argon2/argon2.go
deleted file mode 100644
index 29f0a2de4..000000000
--- a/vendor/golang.org/x/crypto/argon2/argon2.go
+++ /dev/null
@@ -1,283 +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 argon2 implements the key derivation function Argon2.
-// Argon2 was selected as the winner of the Password Hashing Competition and can
-// be used to derive cryptographic keys from passwords.
-//
-// For a detailed specification of Argon2 see [1].
-//
-// If you aren't sure which function you need, use Argon2id (IDKey) and
-// the parameter recommendations for your scenario.
-//
-// # Argon2i
-//
-// Argon2i (implemented by Key) is the side-channel resistant version of Argon2.
-// It uses data-independent memory access, which is preferred for password
-// hashing and password-based key derivation. Argon2i requires more passes over
-// memory than Argon2id to protect from trade-off attacks. The recommended
-// parameters (taken from [2]) for non-interactive operations are time=3 and to
-// use the maximum available memory.
-//
-// # Argon2id
-//
-// Argon2id (implemented by IDKey) is a hybrid version of Argon2 combining
-// Argon2i and Argon2d. It uses data-independent memory access for the first
-// half of the first iteration over the memory and data-dependent memory access
-// for the rest. Argon2id is side-channel resistant and provides better brute-
-// force cost savings due to time-memory tradeoffs than Argon2i. The recommended
-// parameters for non-interactive operations (taken from [2]) are time=1 and to
-// use the maximum available memory.
-//
-// [1] https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf
-// [2] https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03#section-9.3
-package argon2
-
-import (
- "encoding/binary"
- "sync"
-
- "golang.org/x/crypto/blake2b"
-)
-
-// The Argon2 version implemented by this package.
-const Version = 0x13
-
-const (
- argon2d = iota
- argon2i
- argon2id
-)
-
-// Key derives a key from the password, salt, and cost parameters using Argon2i
-// returning a byte slice of length keyLen that can be used as cryptographic
-// key. The CPU cost and parallelism degree must be greater than zero.
-//
-// For example, you can get a derived key for e.g. AES-256 (which needs a
-// 32-byte key) by doing:
-//
-// key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32)
-//
-// The draft RFC recommends[2] time=3, and memory=32*1024 is a sensible number.
-// If using that amount of memory (32 MB) is not possible in some contexts then
-// the time parameter can be increased to compensate.
-//
-// The time parameter specifies the number of passes over the memory and the
-// memory parameter specifies the size of the memory in KiB. For example
-// memory=32*1024 sets the memory cost to ~32 MB. The number of threads can be
-// adjusted to the number of available CPUs. The cost parameters should be
-// increased as memory latency and CPU parallelism increases. Remember to get a
-// good random salt.
-func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
- return deriveKey(argon2i, password, salt, nil, nil, time, memory, threads, keyLen)
-}
-
-// IDKey derives a key from the password, salt, and cost parameters using
-// Argon2id returning a byte slice of length keyLen that can be used as
-// cryptographic key. The CPU cost and parallelism degree must be greater than
-// zero.
-//
-// For example, you can get a derived key for e.g. AES-256 (which needs a
-// 32-byte key) by doing:
-//
-// key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32)
-//
-// The draft RFC recommends[2] time=1, and memory=64*1024 is a sensible number.
-// If using that amount of memory (64 MB) is not possible in some contexts then
-// the time parameter can be increased to compensate.
-//
-// The time parameter specifies the number of passes over the memory and the
-// memory parameter specifies the size of the memory in KiB. For example
-// memory=64*1024 sets the memory cost to ~64 MB. The number of threads can be
-// adjusted to the numbers of available CPUs. The cost parameters should be
-// increased as memory latency and CPU parallelism increases. Remember to get a
-// good random salt.
-func IDKey(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
- return deriveKey(argon2id, password, salt, nil, nil, time, memory, threads, keyLen)
-}
-
-func deriveKey(mode int, password, salt, secret, data []byte, time, memory uint32, threads uint8, keyLen uint32) []byte {
- if time < 1 {
- panic("argon2: number of rounds too small")
- }
- if threads < 1 {
- panic("argon2: parallelism degree too low")
- }
- h0 := initHash(password, salt, secret, data, time, memory, uint32(threads), keyLen, mode)
-
- memory = memory / (syncPoints * uint32(threads)) * (syncPoints * uint32(threads))
- if memory < 2*syncPoints*uint32(threads) {
- memory = 2 * syncPoints * uint32(threads)
- }
- B := initBlocks(&h0, memory, uint32(threads))
- processBlocks(B, time, memory, uint32(threads), mode)
- return extractKey(B, memory, uint32(threads), keyLen)
-}
-
-const (
- blockLength = 128
- syncPoints = 4
-)
-
-type block [blockLength]uint64
-
-func initHash(password, salt, key, data []byte, time, memory, threads, keyLen uint32, mode int) [blake2b.Size + 8]byte {
- var (
- h0 [blake2b.Size + 8]byte
- params [24]byte
- tmp [4]byte
- )
-
- b2, _ := blake2b.New512(nil)
- binary.LittleEndian.PutUint32(params[0:4], threads)
- binary.LittleEndian.PutUint32(params[4:8], keyLen)
- binary.LittleEndian.PutUint32(params[8:12], memory)
- binary.LittleEndian.PutUint32(params[12:16], time)
- binary.LittleEndian.PutUint32(params[16:20], uint32(Version))
- binary.LittleEndian.PutUint32(params[20:24], uint32(mode))
- b2.Write(params[:])
- binary.LittleEndian.PutUint32(tmp[:], uint32(len(password)))
- b2.Write(tmp[:])
- b2.Write(password)
- binary.LittleEndian.PutUint32(tmp[:], uint32(len(salt)))
- b2.Write(tmp[:])
- b2.Write(salt)
- binary.LittleEndian.PutUint32(tmp[:], uint32(len(key)))
- b2.Write(tmp[:])
- b2.Write(key)
- binary.LittleEndian.PutUint32(tmp[:], uint32(len(data)))
- b2.Write(tmp[:])
- b2.Write(data)
- b2.Sum(h0[:0])
- return h0
-}
-
-func initBlocks(h0 *[blake2b.Size + 8]byte, memory, threads uint32) []block {
- var block0 [1024]byte
- B := make([]block, memory)
- for lane := uint32(0); lane < threads; lane++ {
- j := lane * (memory / threads)
- binary.LittleEndian.PutUint32(h0[blake2b.Size+4:], lane)
-
- binary.LittleEndian.PutUint32(h0[blake2b.Size:], 0)
- blake2bHash(block0[:], h0[:])
- for i := range B[j+0] {
- B[j+0][i] = binary.LittleEndian.Uint64(block0[i*8:])
- }
-
- binary.LittleEndian.PutUint32(h0[blake2b.Size:], 1)
- blake2bHash(block0[:], h0[:])
- for i := range B[j+1] {
- B[j+1][i] = binary.LittleEndian.Uint64(block0[i*8:])
- }
- }
- return B
-}
-
-func processBlocks(B []block, time, memory, threads uint32, mode int) {
- lanes := memory / threads
- segments := lanes / syncPoints
-
- processSegment := func(n, slice, lane uint32, wg *sync.WaitGroup) {
- var addresses, in, zero block
- if mode == argon2i || (mode == argon2id && n == 0 && slice < syncPoints/2) {
- in[0] = uint64(n)
- in[1] = uint64(lane)
- in[2] = uint64(slice)
- in[3] = uint64(memory)
- in[4] = uint64(time)
- in[5] = uint64(mode)
- }
-
- index := uint32(0)
- if n == 0 && slice == 0 {
- index = 2 // we have already generated the first two blocks
- if mode == argon2i || mode == argon2id {
- in[6]++
- processBlock(&addresses, &in, &zero)
- processBlock(&addresses, &addresses, &zero)
- }
- }
-
- offset := lane*lanes + slice*segments + index
- var random uint64
- for index < segments {
- prev := offset - 1
- if index == 0 && slice == 0 {
- prev += lanes // last block in lane
- }
- if mode == argon2i || (mode == argon2id && n == 0 && slice < syncPoints/2) {
- if index%blockLength == 0 {
- in[6]++
- processBlock(&addresses, &in, &zero)
- processBlock(&addresses, &addresses, &zero)
- }
- random = addresses[index%blockLength]
- } else {
- random = B[prev][0]
- }
- newOffset := indexAlpha(random, lanes, segments, threads, n, slice, lane, index)
- processBlockXOR(&B[offset], &B[prev], &B[newOffset])
- index, offset = index+1, offset+1
- }
- wg.Done()
- }
-
- for n := uint32(0); n < time; n++ {
- for slice := uint32(0); slice < syncPoints; slice++ {
- var wg sync.WaitGroup
- for lane := uint32(0); lane < threads; lane++ {
- wg.Add(1)
- go processSegment(n, slice, lane, &wg)
- }
- wg.Wait()
- }
- }
-
-}
-
-func extractKey(B []block, memory, threads, keyLen uint32) []byte {
- lanes := memory / threads
- for lane := uint32(0); lane < threads-1; lane++ {
- for i, v := range B[(lane*lanes)+lanes-1] {
- B[memory-1][i] ^= v
- }
- }
-
- var block [1024]byte
- for i, v := range B[memory-1] {
- binary.LittleEndian.PutUint64(block[i*8:], v)
- }
- key := make([]byte, keyLen)
- blake2bHash(key, block[:])
- return key
-}
-
-func indexAlpha(rand uint64, lanes, segments, threads, n, slice, lane, index uint32) uint32 {
- refLane := uint32(rand>>32) % threads
- if n == 0 && slice == 0 {
- refLane = lane
- }
- m, s := 3*segments, ((slice+1)%syncPoints)*segments
- if lane == refLane {
- m += index
- }
- if n == 0 {
- m, s = slice*segments, 0
- if slice == 0 || lane == refLane {
- m += index
- }
- }
- if index == 0 || lane == refLane {
- m--
- }
- return phi(rand, uint64(m), uint64(s), refLane, lanes)
-}
-
-func phi(rand, m, s uint64, lane, lanes uint32) uint32 {
- p := rand & 0xFFFFFFFF
- p = (p * p) >> 32
- p = (p * m) >> 32
- return lane*lanes + uint32((s+m-(p+1))%uint64(lanes))
-}
diff --git a/vendor/golang.org/x/crypto/argon2/blake2b.go b/vendor/golang.org/x/crypto/argon2/blake2b.go
deleted file mode 100644
index 10f46948d..000000000
--- a/vendor/golang.org/x/crypto/argon2/blake2b.go
+++ /dev/null
@@ -1,53 +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 argon2
-
-import (
- "encoding/binary"
- "hash"
-
- "golang.org/x/crypto/blake2b"
-)
-
-// blake2bHash computes an arbitrary long hash value of in
-// and writes the hash to out.
-func blake2bHash(out []byte, in []byte) {
- var b2 hash.Hash
- if n := len(out); n < blake2b.Size {
- b2, _ = blake2b.New(n, nil)
- } else {
- b2, _ = blake2b.New512(nil)
- }
-
- var buffer [blake2b.Size]byte
- binary.LittleEndian.PutUint32(buffer[:4], uint32(len(out)))
- b2.Write(buffer[:4])
- b2.Write(in)
-
- if len(out) <= blake2b.Size {
- b2.Sum(out[:0])
- return
- }
-
- outLen := len(out)
- b2.Sum(buffer[:0])
- b2.Reset()
- copy(out, buffer[:32])
- out = out[32:]
- for len(out) > blake2b.Size {
- b2.Write(buffer[:])
- b2.Sum(buffer[:0])
- copy(out, buffer[:32])
- out = out[32:]
- b2.Reset()
- }
-
- if outLen%blake2b.Size > 0 { // outLen > 64
- r := ((outLen + 31) / 32) - 2 // ⌈τ /32⌉-2
- b2, _ = blake2b.New(outLen-32*r, nil)
- }
- b2.Write(buffer[:])
- b2.Sum(out[:0])
-}
diff --git a/vendor/golang.org/x/crypto/argon2/blamka_amd64.go b/vendor/golang.org/x/crypto/argon2/blamka_amd64.go
deleted file mode 100644
index 063e7784f..000000000
--- a/vendor/golang.org/x/crypto/argon2/blamka_amd64.go
+++ /dev/null
@@ -1,60 +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.
-
-//go:build amd64 && gc && !purego
-
-package argon2
-
-import "golang.org/x/sys/cpu"
-
-func init() {
- useSSE4 = cpu.X86.HasSSE41
-}
-
-//go:noescape
-func mixBlocksSSE2(out, a, b, c *block)
-
-//go:noescape
-func xorBlocksSSE2(out, a, b, c *block)
-
-//go:noescape
-func blamkaSSE4(b *block)
-
-func processBlockSSE(out, in1, in2 *block, xor bool) {
- var t block
- mixBlocksSSE2(&t, in1, in2, &t)
- if useSSE4 {
- blamkaSSE4(&t)
- } else {
- for i := 0; i < blockLength; i += 16 {
- blamkaGeneric(
- &t[i+0], &t[i+1], &t[i+2], &t[i+3],
- &t[i+4], &t[i+5], &t[i+6], &t[i+7],
- &t[i+8], &t[i+9], &t[i+10], &t[i+11],
- &t[i+12], &t[i+13], &t[i+14], &t[i+15],
- )
- }
- for i := 0; i < blockLength/8; i += 2 {
- blamkaGeneric(
- &t[i], &t[i+1], &t[16+i], &t[16+i+1],
- &t[32+i], &t[32+i+1], &t[48+i], &t[48+i+1],
- &t[64+i], &t[64+i+1], &t[80+i], &t[80+i+1],
- &t[96+i], &t[96+i+1], &t[112+i], &t[112+i+1],
- )
- }
- }
- if xor {
- xorBlocksSSE2(out, in1, in2, &t)
- } else {
- mixBlocksSSE2(out, in1, in2, &t)
- }
-}
-
-func processBlock(out, in1, in2 *block) {
- processBlockSSE(out, in1, in2, false)
-}
-
-func processBlockXOR(out, in1, in2 *block) {
- processBlockSSE(out, in1, in2, true)
-}
diff --git a/vendor/golang.org/x/crypto/argon2/blamka_amd64.s b/vendor/golang.org/x/crypto/argon2/blamka_amd64.s
deleted file mode 100644
index c3895478e..000000000
--- a/vendor/golang.org/x/crypto/argon2/blamka_amd64.s
+++ /dev/null
@@ -1,2791 +0,0 @@
-// Code generated by command: go run blamka_amd64.go -out ../blamka_amd64.s -pkg argon2. DO NOT EDIT.
-
-//go:build amd64 && gc && !purego
-
-#include "textflag.h"
-
-// func blamkaSSE4(b *block)
-// Requires: SSE2, SSSE3
-TEXT ·blamkaSSE4(SB), NOSPLIT, $0-8
- MOVQ b+0(FP), AX
- MOVOU ·c40<>+0(SB), X10
- MOVOU ·c48<>+0(SB), X11
- MOVOU (AX), X0
- MOVOU 16(AX), X1
- MOVOU 32(AX), X2
- MOVOU 48(AX), X3
- MOVOU 64(AX), X4
- MOVOU 80(AX), X5
- MOVOU 96(AX), X6
- MOVOU 112(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, (AX)
- MOVOU X1, 16(AX)
- MOVOU X2, 32(AX)
- MOVOU X3, 48(AX)
- MOVOU X4, 64(AX)
- MOVOU X5, 80(AX)
- MOVOU X6, 96(AX)
- MOVOU X7, 112(AX)
- MOVOU 128(AX), X0
- MOVOU 144(AX), X1
- MOVOU 160(AX), X2
- MOVOU 176(AX), X3
- MOVOU 192(AX), X4
- MOVOU 208(AX), X5
- MOVOU 224(AX), X6
- MOVOU 240(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 128(AX)
- MOVOU X1, 144(AX)
- MOVOU X2, 160(AX)
- MOVOU X3, 176(AX)
- MOVOU X4, 192(AX)
- MOVOU X5, 208(AX)
- MOVOU X6, 224(AX)
- MOVOU X7, 240(AX)
- MOVOU 256(AX), X0
- MOVOU 272(AX), X1
- MOVOU 288(AX), X2
- MOVOU 304(AX), X3
- MOVOU 320(AX), X4
- MOVOU 336(AX), X5
- MOVOU 352(AX), X6
- MOVOU 368(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 256(AX)
- MOVOU X1, 272(AX)
- MOVOU X2, 288(AX)
- MOVOU X3, 304(AX)
- MOVOU X4, 320(AX)
- MOVOU X5, 336(AX)
- MOVOU X6, 352(AX)
- MOVOU X7, 368(AX)
- MOVOU 384(AX), X0
- MOVOU 400(AX), X1
- MOVOU 416(AX), X2
- MOVOU 432(AX), X3
- MOVOU 448(AX), X4
- MOVOU 464(AX), X5
- MOVOU 480(AX), X6
- MOVOU 496(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 384(AX)
- MOVOU X1, 400(AX)
- MOVOU X2, 416(AX)
- MOVOU X3, 432(AX)
- MOVOU X4, 448(AX)
- MOVOU X5, 464(AX)
- MOVOU X6, 480(AX)
- MOVOU X7, 496(AX)
- MOVOU 512(AX), X0
- MOVOU 528(AX), X1
- MOVOU 544(AX), X2
- MOVOU 560(AX), X3
- MOVOU 576(AX), X4
- MOVOU 592(AX), X5
- MOVOU 608(AX), X6
- MOVOU 624(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 512(AX)
- MOVOU X1, 528(AX)
- MOVOU X2, 544(AX)
- MOVOU X3, 560(AX)
- MOVOU X4, 576(AX)
- MOVOU X5, 592(AX)
- MOVOU X6, 608(AX)
- MOVOU X7, 624(AX)
- MOVOU 640(AX), X0
- MOVOU 656(AX), X1
- MOVOU 672(AX), X2
- MOVOU 688(AX), X3
- MOVOU 704(AX), X4
- MOVOU 720(AX), X5
- MOVOU 736(AX), X6
- MOVOU 752(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 640(AX)
- MOVOU X1, 656(AX)
- MOVOU X2, 672(AX)
- MOVOU X3, 688(AX)
- MOVOU X4, 704(AX)
- MOVOU X5, 720(AX)
- MOVOU X6, 736(AX)
- MOVOU X7, 752(AX)
- MOVOU 768(AX), X0
- MOVOU 784(AX), X1
- MOVOU 800(AX), X2
- MOVOU 816(AX), X3
- MOVOU 832(AX), X4
- MOVOU 848(AX), X5
- MOVOU 864(AX), X6
- MOVOU 880(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 768(AX)
- MOVOU X1, 784(AX)
- MOVOU X2, 800(AX)
- MOVOU X3, 816(AX)
- MOVOU X4, 832(AX)
- MOVOU X5, 848(AX)
- MOVOU X6, 864(AX)
- MOVOU X7, 880(AX)
- MOVOU 896(AX), X0
- MOVOU 912(AX), X1
- MOVOU 928(AX), X2
- MOVOU 944(AX), X3
- MOVOU 960(AX), X4
- MOVOU 976(AX), X5
- MOVOU 992(AX), X6
- MOVOU 1008(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 896(AX)
- MOVOU X1, 912(AX)
- MOVOU X2, 928(AX)
- MOVOU X3, 944(AX)
- MOVOU X4, 960(AX)
- MOVOU X5, 976(AX)
- MOVOU X6, 992(AX)
- MOVOU X7, 1008(AX)
- MOVOU (AX), X0
- MOVOU 128(AX), X1
- MOVOU 256(AX), X2
- MOVOU 384(AX), X3
- MOVOU 512(AX), X4
- MOVOU 640(AX), X5
- MOVOU 768(AX), X6
- MOVOU 896(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, (AX)
- MOVOU X1, 128(AX)
- MOVOU X2, 256(AX)
- MOVOU X3, 384(AX)
- MOVOU X4, 512(AX)
- MOVOU X5, 640(AX)
- MOVOU X6, 768(AX)
- MOVOU X7, 896(AX)
- MOVOU 16(AX), X0
- MOVOU 144(AX), X1
- MOVOU 272(AX), X2
- MOVOU 400(AX), X3
- MOVOU 528(AX), X4
- MOVOU 656(AX), X5
- MOVOU 784(AX), X6
- MOVOU 912(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 16(AX)
- MOVOU X1, 144(AX)
- MOVOU X2, 272(AX)
- MOVOU X3, 400(AX)
- MOVOU X4, 528(AX)
- MOVOU X5, 656(AX)
- MOVOU X6, 784(AX)
- MOVOU X7, 912(AX)
- MOVOU 32(AX), X0
- MOVOU 160(AX), X1
- MOVOU 288(AX), X2
- MOVOU 416(AX), X3
- MOVOU 544(AX), X4
- MOVOU 672(AX), X5
- MOVOU 800(AX), X6
- MOVOU 928(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 32(AX)
- MOVOU X1, 160(AX)
- MOVOU X2, 288(AX)
- MOVOU X3, 416(AX)
- MOVOU X4, 544(AX)
- MOVOU X5, 672(AX)
- MOVOU X6, 800(AX)
- MOVOU X7, 928(AX)
- MOVOU 48(AX), X0
- MOVOU 176(AX), X1
- MOVOU 304(AX), X2
- MOVOU 432(AX), X3
- MOVOU 560(AX), X4
- MOVOU 688(AX), X5
- MOVOU 816(AX), X6
- MOVOU 944(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 48(AX)
- MOVOU X1, 176(AX)
- MOVOU X2, 304(AX)
- MOVOU X3, 432(AX)
- MOVOU X4, 560(AX)
- MOVOU X5, 688(AX)
- MOVOU X6, 816(AX)
- MOVOU X7, 944(AX)
- MOVOU 64(AX), X0
- MOVOU 192(AX), X1
- MOVOU 320(AX), X2
- MOVOU 448(AX), X3
- MOVOU 576(AX), X4
- MOVOU 704(AX), X5
- MOVOU 832(AX), X6
- MOVOU 960(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 64(AX)
- MOVOU X1, 192(AX)
- MOVOU X2, 320(AX)
- MOVOU X3, 448(AX)
- MOVOU X4, 576(AX)
- MOVOU X5, 704(AX)
- MOVOU X6, 832(AX)
- MOVOU X7, 960(AX)
- MOVOU 80(AX), X0
- MOVOU 208(AX), X1
- MOVOU 336(AX), X2
- MOVOU 464(AX), X3
- MOVOU 592(AX), X4
- MOVOU 720(AX), X5
- MOVOU 848(AX), X6
- MOVOU 976(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 80(AX)
- MOVOU X1, 208(AX)
- MOVOU X2, 336(AX)
- MOVOU X3, 464(AX)
- MOVOU X4, 592(AX)
- MOVOU X5, 720(AX)
- MOVOU X6, 848(AX)
- MOVOU X7, 976(AX)
- MOVOU 96(AX), X0
- MOVOU 224(AX), X1
- MOVOU 352(AX), X2
- MOVOU 480(AX), X3
- MOVOU 608(AX), X4
- MOVOU 736(AX), X5
- MOVOU 864(AX), X6
- MOVOU 992(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 96(AX)
- MOVOU X1, 224(AX)
- MOVOU X2, 352(AX)
- MOVOU X3, 480(AX)
- MOVOU X4, 608(AX)
- MOVOU X5, 736(AX)
- MOVOU X6, 864(AX)
- MOVOU X7, 992(AX)
- MOVOU 112(AX), X0
- MOVOU 240(AX), X1
- MOVOU 368(AX), X2
- MOVOU 496(AX), X3
- MOVOU 624(AX), X4
- MOVOU 752(AX), X5
- MOVOU 880(AX), X6
- MOVOU 1008(AX), X7
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFD $0xb1, X6, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- PSHUFB X10, X2
- MOVO X0, X8
- PMULULQ X2, X8
- PADDQ X2, X0
- PADDQ X8, X0
- PADDQ X8, X0
- PXOR X0, X6
- PSHUFB X11, X6
- MOVO X4, X8
- PMULULQ X6, X8
- PADDQ X6, X4
- PADDQ X8, X4
- PADDQ X8, X4
- PXOR X4, X2
- MOVO X2, X8
- PADDQ X2, X8
- PSRLQ $0x3f, X2
- PXOR X8, X2
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFD $0xb1, X7, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- PSHUFB X10, X3
- MOVO X1, X8
- PMULULQ X3, X8
- PADDQ X3, X1
- PADDQ X8, X1
- PADDQ X8, X1
- PXOR X1, X7
- PSHUFB X11, X7
- MOVO X5, X8
- PMULULQ X7, X8
- PADDQ X7, X5
- PADDQ X8, X5
- PADDQ X8, X5
- PXOR X5, X3
- MOVO X3, X8
- PADDQ X3, X8
- PSRLQ $0x3f, X3
- PXOR X8, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU X0, 112(AX)
- MOVOU X1, 240(AX)
- MOVOU X2, 368(AX)
- MOVOU X3, 496(AX)
- MOVOU X4, 624(AX)
- MOVOU X5, 752(AX)
- MOVOU X6, 880(AX)
- MOVOU X7, 1008(AX)
- RET
-
-DATA ·c40<>+0(SB)/8, $0x0201000706050403
-DATA ·c40<>+8(SB)/8, $0x0a09080f0e0d0c0b
-GLOBL ·c40<>(SB), RODATA|NOPTR, $16
-
-DATA ·c48<>+0(SB)/8, $0x0100070605040302
-DATA ·c48<>+8(SB)/8, $0x09080f0e0d0c0b0a
-GLOBL ·c48<>(SB), RODATA|NOPTR, $16
-
-// func mixBlocksSSE2(out *block, a *block, b *block, c *block)
-// Requires: SSE2
-TEXT ·mixBlocksSSE2(SB), NOSPLIT, $0-32
- MOVQ out+0(FP), DX
- MOVQ a+8(FP), AX
- MOVQ b+16(FP), BX
- MOVQ c+24(FP), CX
- MOVQ $0x00000080, DI
-
-loop:
- MOVOU (AX), X0
- MOVOU (BX), X1
- MOVOU (CX), X2
- PXOR X1, X0
- PXOR X2, X0
- MOVOU X0, (DX)
- ADDQ $0x10, AX
- ADDQ $0x10, BX
- ADDQ $0x10, CX
- ADDQ $0x10, DX
- SUBQ $0x02, DI
- JA loop
- RET
-
-// func xorBlocksSSE2(out *block, a *block, b *block, c *block)
-// Requires: SSE2
-TEXT ·xorBlocksSSE2(SB), NOSPLIT, $0-32
- MOVQ out+0(FP), DX
- MOVQ a+8(FP), AX
- MOVQ b+16(FP), BX
- MOVQ c+24(FP), CX
- MOVQ $0x00000080, DI
-
-loop:
- MOVOU (AX), X0
- MOVOU (BX), X1
- MOVOU (CX), X2
- MOVOU (DX), X3
- PXOR X1, X0
- PXOR X2, X0
- PXOR X3, X0
- MOVOU X0, (DX)
- ADDQ $0x10, AX
- ADDQ $0x10, BX
- ADDQ $0x10, CX
- ADDQ $0x10, DX
- SUBQ $0x02, DI
- JA loop
- RET
diff --git a/vendor/golang.org/x/crypto/argon2/blamka_generic.go b/vendor/golang.org/x/crypto/argon2/blamka_generic.go
deleted file mode 100644
index a481b2243..000000000
--- a/vendor/golang.org/x/crypto/argon2/blamka_generic.go
+++ /dev/null
@@ -1,163 +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 argon2
-
-var useSSE4 bool
-
-func processBlockGeneric(out, in1, in2 *block, xor bool) {
- var t block
- for i := range t {
- t[i] = in1[i] ^ in2[i]
- }
- for i := 0; i < blockLength; i += 16 {
- blamkaGeneric(
- &t[i+0], &t[i+1], &t[i+2], &t[i+3],
- &t[i+4], &t[i+5], &t[i+6], &t[i+7],
- &t[i+8], &t[i+9], &t[i+10], &t[i+11],
- &t[i+12], &t[i+13], &t[i+14], &t[i+15],
- )
- }
- for i := 0; i < blockLength/8; i += 2 {
- blamkaGeneric(
- &t[i], &t[i+1], &t[16+i], &t[16+i+1],
- &t[32+i], &t[32+i+1], &t[48+i], &t[48+i+1],
- &t[64+i], &t[64+i+1], &t[80+i], &t[80+i+1],
- &t[96+i], &t[96+i+1], &t[112+i], &t[112+i+1],
- )
- }
- if xor {
- for i := range t {
- out[i] ^= in1[i] ^ in2[i] ^ t[i]
- }
- } else {
- for i := range t {
- out[i] = in1[i] ^ in2[i] ^ t[i]
- }
- }
-}
-
-func blamkaGeneric(t00, t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12, t13, t14, t15 *uint64) {
- v00, v01, v02, v03 := *t00, *t01, *t02, *t03
- v04, v05, v06, v07 := *t04, *t05, *t06, *t07
- v08, v09, v10, v11 := *t08, *t09, *t10, *t11
- v12, v13, v14, v15 := *t12, *t13, *t14, *t15
-
- v00 += v04 + 2*uint64(uint32(v00))*uint64(uint32(v04))
- v12 ^= v00
- v12 = v12>>32 | v12<<32
- v08 += v12 + 2*uint64(uint32(v08))*uint64(uint32(v12))
- v04 ^= v08
- v04 = v04>>24 | v04<<40
-
- v00 += v04 + 2*uint64(uint32(v00))*uint64(uint32(v04))
- v12 ^= v00
- v12 = v12>>16 | v12<<48
- v08 += v12 + 2*uint64(uint32(v08))*uint64(uint32(v12))
- v04 ^= v08
- v04 = v04>>63 | v04<<1
-
- v01 += v05 + 2*uint64(uint32(v01))*uint64(uint32(v05))
- v13 ^= v01
- v13 = v13>>32 | v13<<32
- v09 += v13 + 2*uint64(uint32(v09))*uint64(uint32(v13))
- v05 ^= v09
- v05 = v05>>24 | v05<<40
-
- v01 += v05 + 2*uint64(uint32(v01))*uint64(uint32(v05))
- v13 ^= v01
- v13 = v13>>16 | v13<<48
- v09 += v13 + 2*uint64(uint32(v09))*uint64(uint32(v13))
- v05 ^= v09
- v05 = v05>>63 | v05<<1
-
- v02 += v06 + 2*uint64(uint32(v02))*uint64(uint32(v06))
- v14 ^= v02
- v14 = v14>>32 | v14<<32
- v10 += v14 + 2*uint64(uint32(v10))*uint64(uint32(v14))
- v06 ^= v10
- v06 = v06>>24 | v06<<40
-
- v02 += v06 + 2*uint64(uint32(v02))*uint64(uint32(v06))
- v14 ^= v02
- v14 = v14>>16 | v14<<48
- v10 += v14 + 2*uint64(uint32(v10))*uint64(uint32(v14))
- v06 ^= v10
- v06 = v06>>63 | v06<<1
-
- v03 += v07 + 2*uint64(uint32(v03))*uint64(uint32(v07))
- v15 ^= v03
- v15 = v15>>32 | v15<<32
- v11 += v15 + 2*uint64(uint32(v11))*uint64(uint32(v15))
- v07 ^= v11
- v07 = v07>>24 | v07<<40
-
- v03 += v07 + 2*uint64(uint32(v03))*uint64(uint32(v07))
- v15 ^= v03
- v15 = v15>>16 | v15<<48
- v11 += v15 + 2*uint64(uint32(v11))*uint64(uint32(v15))
- v07 ^= v11
- v07 = v07>>63 | v07<<1
-
- v00 += v05 + 2*uint64(uint32(v00))*uint64(uint32(v05))
- v15 ^= v00
- v15 = v15>>32 | v15<<32
- v10 += v15 + 2*uint64(uint32(v10))*uint64(uint32(v15))
- v05 ^= v10
- v05 = v05>>24 | v05<<40
-
- v00 += v05 + 2*uint64(uint32(v00))*uint64(uint32(v05))
- v15 ^= v00
- v15 = v15>>16 | v15<<48
- v10 += v15 + 2*uint64(uint32(v10))*uint64(uint32(v15))
- v05 ^= v10
- v05 = v05>>63 | v05<<1
-
- v01 += v06 + 2*uint64(uint32(v01))*uint64(uint32(v06))
- v12 ^= v01
- v12 = v12>>32 | v12<<32
- v11 += v12 + 2*uint64(uint32(v11))*uint64(uint32(v12))
- v06 ^= v11
- v06 = v06>>24 | v06<<40
-
- v01 += v06 + 2*uint64(uint32(v01))*uint64(uint32(v06))
- v12 ^= v01
- v12 = v12>>16 | v12<<48
- v11 += v12 + 2*uint64(uint32(v11))*uint64(uint32(v12))
- v06 ^= v11
- v06 = v06>>63 | v06<<1
-
- v02 += v07 + 2*uint64(uint32(v02))*uint64(uint32(v07))
- v13 ^= v02
- v13 = v13>>32 | v13<<32
- v08 += v13 + 2*uint64(uint32(v08))*uint64(uint32(v13))
- v07 ^= v08
- v07 = v07>>24 | v07<<40
-
- v02 += v07 + 2*uint64(uint32(v02))*uint64(uint32(v07))
- v13 ^= v02
- v13 = v13>>16 | v13<<48
- v08 += v13 + 2*uint64(uint32(v08))*uint64(uint32(v13))
- v07 ^= v08
- v07 = v07>>63 | v07<<1
-
- v03 += v04 + 2*uint64(uint32(v03))*uint64(uint32(v04))
- v14 ^= v03
- v14 = v14>>32 | v14<<32
- v09 += v14 + 2*uint64(uint32(v09))*uint64(uint32(v14))
- v04 ^= v09
- v04 = v04>>24 | v04<<40
-
- v03 += v04 + 2*uint64(uint32(v03))*uint64(uint32(v04))
- v14 ^= v03
- v14 = v14>>16 | v14<<48
- v09 += v14 + 2*uint64(uint32(v09))*uint64(uint32(v14))
- v04 ^= v09
- v04 = v04>>63 | v04<<1
-
- *t00, *t01, *t02, *t03 = v00, v01, v02, v03
- *t04, *t05, *t06, *t07 = v04, v05, v06, v07
- *t08, *t09, *t10, *t11 = v08, v09, v10, v11
- *t12, *t13, *t14, *t15 = v12, v13, v14, v15
-}
diff --git a/vendor/golang.org/x/crypto/argon2/blamka_ref.go b/vendor/golang.org/x/crypto/argon2/blamka_ref.go
deleted file mode 100644
index 16d58c650..000000000
--- a/vendor/golang.org/x/crypto/argon2/blamka_ref.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !amd64 || purego || !gc
-
-package argon2
-
-func processBlock(out, in1, in2 *block) {
- processBlockGeneric(out, in1, in2, false)
-}
-
-func processBlockXOR(out, in1, in2 *block) {
- processBlockGeneric(out, in1, in2, true)
-}
diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b.go b/vendor/golang.org/x/crypto/blake2b/blake2b.go
deleted file mode 100644
index d2e98d429..000000000
--- a/vendor/golang.org/x/crypto/blake2b/blake2b.go
+++ /dev/null
@@ -1,291 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package blake2b implements the BLAKE2b hash algorithm defined by RFC 7693
-// and the extendable output function (XOF) BLAKE2Xb.
-//
-// BLAKE2b is optimized for 64-bit platforms—including NEON-enabled ARMs—and
-// produces digests of any size between 1 and 64 bytes.
-// For a detailed specification of BLAKE2b see https://blake2.net/blake2.pdf
-// and for BLAKE2Xb see https://blake2.net/blake2x.pdf
-//
-// If you aren't sure which function you need, use BLAKE2b (Sum512 or New512).
-// If you need a secret-key MAC (message authentication code), use the New512
-// function with a non-nil key.
-//
-// BLAKE2X is a construction to compute hash values larger than 64 bytes. It
-// can produce hash values between 0 and 4 GiB.
-package blake2b
-
-import (
- "encoding/binary"
- "errors"
- "hash"
-)
-
-const (
- // The blocksize of BLAKE2b in bytes.
- BlockSize = 128
- // The hash size of BLAKE2b-512 in bytes.
- Size = 64
- // The hash size of BLAKE2b-384 in bytes.
- Size384 = 48
- // The hash size of BLAKE2b-256 in bytes.
- Size256 = 32
-)
-
-var (
- useAVX2 bool
- useAVX bool
- useSSE4 bool
-)
-
-var (
- errKeySize = errors.New("blake2b: invalid key size")
- errHashSize = errors.New("blake2b: invalid hash size")
-)
-
-var iv = [8]uint64{
- 0x6a09e667f3bcc908, 0xbb67ae8584caa73b, 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1,
- 0x510e527fade682d1, 0x9b05688c2b3e6c1f, 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179,
-}
-
-// Sum512 returns the BLAKE2b-512 checksum of the data.
-func Sum512(data []byte) [Size]byte {
- var sum [Size]byte
- checkSum(&sum, Size, data)
- return sum
-}
-
-// Sum384 returns the BLAKE2b-384 checksum of the data.
-func Sum384(data []byte) [Size384]byte {
- var sum [Size]byte
- var sum384 [Size384]byte
- checkSum(&sum, Size384, data)
- copy(sum384[:], sum[:Size384])
- return sum384
-}
-
-// Sum256 returns the BLAKE2b-256 checksum of the data.
-func Sum256(data []byte) [Size256]byte {
- var sum [Size]byte
- var sum256 [Size256]byte
- checkSum(&sum, Size256, data)
- copy(sum256[:], sum[:Size256])
- return sum256
-}
-
-// New512 returns a new hash.Hash computing the BLAKE2b-512 checksum. A non-nil
-// key turns the hash into a MAC. The key must be between zero and 64 bytes long.
-func New512(key []byte) (hash.Hash, error) { return newDigest(Size, key) }
-
-// New384 returns a new hash.Hash computing the BLAKE2b-384 checksum. A non-nil
-// key turns the hash into a MAC. The key must be between zero and 64 bytes long.
-func New384(key []byte) (hash.Hash, error) { return newDigest(Size384, key) }
-
-// New256 returns a new hash.Hash computing the BLAKE2b-256 checksum. A non-nil
-// key turns the hash into a MAC. The key must be between zero and 64 bytes long.
-func New256(key []byte) (hash.Hash, error) { return newDigest(Size256, key) }
-
-// New returns a new hash.Hash computing the BLAKE2b checksum with a custom length.
-// A non-nil key turns the hash into a MAC. The key must be between zero and 64 bytes long.
-// The hash size can be a value between 1 and 64 but it is highly recommended to use
-// values equal or greater than:
-// - 32 if BLAKE2b is used as a hash function (The key is zero bytes long).
-// - 16 if BLAKE2b is used as a MAC function (The key is at least 16 bytes long).
-// When the key is nil, the returned hash.Hash implements BinaryMarshaler
-// and BinaryUnmarshaler for state (de)serialization as documented by hash.Hash.
-func New(size int, key []byte) (hash.Hash, error) { return newDigest(size, key) }
-
-func newDigest(hashSize int, key []byte) (*digest, error) {
- if hashSize < 1 || hashSize > Size {
- return nil, errHashSize
- }
- if len(key) > Size {
- return nil, errKeySize
- }
- d := &digest{
- size: hashSize,
- keyLen: len(key),
- }
- copy(d.key[:], key)
- d.Reset()
- return d, nil
-}
-
-func checkSum(sum *[Size]byte, hashSize int, data []byte) {
- h := iv
- h[0] ^= uint64(hashSize) | (1 << 16) | (1 << 24)
- var c [2]uint64
-
- if length := len(data); length > BlockSize {
- n := length &^ (BlockSize - 1)
- if length == n {
- n -= BlockSize
- }
- hashBlocks(&h, &c, 0, data[:n])
- data = data[n:]
- }
-
- var block [BlockSize]byte
- offset := copy(block[:], data)
- remaining := uint64(BlockSize - offset)
- if c[0] < remaining {
- c[1]--
- }
- c[0] -= remaining
-
- hashBlocks(&h, &c, 0xFFFFFFFFFFFFFFFF, block[:])
-
- for i, v := range h[:(hashSize+7)/8] {
- binary.LittleEndian.PutUint64(sum[8*i:], v)
- }
-}
-
-type digest struct {
- h [8]uint64
- c [2]uint64
- size int
- block [BlockSize]byte
- offset int
-
- key [BlockSize]byte
- keyLen int
-}
-
-const (
- magic = "b2b"
- marshaledSize = len(magic) + 8*8 + 2*8 + 1 + BlockSize + 1
-)
-
-func (d *digest) MarshalBinary() ([]byte, error) {
- if d.keyLen != 0 {
- return nil, errors.New("crypto/blake2b: cannot marshal MACs")
- }
- b := make([]byte, 0, marshaledSize)
- b = append(b, magic...)
- for i := 0; i < 8; i++ {
- b = appendUint64(b, d.h[i])
- }
- b = appendUint64(b, d.c[0])
- b = appendUint64(b, d.c[1])
- // Maximum value for size is 64
- b = append(b, byte(d.size))
- b = append(b, d.block[:]...)
- b = append(b, byte(d.offset))
- return b, nil
-}
-
-func (d *digest) UnmarshalBinary(b []byte) error {
- if len(b) < len(magic) || string(b[:len(magic)]) != magic {
- return errors.New("crypto/blake2b: invalid hash state identifier")
- }
- if len(b) != marshaledSize {
- return errors.New("crypto/blake2b: invalid hash state size")
- }
- b = b[len(magic):]
- for i := 0; i < 8; i++ {
- b, d.h[i] = consumeUint64(b)
- }
- b, d.c[0] = consumeUint64(b)
- b, d.c[1] = consumeUint64(b)
- d.size = int(b[0])
- b = b[1:]
- copy(d.block[:], b[:BlockSize])
- b = b[BlockSize:]
- d.offset = int(b[0])
- return nil
-}
-
-func (d *digest) BlockSize() int { return BlockSize }
-
-func (d *digest) Size() int { return d.size }
-
-func (d *digest) Reset() {
- d.h = iv
- d.h[0] ^= uint64(d.size) | (uint64(d.keyLen) << 8) | (1 << 16) | (1 << 24)
- d.offset, d.c[0], d.c[1] = 0, 0, 0
- if d.keyLen > 0 {
- d.block = d.key
- d.offset = BlockSize
- }
-}
-
-func (d *digest) Write(p []byte) (n int, err error) {
- n = len(p)
-
- if d.offset > 0 {
- remaining := BlockSize - d.offset
- if n <= remaining {
- d.offset += copy(d.block[d.offset:], p)
- return
- }
- copy(d.block[d.offset:], p[:remaining])
- hashBlocks(&d.h, &d.c, 0, d.block[:])
- d.offset = 0
- p = p[remaining:]
- }
-
- if length := len(p); length > BlockSize {
- nn := length &^ (BlockSize - 1)
- if length == nn {
- nn -= BlockSize
- }
- hashBlocks(&d.h, &d.c, 0, p[:nn])
- p = p[nn:]
- }
-
- if len(p) > 0 {
- d.offset += copy(d.block[:], p)
- }
-
- return
-}
-
-func (d *digest) Sum(sum []byte) []byte {
- var hash [Size]byte
- d.finalize(&hash)
- return append(sum, hash[:d.size]...)
-}
-
-func (d *digest) finalize(hash *[Size]byte) {
- var block [BlockSize]byte
- copy(block[:], d.block[:d.offset])
- remaining := uint64(BlockSize - d.offset)
-
- c := d.c
- if c[0] < remaining {
- c[1]--
- }
- c[0] -= remaining
-
- h := d.h
- hashBlocks(&h, &c, 0xFFFFFFFFFFFFFFFF, block[:])
-
- for i, v := range h {
- binary.LittleEndian.PutUint64(hash[8*i:], v)
- }
-}
-
-func appendUint64(b []byte, x uint64) []byte {
- var a [8]byte
- binary.BigEndian.PutUint64(a[:], x)
- return append(b, a[:]...)
-}
-
-func appendUint32(b []byte, x uint32) []byte {
- var a [4]byte
- binary.BigEndian.PutUint32(a[:], x)
- return append(b, a[:]...)
-}
-
-func consumeUint64(b []byte) ([]byte, uint64) {
- x := binary.BigEndian.Uint64(b)
- return b[8:], x
-}
-
-func consumeUint32(b []byte) ([]byte, uint32) {
- x := binary.BigEndian.Uint32(b)
- return b[4:], x
-}
diff --git a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go
deleted file mode 100644
index 199c21d27..000000000
--- a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build amd64 && gc && !purego
-
-package blake2b
-
-import "golang.org/x/sys/cpu"
-
-func init() {
- useAVX2 = cpu.X86.HasAVX2
- useAVX = cpu.X86.HasAVX
- useSSE4 = cpu.X86.HasSSE41
-}
-
-//go:noescape
-func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
-
-//go:noescape
-func hashBlocksAVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
-
-//go:noescape
-func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
-
-func hashBlocks(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
- switch {
- case useAVX2:
- hashBlocksAVX2(h, c, flag, blocks)
- case useAVX:
- hashBlocksAVX(h, c, flag, blocks)
- case useSSE4:
- hashBlocksSSE4(h, c, flag, blocks)
- default:
- hashBlocksGeneric(h, c, flag, blocks)
- }
-}
diff --git a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s b/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s
deleted file mode 100644
index f75162e03..000000000
--- a/vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s
+++ /dev/null
@@ -1,4559 +0,0 @@
-// Code generated by command: go run blake2bAVX2_amd64_asm.go -out ../../blake2bAVX2_amd64.s -pkg blake2b. DO NOT EDIT.
-
-//go:build amd64 && gc && !purego
-
-#include "textflag.h"
-
-// func hashBlocksAVX2(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
-// Requires: AVX, AVX2
-TEXT ·hashBlocksAVX2(SB), NOSPLIT, $320-48
- MOVQ h+0(FP), AX
- MOVQ c+8(FP), BX
- MOVQ flag+16(FP), CX
- MOVQ blocks_base+24(FP), SI
- MOVQ blocks_len+32(FP), DI
- MOVQ SP, DX
- ADDQ $+31, DX
- ANDQ $-32, DX
- MOVQ CX, 16(DX)
- XORQ CX, CX
- MOVQ CX, 24(DX)
- VMOVDQU ·AVX2_c40<>+0(SB), Y4
- VMOVDQU ·AVX2_c48<>+0(SB), Y5
- VMOVDQU (AX), Y8
- VMOVDQU 32(AX), Y9
- VMOVDQU ·AVX2_iv0<>+0(SB), Y6
- VMOVDQU ·AVX2_iv1<>+0(SB), Y7
- MOVQ (BX), R8
- MOVQ 8(BX), R9
- MOVQ R9, 8(DX)
-
-loop:
- ADDQ $0x80, R8
- MOVQ R8, (DX)
- CMPQ R8, $0x80
- JGE noinc
- INCQ R9
- MOVQ R9, 8(DX)
-
-noinc:
- VMOVDQA Y8, Y0
- VMOVDQA Y9, Y1
- VMOVDQA Y6, Y2
- VPXOR (DX), Y7, Y3
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x26
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x20
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x10
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x30
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x08
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x28
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x38
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x40
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x60
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x50
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x70
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x48
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x68
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x58
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x78
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VMOVDQA Y12, 32(DX)
- VMOVDQA Y13, 64(DX)
- VMOVDQA Y14, 96(DX)
- VMOVDQA Y15, 128(DX)
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x70
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x48
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x20
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x68
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x50
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x78
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x40
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x30
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x58
- VPSHUFD $0x4e, (SI), X14
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x28
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x60
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x38
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x10
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x18
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VMOVDQA Y12, 160(DX)
- VMOVDQA Y13, 192(DX)
- VMOVDQA Y14, 224(DX)
- VMOVDQA Y15, 256(DX)
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x28
- VMOVDQU 88(SI), X12
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x78
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x40
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x10
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x2e
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x68
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x50
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x38
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x48
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x70
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x08
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x30
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x20
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x38
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x68
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x58
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x48
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x60
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x08
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x70
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x10
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x20
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x28
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x78
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x30
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x1e
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x50
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x40
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x48
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x10
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x28
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x50
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x2e
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x20
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x38
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x78
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x70
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x30
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x58
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x18
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x08
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x40
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x60
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x68
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x10
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x1e
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x30
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x40
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x60
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x58
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x50
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x18
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x20
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x78
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x38
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x08
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x68
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x70
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x28
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x48
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x60
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x70
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x08
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x20
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x28
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x68
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x78
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x50
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x36
- VPSHUFD $0x4e, 64(SI), X11
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x30
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x38
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x10
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x58
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x68
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x60
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x38
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x18
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x58
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x08
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x70
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x48
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x28
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x40
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x78
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x10
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x3e
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x30
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x20
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x50
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x30
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x58
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x70
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x1e
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x78
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x18
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x48
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x40
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x08
- VMOVDQU 96(SI), X14
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x50
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x10
- VMOVDQU 32(SI), X11
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x38
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x50
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x38
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x40
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x08
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y12, Y12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x10
- VPSHUFD $0x4e, 40(SI), X11
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x20
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y13, Y13
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x78
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x18
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x48
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x5e
- BYTE $0x68
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y14, Y14
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x58
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x5e
- BYTE $0x60
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x70
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0xa1
- BYTE $0x22
- BYTE $0x1e
- BYTE $0x01
- VINSERTI128 $0x01, X11, Y15, Y15
- VPADDQ Y12, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y13, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ Y14, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ Y15, Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- VPADDQ 32(DX), Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ 64(DX), Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ 96(DX), Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ 128(DX), Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- VPADDQ 160(DX), Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ 192(DX), Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x93
- VPADDQ 224(DX), Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFD $-79, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPSHUFB Y4, Y1, Y1
- VPADDQ 256(DX), Y0, Y0
- VPADDQ Y1, Y0, Y0
- VPXOR Y0, Y3, Y3
- VPSHUFB Y5, Y3, Y3
- VPADDQ Y3, Y2, Y2
- VPXOR Y2, Y1, Y1
- VPADDQ Y1, Y1, Y10
- VPSRLQ $0x3f, Y1, Y1
- VPXOR Y10, Y1, Y1
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xdb
- BYTE $0x39
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xd2
- BYTE $0x4e
- BYTE $0xc4
- BYTE $0xe3
- BYTE $0xfd
- BYTE $0x00
- BYTE $0xc9
- BYTE $0x93
- VPXOR Y0, Y8, Y8
- VPXOR Y1, Y9, Y9
- VPXOR Y2, Y8, Y8
- VPXOR Y3, Y9, Y9
- LEAQ 128(SI), SI
- SUBQ $0x80, DI
- JNE loop
- MOVQ R8, (BX)
- MOVQ R9, 8(BX)
- VMOVDQU Y8, (AX)
- VMOVDQU Y9, 32(AX)
- VZEROUPPER
- RET
-
-DATA ·AVX2_c40<>+0(SB)/8, $0x0201000706050403
-DATA ·AVX2_c40<>+8(SB)/8, $0x0a09080f0e0d0c0b
-DATA ·AVX2_c40<>+16(SB)/8, $0x0201000706050403
-DATA ·AVX2_c40<>+24(SB)/8, $0x0a09080f0e0d0c0b
-GLOBL ·AVX2_c40<>(SB), RODATA|NOPTR, $32
-
-DATA ·AVX2_c48<>+0(SB)/8, $0x0100070605040302
-DATA ·AVX2_c48<>+8(SB)/8, $0x09080f0e0d0c0b0a
-DATA ·AVX2_c48<>+16(SB)/8, $0x0100070605040302
-DATA ·AVX2_c48<>+24(SB)/8, $0x09080f0e0d0c0b0a
-GLOBL ·AVX2_c48<>(SB), RODATA|NOPTR, $32
-
-DATA ·AVX2_iv0<>+0(SB)/8, $0x6a09e667f3bcc908
-DATA ·AVX2_iv0<>+8(SB)/8, $0xbb67ae8584caa73b
-DATA ·AVX2_iv0<>+16(SB)/8, $0x3c6ef372fe94f82b
-DATA ·AVX2_iv0<>+24(SB)/8, $0xa54ff53a5f1d36f1
-GLOBL ·AVX2_iv0<>(SB), RODATA|NOPTR, $32
-
-DATA ·AVX2_iv1<>+0(SB)/8, $0x510e527fade682d1
-DATA ·AVX2_iv1<>+8(SB)/8, $0x9b05688c2b3e6c1f
-DATA ·AVX2_iv1<>+16(SB)/8, $0x1f83d9abfb41bd6b
-DATA ·AVX2_iv1<>+24(SB)/8, $0x5be0cd19137e2179
-GLOBL ·AVX2_iv1<>(SB), RODATA|NOPTR, $32
-
-// func hashBlocksAVX(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
-// Requires: AVX, SSE2
-TEXT ·hashBlocksAVX(SB), NOSPLIT, $288-48
- MOVQ h+0(FP), AX
- MOVQ c+8(FP), BX
- MOVQ flag+16(FP), CX
- MOVQ blocks_base+24(FP), SI
- MOVQ blocks_len+32(FP), DI
- MOVQ SP, R10
- ADDQ $0x0f, R10
- ANDQ $-16, R10
- VMOVDQU ·AVX_c40<>+0(SB), X0
- VMOVDQU ·AVX_c48<>+0(SB), X1
- VMOVDQA X0, X8
- VMOVDQA X1, X9
- VMOVDQU ·AVX_iv3<>+0(SB), X0
- VMOVDQA X0, (R10)
- XORQ CX, (R10)
- VMOVDQU (AX), X10
- VMOVDQU 16(AX), X11
- VMOVDQU 32(AX), X2
- VMOVDQU 48(AX), X3
- MOVQ (BX), R8
- MOVQ 8(BX), R9
-
-loop:
- ADDQ $0x80, R8
- CMPQ R8, $0x80
- JGE noinc
- INCQ R9
-
-noinc:
- BYTE $0xc4
- BYTE $0x41
- BYTE $0xf9
- BYTE $0x6e
- BYTE $0xf8
- BYTE $0xc4
- BYTE $0x43
- BYTE $0x81
- BYTE $0x22
- BYTE $0xf9
- BYTE $0x01
- VMOVDQA X10, X0
- VMOVDQA X11, X1
- VMOVDQU ·AVX_iv0<>+0(SB), X4
- VMOVDQU ·AVX_iv1<>+0(SB), X5
- VMOVDQU ·AVX_iv2<>+0(SB), X6
- VPXOR X15, X6, X6
- VMOVDQA (R10), X7
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x26
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x20
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x08
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x28
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x10
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x30
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x38
- BYTE $0x01
- VMOVDQA X12, 16(R10)
- VMOVDQA X13, 32(R10)
- VMOVDQA X14, 48(R10)
- VMOVDQA X15, 64(R10)
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x40
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x60
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x48
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x68
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x50
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x70
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x58
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x78
- BYTE $0x01
- VMOVDQA X12, 80(R10)
- VMOVDQA X13, 96(R10)
- VMOVDQA X14, 112(R10)
- VMOVDQA X15, 128(R10)
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x70
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x48
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x50
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x78
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x20
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x68
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x40
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x30
- BYTE $0x01
- VMOVDQA X12, 144(R10)
- VMOVDQA X13, 160(R10)
- VMOVDQA X14, 176(R10)
- VMOVDQA X15, 192(R10)
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- VPSHUFD $0x4e, (SI), X12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x58
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x60
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x38
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x28
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x10
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x18
- BYTE $0x01
- VMOVDQA X12, 208(R10)
- VMOVDQA X13, 224(R10)
- VMOVDQA X14, 240(R10)
- VMOVDQA X15, 256(R10)
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- VMOVDQU 88(SI), X12
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x28
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x40
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x10
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x78
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x36
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x68
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x50
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x38
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x70
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x08
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x48
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x30
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x20
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x38
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x68
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x48
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x60
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x58
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x08
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x70
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x10
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x20
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x30
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x3e
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x28
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x78
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x50
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x40
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x48
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x10
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x36
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x20
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x28
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x50
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x38
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x78
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x70
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x30
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x08
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x40
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x58
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x60
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x68
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x10
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x2e
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x60
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x58
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x30
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x40
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x50
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x18
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x20
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x78
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x68
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x70
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x38
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x08
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x28
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x48
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x60
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x70
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x28
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x68
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x08
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x20
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x78
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x50
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- MOVQ (SI), X12
- VPSHUFD $0x4e, 64(SI), X13
- MOVQ 56(SI), X14
- MOVQ 16(SI), X15
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x30
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x58
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x68
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x60
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x58
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x08
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x38
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x18
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x70
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x48
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- MOVQ 40(SI), X12
- MOVQ 64(SI), X13
- MOVQ (SI), X14
- MOVQ 48(SI), X15
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x78
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x10
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x20
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x50
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- MOVQ 48(SI), X12
- MOVQ 88(SI), X13
- MOVQ 120(SI), X14
- MOVQ 24(SI), X15
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x70
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x2e
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x48
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x40
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- VMOVDQU 96(SI), X12
- MOVQ 8(SI), X13
- MOVQ 16(SI), X14
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x50
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x38
- BYTE $0x01
- VMOVDQU 32(SI), X15
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x66
- BYTE $0x50
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x6e
- BYTE $0x38
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x76
- BYTE $0x10
- BYTE $0xc5
- BYTE $0x7a
- BYTE $0x7e
- BYTE $0x7e
- BYTE $0x30
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x40
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x08
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x20
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x7e
- BYTE $0x28
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- MOVQ 120(SI), X12
- MOVQ 24(SI), X13
- MOVQ 88(SI), X14
- MOVQ 96(SI), X15
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x99
- BYTE $0x22
- BYTE $0x66
- BYTE $0x48
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x91
- BYTE $0x22
- BYTE $0x6e
- BYTE $0x68
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x89
- BYTE $0x22
- BYTE $0x76
- BYTE $0x70
- BYTE $0x01
- BYTE $0xc4
- BYTE $0x63
- BYTE $0x81
- BYTE $0x22
- BYTE $0x3e
- BYTE $0x01
- VPADDQ X12, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X13, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ X14, X0, X0
- VPADDQ X2, X0, X0
- VPADDQ X15, X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- VPADDQ 16(R10), X0, X0
- VPADDQ X2, X0, X0
- VPADDQ 32(R10), X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ 48(R10), X0, X0
- VPADDQ X2, X0, X0
- VPADDQ 64(R10), X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- VPADDQ 80(R10), X0, X0
- VPADDQ X2, X0, X0
- VPADDQ 96(R10), X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ 112(R10), X0, X0
- VPADDQ X2, X0, X0
- VPADDQ 128(R10), X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- VPADDQ 144(R10), X0, X0
- VPADDQ X2, X0, X0
- VPADDQ 160(R10), X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ 176(R10), X0, X0
- VPADDQ X2, X0, X0
- VPADDQ 192(R10), X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X6, X13
- VMOVDQA X2, X14
- VMOVDQA X4, X6
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x11
- BYTE $0x6c
- BYTE $0xfd
- VMOVDQA X5, X4
- VMOVDQA X6, X5
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xff
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x69
- BYTE $0x6d
- BYTE $0xd7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xdf
- VPADDQ 208(R10), X0, X0
- VPADDQ X2, X0, X0
- VPADDQ 224(R10), X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFD $-79, X6, X6
- VPSHUFD $-79, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPSHUFB X8, X2, X2
- VPSHUFB X8, X3, X3
- VPADDQ 240(R10), X0, X0
- VPADDQ X2, X0, X0
- VPADDQ 256(R10), X1, X1
- VPADDQ X3, X1, X1
- VPXOR X0, X6, X6
- VPXOR X1, X7, X7
- VPSHUFB X9, X6, X6
- VPSHUFB X9, X7, X7
- VPADDQ X6, X4, X4
- VPADDQ X7, X5, X5
- VPXOR X4, X2, X2
- VPXOR X5, X3, X3
- VPADDQ X2, X2, X15
- VPSRLQ $0x3f, X2, X2
- VPXOR X15, X2, X2
- VPADDQ X3, X3, X15
- VPSRLQ $0x3f, X3, X3
- VPXOR X15, X3, X3
- VMOVDQA X2, X13
- VMOVDQA X4, X14
- BYTE $0xc5
- BYTE $0x69
- BYTE $0x6c
- BYTE $0xfa
- VMOVDQA X5, X4
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x61
- BYTE $0x6d
- BYTE $0xd7
- VMOVDQA X14, X5
- BYTE $0xc5
- BYTE $0x61
- BYTE $0x6c
- BYTE $0xfb
- VMOVDQA X6, X14
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x11
- BYTE $0x6d
- BYTE $0xdf
- BYTE $0xc5
- BYTE $0x41
- BYTE $0x6c
- BYTE $0xff
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x49
- BYTE $0x6d
- BYTE $0xf7
- BYTE $0xc4
- BYTE $0x41
- BYTE $0x09
- BYTE $0x6c
- BYTE $0xfe
- BYTE $0xc4
- BYTE $0xc1
- BYTE $0x41
- BYTE $0x6d
- BYTE $0xff
- VMOVDQU 32(AX), X14
- VMOVDQU 48(AX), X15
- VPXOR X0, X10, X10
- VPXOR X1, X11, X11
- VPXOR X2, X14, X14
- VPXOR X3, X15, X15
- VPXOR X4, X10, X10
- VPXOR X5, X11, X11
- VPXOR X6, X14, X2
- VPXOR X7, X15, X3
- VMOVDQU X2, 32(AX)
- VMOVDQU X3, 48(AX)
- LEAQ 128(SI), SI
- SUBQ $0x80, DI
- JNE loop
- VMOVDQU X10, (AX)
- VMOVDQU X11, 16(AX)
- MOVQ R8, (BX)
- MOVQ R9, 8(BX)
- VZEROUPPER
- RET
-
-DATA ·AVX_c40<>+0(SB)/8, $0x0201000706050403
-DATA ·AVX_c40<>+8(SB)/8, $0x0a09080f0e0d0c0b
-GLOBL ·AVX_c40<>(SB), RODATA|NOPTR, $16
-
-DATA ·AVX_c48<>+0(SB)/8, $0x0100070605040302
-DATA ·AVX_c48<>+8(SB)/8, $0x09080f0e0d0c0b0a
-GLOBL ·AVX_c48<>(SB), RODATA|NOPTR, $16
-
-DATA ·AVX_iv3<>+0(SB)/8, $0x1f83d9abfb41bd6b
-DATA ·AVX_iv3<>+8(SB)/8, $0x5be0cd19137e2179
-GLOBL ·AVX_iv3<>(SB), RODATA|NOPTR, $16
-
-DATA ·AVX_iv0<>+0(SB)/8, $0x6a09e667f3bcc908
-DATA ·AVX_iv0<>+8(SB)/8, $0xbb67ae8584caa73b
-GLOBL ·AVX_iv0<>(SB), RODATA|NOPTR, $16
-
-DATA ·AVX_iv1<>+0(SB)/8, $0x3c6ef372fe94f82b
-DATA ·AVX_iv1<>+8(SB)/8, $0xa54ff53a5f1d36f1
-GLOBL ·AVX_iv1<>(SB), RODATA|NOPTR, $16
-
-DATA ·AVX_iv2<>+0(SB)/8, $0x510e527fade682d1
-DATA ·AVX_iv2<>+8(SB)/8, $0x9b05688c2b3e6c1f
-GLOBL ·AVX_iv2<>(SB), RODATA|NOPTR, $16
diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s b/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s
deleted file mode 100644
index 9a0ce2124..000000000
--- a/vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s
+++ /dev/null
@@ -1,1441 +0,0 @@
-// Code generated by command: go run blake2b_amd64_asm.go -out ../../blake2b_amd64.s -pkg blake2b. DO NOT EDIT.
-
-//go:build amd64 && gc && !purego
-
-#include "textflag.h"
-
-// func hashBlocksSSE4(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte)
-// Requires: SSE2, SSE4.1, SSSE3
-TEXT ·hashBlocksSSE4(SB), NOSPLIT, $288-48
- MOVQ h+0(FP), AX
- MOVQ c+8(FP), BX
- MOVQ flag+16(FP), CX
- MOVQ blocks_base+24(FP), SI
- MOVQ blocks_len+32(FP), DI
- MOVQ SP, R10
- ADDQ $0x0f, R10
- ANDQ $-16, R10
- MOVOU ·iv3<>+0(SB), X0
- MOVO X0, (R10)
- XORQ CX, (R10)
- MOVOU ·c40<>+0(SB), X13
- MOVOU ·c48<>+0(SB), X14
- MOVOU (AX), X12
- MOVOU 16(AX), X15
- MOVQ (BX), R8
- MOVQ 8(BX), R9
-
-loop:
- ADDQ $0x80, R8
- CMPQ R8, $0x80
- JGE noinc
- INCQ R9
-
-noinc:
- MOVQ R8, X8
- PINSRQ $0x01, R9, X8
- MOVO X12, X0
- MOVO X15, X1
- MOVOU 32(AX), X2
- MOVOU 48(AX), X3
- MOVOU ·iv0<>+0(SB), X4
- MOVOU ·iv1<>+0(SB), X5
- MOVOU ·iv2<>+0(SB), X6
- PXOR X8, X6
- MOVO (R10), X7
- MOVQ (SI), X8
- PINSRQ $0x01, 16(SI), X8
- MOVQ 32(SI), X9
- PINSRQ $0x01, 48(SI), X9
- MOVQ 8(SI), X10
- PINSRQ $0x01, 24(SI), X10
- MOVQ 40(SI), X11
- PINSRQ $0x01, 56(SI), X11
- MOVO X8, 16(R10)
- MOVO X9, 32(R10)
- MOVO X10, 48(R10)
- MOVO X11, 64(R10)
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 64(SI), X8
- PINSRQ $0x01, 80(SI), X8
- MOVQ 96(SI), X9
- PINSRQ $0x01, 112(SI), X9
- MOVQ 72(SI), X10
- PINSRQ $0x01, 88(SI), X10
- MOVQ 104(SI), X11
- PINSRQ $0x01, 120(SI), X11
- MOVO X8, 80(R10)
- MOVO X9, 96(R10)
- MOVO X10, 112(R10)
- MOVO X11, 128(R10)
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 112(SI), X8
- PINSRQ $0x01, 32(SI), X8
- MOVQ 72(SI), X9
- PINSRQ $0x01, 104(SI), X9
- MOVQ 80(SI), X10
- PINSRQ $0x01, 64(SI), X10
- MOVQ 120(SI), X11
- PINSRQ $0x01, 48(SI), X11
- MOVO X8, 144(R10)
- MOVO X9, 160(R10)
- MOVO X10, 176(R10)
- MOVO X11, 192(R10)
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 8(SI), X8
- PINSRQ $0x01, (SI), X8
- MOVQ 88(SI), X9
- PINSRQ $0x01, 40(SI), X9
- MOVQ 96(SI), X10
- PINSRQ $0x01, 16(SI), X10
- MOVQ 56(SI), X11
- PINSRQ $0x01, 24(SI), X11
- MOVO X8, 208(R10)
- MOVO X9, 224(R10)
- MOVO X10, 240(R10)
- MOVO X11, 256(R10)
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 88(SI), X8
- PINSRQ $0x01, 96(SI), X8
- MOVQ 40(SI), X9
- PINSRQ $0x01, 120(SI), X9
- MOVQ 64(SI), X10
- PINSRQ $0x01, (SI), X10
- MOVQ 16(SI), X11
- PINSRQ $0x01, 104(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 80(SI), X8
- PINSRQ $0x01, 24(SI), X8
- MOVQ 56(SI), X9
- PINSRQ $0x01, 72(SI), X9
- MOVQ 112(SI), X10
- PINSRQ $0x01, 48(SI), X10
- MOVQ 8(SI), X11
- PINSRQ $0x01, 32(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 56(SI), X8
- PINSRQ $0x01, 24(SI), X8
- MOVQ 104(SI), X9
- PINSRQ $0x01, 88(SI), X9
- MOVQ 72(SI), X10
- PINSRQ $0x01, 8(SI), X10
- MOVQ 96(SI), X11
- PINSRQ $0x01, 112(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 16(SI), X8
- PINSRQ $0x01, 40(SI), X8
- MOVQ 32(SI), X9
- PINSRQ $0x01, 120(SI), X9
- MOVQ 48(SI), X10
- PINSRQ $0x01, 80(SI), X10
- MOVQ (SI), X11
- PINSRQ $0x01, 64(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 72(SI), X8
- PINSRQ $0x01, 40(SI), X8
- MOVQ 16(SI), X9
- PINSRQ $0x01, 80(SI), X9
- MOVQ (SI), X10
- PINSRQ $0x01, 56(SI), X10
- MOVQ 32(SI), X11
- PINSRQ $0x01, 120(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 112(SI), X8
- PINSRQ $0x01, 88(SI), X8
- MOVQ 48(SI), X9
- PINSRQ $0x01, 24(SI), X9
- MOVQ 8(SI), X10
- PINSRQ $0x01, 96(SI), X10
- MOVQ 64(SI), X11
- PINSRQ $0x01, 104(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 16(SI), X8
- PINSRQ $0x01, 48(SI), X8
- MOVQ (SI), X9
- PINSRQ $0x01, 64(SI), X9
- MOVQ 96(SI), X10
- PINSRQ $0x01, 80(SI), X10
- MOVQ 88(SI), X11
- PINSRQ $0x01, 24(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 32(SI), X8
- PINSRQ $0x01, 56(SI), X8
- MOVQ 120(SI), X9
- PINSRQ $0x01, 8(SI), X9
- MOVQ 104(SI), X10
- PINSRQ $0x01, 40(SI), X10
- MOVQ 112(SI), X11
- PINSRQ $0x01, 72(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 96(SI), X8
- PINSRQ $0x01, 8(SI), X8
- MOVQ 112(SI), X9
- PINSRQ $0x01, 32(SI), X9
- MOVQ 40(SI), X10
- PINSRQ $0x01, 120(SI), X10
- MOVQ 104(SI), X11
- PINSRQ $0x01, 80(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ (SI), X8
- PINSRQ $0x01, 48(SI), X8
- MOVQ 72(SI), X9
- PINSRQ $0x01, 64(SI), X9
- MOVQ 56(SI), X10
- PINSRQ $0x01, 24(SI), X10
- MOVQ 16(SI), X11
- PINSRQ $0x01, 88(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 104(SI), X8
- PINSRQ $0x01, 56(SI), X8
- MOVQ 96(SI), X9
- PINSRQ $0x01, 24(SI), X9
- MOVQ 88(SI), X10
- PINSRQ $0x01, 112(SI), X10
- MOVQ 8(SI), X11
- PINSRQ $0x01, 72(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 40(SI), X8
- PINSRQ $0x01, 120(SI), X8
- MOVQ 64(SI), X9
- PINSRQ $0x01, 16(SI), X9
- MOVQ (SI), X10
- PINSRQ $0x01, 32(SI), X10
- MOVQ 48(SI), X11
- PINSRQ $0x01, 80(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 48(SI), X8
- PINSRQ $0x01, 112(SI), X8
- MOVQ 88(SI), X9
- PINSRQ $0x01, (SI), X9
- MOVQ 120(SI), X10
- PINSRQ $0x01, 72(SI), X10
- MOVQ 24(SI), X11
- PINSRQ $0x01, 64(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 96(SI), X8
- PINSRQ $0x01, 104(SI), X8
- MOVQ 8(SI), X9
- PINSRQ $0x01, 80(SI), X9
- MOVQ 16(SI), X10
- PINSRQ $0x01, 56(SI), X10
- MOVQ 32(SI), X11
- PINSRQ $0x01, 40(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVQ 80(SI), X8
- PINSRQ $0x01, 64(SI), X8
- MOVQ 56(SI), X9
- PINSRQ $0x01, 8(SI), X9
- MOVQ 16(SI), X10
- PINSRQ $0x01, 32(SI), X10
- MOVQ 48(SI), X11
- PINSRQ $0x01, 40(SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- MOVQ 120(SI), X8
- PINSRQ $0x01, 72(SI), X8
- MOVQ 24(SI), X9
- PINSRQ $0x01, 104(SI), X9
- MOVQ 88(SI), X10
- PINSRQ $0x01, 112(SI), X10
- MOVQ 96(SI), X11
- PINSRQ $0x01, (SI), X11
- PADDQ X8, X0
- PADDQ X9, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ X10, X0
- PADDQ X11, X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- PADDQ 16(R10), X0
- PADDQ 32(R10), X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ 48(R10), X0
- PADDQ 64(R10), X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- PADDQ 80(R10), X0
- PADDQ 96(R10), X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ 112(R10), X0
- PADDQ 128(R10), X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- PADDQ 144(R10), X0
- PADDQ 160(R10), X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ 176(R10), X0
- PADDQ 192(R10), X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X6, X8
- PUNPCKLQDQ X6, X9
- PUNPCKHQDQ X7, X6
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X7, X9
- MOVO X8, X7
- MOVO X2, X8
- PUNPCKHQDQ X9, X7
- PUNPCKLQDQ X3, X9
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X3
- PADDQ 208(R10), X0
- PADDQ 224(R10), X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFD $0xb1, X6, X6
- PSHUFD $0xb1, X7, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- PSHUFB X13, X2
- PSHUFB X13, X3
- PADDQ 240(R10), X0
- PADDQ 256(R10), X1
- PADDQ X2, X0
- PADDQ X3, X1
- PXOR X0, X6
- PXOR X1, X7
- PSHUFB X14, X6
- PSHUFB X14, X7
- PADDQ X6, X4
- PADDQ X7, X5
- PXOR X4, X2
- PXOR X5, X3
- MOVOU X2, X11
- PADDQ X2, X11
- PSRLQ $0x3f, X2
- PXOR X11, X2
- MOVOU X3, X11
- PADDQ X3, X11
- PSRLQ $0x3f, X3
- PXOR X11, X3
- MOVO X4, X8
- MOVO X5, X4
- MOVO X8, X5
- MOVO X2, X8
- PUNPCKLQDQ X2, X9
- PUNPCKHQDQ X3, X2
- PUNPCKHQDQ X9, X2
- PUNPCKLQDQ X3, X9
- MOVO X8, X3
- MOVO X6, X8
- PUNPCKHQDQ X9, X3
- PUNPCKLQDQ X7, X9
- PUNPCKHQDQ X9, X6
- PUNPCKLQDQ X8, X9
- PUNPCKHQDQ X9, X7
- MOVOU 32(AX), X10
- MOVOU 48(AX), X11
- PXOR X0, X12
- PXOR X1, X15
- PXOR X2, X10
- PXOR X3, X11
- PXOR X4, X12
- PXOR X5, X15
- PXOR X6, X10
- PXOR X7, X11
- MOVOU X10, 32(AX)
- MOVOU X11, 48(AX)
- LEAQ 128(SI), SI
- SUBQ $0x80, DI
- JNE loop
- MOVOU X12, (AX)
- MOVOU X15, 16(AX)
- MOVQ R8, (BX)
- MOVQ R9, 8(BX)
- RET
-
-DATA ·iv3<>+0(SB)/8, $0x1f83d9abfb41bd6b
-DATA ·iv3<>+8(SB)/8, $0x5be0cd19137e2179
-GLOBL ·iv3<>(SB), RODATA|NOPTR, $16
-
-DATA ·c40<>+0(SB)/8, $0x0201000706050403
-DATA ·c40<>+8(SB)/8, $0x0a09080f0e0d0c0b
-GLOBL ·c40<>(SB), RODATA|NOPTR, $16
-
-DATA ·c48<>+0(SB)/8, $0x0100070605040302
-DATA ·c48<>+8(SB)/8, $0x09080f0e0d0c0b0a
-GLOBL ·c48<>(SB), RODATA|NOPTR, $16
-
-DATA ·iv0<>+0(SB)/8, $0x6a09e667f3bcc908
-DATA ·iv0<>+8(SB)/8, $0xbb67ae8584caa73b
-GLOBL ·iv0<>(SB), RODATA|NOPTR, $16
-
-DATA ·iv1<>+0(SB)/8, $0x3c6ef372fe94f82b
-DATA ·iv1<>+8(SB)/8, $0xa54ff53a5f1d36f1
-GLOBL ·iv1<>(SB), RODATA|NOPTR, $16
-
-DATA ·iv2<>+0(SB)/8, $0x510e527fade682d1
-DATA ·iv2<>+8(SB)/8, $0x9b05688c2b3e6c1f
-GLOBL ·iv2<>(SB), RODATA|NOPTR, $16
diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_generic.go b/vendor/golang.org/x/crypto/blake2b/blake2b_generic.go
deleted file mode 100644
index 3168a8aa3..000000000
--- a/vendor/golang.org/x/crypto/blake2b/blake2b_generic.go
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package blake2b
-
-import (
- "encoding/binary"
- "math/bits"
-)
-
-// the precomputed values for BLAKE2b
-// there are 12 16-byte arrays - one for each round
-// the entries are calculated from the sigma constants.
-var precomputed = [12][16]byte{
- {0, 2, 4, 6, 1, 3, 5, 7, 8, 10, 12, 14, 9, 11, 13, 15},
- {14, 4, 9, 13, 10, 8, 15, 6, 1, 0, 11, 5, 12, 2, 7, 3},
- {11, 12, 5, 15, 8, 0, 2, 13, 10, 3, 7, 9, 14, 6, 1, 4},
- {7, 3, 13, 11, 9, 1, 12, 14, 2, 5, 4, 15, 6, 10, 0, 8},
- {9, 5, 2, 10, 0, 7, 4, 15, 14, 11, 6, 3, 1, 12, 8, 13},
- {2, 6, 0, 8, 12, 10, 11, 3, 4, 7, 15, 1, 13, 5, 14, 9},
- {12, 1, 14, 4, 5, 15, 13, 10, 0, 6, 9, 8, 7, 3, 2, 11},
- {13, 7, 12, 3, 11, 14, 1, 9, 5, 15, 8, 2, 0, 4, 6, 10},
- {6, 14, 11, 0, 15, 9, 3, 8, 12, 13, 1, 10, 2, 7, 4, 5},
- {10, 8, 7, 1, 2, 4, 6, 5, 15, 9, 3, 13, 11, 14, 12, 0},
- {0, 2, 4, 6, 1, 3, 5, 7, 8, 10, 12, 14, 9, 11, 13, 15}, // equal to the first
- {14, 4, 9, 13, 10, 8, 15, 6, 1, 0, 11, 5, 12, 2, 7, 3}, // equal to the second
-}
-
-func hashBlocksGeneric(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
- var m [16]uint64
- c0, c1 := c[0], c[1]
-
- for i := 0; i < len(blocks); {
- c0 += BlockSize
- if c0 < BlockSize {
- c1++
- }
-
- v0, v1, v2, v3, v4, v5, v6, v7 := h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7]
- v8, v9, v10, v11, v12, v13, v14, v15 := iv[0], iv[1], iv[2], iv[3], iv[4], iv[5], iv[6], iv[7]
- v12 ^= c0
- v13 ^= c1
- v14 ^= flag
-
- for j := range m {
- m[j] = binary.LittleEndian.Uint64(blocks[i:])
- i += 8
- }
-
- for j := range precomputed {
- s := &(precomputed[j])
-
- v0 += m[s[0]]
- v0 += v4
- v12 ^= v0
- v12 = bits.RotateLeft64(v12, -32)
- v8 += v12
- v4 ^= v8
- v4 = bits.RotateLeft64(v4, -24)
- v1 += m[s[1]]
- v1 += v5
- v13 ^= v1
- v13 = bits.RotateLeft64(v13, -32)
- v9 += v13
- v5 ^= v9
- v5 = bits.RotateLeft64(v5, -24)
- v2 += m[s[2]]
- v2 += v6
- v14 ^= v2
- v14 = bits.RotateLeft64(v14, -32)
- v10 += v14
- v6 ^= v10
- v6 = bits.RotateLeft64(v6, -24)
- v3 += m[s[3]]
- v3 += v7
- v15 ^= v3
- v15 = bits.RotateLeft64(v15, -32)
- v11 += v15
- v7 ^= v11
- v7 = bits.RotateLeft64(v7, -24)
-
- v0 += m[s[4]]
- v0 += v4
- v12 ^= v0
- v12 = bits.RotateLeft64(v12, -16)
- v8 += v12
- v4 ^= v8
- v4 = bits.RotateLeft64(v4, -63)
- v1 += m[s[5]]
- v1 += v5
- v13 ^= v1
- v13 = bits.RotateLeft64(v13, -16)
- v9 += v13
- v5 ^= v9
- v5 = bits.RotateLeft64(v5, -63)
- v2 += m[s[6]]
- v2 += v6
- v14 ^= v2
- v14 = bits.RotateLeft64(v14, -16)
- v10 += v14
- v6 ^= v10
- v6 = bits.RotateLeft64(v6, -63)
- v3 += m[s[7]]
- v3 += v7
- v15 ^= v3
- v15 = bits.RotateLeft64(v15, -16)
- v11 += v15
- v7 ^= v11
- v7 = bits.RotateLeft64(v7, -63)
-
- v0 += m[s[8]]
- v0 += v5
- v15 ^= v0
- v15 = bits.RotateLeft64(v15, -32)
- v10 += v15
- v5 ^= v10
- v5 = bits.RotateLeft64(v5, -24)
- v1 += m[s[9]]
- v1 += v6
- v12 ^= v1
- v12 = bits.RotateLeft64(v12, -32)
- v11 += v12
- v6 ^= v11
- v6 = bits.RotateLeft64(v6, -24)
- v2 += m[s[10]]
- v2 += v7
- v13 ^= v2
- v13 = bits.RotateLeft64(v13, -32)
- v8 += v13
- v7 ^= v8
- v7 = bits.RotateLeft64(v7, -24)
- v3 += m[s[11]]
- v3 += v4
- v14 ^= v3
- v14 = bits.RotateLeft64(v14, -32)
- v9 += v14
- v4 ^= v9
- v4 = bits.RotateLeft64(v4, -24)
-
- v0 += m[s[12]]
- v0 += v5
- v15 ^= v0
- v15 = bits.RotateLeft64(v15, -16)
- v10 += v15
- v5 ^= v10
- v5 = bits.RotateLeft64(v5, -63)
- v1 += m[s[13]]
- v1 += v6
- v12 ^= v1
- v12 = bits.RotateLeft64(v12, -16)
- v11 += v12
- v6 ^= v11
- v6 = bits.RotateLeft64(v6, -63)
- v2 += m[s[14]]
- v2 += v7
- v13 ^= v2
- v13 = bits.RotateLeft64(v13, -16)
- v8 += v13
- v7 ^= v8
- v7 = bits.RotateLeft64(v7, -63)
- v3 += m[s[15]]
- v3 += v4
- v14 ^= v3
- v14 = bits.RotateLeft64(v14, -16)
- v9 += v14
- v4 ^= v9
- v4 = bits.RotateLeft64(v4, -63)
-
- }
-
- h[0] ^= v0 ^ v8
- h[1] ^= v1 ^ v9
- h[2] ^= v2 ^ v10
- h[3] ^= v3 ^ v11
- h[4] ^= v4 ^ v12
- h[5] ^= v5 ^ v13
- h[6] ^= v6 ^ v14
- h[7] ^= v7 ^ v15
- }
- c[0], c[1] = c0, c1
-}
diff --git a/vendor/golang.org/x/crypto/blake2b/blake2b_ref.go b/vendor/golang.org/x/crypto/blake2b/blake2b_ref.go
deleted file mode 100644
index 6e28668cd..000000000
--- a/vendor/golang.org/x/crypto/blake2b/blake2b_ref.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !amd64 || purego || !gc
-
-package blake2b
-
-func hashBlocks(h *[8]uint64, c *[2]uint64, flag uint64, blocks []byte) {
- hashBlocksGeneric(h, c, flag, blocks)
-}
diff --git a/vendor/golang.org/x/crypto/blake2b/blake2x.go b/vendor/golang.org/x/crypto/blake2b/blake2x.go
deleted file mode 100644
index 52c414db0..000000000
--- a/vendor/golang.org/x/crypto/blake2b/blake2x.go
+++ /dev/null
@@ -1,177 +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 blake2b
-
-import (
- "encoding/binary"
- "errors"
- "io"
-)
-
-// XOF defines the interface to hash functions that
-// support arbitrary-length output.
-type XOF interface {
- // Write absorbs more data into the hash's state. It panics if called
- // after Read.
- io.Writer
-
- // Read reads more output from the hash. It returns io.EOF if the limit
- // has been reached.
- io.Reader
-
- // Clone returns a copy of the XOF in its current state.
- Clone() XOF
-
- // Reset resets the XOF to its initial state.
- Reset()
-}
-
-// OutputLengthUnknown can be used as the size argument to NewXOF to indicate
-// the length of the output is not known in advance.
-const OutputLengthUnknown = 0
-
-// magicUnknownOutputLength is a magic value for the output size that indicates
-// an unknown number of output bytes.
-const magicUnknownOutputLength = (1 << 32) - 1
-
-// maxOutputLength is the absolute maximum number of bytes to produce when the
-// number of output bytes is unknown.
-const maxOutputLength = (1 << 32) * 64
-
-// NewXOF creates a new variable-output-length hash. The hash either produce a
-// known number of bytes (1 <= size < 2**32-1), or an unknown number of bytes
-// (size == OutputLengthUnknown). In the latter case, an absolute limit of
-// 256GiB applies.
-//
-// A non-nil key turns the hash into a MAC. The key must between
-// zero and 32 bytes long.
-func NewXOF(size uint32, key []byte) (XOF, error) {
- if len(key) > Size {
- return nil, errKeySize
- }
- if size == magicUnknownOutputLength {
- // 2^32-1 indicates an unknown number of bytes and thus isn't a
- // valid length.
- return nil, errors.New("blake2b: XOF length too large")
- }
- if size == OutputLengthUnknown {
- size = magicUnknownOutputLength
- }
- x := &xof{
- d: digest{
- size: Size,
- keyLen: len(key),
- },
- length: size,
- }
- copy(x.d.key[:], key)
- x.Reset()
- return x, nil
-}
-
-type xof struct {
- d digest
- length uint32
- remaining uint64
- cfg, root, block [Size]byte
- offset int
- nodeOffset uint32
- readMode bool
-}
-
-func (x *xof) Write(p []byte) (n int, err error) {
- if x.readMode {
- panic("blake2b: write to XOF after read")
- }
- return x.d.Write(p)
-}
-
-func (x *xof) Clone() XOF {
- clone := *x
- return &clone
-}
-
-func (x *xof) Reset() {
- x.cfg[0] = byte(Size)
- binary.LittleEndian.PutUint32(x.cfg[4:], uint32(Size)) // leaf length
- binary.LittleEndian.PutUint32(x.cfg[12:], x.length) // XOF length
- x.cfg[17] = byte(Size) // inner hash size
-
- x.d.Reset()
- x.d.h[1] ^= uint64(x.length) << 32
-
- x.remaining = uint64(x.length)
- if x.remaining == magicUnknownOutputLength {
- x.remaining = maxOutputLength
- }
- x.offset, x.nodeOffset = 0, 0
- x.readMode = false
-}
-
-func (x *xof) Read(p []byte) (n int, err error) {
- if !x.readMode {
- x.d.finalize(&x.root)
- x.readMode = true
- }
-
- if x.remaining == 0 {
- return 0, io.EOF
- }
-
- n = len(p)
- if uint64(n) > x.remaining {
- n = int(x.remaining)
- p = p[:n]
- }
-
- if x.offset > 0 {
- blockRemaining := Size - x.offset
- if n < blockRemaining {
- x.offset += copy(p, x.block[x.offset:])
- x.remaining -= uint64(n)
- return
- }
- copy(p, x.block[x.offset:])
- p = p[blockRemaining:]
- x.offset = 0
- x.remaining -= uint64(blockRemaining)
- }
-
- for len(p) >= Size {
- binary.LittleEndian.PutUint32(x.cfg[8:], x.nodeOffset)
- x.nodeOffset++
-
- x.d.initConfig(&x.cfg)
- x.d.Write(x.root[:])
- x.d.finalize(&x.block)
-
- copy(p, x.block[:])
- p = p[Size:]
- x.remaining -= uint64(Size)
- }
-
- if todo := len(p); todo > 0 {
- if x.remaining < uint64(Size) {
- x.cfg[0] = byte(x.remaining)
- }
- binary.LittleEndian.PutUint32(x.cfg[8:], x.nodeOffset)
- x.nodeOffset++
-
- x.d.initConfig(&x.cfg)
- x.d.Write(x.root[:])
- x.d.finalize(&x.block)
-
- x.offset = copy(p, x.block[:todo])
- x.remaining -= uint64(todo)
- }
- return
-}
-
-func (d *digest) initConfig(cfg *[Size]byte) {
- d.offset, d.c[0], d.c[1] = 0, 0, 0
- for i := range d.h {
- d.h[i] = iv[i] ^ binary.LittleEndian.Uint64(cfg[i*8:])
- }
-}
diff --git a/vendor/golang.org/x/crypto/blake2b/register.go b/vendor/golang.org/x/crypto/blake2b/register.go
deleted file mode 100644
index 54e446e1d..000000000
--- a/vendor/golang.org/x/crypto/blake2b/register.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package blake2b
-
-import (
- "crypto"
- "hash"
-)
-
-func init() {
- newHash256 := func() hash.Hash {
- h, _ := New256(nil)
- return h
- }
- newHash384 := func() hash.Hash {
- h, _ := New384(nil)
- return h
- }
-
- newHash512 := func() hash.Hash {
- h, _ := New512(nil)
- return h
- }
-
- crypto.RegisterHash(crypto.BLAKE2b_256, newHash256)
- crypto.RegisterHash(crypto.BLAKE2b_384, newHash384)
- crypto.RegisterHash(crypto.BLAKE2b_512, newHash512)
-}
diff --git a/vendor/golang.org/x/crypto/blowfish/block.go b/vendor/golang.org/x/crypto/blowfish/block.go
deleted file mode 100644
index 9d80f1952..000000000
--- a/vendor/golang.org/x/crypto/blowfish/block.go
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package blowfish
-
-// getNextWord returns the next big-endian uint32 value from the byte slice
-// at the given position in a circular manner, updating the position.
-func getNextWord(b []byte, pos *int) uint32 {
- var w uint32
- j := *pos
- for i := 0; i < 4; i++ {
- w = w<<8 | uint32(b[j])
- j++
- if j >= len(b) {
- j = 0
- }
- }
- *pos = j
- return w
-}
-
-// ExpandKey performs a key expansion on the given *Cipher. Specifically, it
-// performs the Blowfish algorithm's key schedule which sets up the *Cipher's
-// pi and substitution tables for calls to Encrypt. This is used, primarily,
-// by the bcrypt package to reuse the Blowfish key schedule during its
-// set up. It's unlikely that you need to use this directly.
-func ExpandKey(key []byte, c *Cipher) {
- j := 0
- for i := 0; i < 18; i++ {
- // Using inlined getNextWord for performance.
- var d uint32
- for k := 0; k < 4; k++ {
- d = d<<8 | uint32(key[j])
- j++
- if j >= len(key) {
- j = 0
- }
- }
- c.p[i] ^= d
- }
-
- var l, r uint32
- for i := 0; i < 18; i += 2 {
- l, r = encryptBlock(l, r, c)
- c.p[i], c.p[i+1] = l, r
- }
-
- for i := 0; i < 256; i += 2 {
- l, r = encryptBlock(l, r, c)
- c.s0[i], c.s0[i+1] = l, r
- }
- for i := 0; i < 256; i += 2 {
- l, r = encryptBlock(l, r, c)
- c.s1[i], c.s1[i+1] = l, r
- }
- for i := 0; i < 256; i += 2 {
- l, r = encryptBlock(l, r, c)
- c.s2[i], c.s2[i+1] = l, r
- }
- for i := 0; i < 256; i += 2 {
- l, r = encryptBlock(l, r, c)
- c.s3[i], c.s3[i+1] = l, r
- }
-}
-
-// This is similar to ExpandKey, but folds the salt during the key
-// schedule. While ExpandKey is essentially expandKeyWithSalt with an all-zero
-// salt passed in, reusing ExpandKey turns out to be a place of inefficiency
-// and specializing it here is useful.
-func expandKeyWithSalt(key []byte, salt []byte, c *Cipher) {
- j := 0
- for i := 0; i < 18; i++ {
- c.p[i] ^= getNextWord(key, &j)
- }
-
- j = 0
- var l, r uint32
- for i := 0; i < 18; i += 2 {
- l ^= getNextWord(salt, &j)
- r ^= getNextWord(salt, &j)
- l, r = encryptBlock(l, r, c)
- c.p[i], c.p[i+1] = l, r
- }
-
- for i := 0; i < 256; i += 2 {
- l ^= getNextWord(salt, &j)
- r ^= getNextWord(salt, &j)
- l, r = encryptBlock(l, r, c)
- c.s0[i], c.s0[i+1] = l, r
- }
-
- for i := 0; i < 256; i += 2 {
- l ^= getNextWord(salt, &j)
- r ^= getNextWord(salt, &j)
- l, r = encryptBlock(l, r, c)
- c.s1[i], c.s1[i+1] = l, r
- }
-
- for i := 0; i < 256; i += 2 {
- l ^= getNextWord(salt, &j)
- r ^= getNextWord(salt, &j)
- l, r = encryptBlock(l, r, c)
- c.s2[i], c.s2[i+1] = l, r
- }
-
- for i := 0; i < 256; i += 2 {
- l ^= getNextWord(salt, &j)
- r ^= getNextWord(salt, &j)
- l, r = encryptBlock(l, r, c)
- c.s3[i], c.s3[i+1] = l, r
- }
-}
-
-func encryptBlock(l, r uint32, c *Cipher) (uint32, uint32) {
- xl, xr := l, r
- xl ^= c.p[0]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[1]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[2]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[3]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[4]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[5]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[6]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[7]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[8]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[9]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[10]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[11]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[12]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[13]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[14]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[15]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[16]
- xr ^= c.p[17]
- return xr, xl
-}
-
-func decryptBlock(l, r uint32, c *Cipher) (uint32, uint32) {
- xl, xr := l, r
- xl ^= c.p[17]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[16]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[15]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[14]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[13]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[12]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[11]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[10]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[9]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[8]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[7]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[6]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[5]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[4]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[3]
- xr ^= ((c.s0[byte(xl>>24)] + c.s1[byte(xl>>16)]) ^ c.s2[byte(xl>>8)]) + c.s3[byte(xl)] ^ c.p[2]
- xl ^= ((c.s0[byte(xr>>24)] + c.s1[byte(xr>>16)]) ^ c.s2[byte(xr>>8)]) + c.s3[byte(xr)] ^ c.p[1]
- xr ^= c.p[0]
- return xr, xl
-}
diff --git a/vendor/golang.org/x/crypto/blowfish/cipher.go b/vendor/golang.org/x/crypto/blowfish/cipher.go
deleted file mode 100644
index 089895680..000000000
--- a/vendor/golang.org/x/crypto/blowfish/cipher.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
-//
-// Blowfish is a legacy cipher and its short block size makes it vulnerable to
-// birthday bound attacks (see https://sweet32.info). It should only be used
-// where compatibility with legacy systems, not security, is the goal.
-//
-// Deprecated: any new system should use AES (from crypto/aes, if necessary in
-// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
-// golang.org/x/crypto/chacha20poly1305).
-package blowfish
-
-// The code is a port of Bruce Schneier's C implementation.
-// See https://www.schneier.com/blowfish.html.
-
-import "strconv"
-
-// The Blowfish block size in bytes.
-const BlockSize = 8
-
-// A Cipher is an instance of Blowfish encryption using a particular key.
-type Cipher struct {
- p [18]uint32
- s0, s1, s2, s3 [256]uint32
-}
-
-type KeySizeError int
-
-func (k KeySizeError) Error() string {
- return "crypto/blowfish: invalid key size " + strconv.Itoa(int(k))
-}
-
-// NewCipher creates and returns a Cipher.
-// The key argument should be the Blowfish key, from 1 to 56 bytes.
-func NewCipher(key []byte) (*Cipher, error) {
- var result Cipher
- if k := len(key); k < 1 || k > 56 {
- return nil, KeySizeError(k)
- }
- initCipher(&result)
- ExpandKey(key, &result)
- return &result, nil
-}
-
-// NewSaltedCipher creates a returns a Cipher that folds a salt into its key
-// schedule. For most purposes, NewCipher, instead of NewSaltedCipher, is
-// sufficient and desirable. For bcrypt compatibility, the key can be over 56
-// bytes.
-func NewSaltedCipher(key, salt []byte) (*Cipher, error) {
- if len(salt) == 0 {
- return NewCipher(key)
- }
- var result Cipher
- if k := len(key); k < 1 {
- return nil, KeySizeError(k)
- }
- initCipher(&result)
- expandKeyWithSalt(key, salt, &result)
- return &result, nil
-}
-
-// BlockSize returns the Blowfish block size, 8 bytes.
-// It is necessary to satisfy the Block interface in the
-// package "crypto/cipher".
-func (c *Cipher) BlockSize() int { return BlockSize }
-
-// Encrypt encrypts the 8-byte buffer src using the key k
-// and stores the result in dst.
-// Note that for amounts of data larger than a block,
-// it is not safe to just call Encrypt on successive blocks;
-// instead, use an encryption mode like CBC (see crypto/cipher/cbc.go).
-func (c *Cipher) Encrypt(dst, src []byte) {
- l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
- r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7])
- l, r = encryptBlock(l, r, c)
- dst[0], dst[1], dst[2], dst[3] = byte(l>>24), byte(l>>16), byte(l>>8), byte(l)
- dst[4], dst[5], dst[6], dst[7] = byte(r>>24), byte(r>>16), byte(r>>8), byte(r)
-}
-
-// Decrypt decrypts the 8-byte buffer src using the key k
-// and stores the result in dst.
-func (c *Cipher) Decrypt(dst, src []byte) {
- l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
- r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7])
- l, r = decryptBlock(l, r, c)
- dst[0], dst[1], dst[2], dst[3] = byte(l>>24), byte(l>>16), byte(l>>8), byte(l)
- dst[4], dst[5], dst[6], dst[7] = byte(r>>24), byte(r>>16), byte(r>>8), byte(r)
-}
-
-func initCipher(c *Cipher) {
- copy(c.p[0:], p[0:])
- copy(c.s0[0:], s0[0:])
- copy(c.s1[0:], s1[0:])
- copy(c.s2[0:], s2[0:])
- copy(c.s3[0:], s3[0:])
-}
diff --git a/vendor/golang.org/x/crypto/blowfish/const.go b/vendor/golang.org/x/crypto/blowfish/const.go
deleted file mode 100644
index d04077595..000000000
--- a/vendor/golang.org/x/crypto/blowfish/const.go
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// The startup permutation array and substitution boxes.
-// They are the hexadecimal digits of PI; see:
-// https://www.schneier.com/code/constants.txt.
-
-package blowfish
-
-var s0 = [256]uint32{
- 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96,
- 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
- 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658,
- 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
- 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e,
- 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
- 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6,
- 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
- 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c,
- 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
- 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1,
- 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
- 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a,
- 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
- 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176,
- 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
- 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706,
- 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
- 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b,
- 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
- 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c,
- 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
- 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a,
- 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
- 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760,
- 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
- 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8,
- 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
- 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33,
- 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
- 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0,
- 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
- 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777,
- 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
- 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705,
- 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
- 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e,
- 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
- 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9,
- 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
- 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f,
- 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
- 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a,
-}
-
-var s1 = [256]uint32{
- 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d,
- 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
- 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65,
- 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
- 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9,
- 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
- 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d,
- 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
- 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc,
- 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
- 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908,
- 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
- 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124,
- 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
- 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908,
- 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
- 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b,
- 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
- 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa,
- 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
- 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d,
- 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
- 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5,
- 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
- 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96,
- 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
- 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca,
- 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
- 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77,
- 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
- 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054,
- 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
- 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea,
- 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
- 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646,
- 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
- 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea,
- 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
- 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e,
- 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
- 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd,
- 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
- 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7,
-}
-
-var s2 = [256]uint32{
- 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7,
- 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
- 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af,
- 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
- 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4,
- 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
- 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec,
- 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
- 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332,
- 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
- 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58,
- 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
- 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22,
- 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
- 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60,
- 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
- 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99,
- 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
- 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74,
- 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
- 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3,
- 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
- 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979,
- 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
- 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa,
- 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
- 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086,
- 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
- 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24,
- 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
- 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84,
- 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
- 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09,
- 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
- 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe,
- 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
- 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0,
- 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
- 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188,
- 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
- 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8,
- 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
- 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0,
-}
-
-var s3 = [256]uint32{
- 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742,
- 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
- 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79,
- 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
- 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a,
- 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
- 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1,
- 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
- 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797,
- 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
- 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6,
- 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
- 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba,
- 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
- 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5,
- 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
- 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce,
- 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
- 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd,
- 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
- 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb,
- 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
- 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc,
- 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
- 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc,
- 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
- 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a,
- 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
- 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a,
- 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
- 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b,
- 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
- 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e,
- 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
- 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623,
- 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
- 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a,
- 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
- 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3,
- 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
- 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c,
- 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
- 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6,
-}
-
-var p = [18]uint32{
- 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0,
- 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
- 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b,
-}
diff --git a/vendor/golang.org/x/crypto/cast5/cast5.go b/vendor/golang.org/x/crypto/cast5/cast5.go
deleted file mode 100644
index 016e90215..000000000
--- a/vendor/golang.org/x/crypto/cast5/cast5.go
+++ /dev/null
@@ -1,536 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package cast5 implements CAST5, as defined in RFC 2144.
-//
-// CAST5 is a legacy cipher and its short block size makes it vulnerable to
-// birthday bound attacks (see https://sweet32.info). It should only be used
-// where compatibility with legacy systems, not security, is the goal.
-//
-// Deprecated: any new system should use AES (from crypto/aes, if necessary in
-// an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from
-// golang.org/x/crypto/chacha20poly1305).
-package cast5
-
-import (
- "errors"
- "math/bits"
-)
-
-const BlockSize = 8
-const KeySize = 16
-
-type Cipher struct {
- masking [16]uint32
- rotate [16]uint8
-}
-
-func NewCipher(key []byte) (c *Cipher, err error) {
- if len(key) != KeySize {
- return nil, errors.New("CAST5: keys must be 16 bytes")
- }
-
- c = new(Cipher)
- c.keySchedule(key)
- return
-}
-
-func (c *Cipher) BlockSize() int {
- return BlockSize
-}
-
-func (c *Cipher) Encrypt(dst, src []byte) {
- l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
- r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7])
-
- l, r = r, l^f1(r, c.masking[0], c.rotate[0])
- l, r = r, l^f2(r, c.masking[1], c.rotate[1])
- l, r = r, l^f3(r, c.masking[2], c.rotate[2])
- l, r = r, l^f1(r, c.masking[3], c.rotate[3])
-
- l, r = r, l^f2(r, c.masking[4], c.rotate[4])
- l, r = r, l^f3(r, c.masking[5], c.rotate[5])
- l, r = r, l^f1(r, c.masking[6], c.rotate[6])
- l, r = r, l^f2(r, c.masking[7], c.rotate[7])
-
- l, r = r, l^f3(r, c.masking[8], c.rotate[8])
- l, r = r, l^f1(r, c.masking[9], c.rotate[9])
- l, r = r, l^f2(r, c.masking[10], c.rotate[10])
- l, r = r, l^f3(r, c.masking[11], c.rotate[11])
-
- l, r = r, l^f1(r, c.masking[12], c.rotate[12])
- l, r = r, l^f2(r, c.masking[13], c.rotate[13])
- l, r = r, l^f3(r, c.masking[14], c.rotate[14])
- l, r = r, l^f1(r, c.masking[15], c.rotate[15])
-
- dst[0] = uint8(r >> 24)
- dst[1] = uint8(r >> 16)
- dst[2] = uint8(r >> 8)
- dst[3] = uint8(r)
- dst[4] = uint8(l >> 24)
- dst[5] = uint8(l >> 16)
- dst[6] = uint8(l >> 8)
- dst[7] = uint8(l)
-}
-
-func (c *Cipher) Decrypt(dst, src []byte) {
- l := uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
- r := uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7])
-
- l, r = r, l^f1(r, c.masking[15], c.rotate[15])
- l, r = r, l^f3(r, c.masking[14], c.rotate[14])
- l, r = r, l^f2(r, c.masking[13], c.rotate[13])
- l, r = r, l^f1(r, c.masking[12], c.rotate[12])
-
- l, r = r, l^f3(r, c.masking[11], c.rotate[11])
- l, r = r, l^f2(r, c.masking[10], c.rotate[10])
- l, r = r, l^f1(r, c.masking[9], c.rotate[9])
- l, r = r, l^f3(r, c.masking[8], c.rotate[8])
-
- l, r = r, l^f2(r, c.masking[7], c.rotate[7])
- l, r = r, l^f1(r, c.masking[6], c.rotate[6])
- l, r = r, l^f3(r, c.masking[5], c.rotate[5])
- l, r = r, l^f2(r, c.masking[4], c.rotate[4])
-
- l, r = r, l^f1(r, c.masking[3], c.rotate[3])
- l, r = r, l^f3(r, c.masking[2], c.rotate[2])
- l, r = r, l^f2(r, c.masking[1], c.rotate[1])
- l, r = r, l^f1(r, c.masking[0], c.rotate[0])
-
- dst[0] = uint8(r >> 24)
- dst[1] = uint8(r >> 16)
- dst[2] = uint8(r >> 8)
- dst[3] = uint8(r)
- dst[4] = uint8(l >> 24)
- dst[5] = uint8(l >> 16)
- dst[6] = uint8(l >> 8)
- dst[7] = uint8(l)
-}
-
-type keyScheduleA [4][7]uint8
-type keyScheduleB [4][5]uint8
-
-// keyScheduleRound contains the magic values for a round of the key schedule.
-// The keyScheduleA deals with the lines like:
-// z0z1z2z3 = x0x1x2x3 ^ S5[xD] ^ S6[xF] ^ S7[xC] ^ S8[xE] ^ S7[x8]
-// Conceptually, both x and z are in the same array, x first. The first
-// element describes which word of this array gets written to and the
-// second, which word gets read. So, for the line above, it's "4, 0", because
-// it's writing to the first word of z, which, being after x, is word 4, and
-// reading from the first word of x: word 0.
-//
-// Next are the indexes into the S-boxes. Now the array is treated as bytes. So
-// "xD" is 0xd. The first byte of z is written as "16 + 0", just to be clear
-// that it's z that we're indexing.
-//
-// keyScheduleB deals with lines like:
-// K1 = S5[z8] ^ S6[z9] ^ S7[z7] ^ S8[z6] ^ S5[z2]
-// "K1" is ignored because key words are always written in order. So the five
-// elements are the S-box indexes. They use the same form as in keyScheduleA,
-// above.
-
-type keyScheduleRound struct{}
-type keySchedule []keyScheduleRound
-
-var schedule = []struct {
- a keyScheduleA
- b keyScheduleB
-}{
- {
- keyScheduleA{
- {4, 0, 0xd, 0xf, 0xc, 0xe, 0x8},
- {5, 2, 16 + 0, 16 + 2, 16 + 1, 16 + 3, 0xa},
- {6, 3, 16 + 7, 16 + 6, 16 + 5, 16 + 4, 9},
- {7, 1, 16 + 0xa, 16 + 9, 16 + 0xb, 16 + 8, 0xb},
- },
- keyScheduleB{
- {16 + 8, 16 + 9, 16 + 7, 16 + 6, 16 + 2},
- {16 + 0xa, 16 + 0xb, 16 + 5, 16 + 4, 16 + 6},
- {16 + 0xc, 16 + 0xd, 16 + 3, 16 + 2, 16 + 9},
- {16 + 0xe, 16 + 0xf, 16 + 1, 16 + 0, 16 + 0xc},
- },
- },
- {
- keyScheduleA{
- {0, 6, 16 + 5, 16 + 7, 16 + 4, 16 + 6, 16 + 0},
- {1, 4, 0, 2, 1, 3, 16 + 2},
- {2, 5, 7, 6, 5, 4, 16 + 1},
- {3, 7, 0xa, 9, 0xb, 8, 16 + 3},
- },
- keyScheduleB{
- {3, 2, 0xc, 0xd, 8},
- {1, 0, 0xe, 0xf, 0xd},
- {7, 6, 8, 9, 3},
- {5, 4, 0xa, 0xb, 7},
- },
- },
- {
- keyScheduleA{
- {4, 0, 0xd, 0xf, 0xc, 0xe, 8},
- {5, 2, 16 + 0, 16 + 2, 16 + 1, 16 + 3, 0xa},
- {6, 3, 16 + 7, 16 + 6, 16 + 5, 16 + 4, 9},
- {7, 1, 16 + 0xa, 16 + 9, 16 + 0xb, 16 + 8, 0xb},
- },
- keyScheduleB{
- {16 + 3, 16 + 2, 16 + 0xc, 16 + 0xd, 16 + 9},
- {16 + 1, 16 + 0, 16 + 0xe, 16 + 0xf, 16 + 0xc},
- {16 + 7, 16 + 6, 16 + 8, 16 + 9, 16 + 2},
- {16 + 5, 16 + 4, 16 + 0xa, 16 + 0xb, 16 + 6},
- },
- },
- {
- keyScheduleA{
- {0, 6, 16 + 5, 16 + 7, 16 + 4, 16 + 6, 16 + 0},
- {1, 4, 0, 2, 1, 3, 16 + 2},
- {2, 5, 7, 6, 5, 4, 16 + 1},
- {3, 7, 0xa, 9, 0xb, 8, 16 + 3},
- },
- keyScheduleB{
- {8, 9, 7, 6, 3},
- {0xa, 0xb, 5, 4, 7},
- {0xc, 0xd, 3, 2, 8},
- {0xe, 0xf, 1, 0, 0xd},
- },
- },
-}
-
-func (c *Cipher) keySchedule(in []byte) {
- var t [8]uint32
- var k [32]uint32
-
- for i := 0; i < 4; i++ {
- j := i * 4
- t[i] = uint32(in[j])<<24 | uint32(in[j+1])<<16 | uint32(in[j+2])<<8 | uint32(in[j+3])
- }
-
- x := []byte{6, 7, 4, 5}
- ki := 0
-
- for half := 0; half < 2; half++ {
- for _, round := range schedule {
- for j := 0; j < 4; j++ {
- var a [7]uint8
- copy(a[:], round.a[j][:])
- w := t[a[1]]
- w ^= sBox[4][(t[a[2]>>2]>>(24-8*(a[2]&3)))&0xff]
- w ^= sBox[5][(t[a[3]>>2]>>(24-8*(a[3]&3)))&0xff]
- w ^= sBox[6][(t[a[4]>>2]>>(24-8*(a[4]&3)))&0xff]
- w ^= sBox[7][(t[a[5]>>2]>>(24-8*(a[5]&3)))&0xff]
- w ^= sBox[x[j]][(t[a[6]>>2]>>(24-8*(a[6]&3)))&0xff]
- t[a[0]] = w
- }
-
- for j := 0; j < 4; j++ {
- var b [5]uint8
- copy(b[:], round.b[j][:])
- w := sBox[4][(t[b[0]>>2]>>(24-8*(b[0]&3)))&0xff]
- w ^= sBox[5][(t[b[1]>>2]>>(24-8*(b[1]&3)))&0xff]
- w ^= sBox[6][(t[b[2]>>2]>>(24-8*(b[2]&3)))&0xff]
- w ^= sBox[7][(t[b[3]>>2]>>(24-8*(b[3]&3)))&0xff]
- w ^= sBox[4+j][(t[b[4]>>2]>>(24-8*(b[4]&3)))&0xff]
- k[ki] = w
- ki++
- }
- }
- }
-
- for i := 0; i < 16; i++ {
- c.masking[i] = k[i]
- c.rotate[i] = uint8(k[16+i] & 0x1f)
- }
-}
-
-// These are the three 'f' functions. See RFC 2144, section 2.2.
-func f1(d, m uint32, r uint8) uint32 {
- t := m + d
- I := bits.RotateLeft32(t, int(r))
- return ((sBox[0][I>>24] ^ sBox[1][(I>>16)&0xff]) - sBox[2][(I>>8)&0xff]) + sBox[3][I&0xff]
-}
-
-func f2(d, m uint32, r uint8) uint32 {
- t := m ^ d
- I := bits.RotateLeft32(t, int(r))
- return ((sBox[0][I>>24] - sBox[1][(I>>16)&0xff]) + sBox[2][(I>>8)&0xff]) ^ sBox[3][I&0xff]
-}
-
-func f3(d, m uint32, r uint8) uint32 {
- t := m - d
- I := bits.RotateLeft32(t, int(r))
- return ((sBox[0][I>>24] + sBox[1][(I>>16)&0xff]) ^ sBox[2][(I>>8)&0xff]) - sBox[3][I&0xff]
-}
-
-var sBox = [8][256]uint32{
- {
- 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f, 0x9c004dd3, 0x6003e540, 0xcf9fc949,
- 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0, 0x15c361d2, 0xc2e7661d, 0x22d4ff8e,
- 0x28683b6f, 0xc07fd059, 0xff2379c8, 0x775f50e2, 0x43c340d3, 0xdf2f8656, 0x887ca41a, 0xa2d2bd2d,
- 0xa1c9e0d6, 0x346c4819, 0x61b76d87, 0x22540f2f, 0x2abe32e1, 0xaa54166b, 0x22568e3a, 0xa2d341d0,
- 0x66db40c8, 0xa784392f, 0x004dff2f, 0x2db9d2de, 0x97943fac, 0x4a97c1d8, 0x527644b7, 0xb5f437a7,
- 0xb82cbaef, 0xd751d159, 0x6ff7f0ed, 0x5a097a1f, 0x827b68d0, 0x90ecf52e, 0x22b0c054, 0xbc8e5935,
- 0x4b6d2f7f, 0x50bb64a2, 0xd2664910, 0xbee5812d, 0xb7332290, 0xe93b159f, 0xb48ee411, 0x4bff345d,
- 0xfd45c240, 0xad31973f, 0xc4f6d02e, 0x55fc8165, 0xd5b1caad, 0xa1ac2dae, 0xa2d4b76d, 0xc19b0c50,
- 0x882240f2, 0x0c6e4f38, 0xa4e4bfd7, 0x4f5ba272, 0x564c1d2f, 0xc59c5319, 0xb949e354, 0xb04669fe,
- 0xb1b6ab8a, 0xc71358dd, 0x6385c545, 0x110f935d, 0x57538ad5, 0x6a390493, 0xe63d37e0, 0x2a54f6b3,
- 0x3a787d5f, 0x6276a0b5, 0x19a6fcdf, 0x7a42206a, 0x29f9d4d5, 0xf61b1891, 0xbb72275e, 0xaa508167,
- 0x38901091, 0xc6b505eb, 0x84c7cb8c, 0x2ad75a0f, 0x874a1427, 0xa2d1936b, 0x2ad286af, 0xaa56d291,
- 0xd7894360, 0x425c750d, 0x93b39e26, 0x187184c9, 0x6c00b32d, 0x73e2bb14, 0xa0bebc3c, 0x54623779,
- 0x64459eab, 0x3f328b82, 0x7718cf82, 0x59a2cea6, 0x04ee002e, 0x89fe78e6, 0x3fab0950, 0x325ff6c2,
- 0x81383f05, 0x6963c5c8, 0x76cb5ad6, 0xd49974c9, 0xca180dcf, 0x380782d5, 0xc7fa5cf6, 0x8ac31511,
- 0x35e79e13, 0x47da91d0, 0xf40f9086, 0xa7e2419e, 0x31366241, 0x051ef495, 0xaa573b04, 0x4a805d8d,
- 0x548300d0, 0x00322a3c, 0xbf64cddf, 0xba57a68e, 0x75c6372b, 0x50afd341, 0xa7c13275, 0x915a0bf5,
- 0x6b54bfab, 0x2b0b1426, 0xab4cc9d7, 0x449ccd82, 0xf7fbf265, 0xab85c5f3, 0x1b55db94, 0xaad4e324,
- 0xcfa4bd3f, 0x2deaa3e2, 0x9e204d02, 0xc8bd25ac, 0xeadf55b3, 0xd5bd9e98, 0xe31231b2, 0x2ad5ad6c,
- 0x954329de, 0xadbe4528, 0xd8710f69, 0xaa51c90f, 0xaa786bf6, 0x22513f1e, 0xaa51a79b, 0x2ad344cc,
- 0x7b5a41f0, 0xd37cfbad, 0x1b069505, 0x41ece491, 0xb4c332e6, 0x032268d4, 0xc9600acc, 0xce387e6d,
- 0xbf6bb16c, 0x6a70fb78, 0x0d03d9c9, 0xd4df39de, 0xe01063da, 0x4736f464, 0x5ad328d8, 0xb347cc96,
- 0x75bb0fc3, 0x98511bfb, 0x4ffbcc35, 0xb58bcf6a, 0xe11f0abc, 0xbfc5fe4a, 0xa70aec10, 0xac39570a,
- 0x3f04442f, 0x6188b153, 0xe0397a2e, 0x5727cb79, 0x9ceb418f, 0x1cacd68d, 0x2ad37c96, 0x0175cb9d,
- 0xc69dff09, 0xc75b65f0, 0xd9db40d8, 0xec0e7779, 0x4744ead4, 0xb11c3274, 0xdd24cb9e, 0x7e1c54bd,
- 0xf01144f9, 0xd2240eb1, 0x9675b3fd, 0xa3ac3755, 0xd47c27af, 0x51c85f4d, 0x56907596, 0xa5bb15e6,
- 0x580304f0, 0xca042cf1, 0x011a37ea, 0x8dbfaadb, 0x35ba3e4a, 0x3526ffa0, 0xc37b4d09, 0xbc306ed9,
- 0x98a52666, 0x5648f725, 0xff5e569d, 0x0ced63d0, 0x7c63b2cf, 0x700b45e1, 0xd5ea50f1, 0x85a92872,
- 0xaf1fbda7, 0xd4234870, 0xa7870bf3, 0x2d3b4d79, 0x42e04198, 0x0cd0ede7, 0x26470db8, 0xf881814c,
- 0x474d6ad7, 0x7c0c5e5c, 0xd1231959, 0x381b7298, 0xf5d2f4db, 0xab838653, 0x6e2f1e23, 0x83719c9e,
- 0xbd91e046, 0x9a56456e, 0xdc39200c, 0x20c8c571, 0x962bda1c, 0xe1e696ff, 0xb141ab08, 0x7cca89b9,
- 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c, 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf,
- },
- {
- 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a, 0xeec5207a, 0x55889c94, 0x72fc0651,
- 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef, 0x5f0c0794, 0x18dcdb7d, 0xa1d6eff3,
- 0xa0b52f7b, 0x59e83605, 0xee15b094, 0xe9ffd909, 0xdc440086, 0xef944459, 0xba83ccb3, 0xe0c3cdfb,
- 0xd1da4181, 0x3b092ab1, 0xf997f1c1, 0xa5e6cf7b, 0x01420ddb, 0xe4e7ef5b, 0x25a1ff41, 0xe180f806,
- 0x1fc41080, 0x179bee7a, 0xd37ac6a9, 0xfe5830a4, 0x98de8b7f, 0x77e83f4e, 0x79929269, 0x24fa9f7b,
- 0xe113c85b, 0xacc40083, 0xd7503525, 0xf7ea615f, 0x62143154, 0x0d554b63, 0x5d681121, 0xc866c359,
- 0x3d63cf73, 0xcee234c0, 0xd4d87e87, 0x5c672b21, 0x071f6181, 0x39f7627f, 0x361e3084, 0xe4eb573b,
- 0x602f64a4, 0xd63acd9c, 0x1bbc4635, 0x9e81032d, 0x2701f50c, 0x99847ab4, 0xa0e3df79, 0xba6cf38c,
- 0x10843094, 0x2537a95e, 0xf46f6ffe, 0xa1ff3b1f, 0x208cfb6a, 0x8f458c74, 0xd9e0a227, 0x4ec73a34,
- 0xfc884f69, 0x3e4de8df, 0xef0e0088, 0x3559648d, 0x8a45388c, 0x1d804366, 0x721d9bfd, 0xa58684bb,
- 0xe8256333, 0x844e8212, 0x128d8098, 0xfed33fb4, 0xce280ae1, 0x27e19ba5, 0xd5a6c252, 0xe49754bd,
- 0xc5d655dd, 0xeb667064, 0x77840b4d, 0xa1b6a801, 0x84db26a9, 0xe0b56714, 0x21f043b7, 0xe5d05860,
- 0x54f03084, 0x066ff472, 0xa31aa153, 0xdadc4755, 0xb5625dbf, 0x68561be6, 0x83ca6b94, 0x2d6ed23b,
- 0xeccf01db, 0xa6d3d0ba, 0xb6803d5c, 0xaf77a709, 0x33b4a34c, 0x397bc8d6, 0x5ee22b95, 0x5f0e5304,
- 0x81ed6f61, 0x20e74364, 0xb45e1378, 0xde18639b, 0x881ca122, 0xb96726d1, 0x8049a7e8, 0x22b7da7b,
- 0x5e552d25, 0x5272d237, 0x79d2951c, 0xc60d894c, 0x488cb402, 0x1ba4fe5b, 0xa4b09f6b, 0x1ca815cf,
- 0xa20c3005, 0x8871df63, 0xb9de2fcb, 0x0cc6c9e9, 0x0beeff53, 0xe3214517, 0xb4542835, 0x9f63293c,
- 0xee41e729, 0x6e1d2d7c, 0x50045286, 0x1e6685f3, 0xf33401c6, 0x30a22c95, 0x31a70850, 0x60930f13,
- 0x73f98417, 0xa1269859, 0xec645c44, 0x52c877a9, 0xcdff33a6, 0xa02b1741, 0x7cbad9a2, 0x2180036f,
- 0x50d99c08, 0xcb3f4861, 0xc26bd765, 0x64a3f6ab, 0x80342676, 0x25a75e7b, 0xe4e6d1fc, 0x20c710e6,
- 0xcdf0b680, 0x17844d3b, 0x31eef84d, 0x7e0824e4, 0x2ccb49eb, 0x846a3bae, 0x8ff77888, 0xee5d60f6,
- 0x7af75673, 0x2fdd5cdb, 0xa11631c1, 0x30f66f43, 0xb3faec54, 0x157fd7fa, 0xef8579cc, 0xd152de58,
- 0xdb2ffd5e, 0x8f32ce19, 0x306af97a, 0x02f03ef8, 0x99319ad5, 0xc242fa0f, 0xa7e3ebb0, 0xc68e4906,
- 0xb8da230c, 0x80823028, 0xdcdef3c8, 0xd35fb171, 0x088a1bc8, 0xbec0c560, 0x61a3c9e8, 0xbca8f54d,
- 0xc72feffa, 0x22822e99, 0x82c570b4, 0xd8d94e89, 0x8b1c34bc, 0x301e16e6, 0x273be979, 0xb0ffeaa6,
- 0x61d9b8c6, 0x00b24869, 0xb7ffce3f, 0x08dc283b, 0x43daf65a, 0xf7e19798, 0x7619b72f, 0x8f1c9ba4,
- 0xdc8637a0, 0x16a7d3b1, 0x9fc393b7, 0xa7136eeb, 0xc6bcc63e, 0x1a513742, 0xef6828bc, 0x520365d6,
- 0x2d6a77ab, 0x3527ed4b, 0x821fd216, 0x095c6e2e, 0xdb92f2fb, 0x5eea29cb, 0x145892f5, 0x91584f7f,
- 0x5483697b, 0x2667a8cc, 0x85196048, 0x8c4bacea, 0x833860d4, 0x0d23e0f9, 0x6c387e8a, 0x0ae6d249,
- 0xb284600c, 0xd835731d, 0xdcb1c647, 0xac4c56ea, 0x3ebd81b3, 0x230eabb0, 0x6438bc87, 0xf0b5b1fa,
- 0x8f5ea2b3, 0xfc184642, 0x0a036b7a, 0x4fb089bd, 0x649da589, 0xa345415e, 0x5c038323, 0x3e5d3bb9,
- 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539, 0x73bfbe70, 0x83877605, 0x4523ecf1,
- },
- {
- 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff, 0x369fe44b, 0x8c1fc644, 0xaececa90,
- 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806, 0xf0ad0548, 0xe13c8d83, 0x927010d5,
- 0x11107d9f, 0x07647db9, 0xb2e3e4d4, 0x3d4f285e, 0xb9afa820, 0xfade82e0, 0xa067268b, 0x8272792e,
- 0x553fb2c0, 0x489ae22b, 0xd4ef9794, 0x125e3fbc, 0x21fffcee, 0x825b1bfd, 0x9255c5ed, 0x1257a240,
- 0x4e1a8302, 0xbae07fff, 0x528246e7, 0x8e57140e, 0x3373f7bf, 0x8c9f8188, 0xa6fc4ee8, 0xc982b5a5,
- 0xa8c01db7, 0x579fc264, 0x67094f31, 0xf2bd3f5f, 0x40fff7c1, 0x1fb78dfc, 0x8e6bd2c1, 0x437be59b,
- 0x99b03dbf, 0xb5dbc64b, 0x638dc0e6, 0x55819d99, 0xa197c81c, 0x4a012d6e, 0xc5884a28, 0xccc36f71,
- 0xb843c213, 0x6c0743f1, 0x8309893c, 0x0feddd5f, 0x2f7fe850, 0xd7c07f7e, 0x02507fbf, 0x5afb9a04,
- 0xa747d2d0, 0x1651192e, 0xaf70bf3e, 0x58c31380, 0x5f98302e, 0x727cc3c4, 0x0a0fb402, 0x0f7fef82,
- 0x8c96fdad, 0x5d2c2aae, 0x8ee99a49, 0x50da88b8, 0x8427f4a0, 0x1eac5790, 0x796fb449, 0x8252dc15,
- 0xefbd7d9b, 0xa672597d, 0xada840d8, 0x45f54504, 0xfa5d7403, 0xe83ec305, 0x4f91751a, 0x925669c2,
- 0x23efe941, 0xa903f12e, 0x60270df2, 0x0276e4b6, 0x94fd6574, 0x927985b2, 0x8276dbcb, 0x02778176,
- 0xf8af918d, 0x4e48f79e, 0x8f616ddf, 0xe29d840e, 0x842f7d83, 0x340ce5c8, 0x96bbb682, 0x93b4b148,
- 0xef303cab, 0x984faf28, 0x779faf9b, 0x92dc560d, 0x224d1e20, 0x8437aa88, 0x7d29dc96, 0x2756d3dc,
- 0x8b907cee, 0xb51fd240, 0xe7c07ce3, 0xe566b4a1, 0xc3e9615e, 0x3cf8209d, 0x6094d1e3, 0xcd9ca341,
- 0x5c76460e, 0x00ea983b, 0xd4d67881, 0xfd47572c, 0xf76cedd9, 0xbda8229c, 0x127dadaa, 0x438a074e,
- 0x1f97c090, 0x081bdb8a, 0x93a07ebe, 0xb938ca15, 0x97b03cff, 0x3dc2c0f8, 0x8d1ab2ec, 0x64380e51,
- 0x68cc7bfb, 0xd90f2788, 0x12490181, 0x5de5ffd4, 0xdd7ef86a, 0x76a2e214, 0xb9a40368, 0x925d958f,
- 0x4b39fffa, 0xba39aee9, 0xa4ffd30b, 0xfaf7933b, 0x6d498623, 0x193cbcfa, 0x27627545, 0x825cf47a,
- 0x61bd8ba0, 0xd11e42d1, 0xcead04f4, 0x127ea392, 0x10428db7, 0x8272a972, 0x9270c4a8, 0x127de50b,
- 0x285ba1c8, 0x3c62f44f, 0x35c0eaa5, 0xe805d231, 0x428929fb, 0xb4fcdf82, 0x4fb66a53, 0x0e7dc15b,
- 0x1f081fab, 0x108618ae, 0xfcfd086d, 0xf9ff2889, 0x694bcc11, 0x236a5cae, 0x12deca4d, 0x2c3f8cc5,
- 0xd2d02dfe, 0xf8ef5896, 0xe4cf52da, 0x95155b67, 0x494a488c, 0xb9b6a80c, 0x5c8f82bc, 0x89d36b45,
- 0x3a609437, 0xec00c9a9, 0x44715253, 0x0a874b49, 0xd773bc40, 0x7c34671c, 0x02717ef6, 0x4feb5536,
- 0xa2d02fff, 0xd2bf60c4, 0xd43f03c0, 0x50b4ef6d, 0x07478cd1, 0x006e1888, 0xa2e53f55, 0xb9e6d4bc,
- 0xa2048016, 0x97573833, 0xd7207d67, 0xde0f8f3d, 0x72f87b33, 0xabcc4f33, 0x7688c55d, 0x7b00a6b0,
- 0x947b0001, 0x570075d2, 0xf9bb88f8, 0x8942019e, 0x4264a5ff, 0x856302e0, 0x72dbd92b, 0xee971b69,
- 0x6ea22fde, 0x5f08ae2b, 0xaf7a616d, 0xe5c98767, 0xcf1febd2, 0x61efc8c2, 0xf1ac2571, 0xcc8239c2,
- 0x67214cb8, 0xb1e583d1, 0xb7dc3e62, 0x7f10bdce, 0xf90a5c38, 0x0ff0443d, 0x606e6dc6, 0x60543a49,
- 0x5727c148, 0x2be98a1d, 0x8ab41738, 0x20e1be24, 0xaf96da0f, 0x68458425, 0x99833be5, 0x600d457d,
- 0x282f9350, 0x8334b362, 0xd91d1120, 0x2b6d8da0, 0x642b1e31, 0x9c305a00, 0x52bce688, 0x1b03588a,
- 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636, 0xa133c501, 0xe9d3531c, 0xee353783,
- },
- {
- 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb, 0x64ad8c57, 0x85510443, 0xfa020ed1,
- 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43, 0x6497b7b1, 0xf3641f63, 0x241e4adf,
- 0x28147f5f, 0x4fa2b8cd, 0xc9430040, 0x0cc32220, 0xfdd30b30, 0xc0a5374f, 0x1d2d00d9, 0x24147b15,
- 0xee4d111a, 0x0fca5167, 0x71ff904c, 0x2d195ffe, 0x1a05645f, 0x0c13fefe, 0x081b08ca, 0x05170121,
- 0x80530100, 0xe83e5efe, 0xac9af4f8, 0x7fe72701, 0xd2b8ee5f, 0x06df4261, 0xbb9e9b8a, 0x7293ea25,
- 0xce84ffdf, 0xf5718801, 0x3dd64b04, 0xa26f263b, 0x7ed48400, 0x547eebe6, 0x446d4ca0, 0x6cf3d6f5,
- 0x2649abdf, 0xaea0c7f5, 0x36338cc1, 0x503f7e93, 0xd3772061, 0x11b638e1, 0x72500e03, 0xf80eb2bb,
- 0xabe0502e, 0xec8d77de, 0x57971e81, 0xe14f6746, 0xc9335400, 0x6920318f, 0x081dbb99, 0xffc304a5,
- 0x4d351805, 0x7f3d5ce3, 0xa6c866c6, 0x5d5bcca9, 0xdaec6fea, 0x9f926f91, 0x9f46222f, 0x3991467d,
- 0xa5bf6d8e, 0x1143c44f, 0x43958302, 0xd0214eeb, 0x022083b8, 0x3fb6180c, 0x18f8931e, 0x281658e6,
- 0x26486e3e, 0x8bd78a70, 0x7477e4c1, 0xb506e07c, 0xf32d0a25, 0x79098b02, 0xe4eabb81, 0x28123b23,
- 0x69dead38, 0x1574ca16, 0xdf871b62, 0x211c40b7, 0xa51a9ef9, 0x0014377b, 0x041e8ac8, 0x09114003,
- 0xbd59e4d2, 0xe3d156d5, 0x4fe876d5, 0x2f91a340, 0x557be8de, 0x00eae4a7, 0x0ce5c2ec, 0x4db4bba6,
- 0xe756bdff, 0xdd3369ac, 0xec17b035, 0x06572327, 0x99afc8b0, 0x56c8c391, 0x6b65811c, 0x5e146119,
- 0x6e85cb75, 0xbe07c002, 0xc2325577, 0x893ff4ec, 0x5bbfc92d, 0xd0ec3b25, 0xb7801ab7, 0x8d6d3b24,
- 0x20c763ef, 0xc366a5fc, 0x9c382880, 0x0ace3205, 0xaac9548a, 0xeca1d7c7, 0x041afa32, 0x1d16625a,
- 0x6701902c, 0x9b757a54, 0x31d477f7, 0x9126b031, 0x36cc6fdb, 0xc70b8b46, 0xd9e66a48, 0x56e55a79,
- 0x026a4ceb, 0x52437eff, 0x2f8f76b4, 0x0df980a5, 0x8674cde3, 0xedda04eb, 0x17a9be04, 0x2c18f4df,
- 0xb7747f9d, 0xab2af7b4, 0xefc34d20, 0x2e096b7c, 0x1741a254, 0xe5b6a035, 0x213d42f6, 0x2c1c7c26,
- 0x61c2f50f, 0x6552daf9, 0xd2c231f8, 0x25130f69, 0xd8167fa2, 0x0418f2c8, 0x001a96a6, 0x0d1526ab,
- 0x63315c21, 0x5e0a72ec, 0x49bafefd, 0x187908d9, 0x8d0dbd86, 0x311170a7, 0x3e9b640c, 0xcc3e10d7,
- 0xd5cad3b6, 0x0caec388, 0xf73001e1, 0x6c728aff, 0x71eae2a1, 0x1f9af36e, 0xcfcbd12f, 0xc1de8417,
- 0xac07be6b, 0xcb44a1d8, 0x8b9b0f56, 0x013988c3, 0xb1c52fca, 0xb4be31cd, 0xd8782806, 0x12a3a4e2,
- 0x6f7de532, 0x58fd7eb6, 0xd01ee900, 0x24adffc2, 0xf4990fc5, 0x9711aac5, 0x001d7b95, 0x82e5e7d2,
- 0x109873f6, 0x00613096, 0xc32d9521, 0xada121ff, 0x29908415, 0x7fbb977f, 0xaf9eb3db, 0x29c9ed2a,
- 0x5ce2a465, 0xa730f32c, 0xd0aa3fe8, 0x8a5cc091, 0xd49e2ce7, 0x0ce454a9, 0xd60acd86, 0x015f1919,
- 0x77079103, 0xdea03af6, 0x78a8565e, 0xdee356df, 0x21f05cbe, 0x8b75e387, 0xb3c50651, 0xb8a5c3ef,
- 0xd8eeb6d2, 0xe523be77, 0xc2154529, 0x2f69efdf, 0xafe67afb, 0xf470c4b2, 0xf3e0eb5b, 0xd6cc9876,
- 0x39e4460c, 0x1fda8538, 0x1987832f, 0xca007367, 0xa99144f8, 0x296b299e, 0x492fc295, 0x9266beab,
- 0xb5676e69, 0x9bd3ddda, 0xdf7e052f, 0xdb25701c, 0x1b5e51ee, 0xf65324e6, 0x6afce36c, 0x0316cc04,
- 0x8644213e, 0xb7dc59d0, 0x7965291f, 0xccd6fd43, 0x41823979, 0x932bcdf6, 0xb657c34d, 0x4edfd282,
- 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0, 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2,
- },
- {
- 0x7ec90c04, 0x2c6e74b9, 0x9b0e66df, 0xa6337911, 0xb86a7fff, 0x1dd358f5, 0x44dd9d44, 0x1731167f,
- 0x08fbf1fa, 0xe7f511cc, 0xd2051b00, 0x735aba00, 0x2ab722d8, 0x386381cb, 0xacf6243a, 0x69befd7a,
- 0xe6a2e77f, 0xf0c720cd, 0xc4494816, 0xccf5c180, 0x38851640, 0x15b0a848, 0xe68b18cb, 0x4caadeff,
- 0x5f480a01, 0x0412b2aa, 0x259814fc, 0x41d0efe2, 0x4e40b48d, 0x248eb6fb, 0x8dba1cfe, 0x41a99b02,
- 0x1a550a04, 0xba8f65cb, 0x7251f4e7, 0x95a51725, 0xc106ecd7, 0x97a5980a, 0xc539b9aa, 0x4d79fe6a,
- 0xf2f3f763, 0x68af8040, 0xed0c9e56, 0x11b4958b, 0xe1eb5a88, 0x8709e6b0, 0xd7e07156, 0x4e29fea7,
- 0x6366e52d, 0x02d1c000, 0xc4ac8e05, 0x9377f571, 0x0c05372a, 0x578535f2, 0x2261be02, 0xd642a0c9,
- 0xdf13a280, 0x74b55bd2, 0x682199c0, 0xd421e5ec, 0x53fb3ce8, 0xc8adedb3, 0x28a87fc9, 0x3d959981,
- 0x5c1ff900, 0xfe38d399, 0x0c4eff0b, 0x062407ea, 0xaa2f4fb1, 0x4fb96976, 0x90c79505, 0xb0a8a774,
- 0xef55a1ff, 0xe59ca2c2, 0xa6b62d27, 0xe66a4263, 0xdf65001f, 0x0ec50966, 0xdfdd55bc, 0x29de0655,
- 0x911e739a, 0x17af8975, 0x32c7911c, 0x89f89468, 0x0d01e980, 0x524755f4, 0x03b63cc9, 0x0cc844b2,
- 0xbcf3f0aa, 0x87ac36e9, 0xe53a7426, 0x01b3d82b, 0x1a9e7449, 0x64ee2d7e, 0xcddbb1da, 0x01c94910,
- 0xb868bf80, 0x0d26f3fd, 0x9342ede7, 0x04a5c284, 0x636737b6, 0x50f5b616, 0xf24766e3, 0x8eca36c1,
- 0x136e05db, 0xfef18391, 0xfb887a37, 0xd6e7f7d4, 0xc7fb7dc9, 0x3063fcdf, 0xb6f589de, 0xec2941da,
- 0x26e46695, 0xb7566419, 0xf654efc5, 0xd08d58b7, 0x48925401, 0xc1bacb7f, 0xe5ff550f, 0xb6083049,
- 0x5bb5d0e8, 0x87d72e5a, 0xab6a6ee1, 0x223a66ce, 0xc62bf3cd, 0x9e0885f9, 0x68cb3e47, 0x086c010f,
- 0xa21de820, 0xd18b69de, 0xf3f65777, 0xfa02c3f6, 0x407edac3, 0xcbb3d550, 0x1793084d, 0xb0d70eba,
- 0x0ab378d5, 0xd951fb0c, 0xded7da56, 0x4124bbe4, 0x94ca0b56, 0x0f5755d1, 0xe0e1e56e, 0x6184b5be,
- 0x580a249f, 0x94f74bc0, 0xe327888e, 0x9f7b5561, 0xc3dc0280, 0x05687715, 0x646c6bd7, 0x44904db3,
- 0x66b4f0a3, 0xc0f1648a, 0x697ed5af, 0x49e92ff6, 0x309e374f, 0x2cb6356a, 0x85808573, 0x4991f840,
- 0x76f0ae02, 0x083be84d, 0x28421c9a, 0x44489406, 0x736e4cb8, 0xc1092910, 0x8bc95fc6, 0x7d869cf4,
- 0x134f616f, 0x2e77118d, 0xb31b2be1, 0xaa90b472, 0x3ca5d717, 0x7d161bba, 0x9cad9010, 0xaf462ba2,
- 0x9fe459d2, 0x45d34559, 0xd9f2da13, 0xdbc65487, 0xf3e4f94e, 0x176d486f, 0x097c13ea, 0x631da5c7,
- 0x445f7382, 0x175683f4, 0xcdc66a97, 0x70be0288, 0xb3cdcf72, 0x6e5dd2f3, 0x20936079, 0x459b80a5,
- 0xbe60e2db, 0xa9c23101, 0xeba5315c, 0x224e42f2, 0x1c5c1572, 0xf6721b2c, 0x1ad2fff3, 0x8c25404e,
- 0x324ed72f, 0x4067b7fd, 0x0523138e, 0x5ca3bc78, 0xdc0fd66e, 0x75922283, 0x784d6b17, 0x58ebb16e,
- 0x44094f85, 0x3f481d87, 0xfcfeae7b, 0x77b5ff76, 0x8c2302bf, 0xaaf47556, 0x5f46b02a, 0x2b092801,
- 0x3d38f5f7, 0x0ca81f36, 0x52af4a8a, 0x66d5e7c0, 0xdf3b0874, 0x95055110, 0x1b5ad7a8, 0xf61ed5ad,
- 0x6cf6e479, 0x20758184, 0xd0cefa65, 0x88f7be58, 0x4a046826, 0x0ff6f8f3, 0xa09c7f70, 0x5346aba0,
- 0x5ce96c28, 0xe176eda3, 0x6bac307f, 0x376829d2, 0x85360fa9, 0x17e3fe2a, 0x24b79767, 0xf5a96b20,
- 0xd6cd2595, 0x68ff1ebf, 0x7555442c, 0xf19f06be, 0xf9e0659a, 0xeeb9491d, 0x34010718, 0xbb30cab8,
- 0xe822fe15, 0x88570983, 0x750e6249, 0xda627e55, 0x5e76ffa8, 0xb1534546, 0x6d47de08, 0xefe9e7d4,
- },
- {
- 0xf6fa8f9d, 0x2cac6ce1, 0x4ca34867, 0xe2337f7c, 0x95db08e7, 0x016843b4, 0xeced5cbc, 0x325553ac,
- 0xbf9f0960, 0xdfa1e2ed, 0x83f0579d, 0x63ed86b9, 0x1ab6a6b8, 0xde5ebe39, 0xf38ff732, 0x8989b138,
- 0x33f14961, 0xc01937bd, 0xf506c6da, 0xe4625e7e, 0xa308ea99, 0x4e23e33c, 0x79cbd7cc, 0x48a14367,
- 0xa3149619, 0xfec94bd5, 0xa114174a, 0xeaa01866, 0xa084db2d, 0x09a8486f, 0xa888614a, 0x2900af98,
- 0x01665991, 0xe1992863, 0xc8f30c60, 0x2e78ef3c, 0xd0d51932, 0xcf0fec14, 0xf7ca07d2, 0xd0a82072,
- 0xfd41197e, 0x9305a6b0, 0xe86be3da, 0x74bed3cd, 0x372da53c, 0x4c7f4448, 0xdab5d440, 0x6dba0ec3,
- 0x083919a7, 0x9fbaeed9, 0x49dbcfb0, 0x4e670c53, 0x5c3d9c01, 0x64bdb941, 0x2c0e636a, 0xba7dd9cd,
- 0xea6f7388, 0xe70bc762, 0x35f29adb, 0x5c4cdd8d, 0xf0d48d8c, 0xb88153e2, 0x08a19866, 0x1ae2eac8,
- 0x284caf89, 0xaa928223, 0x9334be53, 0x3b3a21bf, 0x16434be3, 0x9aea3906, 0xefe8c36e, 0xf890cdd9,
- 0x80226dae, 0xc340a4a3, 0xdf7e9c09, 0xa694a807, 0x5b7c5ecc, 0x221db3a6, 0x9a69a02f, 0x68818a54,
- 0xceb2296f, 0x53c0843a, 0xfe893655, 0x25bfe68a, 0xb4628abc, 0xcf222ebf, 0x25ac6f48, 0xa9a99387,
- 0x53bddb65, 0xe76ffbe7, 0xe967fd78, 0x0ba93563, 0x8e342bc1, 0xe8a11be9, 0x4980740d, 0xc8087dfc,
- 0x8de4bf99, 0xa11101a0, 0x7fd37975, 0xda5a26c0, 0xe81f994f, 0x9528cd89, 0xfd339fed, 0xb87834bf,
- 0x5f04456d, 0x22258698, 0xc9c4c83b, 0x2dc156be, 0x4f628daa, 0x57f55ec5, 0xe2220abe, 0xd2916ebf,
- 0x4ec75b95, 0x24f2c3c0, 0x42d15d99, 0xcd0d7fa0, 0x7b6e27ff, 0xa8dc8af0, 0x7345c106, 0xf41e232f,
- 0x35162386, 0xe6ea8926, 0x3333b094, 0x157ec6f2, 0x372b74af, 0x692573e4, 0xe9a9d848, 0xf3160289,
- 0x3a62ef1d, 0xa787e238, 0xf3a5f676, 0x74364853, 0x20951063, 0x4576698d, 0xb6fad407, 0x592af950,
- 0x36f73523, 0x4cfb6e87, 0x7da4cec0, 0x6c152daa, 0xcb0396a8, 0xc50dfe5d, 0xfcd707ab, 0x0921c42f,
- 0x89dff0bb, 0x5fe2be78, 0x448f4f33, 0x754613c9, 0x2b05d08d, 0x48b9d585, 0xdc049441, 0xc8098f9b,
- 0x7dede786, 0xc39a3373, 0x42410005, 0x6a091751, 0x0ef3c8a6, 0x890072d6, 0x28207682, 0xa9a9f7be,
- 0xbf32679d, 0xd45b5b75, 0xb353fd00, 0xcbb0e358, 0x830f220a, 0x1f8fb214, 0xd372cf08, 0xcc3c4a13,
- 0x8cf63166, 0x061c87be, 0x88c98f88, 0x6062e397, 0x47cf8e7a, 0xb6c85283, 0x3cc2acfb, 0x3fc06976,
- 0x4e8f0252, 0x64d8314d, 0xda3870e3, 0x1e665459, 0xc10908f0, 0x513021a5, 0x6c5b68b7, 0x822f8aa0,
- 0x3007cd3e, 0x74719eef, 0xdc872681, 0x073340d4, 0x7e432fd9, 0x0c5ec241, 0x8809286c, 0xf592d891,
- 0x08a930f6, 0x957ef305, 0xb7fbffbd, 0xc266e96f, 0x6fe4ac98, 0xb173ecc0, 0xbc60b42a, 0x953498da,
- 0xfba1ae12, 0x2d4bd736, 0x0f25faab, 0xa4f3fceb, 0xe2969123, 0x257f0c3d, 0x9348af49, 0x361400bc,
- 0xe8816f4a, 0x3814f200, 0xa3f94043, 0x9c7a54c2, 0xbc704f57, 0xda41e7f9, 0xc25ad33a, 0x54f4a084,
- 0xb17f5505, 0x59357cbe, 0xedbd15c8, 0x7f97c5ab, 0xba5ac7b5, 0xb6f6deaf, 0x3a479c3a, 0x5302da25,
- 0x653d7e6a, 0x54268d49, 0x51a477ea, 0x5017d55b, 0xd7d25d88, 0x44136c76, 0x0404a8c8, 0xb8e5a121,
- 0xb81a928a, 0x60ed5869, 0x97c55b96, 0xeaec991b, 0x29935913, 0x01fdb7f1, 0x088e8dfa, 0x9ab6f6f5,
- 0x3b4cbf9f, 0x4a5de3ab, 0xe6051d35, 0xa0e1d855, 0xd36b4cf1, 0xf544edeb, 0xb0e93524, 0xbebb8fbd,
- 0xa2d762cf, 0x49c92f54, 0x38b5f331, 0x7128a454, 0x48392905, 0xa65b1db8, 0x851c97bd, 0xd675cf2f,
- },
- {
- 0x85e04019, 0x332bf567, 0x662dbfff, 0xcfc65693, 0x2a8d7f6f, 0xab9bc912, 0xde6008a1, 0x2028da1f,
- 0x0227bce7, 0x4d642916, 0x18fac300, 0x50f18b82, 0x2cb2cb11, 0xb232e75c, 0x4b3695f2, 0xb28707de,
- 0xa05fbcf6, 0xcd4181e9, 0xe150210c, 0xe24ef1bd, 0xb168c381, 0xfde4e789, 0x5c79b0d8, 0x1e8bfd43,
- 0x4d495001, 0x38be4341, 0x913cee1d, 0x92a79c3f, 0x089766be, 0xbaeeadf4, 0x1286becf, 0xb6eacb19,
- 0x2660c200, 0x7565bde4, 0x64241f7a, 0x8248dca9, 0xc3b3ad66, 0x28136086, 0x0bd8dfa8, 0x356d1cf2,
- 0x107789be, 0xb3b2e9ce, 0x0502aa8f, 0x0bc0351e, 0x166bf52a, 0xeb12ff82, 0xe3486911, 0xd34d7516,
- 0x4e7b3aff, 0x5f43671b, 0x9cf6e037, 0x4981ac83, 0x334266ce, 0x8c9341b7, 0xd0d854c0, 0xcb3a6c88,
- 0x47bc2829, 0x4725ba37, 0xa66ad22b, 0x7ad61f1e, 0x0c5cbafa, 0x4437f107, 0xb6e79962, 0x42d2d816,
- 0x0a961288, 0xe1a5c06e, 0x13749e67, 0x72fc081a, 0xb1d139f7, 0xf9583745, 0xcf19df58, 0xbec3f756,
- 0xc06eba30, 0x07211b24, 0x45c28829, 0xc95e317f, 0xbc8ec511, 0x38bc46e9, 0xc6e6fa14, 0xbae8584a,
- 0xad4ebc46, 0x468f508b, 0x7829435f, 0xf124183b, 0x821dba9f, 0xaff60ff4, 0xea2c4e6d, 0x16e39264,
- 0x92544a8b, 0x009b4fc3, 0xaba68ced, 0x9ac96f78, 0x06a5b79a, 0xb2856e6e, 0x1aec3ca9, 0xbe838688,
- 0x0e0804e9, 0x55f1be56, 0xe7e5363b, 0xb3a1f25d, 0xf7debb85, 0x61fe033c, 0x16746233, 0x3c034c28,
- 0xda6d0c74, 0x79aac56c, 0x3ce4e1ad, 0x51f0c802, 0x98f8f35a, 0x1626a49f, 0xeed82b29, 0x1d382fe3,
- 0x0c4fb99a, 0xbb325778, 0x3ec6d97b, 0x6e77a6a9, 0xcb658b5c, 0xd45230c7, 0x2bd1408b, 0x60c03eb7,
- 0xb9068d78, 0xa33754f4, 0xf430c87d, 0xc8a71302, 0xb96d8c32, 0xebd4e7be, 0xbe8b9d2d, 0x7979fb06,
- 0xe7225308, 0x8b75cf77, 0x11ef8da4, 0xe083c858, 0x8d6b786f, 0x5a6317a6, 0xfa5cf7a0, 0x5dda0033,
- 0xf28ebfb0, 0xf5b9c310, 0xa0eac280, 0x08b9767a, 0xa3d9d2b0, 0x79d34217, 0x021a718d, 0x9ac6336a,
- 0x2711fd60, 0x438050e3, 0x069908a8, 0x3d7fedc4, 0x826d2bef, 0x4eeb8476, 0x488dcf25, 0x36c9d566,
- 0x28e74e41, 0xc2610aca, 0x3d49a9cf, 0xbae3b9df, 0xb65f8de6, 0x92aeaf64, 0x3ac7d5e6, 0x9ea80509,
- 0xf22b017d, 0xa4173f70, 0xdd1e16c3, 0x15e0d7f9, 0x50b1b887, 0x2b9f4fd5, 0x625aba82, 0x6a017962,
- 0x2ec01b9c, 0x15488aa9, 0xd716e740, 0x40055a2c, 0x93d29a22, 0xe32dbf9a, 0x058745b9, 0x3453dc1e,
- 0xd699296e, 0x496cff6f, 0x1c9f4986, 0xdfe2ed07, 0xb87242d1, 0x19de7eae, 0x053e561a, 0x15ad6f8c,
- 0x66626c1c, 0x7154c24c, 0xea082b2a, 0x93eb2939, 0x17dcb0f0, 0x58d4f2ae, 0x9ea294fb, 0x52cf564c,
- 0x9883fe66, 0x2ec40581, 0x763953c3, 0x01d6692e, 0xd3a0c108, 0xa1e7160e, 0xe4f2dfa6, 0x693ed285,
- 0x74904698, 0x4c2b0edd, 0x4f757656, 0x5d393378, 0xa132234f, 0x3d321c5d, 0xc3f5e194, 0x4b269301,
- 0xc79f022f, 0x3c997e7e, 0x5e4f9504, 0x3ffafbbd, 0x76f7ad0e, 0x296693f4, 0x3d1fce6f, 0xc61e45be,
- 0xd3b5ab34, 0xf72bf9b7, 0x1b0434c0, 0x4e72b567, 0x5592a33d, 0xb5229301, 0xcfd2a87f, 0x60aeb767,
- 0x1814386b, 0x30bcc33d, 0x38a0c07d, 0xfd1606f2, 0xc363519b, 0x589dd390, 0x5479f8e6, 0x1cb8d647,
- 0x97fd61a9, 0xea7759f4, 0x2d57539d, 0x569a58cf, 0xe84e63ad, 0x462e1b78, 0x6580f87e, 0xf3817914,
- 0x91da55f4, 0x40a230f3, 0xd1988f35, 0xb6e318d2, 0x3ffa50bc, 0x3d40f021, 0xc3c0bdae, 0x4958c24c,
- 0x518f36b2, 0x84b1d370, 0x0fedce83, 0x878ddada, 0xf2a279c7, 0x94e01be8, 0x90716f4b, 0x954b8aa3,
- },
- {
- 0xe216300d, 0xbbddfffc, 0xa7ebdabd, 0x35648095, 0x7789f8b7, 0xe6c1121b, 0x0e241600, 0x052ce8b5,
- 0x11a9cfb0, 0xe5952f11, 0xece7990a, 0x9386d174, 0x2a42931c, 0x76e38111, 0xb12def3a, 0x37ddddfc,
- 0xde9adeb1, 0x0a0cc32c, 0xbe197029, 0x84a00940, 0xbb243a0f, 0xb4d137cf, 0xb44e79f0, 0x049eedfd,
- 0x0b15a15d, 0x480d3168, 0x8bbbde5a, 0x669ded42, 0xc7ece831, 0x3f8f95e7, 0x72df191b, 0x7580330d,
- 0x94074251, 0x5c7dcdfa, 0xabbe6d63, 0xaa402164, 0xb301d40a, 0x02e7d1ca, 0x53571dae, 0x7a3182a2,
- 0x12a8ddec, 0xfdaa335d, 0x176f43e8, 0x71fb46d4, 0x38129022, 0xce949ad4, 0xb84769ad, 0x965bd862,
- 0x82f3d055, 0x66fb9767, 0x15b80b4e, 0x1d5b47a0, 0x4cfde06f, 0xc28ec4b8, 0x57e8726e, 0x647a78fc,
- 0x99865d44, 0x608bd593, 0x6c200e03, 0x39dc5ff6, 0x5d0b00a3, 0xae63aff2, 0x7e8bd632, 0x70108c0c,
- 0xbbd35049, 0x2998df04, 0x980cf42a, 0x9b6df491, 0x9e7edd53, 0x06918548, 0x58cb7e07, 0x3b74ef2e,
- 0x522fffb1, 0xd24708cc, 0x1c7e27cd, 0xa4eb215b, 0x3cf1d2e2, 0x19b47a38, 0x424f7618, 0x35856039,
- 0x9d17dee7, 0x27eb35e6, 0xc9aff67b, 0x36baf5b8, 0x09c467cd, 0xc18910b1, 0xe11dbf7b, 0x06cd1af8,
- 0x7170c608, 0x2d5e3354, 0xd4de495a, 0x64c6d006, 0xbcc0c62c, 0x3dd00db3, 0x708f8f34, 0x77d51b42,
- 0x264f620f, 0x24b8d2bf, 0x15c1b79e, 0x46a52564, 0xf8d7e54e, 0x3e378160, 0x7895cda5, 0x859c15a5,
- 0xe6459788, 0xc37bc75f, 0xdb07ba0c, 0x0676a3ab, 0x7f229b1e, 0x31842e7b, 0x24259fd7, 0xf8bef472,
- 0x835ffcb8, 0x6df4c1f2, 0x96f5b195, 0xfd0af0fc, 0xb0fe134c, 0xe2506d3d, 0x4f9b12ea, 0xf215f225,
- 0xa223736f, 0x9fb4c428, 0x25d04979, 0x34c713f8, 0xc4618187, 0xea7a6e98, 0x7cd16efc, 0x1436876c,
- 0xf1544107, 0xbedeee14, 0x56e9af27, 0xa04aa441, 0x3cf7c899, 0x92ecbae6, 0xdd67016d, 0x151682eb,
- 0xa842eedf, 0xfdba60b4, 0xf1907b75, 0x20e3030f, 0x24d8c29e, 0xe139673b, 0xefa63fb8, 0x71873054,
- 0xb6f2cf3b, 0x9f326442, 0xcb15a4cc, 0xb01a4504, 0xf1e47d8d, 0x844a1be5, 0xbae7dfdc, 0x42cbda70,
- 0xcd7dae0a, 0x57e85b7a, 0xd53f5af6, 0x20cf4d8c, 0xcea4d428, 0x79d130a4, 0x3486ebfb, 0x33d3cddc,
- 0x77853b53, 0x37effcb5, 0xc5068778, 0xe580b3e6, 0x4e68b8f4, 0xc5c8b37e, 0x0d809ea2, 0x398feb7c,
- 0x132a4f94, 0x43b7950e, 0x2fee7d1c, 0x223613bd, 0xdd06caa2, 0x37df932b, 0xc4248289, 0xacf3ebc3,
- 0x5715f6b7, 0xef3478dd, 0xf267616f, 0xc148cbe4, 0x9052815e, 0x5e410fab, 0xb48a2465, 0x2eda7fa4,
- 0xe87b40e4, 0xe98ea084, 0x5889e9e1, 0xefd390fc, 0xdd07d35b, 0xdb485694, 0x38d7e5b2, 0x57720101,
- 0x730edebc, 0x5b643113, 0x94917e4f, 0x503c2fba, 0x646f1282, 0x7523d24a, 0xe0779695, 0xf9c17a8f,
- 0x7a5b2121, 0xd187b896, 0x29263a4d, 0xba510cdf, 0x81f47c9f, 0xad1163ed, 0xea7b5965, 0x1a00726e,
- 0x11403092, 0x00da6d77, 0x4a0cdd61, 0xad1f4603, 0x605bdfb0, 0x9eedc364, 0x22ebe6a8, 0xcee7d28a,
- 0xa0e736a0, 0x5564a6b9, 0x10853209, 0xc7eb8f37, 0x2de705ca, 0x8951570f, 0xdf09822b, 0xbd691a6c,
- 0xaa12e4f2, 0x87451c0f, 0xe0f6a27a, 0x3ada4819, 0x4cf1764f, 0x0d771c2b, 0x67cdb156, 0x350d8384,
- 0x5938fa0f, 0x42399ef3, 0x36997b07, 0x0e84093d, 0x4aa93e61, 0x8360d87b, 0x1fa98b0c, 0x1149382c,
- 0xe97625a5, 0x0614d1b7, 0x0e25244b, 0x0c768347, 0x589e8d82, 0x0d2059d1, 0xa466bb1e, 0xf8da0a82,
- 0x04f19130, 0xba6e4ec0, 0x99265164, 0x1ee7230d, 0x50b2ad80, 0xeaee6801, 0x8db2a283, 0xea8bf59e,
- },
-}
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.go b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.go
deleted file mode 100644
index 661ea132e..000000000
--- a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build gc && !purego
-
-package chacha20
-
-const bufSize = 256
-
-//go:noescape
-func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
-
-func (c *Cipher) xorKeyStreamBlocks(dst, src []byte) {
- xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter)
-}
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s
deleted file mode 100644
index 7dd2638e8..000000000
--- a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s
+++ /dev/null
@@ -1,307 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build gc && !purego
-
-#include "textflag.h"
-
-#define NUM_ROUNDS 10
-
-// func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
-TEXT ·xorKeyStreamVX(SB), NOSPLIT, $0
- MOVD dst+0(FP), R1
- MOVD src+24(FP), R2
- MOVD src_len+32(FP), R3
- MOVD key+48(FP), R4
- MOVD nonce+56(FP), R6
- MOVD counter+64(FP), R7
-
- MOVD $·constants(SB), R10
- MOVD $·incRotMatrix(SB), R11
-
- MOVW (R7), R20
-
- AND $~255, R3, R13
- ADD R2, R13, R12 // R12 for block end
- AND $255, R3, R13
-loop:
- MOVD $NUM_ROUNDS, R21
- VLD1 (R11), [V30.S4, V31.S4]
-
- // load contants
- // VLD4R (R10), [V0.S4, V1.S4, V2.S4, V3.S4]
- WORD $0x4D60E940
-
- // load keys
- // VLD4R 16(R4), [V4.S4, V5.S4, V6.S4, V7.S4]
- WORD $0x4DFFE884
- // VLD4R 16(R4), [V8.S4, V9.S4, V10.S4, V11.S4]
- WORD $0x4DFFE888
- SUB $32, R4
-
- // load counter + nonce
- // VLD1R (R7), [V12.S4]
- WORD $0x4D40C8EC
-
- // VLD3R (R6), [V13.S4, V14.S4, V15.S4]
- WORD $0x4D40E8CD
-
- // update counter
- VADD V30.S4, V12.S4, V12.S4
-
-chacha:
- // V0..V3 += V4..V7
- // V12..V15 <<<= ((V12..V15 XOR V0..V3), 16)
- VADD V0.S4, V4.S4, V0.S4
- VADD V1.S4, V5.S4, V1.S4
- VADD V2.S4, V6.S4, V2.S4
- VADD V3.S4, V7.S4, V3.S4
- VEOR V12.B16, V0.B16, V12.B16
- VEOR V13.B16, V1.B16, V13.B16
- VEOR V14.B16, V2.B16, V14.B16
- VEOR V15.B16, V3.B16, V15.B16
- VREV32 V12.H8, V12.H8
- VREV32 V13.H8, V13.H8
- VREV32 V14.H8, V14.H8
- VREV32 V15.H8, V15.H8
- // V8..V11 += V12..V15
- // V4..V7 <<<= ((V4..V7 XOR V8..V11), 12)
- VADD V8.S4, V12.S4, V8.S4
- VADD V9.S4, V13.S4, V9.S4
- VADD V10.S4, V14.S4, V10.S4
- VADD V11.S4, V15.S4, V11.S4
- VEOR V8.B16, V4.B16, V16.B16
- VEOR V9.B16, V5.B16, V17.B16
- VEOR V10.B16, V6.B16, V18.B16
- VEOR V11.B16, V7.B16, V19.B16
- VSHL $12, V16.S4, V4.S4
- VSHL $12, V17.S4, V5.S4
- VSHL $12, V18.S4, V6.S4
- VSHL $12, V19.S4, V7.S4
- VSRI $20, V16.S4, V4.S4
- VSRI $20, V17.S4, V5.S4
- VSRI $20, V18.S4, V6.S4
- VSRI $20, V19.S4, V7.S4
-
- // V0..V3 += V4..V7
- // V12..V15 <<<= ((V12..V15 XOR V0..V3), 8)
- VADD V0.S4, V4.S4, V0.S4
- VADD V1.S4, V5.S4, V1.S4
- VADD V2.S4, V6.S4, V2.S4
- VADD V3.S4, V7.S4, V3.S4
- VEOR V12.B16, V0.B16, V12.B16
- VEOR V13.B16, V1.B16, V13.B16
- VEOR V14.B16, V2.B16, V14.B16
- VEOR V15.B16, V3.B16, V15.B16
- VTBL V31.B16, [V12.B16], V12.B16
- VTBL V31.B16, [V13.B16], V13.B16
- VTBL V31.B16, [V14.B16], V14.B16
- VTBL V31.B16, [V15.B16], V15.B16
-
- // V8..V11 += V12..V15
- // V4..V7 <<<= ((V4..V7 XOR V8..V11), 7)
- VADD V12.S4, V8.S4, V8.S4
- VADD V13.S4, V9.S4, V9.S4
- VADD V14.S4, V10.S4, V10.S4
- VADD V15.S4, V11.S4, V11.S4
- VEOR V8.B16, V4.B16, V16.B16
- VEOR V9.B16, V5.B16, V17.B16
- VEOR V10.B16, V6.B16, V18.B16
- VEOR V11.B16, V7.B16, V19.B16
- VSHL $7, V16.S4, V4.S4
- VSHL $7, V17.S4, V5.S4
- VSHL $7, V18.S4, V6.S4
- VSHL $7, V19.S4, V7.S4
- VSRI $25, V16.S4, V4.S4
- VSRI $25, V17.S4, V5.S4
- VSRI $25, V18.S4, V6.S4
- VSRI $25, V19.S4, V7.S4
-
- // V0..V3 += V5..V7, V4
- // V15,V12-V14 <<<= ((V15,V12-V14 XOR V0..V3), 16)
- VADD V0.S4, V5.S4, V0.S4
- VADD V1.S4, V6.S4, V1.S4
- VADD V2.S4, V7.S4, V2.S4
- VADD V3.S4, V4.S4, V3.S4
- VEOR V15.B16, V0.B16, V15.B16
- VEOR V12.B16, V1.B16, V12.B16
- VEOR V13.B16, V2.B16, V13.B16
- VEOR V14.B16, V3.B16, V14.B16
- VREV32 V12.H8, V12.H8
- VREV32 V13.H8, V13.H8
- VREV32 V14.H8, V14.H8
- VREV32 V15.H8, V15.H8
-
- // V10 += V15; V5 <<<= ((V10 XOR V5), 12)
- // ...
- VADD V15.S4, V10.S4, V10.S4
- VADD V12.S4, V11.S4, V11.S4
- VADD V13.S4, V8.S4, V8.S4
- VADD V14.S4, V9.S4, V9.S4
- VEOR V10.B16, V5.B16, V16.B16
- VEOR V11.B16, V6.B16, V17.B16
- VEOR V8.B16, V7.B16, V18.B16
- VEOR V9.B16, V4.B16, V19.B16
- VSHL $12, V16.S4, V5.S4
- VSHL $12, V17.S4, V6.S4
- VSHL $12, V18.S4, V7.S4
- VSHL $12, V19.S4, V4.S4
- VSRI $20, V16.S4, V5.S4
- VSRI $20, V17.S4, V6.S4
- VSRI $20, V18.S4, V7.S4
- VSRI $20, V19.S4, V4.S4
-
- // V0 += V5; V15 <<<= ((V0 XOR V15), 8)
- // ...
- VADD V5.S4, V0.S4, V0.S4
- VADD V6.S4, V1.S4, V1.S4
- VADD V7.S4, V2.S4, V2.S4
- VADD V4.S4, V3.S4, V3.S4
- VEOR V0.B16, V15.B16, V15.B16
- VEOR V1.B16, V12.B16, V12.B16
- VEOR V2.B16, V13.B16, V13.B16
- VEOR V3.B16, V14.B16, V14.B16
- VTBL V31.B16, [V12.B16], V12.B16
- VTBL V31.B16, [V13.B16], V13.B16
- VTBL V31.B16, [V14.B16], V14.B16
- VTBL V31.B16, [V15.B16], V15.B16
-
- // V10 += V15; V5 <<<= ((V10 XOR V5), 7)
- // ...
- VADD V15.S4, V10.S4, V10.S4
- VADD V12.S4, V11.S4, V11.S4
- VADD V13.S4, V8.S4, V8.S4
- VADD V14.S4, V9.S4, V9.S4
- VEOR V10.B16, V5.B16, V16.B16
- VEOR V11.B16, V6.B16, V17.B16
- VEOR V8.B16, V7.B16, V18.B16
- VEOR V9.B16, V4.B16, V19.B16
- VSHL $7, V16.S4, V5.S4
- VSHL $7, V17.S4, V6.S4
- VSHL $7, V18.S4, V7.S4
- VSHL $7, V19.S4, V4.S4
- VSRI $25, V16.S4, V5.S4
- VSRI $25, V17.S4, V6.S4
- VSRI $25, V18.S4, V7.S4
- VSRI $25, V19.S4, V4.S4
-
- SUB $1, R21
- CBNZ R21, chacha
-
- // VLD4R (R10), [V16.S4, V17.S4, V18.S4, V19.S4]
- WORD $0x4D60E950
-
- // VLD4R 16(R4), [V20.S4, V21.S4, V22.S4, V23.S4]
- WORD $0x4DFFE894
- VADD V30.S4, V12.S4, V12.S4
- VADD V16.S4, V0.S4, V0.S4
- VADD V17.S4, V1.S4, V1.S4
- VADD V18.S4, V2.S4, V2.S4
- VADD V19.S4, V3.S4, V3.S4
- // VLD4R 16(R4), [V24.S4, V25.S4, V26.S4, V27.S4]
- WORD $0x4DFFE898
- // restore R4
- SUB $32, R4
-
- // load counter + nonce
- // VLD1R (R7), [V28.S4]
- WORD $0x4D40C8FC
- // VLD3R (R6), [V29.S4, V30.S4, V31.S4]
- WORD $0x4D40E8DD
-
- VADD V20.S4, V4.S4, V4.S4
- VADD V21.S4, V5.S4, V5.S4
- VADD V22.S4, V6.S4, V6.S4
- VADD V23.S4, V7.S4, V7.S4
- VADD V24.S4, V8.S4, V8.S4
- VADD V25.S4, V9.S4, V9.S4
- VADD V26.S4, V10.S4, V10.S4
- VADD V27.S4, V11.S4, V11.S4
- VADD V28.S4, V12.S4, V12.S4
- VADD V29.S4, V13.S4, V13.S4
- VADD V30.S4, V14.S4, V14.S4
- VADD V31.S4, V15.S4, V15.S4
-
- VZIP1 V1.S4, V0.S4, V16.S4
- VZIP2 V1.S4, V0.S4, V17.S4
- VZIP1 V3.S4, V2.S4, V18.S4
- VZIP2 V3.S4, V2.S4, V19.S4
- VZIP1 V5.S4, V4.S4, V20.S4
- VZIP2 V5.S4, V4.S4, V21.S4
- VZIP1 V7.S4, V6.S4, V22.S4
- VZIP2 V7.S4, V6.S4, V23.S4
- VZIP1 V9.S4, V8.S4, V24.S4
- VZIP2 V9.S4, V8.S4, V25.S4
- VZIP1 V11.S4, V10.S4, V26.S4
- VZIP2 V11.S4, V10.S4, V27.S4
- VZIP1 V13.S4, V12.S4, V28.S4
- VZIP2 V13.S4, V12.S4, V29.S4
- VZIP1 V15.S4, V14.S4, V30.S4
- VZIP2 V15.S4, V14.S4, V31.S4
- VZIP1 V18.D2, V16.D2, V0.D2
- VZIP2 V18.D2, V16.D2, V4.D2
- VZIP1 V19.D2, V17.D2, V8.D2
- VZIP2 V19.D2, V17.D2, V12.D2
- VLD1.P 64(R2), [V16.B16, V17.B16, V18.B16, V19.B16]
-
- VZIP1 V22.D2, V20.D2, V1.D2
- VZIP2 V22.D2, V20.D2, V5.D2
- VZIP1 V23.D2, V21.D2, V9.D2
- VZIP2 V23.D2, V21.D2, V13.D2
- VLD1.P 64(R2), [V20.B16, V21.B16, V22.B16, V23.B16]
- VZIP1 V26.D2, V24.D2, V2.D2
- VZIP2 V26.D2, V24.D2, V6.D2
- VZIP1 V27.D2, V25.D2, V10.D2
- VZIP2 V27.D2, V25.D2, V14.D2
- VLD1.P 64(R2), [V24.B16, V25.B16, V26.B16, V27.B16]
- VZIP1 V30.D2, V28.D2, V3.D2
- VZIP2 V30.D2, V28.D2, V7.D2
- VZIP1 V31.D2, V29.D2, V11.D2
- VZIP2 V31.D2, V29.D2, V15.D2
- VLD1.P 64(R2), [V28.B16, V29.B16, V30.B16, V31.B16]
- VEOR V0.B16, V16.B16, V16.B16
- VEOR V1.B16, V17.B16, V17.B16
- VEOR V2.B16, V18.B16, V18.B16
- VEOR V3.B16, V19.B16, V19.B16
- VST1.P [V16.B16, V17.B16, V18.B16, V19.B16], 64(R1)
- VEOR V4.B16, V20.B16, V20.B16
- VEOR V5.B16, V21.B16, V21.B16
- VEOR V6.B16, V22.B16, V22.B16
- VEOR V7.B16, V23.B16, V23.B16
- VST1.P [V20.B16, V21.B16, V22.B16, V23.B16], 64(R1)
- VEOR V8.B16, V24.B16, V24.B16
- VEOR V9.B16, V25.B16, V25.B16
- VEOR V10.B16, V26.B16, V26.B16
- VEOR V11.B16, V27.B16, V27.B16
- VST1.P [V24.B16, V25.B16, V26.B16, V27.B16], 64(R1)
- VEOR V12.B16, V28.B16, V28.B16
- VEOR V13.B16, V29.B16, V29.B16
- VEOR V14.B16, V30.B16, V30.B16
- VEOR V15.B16, V31.B16, V31.B16
- VST1.P [V28.B16, V29.B16, V30.B16, V31.B16], 64(R1)
-
- ADD $4, R20
- MOVW R20, (R7) // update counter
-
- CMP R2, R12
- BGT loop
-
- RET
-
-
-DATA ·constants+0x00(SB)/4, $0x61707865
-DATA ·constants+0x04(SB)/4, $0x3320646e
-DATA ·constants+0x08(SB)/4, $0x79622d32
-DATA ·constants+0x0c(SB)/4, $0x6b206574
-GLOBL ·constants(SB), NOPTR|RODATA, $32
-
-DATA ·incRotMatrix+0x00(SB)/4, $0x00000000
-DATA ·incRotMatrix+0x04(SB)/4, $0x00000001
-DATA ·incRotMatrix+0x08(SB)/4, $0x00000002
-DATA ·incRotMatrix+0x0c(SB)/4, $0x00000003
-DATA ·incRotMatrix+0x10(SB)/4, $0x02010003
-DATA ·incRotMatrix+0x14(SB)/4, $0x06050407
-DATA ·incRotMatrix+0x18(SB)/4, $0x0A09080B
-DATA ·incRotMatrix+0x1c(SB)/4, $0x0E0D0C0F
-GLOBL ·incRotMatrix(SB), NOPTR|RODATA, $32
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_generic.go b/vendor/golang.org/x/crypto/chacha20/chacha_generic.go
deleted file mode 100644
index 93eb5ae6d..000000000
--- a/vendor/golang.org/x/crypto/chacha20/chacha_generic.go
+++ /dev/null
@@ -1,398 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package chacha20 implements the ChaCha20 and XChaCha20 encryption algorithms
-// as specified in RFC 8439 and draft-irtf-cfrg-xchacha-01.
-package chacha20
-
-import (
- "crypto/cipher"
- "encoding/binary"
- "errors"
- "math/bits"
-
- "golang.org/x/crypto/internal/alias"
-)
-
-const (
- // KeySize is the size of the key used by this cipher, in bytes.
- KeySize = 32
-
- // NonceSize is the size of the nonce used with the standard variant of this
- // cipher, in bytes.
- //
- // Note that this is too short to be safely generated at random if the same
- // key is reused more than 2³² times.
- NonceSize = 12
-
- // NonceSizeX is the size of the nonce used with the XChaCha20 variant of
- // this cipher, in bytes.
- NonceSizeX = 24
-)
-
-// Cipher is a stateful instance of ChaCha20 or XChaCha20 using a particular key
-// and nonce. A *Cipher implements the cipher.Stream interface.
-type Cipher struct {
- // The ChaCha20 state is 16 words: 4 constant, 8 of key, 1 of counter
- // (incremented after each block), and 3 of nonce.
- key [8]uint32
- counter uint32
- nonce [3]uint32
-
- // The last len bytes of buf are leftover key stream bytes from the previous
- // XORKeyStream invocation. The size of buf depends on how many blocks are
- // computed at a time by xorKeyStreamBlocks.
- buf [bufSize]byte
- len int
-
- // overflow is set when the counter overflowed, no more blocks can be
- // generated, and the next XORKeyStream call should panic.
- overflow bool
-
- // The counter-independent results of the first round are cached after they
- // are computed the first time.
- precompDone bool
- p1, p5, p9, p13 uint32
- p2, p6, p10, p14 uint32
- p3, p7, p11, p15 uint32
-}
-
-var _ cipher.Stream = (*Cipher)(nil)
-
-// NewUnauthenticatedCipher creates a new ChaCha20 stream cipher with the given
-// 32 bytes key and a 12 or 24 bytes nonce. If a nonce of 24 bytes is provided,
-// the XChaCha20 construction will be used. It returns an error if key or nonce
-// have any other length.
-//
-// Note that ChaCha20, like all stream ciphers, is not authenticated and allows
-// attackers to silently tamper with the plaintext. For this reason, it is more
-// appropriate as a building block than as a standalone encryption mechanism.
-// Instead, consider using package golang.org/x/crypto/chacha20poly1305.
-func NewUnauthenticatedCipher(key, nonce []byte) (*Cipher, error) {
- // This function is split into a wrapper so that the Cipher allocation will
- // be inlined, and depending on how the caller uses the return value, won't
- // escape to the heap.
- c := &Cipher{}
- return newUnauthenticatedCipher(c, key, nonce)
-}
-
-func newUnauthenticatedCipher(c *Cipher, key, nonce []byte) (*Cipher, error) {
- if len(key) != KeySize {
- return nil, errors.New("chacha20: wrong key size")
- }
- if len(nonce) == NonceSizeX {
- // XChaCha20 uses the ChaCha20 core to mix 16 bytes of the nonce into a
- // derived key, allowing it to operate on a nonce of 24 bytes. See
- // draft-irtf-cfrg-xchacha-01, Section 2.3.
- key, _ = HChaCha20(key, nonce[0:16])
- cNonce := make([]byte, NonceSize)
- copy(cNonce[4:12], nonce[16:24])
- nonce = cNonce
- } else if len(nonce) != NonceSize {
- return nil, errors.New("chacha20: wrong nonce size")
- }
-
- key, nonce = key[:KeySize], nonce[:NonceSize] // bounds check elimination hint
- c.key = [8]uint32{
- binary.LittleEndian.Uint32(key[0:4]),
- binary.LittleEndian.Uint32(key[4:8]),
- binary.LittleEndian.Uint32(key[8:12]),
- binary.LittleEndian.Uint32(key[12:16]),
- binary.LittleEndian.Uint32(key[16:20]),
- binary.LittleEndian.Uint32(key[20:24]),
- binary.LittleEndian.Uint32(key[24:28]),
- binary.LittleEndian.Uint32(key[28:32]),
- }
- c.nonce = [3]uint32{
- binary.LittleEndian.Uint32(nonce[0:4]),
- binary.LittleEndian.Uint32(nonce[4:8]),
- binary.LittleEndian.Uint32(nonce[8:12]),
- }
- return c, nil
-}
-
-// The constant first 4 words of the ChaCha20 state.
-const (
- j0 uint32 = 0x61707865 // expa
- j1 uint32 = 0x3320646e // nd 3
- j2 uint32 = 0x79622d32 // 2-by
- j3 uint32 = 0x6b206574 // te k
-)
-
-const blockSize = 64
-
-// quarterRound is the core of ChaCha20. It shuffles the bits of 4 state words.
-// It's executed 4 times for each of the 20 ChaCha20 rounds, operating on all 16
-// words each round, in columnar or diagonal groups of 4 at a time.
-func quarterRound(a, b, c, d uint32) (uint32, uint32, uint32, uint32) {
- a += b
- d ^= a
- d = bits.RotateLeft32(d, 16)
- c += d
- b ^= c
- b = bits.RotateLeft32(b, 12)
- a += b
- d ^= a
- d = bits.RotateLeft32(d, 8)
- c += d
- b ^= c
- b = bits.RotateLeft32(b, 7)
- return a, b, c, d
-}
-
-// SetCounter sets the Cipher counter. The next invocation of XORKeyStream will
-// behave as if (64 * counter) bytes had been encrypted so far.
-//
-// To prevent accidental counter reuse, SetCounter panics if counter is less
-// than the current value.
-//
-// Note that the execution time of XORKeyStream is not independent of the
-// counter value.
-func (s *Cipher) SetCounter(counter uint32) {
- // Internally, s may buffer multiple blocks, which complicates this
- // implementation slightly. When checking whether the counter has rolled
- // back, we must use both s.counter and s.len to determine how many blocks
- // we have already output.
- outputCounter := s.counter - uint32(s.len)/blockSize
- if s.overflow || counter < outputCounter {
- panic("chacha20: SetCounter attempted to rollback counter")
- }
-
- // In the general case, we set the new counter value and reset s.len to 0,
- // causing the next call to XORKeyStream to refill the buffer. However, if
- // we're advancing within the existing buffer, we can save work by simply
- // setting s.len.
- if counter < s.counter {
- s.len = int(s.counter-counter) * blockSize
- } else {
- s.counter = counter
- s.len = 0
- }
-}
-
-// XORKeyStream XORs each byte in the given slice with a byte from the
-// cipher's key stream. Dst and src must overlap entirely or not at all.
-//
-// If len(dst) < len(src), XORKeyStream will panic. It is acceptable
-// to pass a dst bigger than src, and in that case, XORKeyStream will
-// only update dst[:len(src)] and will not touch the rest of dst.
-//
-// Multiple calls to XORKeyStream behave as if the concatenation of
-// the src buffers was passed in a single run. That is, Cipher
-// maintains state and does not reset at each XORKeyStream call.
-func (s *Cipher) XORKeyStream(dst, src []byte) {
- if len(src) == 0 {
- return
- }
- if len(dst) < len(src) {
- panic("chacha20: output smaller than input")
- }
- dst = dst[:len(src)]
- if alias.InexactOverlap(dst, src) {
- panic("chacha20: invalid buffer overlap")
- }
-
- // First, drain any remaining key stream from a previous XORKeyStream.
- if s.len != 0 {
- keyStream := s.buf[bufSize-s.len:]
- if len(src) < len(keyStream) {
- keyStream = keyStream[:len(src)]
- }
- _ = src[len(keyStream)-1] // bounds check elimination hint
- for i, b := range keyStream {
- dst[i] = src[i] ^ b
- }
- s.len -= len(keyStream)
- dst, src = dst[len(keyStream):], src[len(keyStream):]
- }
- if len(src) == 0 {
- return
- }
-
- // If we'd need to let the counter overflow and keep generating output,
- // panic immediately. If instead we'd only reach the last block, remember
- // not to generate any more output after the buffer is drained.
- numBlocks := (uint64(len(src)) + blockSize - 1) / blockSize
- if s.overflow || uint64(s.counter)+numBlocks > 1<<32 {
- panic("chacha20: counter overflow")
- } else if uint64(s.counter)+numBlocks == 1<<32 {
- s.overflow = true
- }
-
- // xorKeyStreamBlocks implementations expect input lengths that are a
- // multiple of bufSize. Platform-specific ones process multiple blocks at a
- // time, so have bufSizes that are a multiple of blockSize.
-
- full := len(src) - len(src)%bufSize
- if full > 0 {
- s.xorKeyStreamBlocks(dst[:full], src[:full])
- }
- dst, src = dst[full:], src[full:]
-
- // If using a multi-block xorKeyStreamBlocks would overflow, use the generic
- // one that does one block at a time.
- const blocksPerBuf = bufSize / blockSize
- if uint64(s.counter)+blocksPerBuf > 1<<32 {
- s.buf = [bufSize]byte{}
- numBlocks := (len(src) + blockSize - 1) / blockSize
- buf := s.buf[bufSize-numBlocks*blockSize:]
- copy(buf, src)
- s.xorKeyStreamBlocksGeneric(buf, buf)
- s.len = len(buf) - copy(dst, buf)
- return
- }
-
- // If we have a partial (multi-)block, pad it for xorKeyStreamBlocks, and
- // keep the leftover keystream for the next XORKeyStream invocation.
- if len(src) > 0 {
- s.buf = [bufSize]byte{}
- copy(s.buf[:], src)
- s.xorKeyStreamBlocks(s.buf[:], s.buf[:])
- s.len = bufSize - copy(dst, s.buf[:])
- }
-}
-
-func (s *Cipher) xorKeyStreamBlocksGeneric(dst, src []byte) {
- if len(dst) != len(src) || len(dst)%blockSize != 0 {
- panic("chacha20: internal error: wrong dst and/or src length")
- }
-
- // To generate each block of key stream, the initial cipher state
- // (represented below) is passed through 20 rounds of shuffling,
- // alternatively applying quarterRounds by columns (like 1, 5, 9, 13)
- // or by diagonals (like 1, 6, 11, 12).
- //
- // 0:cccccccc 1:cccccccc 2:cccccccc 3:cccccccc
- // 4:kkkkkkkk 5:kkkkkkkk 6:kkkkkkkk 7:kkkkkkkk
- // 8:kkkkkkkk 9:kkkkkkkk 10:kkkkkkkk 11:kkkkkkkk
- // 12:bbbbbbbb 13:nnnnnnnn 14:nnnnnnnn 15:nnnnnnnn
- //
- // c=constant k=key b=blockcount n=nonce
- var (
- c0, c1, c2, c3 = j0, j1, j2, j3
- c4, c5, c6, c7 = s.key[0], s.key[1], s.key[2], s.key[3]
- c8, c9, c10, c11 = s.key[4], s.key[5], s.key[6], s.key[7]
- _, c13, c14, c15 = s.counter, s.nonce[0], s.nonce[1], s.nonce[2]
- )
-
- // Three quarters of the first round don't depend on the counter, so we can
- // calculate them here, and reuse them for multiple blocks in the loop, and
- // for future XORKeyStream invocations.
- if !s.precompDone {
- s.p1, s.p5, s.p9, s.p13 = quarterRound(c1, c5, c9, c13)
- s.p2, s.p6, s.p10, s.p14 = quarterRound(c2, c6, c10, c14)
- s.p3, s.p7, s.p11, s.p15 = quarterRound(c3, c7, c11, c15)
- s.precompDone = true
- }
-
- // A condition of len(src) > 0 would be sufficient, but this also
- // acts as a bounds check elimination hint.
- for len(src) >= 64 && len(dst) >= 64 {
- // The remainder of the first column round.
- fcr0, fcr4, fcr8, fcr12 := quarterRound(c0, c4, c8, s.counter)
-
- // The second diagonal round.
- x0, x5, x10, x15 := quarterRound(fcr0, s.p5, s.p10, s.p15)
- x1, x6, x11, x12 := quarterRound(s.p1, s.p6, s.p11, fcr12)
- x2, x7, x8, x13 := quarterRound(s.p2, s.p7, fcr8, s.p13)
- x3, x4, x9, x14 := quarterRound(s.p3, fcr4, s.p9, s.p14)
-
- // The remaining 18 rounds.
- for i := 0; i < 9; i++ {
- // Column round.
- x0, x4, x8, x12 = quarterRound(x0, x4, x8, x12)
- x1, x5, x9, x13 = quarterRound(x1, x5, x9, x13)
- x2, x6, x10, x14 = quarterRound(x2, x6, x10, x14)
- x3, x7, x11, x15 = quarterRound(x3, x7, x11, x15)
-
- // Diagonal round.
- x0, x5, x10, x15 = quarterRound(x0, x5, x10, x15)
- x1, x6, x11, x12 = quarterRound(x1, x6, x11, x12)
- x2, x7, x8, x13 = quarterRound(x2, x7, x8, x13)
- x3, x4, x9, x14 = quarterRound(x3, x4, x9, x14)
- }
-
- // Add back the initial state to generate the key stream, then
- // XOR the key stream with the source and write out the result.
- addXor(dst[0:4], src[0:4], x0, c0)
- addXor(dst[4:8], src[4:8], x1, c1)
- addXor(dst[8:12], src[8:12], x2, c2)
- addXor(dst[12:16], src[12:16], x3, c3)
- addXor(dst[16:20], src[16:20], x4, c4)
- addXor(dst[20:24], src[20:24], x5, c5)
- addXor(dst[24:28], src[24:28], x6, c6)
- addXor(dst[28:32], src[28:32], x7, c7)
- addXor(dst[32:36], src[32:36], x8, c8)
- addXor(dst[36:40], src[36:40], x9, c9)
- addXor(dst[40:44], src[40:44], x10, c10)
- addXor(dst[44:48], src[44:48], x11, c11)
- addXor(dst[48:52], src[48:52], x12, s.counter)
- addXor(dst[52:56], src[52:56], x13, c13)
- addXor(dst[56:60], src[56:60], x14, c14)
- addXor(dst[60:64], src[60:64], x15, c15)
-
- s.counter += 1
-
- src, dst = src[blockSize:], dst[blockSize:]
- }
-}
-
-// HChaCha20 uses the ChaCha20 core to generate a derived key from a 32 bytes
-// key and a 16 bytes nonce. It returns an error if key or nonce have any other
-// length. It is used as part of the XChaCha20 construction.
-func HChaCha20(key, nonce []byte) ([]byte, error) {
- // This function is split into a wrapper so that the slice allocation will
- // be inlined, and depending on how the caller uses the return value, won't
- // escape to the heap.
- out := make([]byte, 32)
- return hChaCha20(out, key, nonce)
-}
-
-func hChaCha20(out, key, nonce []byte) ([]byte, error) {
- if len(key) != KeySize {
- return nil, errors.New("chacha20: wrong HChaCha20 key size")
- }
- if len(nonce) != 16 {
- return nil, errors.New("chacha20: wrong HChaCha20 nonce size")
- }
-
- x0, x1, x2, x3 := j0, j1, j2, j3
- x4 := binary.LittleEndian.Uint32(key[0:4])
- x5 := binary.LittleEndian.Uint32(key[4:8])
- x6 := binary.LittleEndian.Uint32(key[8:12])
- x7 := binary.LittleEndian.Uint32(key[12:16])
- x8 := binary.LittleEndian.Uint32(key[16:20])
- x9 := binary.LittleEndian.Uint32(key[20:24])
- x10 := binary.LittleEndian.Uint32(key[24:28])
- x11 := binary.LittleEndian.Uint32(key[28:32])
- x12 := binary.LittleEndian.Uint32(nonce[0:4])
- x13 := binary.LittleEndian.Uint32(nonce[4:8])
- x14 := binary.LittleEndian.Uint32(nonce[8:12])
- x15 := binary.LittleEndian.Uint32(nonce[12:16])
-
- for i := 0; i < 10; i++ {
- // Diagonal round.
- x0, x4, x8, x12 = quarterRound(x0, x4, x8, x12)
- x1, x5, x9, x13 = quarterRound(x1, x5, x9, x13)
- x2, x6, x10, x14 = quarterRound(x2, x6, x10, x14)
- x3, x7, x11, x15 = quarterRound(x3, x7, x11, x15)
-
- // Column round.
- x0, x5, x10, x15 = quarterRound(x0, x5, x10, x15)
- x1, x6, x11, x12 = quarterRound(x1, x6, x11, x12)
- x2, x7, x8, x13 = quarterRound(x2, x7, x8, x13)
- x3, x4, x9, x14 = quarterRound(x3, x4, x9, x14)
- }
-
- _ = out[31] // bounds check elimination hint
- binary.LittleEndian.PutUint32(out[0:4], x0)
- binary.LittleEndian.PutUint32(out[4:8], x1)
- binary.LittleEndian.PutUint32(out[8:12], x2)
- binary.LittleEndian.PutUint32(out[12:16], x3)
- binary.LittleEndian.PutUint32(out[16:20], x12)
- binary.LittleEndian.PutUint32(out[20:24], x13)
- binary.LittleEndian.PutUint32(out[24:28], x14)
- binary.LittleEndian.PutUint32(out[28:32], x15)
- return out, nil
-}
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go b/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go
deleted file mode 100644
index c709b7284..000000000
--- a/vendor/golang.org/x/crypto/chacha20/chacha_noasm.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build (!arm64 && !s390x && !ppc64 && !ppc64le) || !gc || purego
-
-package chacha20
-
-const bufSize = blockSize
-
-func (s *Cipher) xorKeyStreamBlocks(dst, src []byte) {
- s.xorKeyStreamBlocksGeneric(dst, src)
-}
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64x.go b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64x.go
deleted file mode 100644
index bd183d9ba..000000000
--- a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64x.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2019 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.
-
-//go:build gc && !purego && (ppc64 || ppc64le)
-
-package chacha20
-
-const bufSize = 256
-
-//go:noescape
-func chaCha20_ctr32_vsx(out, inp *byte, len int, key *[8]uint32, counter *uint32)
-
-func (c *Cipher) xorKeyStreamBlocks(dst, src []byte) {
- chaCha20_ctr32_vsx(&dst[0], &src[0], len(src), &c.key, &c.counter)
-}
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64x.s b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64x.s
deleted file mode 100644
index a660b4112..000000000
--- a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64x.s
+++ /dev/null
@@ -1,501 +0,0 @@
-// Copyright 2019 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.
-
-// Based on CRYPTOGAMS code with the following comment:
-// # ====================================================================
-// # Written by Andy Polyakov for the OpenSSL
-// # project. The module is, however, dual licensed under OpenSSL and
-// # CRYPTOGAMS licenses depending on where you obtain it. For further
-// # details see http://www.openssl.org/~appro/cryptogams/.
-// # ====================================================================
-
-// Code for the perl script that generates the ppc64 assembler
-// can be found in the cryptogams repository at the link below. It is based on
-// the original from openssl.
-
-// https://github.com/dot-asm/cryptogams/commit/a60f5b50ed908e91
-
-// The differences in this and the original implementation are
-// due to the calling conventions and initialization of constants.
-
-//go:build gc && !purego && (ppc64 || ppc64le)
-
-#include "textflag.h"
-
-#define OUT R3
-#define INP R4
-#define LEN R5
-#define KEY R6
-#define CNT R7
-#define TMP R15
-
-#define CONSTBASE R16
-#define BLOCKS R17
-
-// for VPERMXOR
-#define MASK R18
-
-DATA consts<>+0x00(SB)/4, $0x61707865
-DATA consts<>+0x04(SB)/4, $0x3320646e
-DATA consts<>+0x08(SB)/4, $0x79622d32
-DATA consts<>+0x0c(SB)/4, $0x6b206574
-DATA consts<>+0x10(SB)/4, $0x00000001
-DATA consts<>+0x14(SB)/4, $0x00000000
-DATA consts<>+0x18(SB)/4, $0x00000000
-DATA consts<>+0x1c(SB)/4, $0x00000000
-DATA consts<>+0x20(SB)/4, $0x00000004
-DATA consts<>+0x24(SB)/4, $0x00000000
-DATA consts<>+0x28(SB)/4, $0x00000000
-DATA consts<>+0x2c(SB)/4, $0x00000000
-DATA consts<>+0x30(SB)/4, $0x0e0f0c0d
-DATA consts<>+0x34(SB)/4, $0x0a0b0809
-DATA consts<>+0x38(SB)/4, $0x06070405
-DATA consts<>+0x3c(SB)/4, $0x02030001
-DATA consts<>+0x40(SB)/4, $0x0d0e0f0c
-DATA consts<>+0x44(SB)/4, $0x090a0b08
-DATA consts<>+0x48(SB)/4, $0x05060704
-DATA consts<>+0x4c(SB)/4, $0x01020300
-DATA consts<>+0x50(SB)/4, $0x61707865
-DATA consts<>+0x54(SB)/4, $0x61707865
-DATA consts<>+0x58(SB)/4, $0x61707865
-DATA consts<>+0x5c(SB)/4, $0x61707865
-DATA consts<>+0x60(SB)/4, $0x3320646e
-DATA consts<>+0x64(SB)/4, $0x3320646e
-DATA consts<>+0x68(SB)/4, $0x3320646e
-DATA consts<>+0x6c(SB)/4, $0x3320646e
-DATA consts<>+0x70(SB)/4, $0x79622d32
-DATA consts<>+0x74(SB)/4, $0x79622d32
-DATA consts<>+0x78(SB)/4, $0x79622d32
-DATA consts<>+0x7c(SB)/4, $0x79622d32
-DATA consts<>+0x80(SB)/4, $0x6b206574
-DATA consts<>+0x84(SB)/4, $0x6b206574
-DATA consts<>+0x88(SB)/4, $0x6b206574
-DATA consts<>+0x8c(SB)/4, $0x6b206574
-DATA consts<>+0x90(SB)/4, $0x00000000
-DATA consts<>+0x94(SB)/4, $0x00000001
-DATA consts<>+0x98(SB)/4, $0x00000002
-DATA consts<>+0x9c(SB)/4, $0x00000003
-DATA consts<>+0xa0(SB)/4, $0x11223300
-DATA consts<>+0xa4(SB)/4, $0x55667744
-DATA consts<>+0xa8(SB)/4, $0x99aabb88
-DATA consts<>+0xac(SB)/4, $0xddeeffcc
-DATA consts<>+0xb0(SB)/4, $0x22330011
-DATA consts<>+0xb4(SB)/4, $0x66774455
-DATA consts<>+0xb8(SB)/4, $0xaabb8899
-DATA consts<>+0xbc(SB)/4, $0xeeffccdd
-GLOBL consts<>(SB), RODATA, $0xc0
-
-#ifdef GOARCH_ppc64
-#define BE_XXBRW_INIT() \
- LVSL (R0)(R0), V24 \
- VSPLTISB $3, V25 \
- VXOR V24, V25, V24 \
-
-#define BE_XXBRW(vr) VPERM vr, vr, V24, vr
-#else
-#define BE_XXBRW_INIT()
-#define BE_XXBRW(vr)
-#endif
-
-//func chaCha20_ctr32_vsx(out, inp *byte, len int, key *[8]uint32, counter *uint32)
-TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40
- MOVD out+0(FP), OUT
- MOVD inp+8(FP), INP
- MOVD len+16(FP), LEN
- MOVD key+24(FP), KEY
- MOVD counter+32(FP), CNT
-
- // Addressing for constants
- MOVD $consts<>+0x00(SB), CONSTBASE
- MOVD $16, R8
- MOVD $32, R9
- MOVD $48, R10
- MOVD $64, R11
- SRD $6, LEN, BLOCKS
- // for VPERMXOR
- MOVD $consts<>+0xa0(SB), MASK
- MOVD $16, R20
- // V16
- LXVW4X (CONSTBASE)(R0), VS48
- ADD $80,CONSTBASE
-
- // Load key into V17,V18
- LXVW4X (KEY)(R0), VS49
- LXVW4X (KEY)(R8), VS50
-
- // Load CNT, NONCE into V19
- LXVW4X (CNT)(R0), VS51
-
- // Clear V27
- VXOR V27, V27, V27
-
- BE_XXBRW_INIT()
-
- // V28
- LXVW4X (CONSTBASE)(R11), VS60
-
- // Load mask constants for VPERMXOR
- LXVW4X (MASK)(R0), V20
- LXVW4X (MASK)(R20), V21
-
- // splat slot from V19 -> V26
- VSPLTW $0, V19, V26
-
- VSLDOI $4, V19, V27, V19
- VSLDOI $12, V27, V19, V19
-
- VADDUWM V26, V28, V26
-
- MOVD $10, R14
- MOVD R14, CTR
- PCALIGN $16
-loop_outer_vsx:
- // V0, V1, V2, V3
- LXVW4X (R0)(CONSTBASE), VS32
- LXVW4X (R8)(CONSTBASE), VS33
- LXVW4X (R9)(CONSTBASE), VS34
- LXVW4X (R10)(CONSTBASE), VS35
-
- // splat values from V17, V18 into V4-V11
- VSPLTW $0, V17, V4
- VSPLTW $1, V17, V5
- VSPLTW $2, V17, V6
- VSPLTW $3, V17, V7
- VSPLTW $0, V18, V8
- VSPLTW $1, V18, V9
- VSPLTW $2, V18, V10
- VSPLTW $3, V18, V11
-
- // VOR
- VOR V26, V26, V12
-
- // splat values from V19 -> V13, V14, V15
- VSPLTW $1, V19, V13
- VSPLTW $2, V19, V14
- VSPLTW $3, V19, V15
-
- // splat const values
- VSPLTISW $-16, V27
- VSPLTISW $12, V28
- VSPLTISW $8, V29
- VSPLTISW $7, V30
- PCALIGN $16
-loop_vsx:
- VADDUWM V0, V4, V0
- VADDUWM V1, V5, V1
- VADDUWM V2, V6, V2
- VADDUWM V3, V7, V3
-
- VPERMXOR V12, V0, V21, V12
- VPERMXOR V13, V1, V21, V13
- VPERMXOR V14, V2, V21, V14
- VPERMXOR V15, V3, V21, V15
-
- VADDUWM V8, V12, V8
- VADDUWM V9, V13, V9
- VADDUWM V10, V14, V10
- VADDUWM V11, V15, V11
-
- VXOR V4, V8, V4
- VXOR V5, V9, V5
- VXOR V6, V10, V6
- VXOR V7, V11, V7
-
- VRLW V4, V28, V4
- VRLW V5, V28, V5
- VRLW V6, V28, V6
- VRLW V7, V28, V7
-
- VADDUWM V0, V4, V0
- VADDUWM V1, V5, V1
- VADDUWM V2, V6, V2
- VADDUWM V3, V7, V3
-
- VPERMXOR V12, V0, V20, V12
- VPERMXOR V13, V1, V20, V13
- VPERMXOR V14, V2, V20, V14
- VPERMXOR V15, V3, V20, V15
-
- VADDUWM V8, V12, V8
- VADDUWM V9, V13, V9
- VADDUWM V10, V14, V10
- VADDUWM V11, V15, V11
-
- VXOR V4, V8, V4
- VXOR V5, V9, V5
- VXOR V6, V10, V6
- VXOR V7, V11, V7
-
- VRLW V4, V30, V4
- VRLW V5, V30, V5
- VRLW V6, V30, V6
- VRLW V7, V30, V7
-
- VADDUWM V0, V5, V0
- VADDUWM V1, V6, V1
- VADDUWM V2, V7, V2
- VADDUWM V3, V4, V3
-
- VPERMXOR V15, V0, V21, V15
- VPERMXOR V12, V1, V21, V12
- VPERMXOR V13, V2, V21, V13
- VPERMXOR V14, V3, V21, V14
-
- VADDUWM V10, V15, V10
- VADDUWM V11, V12, V11
- VADDUWM V8, V13, V8
- VADDUWM V9, V14, V9
-
- VXOR V5, V10, V5
- VXOR V6, V11, V6
- VXOR V7, V8, V7
- VXOR V4, V9, V4
-
- VRLW V5, V28, V5
- VRLW V6, V28, V6
- VRLW V7, V28, V7
- VRLW V4, V28, V4
-
- VADDUWM V0, V5, V0
- VADDUWM V1, V6, V1
- VADDUWM V2, V7, V2
- VADDUWM V3, V4, V3
-
- VPERMXOR V15, V0, V20, V15
- VPERMXOR V12, V1, V20, V12
- VPERMXOR V13, V2, V20, V13
- VPERMXOR V14, V3, V20, V14
-
- VADDUWM V10, V15, V10
- VADDUWM V11, V12, V11
- VADDUWM V8, V13, V8
- VADDUWM V9, V14, V9
-
- VXOR V5, V10, V5
- VXOR V6, V11, V6
- VXOR V7, V8, V7
- VXOR V4, V9, V4
-
- VRLW V5, V30, V5
- VRLW V6, V30, V6
- VRLW V7, V30, V7
- VRLW V4, V30, V4
- BDNZ loop_vsx
-
- VADDUWM V12, V26, V12
-
- VMRGEW V0, V1, V27
- VMRGEW V2, V3, V28
-
- VMRGOW V0, V1, V0
- VMRGOW V2, V3, V2
-
- VMRGEW V4, V5, V29
- VMRGEW V6, V7, V30
-
- XXPERMDI VS32, VS34, $0, VS33
- XXPERMDI VS32, VS34, $3, VS35
- XXPERMDI VS59, VS60, $0, VS32
- XXPERMDI VS59, VS60, $3, VS34
-
- VMRGOW V4, V5, V4
- VMRGOW V6, V7, V6
-
- VMRGEW V8, V9, V27
- VMRGEW V10, V11, V28
-
- XXPERMDI VS36, VS38, $0, VS37
- XXPERMDI VS36, VS38, $3, VS39
- XXPERMDI VS61, VS62, $0, VS36
- XXPERMDI VS61, VS62, $3, VS38
-
- VMRGOW V8, V9, V8
- VMRGOW V10, V11, V10
-
- VMRGEW V12, V13, V29
- VMRGEW V14, V15, V30
-
- XXPERMDI VS40, VS42, $0, VS41
- XXPERMDI VS40, VS42, $3, VS43
- XXPERMDI VS59, VS60, $0, VS40
- XXPERMDI VS59, VS60, $3, VS42
-
- VMRGOW V12, V13, V12
- VMRGOW V14, V15, V14
-
- VSPLTISW $4, V27
- VADDUWM V26, V27, V26
-
- XXPERMDI VS44, VS46, $0, VS45
- XXPERMDI VS44, VS46, $3, VS47
- XXPERMDI VS61, VS62, $0, VS44
- XXPERMDI VS61, VS62, $3, VS46
-
- VADDUWM V0, V16, V0
- VADDUWM V4, V17, V4
- VADDUWM V8, V18, V8
- VADDUWM V12, V19, V12
-
- BE_XXBRW(V0)
- BE_XXBRW(V4)
- BE_XXBRW(V8)
- BE_XXBRW(V12)
-
- CMPU LEN, $64
- BLT tail_vsx
-
- // Bottom of loop
- LXVW4X (INP)(R0), VS59
- LXVW4X (INP)(R8), VS60
- LXVW4X (INP)(R9), VS61
- LXVW4X (INP)(R10), VS62
-
- VXOR V27, V0, V27
- VXOR V28, V4, V28
- VXOR V29, V8, V29
- VXOR V30, V12, V30
-
- STXVW4X VS59, (OUT)(R0)
- STXVW4X VS60, (OUT)(R8)
- ADD $64, INP
- STXVW4X VS61, (OUT)(R9)
- ADD $-64, LEN
- STXVW4X VS62, (OUT)(R10)
- ADD $64, OUT
- BEQ done_vsx
-
- VADDUWM V1, V16, V0
- VADDUWM V5, V17, V4
- VADDUWM V9, V18, V8
- VADDUWM V13, V19, V12
-
- BE_XXBRW(V0)
- BE_XXBRW(V4)
- BE_XXBRW(V8)
- BE_XXBRW(V12)
-
- CMPU LEN, $64
- BLT tail_vsx
-
- LXVW4X (INP)(R0), VS59
- LXVW4X (INP)(R8), VS60
- LXVW4X (INP)(R9), VS61
- LXVW4X (INP)(R10), VS62
-
- VXOR V27, V0, V27
- VXOR V28, V4, V28
- VXOR V29, V8, V29
- VXOR V30, V12, V30
-
- STXVW4X VS59, (OUT)(R0)
- STXVW4X VS60, (OUT)(R8)
- ADD $64, INP
- STXVW4X VS61, (OUT)(R9)
- ADD $-64, LEN
- STXVW4X VS62, (OUT)(V10)
- ADD $64, OUT
- BEQ done_vsx
-
- VADDUWM V2, V16, V0
- VADDUWM V6, V17, V4
- VADDUWM V10, V18, V8
- VADDUWM V14, V19, V12
-
- BE_XXBRW(V0)
- BE_XXBRW(V4)
- BE_XXBRW(V8)
- BE_XXBRW(V12)
-
- CMPU LEN, $64
- BLT tail_vsx
-
- LXVW4X (INP)(R0), VS59
- LXVW4X (INP)(R8), VS60
- LXVW4X (INP)(R9), VS61
- LXVW4X (INP)(R10), VS62
-
- VXOR V27, V0, V27
- VXOR V28, V4, V28
- VXOR V29, V8, V29
- VXOR V30, V12, V30
-
- STXVW4X VS59, (OUT)(R0)
- STXVW4X VS60, (OUT)(R8)
- ADD $64, INP
- STXVW4X VS61, (OUT)(R9)
- ADD $-64, LEN
- STXVW4X VS62, (OUT)(R10)
- ADD $64, OUT
- BEQ done_vsx
-
- VADDUWM V3, V16, V0
- VADDUWM V7, V17, V4
- VADDUWM V11, V18, V8
- VADDUWM V15, V19, V12
-
- BE_XXBRW(V0)
- BE_XXBRW(V4)
- BE_XXBRW(V8)
- BE_XXBRW(V12)
-
- CMPU LEN, $64
- BLT tail_vsx
-
- LXVW4X (INP)(R0), VS59
- LXVW4X (INP)(R8), VS60
- LXVW4X (INP)(R9), VS61
- LXVW4X (INP)(R10), VS62
-
- VXOR V27, V0, V27
- VXOR V28, V4, V28
- VXOR V29, V8, V29
- VXOR V30, V12, V30
-
- STXVW4X VS59, (OUT)(R0)
- STXVW4X VS60, (OUT)(R8)
- ADD $64, INP
- STXVW4X VS61, (OUT)(R9)
- ADD $-64, LEN
- STXVW4X VS62, (OUT)(R10)
- ADD $64, OUT
-
- MOVD $10, R14
- MOVD R14, CTR
- BNE loop_outer_vsx
-
-done_vsx:
- // Increment counter by number of 64 byte blocks
- MOVWZ (CNT), R14
- ADD BLOCKS, R14
- MOVWZ R14, (CNT)
- RET
-
-tail_vsx:
- ADD $32, R1, R11
- MOVD LEN, CTR
-
- // Save values on stack to copy from
- STXVW4X VS32, (R11)(R0)
- STXVW4X VS36, (R11)(R8)
- STXVW4X VS40, (R11)(R9)
- STXVW4X VS44, (R11)(R10)
- ADD $-1, R11, R12
- ADD $-1, INP
- ADD $-1, OUT
- PCALIGN $16
-looptail_vsx:
- // Copying the result to OUT
- // in bytes.
- MOVBZU 1(R12), KEY
- MOVBZU 1(INP), TMP
- XOR KEY, TMP, KEY
- MOVBU KEY, 1(OUT)
- BDNZ looptail_vsx
-
- // Clear the stack values
- STXVW4X VS48, (R11)(R0)
- STXVW4X VS48, (R11)(R8)
- STXVW4X VS48, (R11)(R9)
- STXVW4X VS48, (R11)(R10)
- BR done_vsx
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.go b/vendor/golang.org/x/crypto/chacha20/chacha_s390x.go
deleted file mode 100644
index 683ccfd1c..000000000
--- a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build gc && !purego
-
-package chacha20
-
-import "golang.org/x/sys/cpu"
-
-var haveAsm = cpu.S390X.HasVX
-
-const bufSize = 256
-
-// xorKeyStreamVX is an assembly implementation of XORKeyStream. It must only
-// be called when the vector facility is available. Implementation in asm_s390x.s.
-//
-//go:noescape
-func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
-
-func (c *Cipher) xorKeyStreamBlocks(dst, src []byte) {
- if cpu.S390X.HasVX {
- xorKeyStreamVX(dst, src, &c.key, &c.nonce, &c.counter)
- } else {
- c.xorKeyStreamBlocksGeneric(dst, src)
- }
-}
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s b/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s
deleted file mode 100644
index 1eda91a3d..000000000
--- a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build gc && !purego
-
-#include "go_asm.h"
-#include "textflag.h"
-
-// This is an implementation of the ChaCha20 encryption algorithm as
-// specified in RFC 7539. It uses vector instructions to compute
-// 4 keystream blocks in parallel (256 bytes) which are then XORed
-// with the bytes in the input slice.
-
-GLOBL ·constants<>(SB), RODATA|NOPTR, $32
-// BSWAP: swap bytes in each 4-byte element
-DATA ·constants<>+0x00(SB)/4, $0x03020100
-DATA ·constants<>+0x04(SB)/4, $0x07060504
-DATA ·constants<>+0x08(SB)/4, $0x0b0a0908
-DATA ·constants<>+0x0c(SB)/4, $0x0f0e0d0c
-// J0: [j0, j1, j2, j3]
-DATA ·constants<>+0x10(SB)/4, $0x61707865
-DATA ·constants<>+0x14(SB)/4, $0x3320646e
-DATA ·constants<>+0x18(SB)/4, $0x79622d32
-DATA ·constants<>+0x1c(SB)/4, $0x6b206574
-
-#define BSWAP V5
-#define J0 V6
-#define KEY0 V7
-#define KEY1 V8
-#define NONCE V9
-#define CTR V10
-#define M0 V11
-#define M1 V12
-#define M2 V13
-#define M3 V14
-#define INC V15
-#define X0 V16
-#define X1 V17
-#define X2 V18
-#define X3 V19
-#define X4 V20
-#define X5 V21
-#define X6 V22
-#define X7 V23
-#define X8 V24
-#define X9 V25
-#define X10 V26
-#define X11 V27
-#define X12 V28
-#define X13 V29
-#define X14 V30
-#define X15 V31
-
-#define NUM_ROUNDS 20
-
-#define ROUND4(a0, a1, a2, a3, b0, b1, b2, b3, c0, c1, c2, c3, d0, d1, d2, d3) \
- VAF a1, a0, a0 \
- VAF b1, b0, b0 \
- VAF c1, c0, c0 \
- VAF d1, d0, d0 \
- VX a0, a2, a2 \
- VX b0, b2, b2 \
- VX c0, c2, c2 \
- VX d0, d2, d2 \
- VERLLF $16, a2, a2 \
- VERLLF $16, b2, b2 \
- VERLLF $16, c2, c2 \
- VERLLF $16, d2, d2 \
- VAF a2, a3, a3 \
- VAF b2, b3, b3 \
- VAF c2, c3, c3 \
- VAF d2, d3, d3 \
- VX a3, a1, a1 \
- VX b3, b1, b1 \
- VX c3, c1, c1 \
- VX d3, d1, d1 \
- VERLLF $12, a1, a1 \
- VERLLF $12, b1, b1 \
- VERLLF $12, c1, c1 \
- VERLLF $12, d1, d1 \
- VAF a1, a0, a0 \
- VAF b1, b0, b0 \
- VAF c1, c0, c0 \
- VAF d1, d0, d0 \
- VX a0, a2, a2 \
- VX b0, b2, b2 \
- VX c0, c2, c2 \
- VX d0, d2, d2 \
- VERLLF $8, a2, a2 \
- VERLLF $8, b2, b2 \
- VERLLF $8, c2, c2 \
- VERLLF $8, d2, d2 \
- VAF a2, a3, a3 \
- VAF b2, b3, b3 \
- VAF c2, c3, c3 \
- VAF d2, d3, d3 \
- VX a3, a1, a1 \
- VX b3, b1, b1 \
- VX c3, c1, c1 \
- VX d3, d1, d1 \
- VERLLF $7, a1, a1 \
- VERLLF $7, b1, b1 \
- VERLLF $7, c1, c1 \
- VERLLF $7, d1, d1
-
-#define PERMUTE(mask, v0, v1, v2, v3) \
- VPERM v0, v0, mask, v0 \
- VPERM v1, v1, mask, v1 \
- VPERM v2, v2, mask, v2 \
- VPERM v3, v3, mask, v3
-
-#define ADDV(x, v0, v1, v2, v3) \
- VAF x, v0, v0 \
- VAF x, v1, v1 \
- VAF x, v2, v2 \
- VAF x, v3, v3
-
-#define XORV(off, dst, src, v0, v1, v2, v3) \
- VLM off(src), M0, M3 \
- PERMUTE(BSWAP, v0, v1, v2, v3) \
- VX v0, M0, M0 \
- VX v1, M1, M1 \
- VX v2, M2, M2 \
- VX v3, M3, M3 \
- VSTM M0, M3, off(dst)
-
-#define SHUFFLE(a, b, c, d, t, u, v, w) \
- VMRHF a, c, t \ // t = {a[0], c[0], a[1], c[1]}
- VMRHF b, d, u \ // u = {b[0], d[0], b[1], d[1]}
- VMRLF a, c, v \ // v = {a[2], c[2], a[3], c[3]}
- VMRLF b, d, w \ // w = {b[2], d[2], b[3], d[3]}
- VMRHF t, u, a \ // a = {a[0], b[0], c[0], d[0]}
- VMRLF t, u, b \ // b = {a[1], b[1], c[1], d[1]}
- VMRHF v, w, c \ // c = {a[2], b[2], c[2], d[2]}
- VMRLF v, w, d // d = {a[3], b[3], c[3], d[3]}
-
-// func xorKeyStreamVX(dst, src []byte, key *[8]uint32, nonce *[3]uint32, counter *uint32)
-TEXT ·xorKeyStreamVX(SB), NOSPLIT, $0
- MOVD $·constants<>(SB), R1
- MOVD dst+0(FP), R2 // R2=&dst[0]
- LMG src+24(FP), R3, R4 // R3=&src[0] R4=len(src)
- MOVD key+48(FP), R5 // R5=key
- MOVD nonce+56(FP), R6 // R6=nonce
- MOVD counter+64(FP), R7 // R7=counter
-
- // load BSWAP and J0
- VLM (R1), BSWAP, J0
-
- // setup
- MOVD $95, R0
- VLM (R5), KEY0, KEY1
- VLL R0, (R6), NONCE
- VZERO M0
- VLEIB $7, $32, M0
- VSRLB M0, NONCE, NONCE
-
- // initialize counter values
- VLREPF (R7), CTR
- VZERO INC
- VLEIF $1, $1, INC
- VLEIF $2, $2, INC
- VLEIF $3, $3, INC
- VAF INC, CTR, CTR
- VREPIF $4, INC
-
-chacha:
- VREPF $0, J0, X0
- VREPF $1, J0, X1
- VREPF $2, J0, X2
- VREPF $3, J0, X3
- VREPF $0, KEY0, X4
- VREPF $1, KEY0, X5
- VREPF $2, KEY0, X6
- VREPF $3, KEY0, X7
- VREPF $0, KEY1, X8
- VREPF $1, KEY1, X9
- VREPF $2, KEY1, X10
- VREPF $3, KEY1, X11
- VLR CTR, X12
- VREPF $1, NONCE, X13
- VREPF $2, NONCE, X14
- VREPF $3, NONCE, X15
-
- MOVD $(NUM_ROUNDS/2), R1
-
-loop:
- ROUND4(X0, X4, X12, X8, X1, X5, X13, X9, X2, X6, X14, X10, X3, X7, X15, X11)
- ROUND4(X0, X5, X15, X10, X1, X6, X12, X11, X2, X7, X13, X8, X3, X4, X14, X9)
-
- ADD $-1, R1
- BNE loop
-
- // decrement length
- ADD $-256, R4
-
- // rearrange vectors
- SHUFFLE(X0, X1, X2, X3, M0, M1, M2, M3)
- ADDV(J0, X0, X1, X2, X3)
- SHUFFLE(X4, X5, X6, X7, M0, M1, M2, M3)
- ADDV(KEY0, X4, X5, X6, X7)
- SHUFFLE(X8, X9, X10, X11, M0, M1, M2, M3)
- ADDV(KEY1, X8, X9, X10, X11)
- VAF CTR, X12, X12
- SHUFFLE(X12, X13, X14, X15, M0, M1, M2, M3)
- ADDV(NONCE, X12, X13, X14, X15)
-
- // increment counters
- VAF INC, CTR, CTR
-
- // xor keystream with plaintext
- XORV(0*64, R2, R3, X0, X4, X8, X12)
- XORV(1*64, R2, R3, X1, X5, X9, X13)
- XORV(2*64, R2, R3, X2, X6, X10, X14)
- XORV(3*64, R2, R3, X3, X7, X11, X15)
-
- // increment pointers
- MOVD $256(R2), R2
- MOVD $256(R3), R3
-
- CMPBNE R4, $0, chacha
-
- VSTEF $0, CTR, (R7)
- RET
diff --git a/vendor/golang.org/x/crypto/chacha20/xor.go b/vendor/golang.org/x/crypto/chacha20/xor.go
deleted file mode 100644
index c2d04851e..000000000
--- a/vendor/golang.org/x/crypto/chacha20/xor.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found src the LICENSE file.
-
-package chacha20
-
-import "runtime"
-
-// Platforms that have fast unaligned 32-bit little endian accesses.
-const unaligned = runtime.GOARCH == "386" ||
- runtime.GOARCH == "amd64" ||
- runtime.GOARCH == "arm64" ||
- runtime.GOARCH == "ppc64le" ||
- runtime.GOARCH == "s390x"
-
-// addXor reads a little endian uint32 from src, XORs it with (a + b) and
-// places the result in little endian byte order in dst.
-func addXor(dst, src []byte, a, b uint32) {
- _, _ = src[3], dst[3] // bounds check elimination hint
- if unaligned {
- // The compiler should optimize this code into
- // 32-bit unaligned little endian loads and stores.
- // TODO: delete once the compiler does a reliably
- // good job with the generic code below.
- // See issue #25111 for more details.
- v := uint32(src[0])
- v |= uint32(src[1]) << 8
- v |= uint32(src[2]) << 16
- v |= uint32(src[3]) << 24
- v ^= a + b
- dst[0] = byte(v)
- dst[1] = byte(v >> 8)
- dst[2] = byte(v >> 16)
- dst[3] = byte(v >> 24)
- } else {
- a += b
- dst[0] = src[0] ^ byte(a)
- dst[1] = src[1] ^ byte(a>>8)
- dst[2] = src[2] ^ byte(a>>16)
- dst[3] = src[3] ^ byte(a>>24)
- }
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go
deleted file mode 100644
index 21ca3b2ee..000000000
--- a/vendor/golang.org/x/crypto/curve25519/curve25519.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2019 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 curve25519 provides an implementation of the X25519 function, which
-// performs scalar multiplication on the elliptic curve known as Curve25519.
-// See RFC 7748.
-//
-// This package is a wrapper for the X25519 implementation
-// in the crypto/ecdh package.
-package curve25519
-
-import "crypto/ecdh"
-
-// ScalarMult sets dst to the product scalar * point.
-//
-// Deprecated: when provided a low-order point, ScalarMult will set dst to all
-// zeroes, irrespective of the scalar. Instead, use the X25519 function, which
-// will return an error.
-func ScalarMult(dst, scalar, point *[32]byte) {
- if _, err := x25519(dst, scalar[:], point[:]); err != nil {
- // The only error condition for x25519 when the inputs are 32 bytes long
- // is if the output would have been the all-zero value.
- for i := range dst {
- dst[i] = 0
- }
- }
-}
-
-// ScalarBaseMult sets dst to the product scalar * base where base is the
-// standard generator.
-//
-// It is recommended to use the X25519 function with Basepoint instead, as
-// copying into fixed size arrays can lead to unexpected bugs.
-func ScalarBaseMult(dst, scalar *[32]byte) {
- curve := ecdh.X25519()
- priv, err := curve.NewPrivateKey(scalar[:])
- if err != nil {
- panic("curve25519: internal error: scalarBaseMult was not 32 bytes")
- }
- copy(dst[:], priv.PublicKey().Bytes())
-}
-
-const (
- // ScalarSize is the size of the scalar input to X25519.
- ScalarSize = 32
- // PointSize is the size of the point input to X25519.
- PointSize = 32
-)
-
-// Basepoint is the canonical Curve25519 generator.
-var Basepoint []byte
-
-var basePoint = [32]byte{9}
-
-func init() { Basepoint = basePoint[:] }
-
-// X25519 returns the result of the scalar multiplication (scalar * point),
-// according to RFC 7748, Section 5. scalar, point and the return value are
-// slices of 32 bytes.
-//
-// scalar can be generated at random, for example with crypto/rand. point should
-// be either Basepoint or the output of another X25519 call.
-//
-// If point is Basepoint (but not if it's a different slice with the same
-// contents) a precomputed implementation might be used for performance.
-func X25519(scalar, point []byte) ([]byte, error) {
- // Outline the body of function, to let the allocation be inlined in the
- // caller, and possibly avoid escaping to the heap.
- var dst [32]byte
- return x25519(&dst, scalar, point)
-}
-
-func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) {
- curve := ecdh.X25519()
- pub, err := curve.NewPublicKey(point)
- if err != nil {
- return nil, err
- }
- priv, err := curve.NewPrivateKey(scalar)
- if err != nil {
- return nil, err
- }
- out, err := priv.ECDH(pub)
- if err != nil {
- return nil, err
- }
- copy(dst[:], out)
- return dst[:], nil
-}
diff --git a/vendor/golang.org/x/crypto/hkdf/hkdf.go b/vendor/golang.org/x/crypto/hkdf/hkdf.go
deleted file mode 100644
index 3bee66294..000000000
--- a/vendor/golang.org/x/crypto/hkdf/hkdf.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package hkdf implements the HMAC-based Extract-and-Expand Key Derivation
-// Function (HKDF) as defined in RFC 5869.
-//
-// HKDF is a cryptographic key derivation function (KDF) with the goal of
-// expanding limited input keying material into one or more cryptographically
-// strong secret keys.
-package hkdf
-
-import (
- "crypto/hmac"
- "errors"
- "hash"
- "io"
-)
-
-// Extract generates a pseudorandom key for use with Expand from an input secret
-// and an optional independent salt.
-//
-// Only use this function if you need to reuse the extracted key with multiple
-// Expand invocations and different context values. Most common scenarios,
-// including the generation of multiple keys, should use New instead.
-func Extract(hash func() hash.Hash, secret, salt []byte) []byte {
- if salt == nil {
- salt = make([]byte, hash().Size())
- }
- extractor := hmac.New(hash, salt)
- extractor.Write(secret)
- return extractor.Sum(nil)
-}
-
-type hkdf struct {
- expander hash.Hash
- size int
-
- info []byte
- counter byte
-
- prev []byte
- buf []byte
-}
-
-func (f *hkdf) Read(p []byte) (int, error) {
- // Check whether enough data can be generated
- need := len(p)
- remains := len(f.buf) + int(255-f.counter+1)*f.size
- if remains < need {
- return 0, errors.New("hkdf: entropy limit reached")
- }
- // Read any leftover from the buffer
- n := copy(p, f.buf)
- p = p[n:]
-
- // Fill the rest of the buffer
- for len(p) > 0 {
- if f.counter > 1 {
- f.expander.Reset()
- }
- f.expander.Write(f.prev)
- f.expander.Write(f.info)
- f.expander.Write([]byte{f.counter})
- f.prev = f.expander.Sum(f.prev[:0])
- f.counter++
-
- // Copy the new batch into p
- f.buf = f.prev
- n = copy(p, f.buf)
- p = p[n:]
- }
- // Save leftovers for next run
- f.buf = f.buf[n:]
-
- return need, nil
-}
-
-// Expand returns a Reader, from which keys can be read, using the given
-// pseudorandom key and optional context info, skipping the extraction step.
-//
-// The pseudorandomKey should have been generated by Extract, or be a uniformly
-// random or pseudorandom cryptographically strong key. See RFC 5869, Section
-// 3.3. Most common scenarios will want to use New instead.
-func Expand(hash func() hash.Hash, pseudorandomKey, info []byte) io.Reader {
- expander := hmac.New(hash, pseudorandomKey)
- return &hkdf{expander, expander.Size(), info, 1, nil, nil}
-}
-
-// New returns a Reader, from which keys can be read, using the given hash,
-// secret, salt and context info. Salt and info can be nil.
-func New(hash func() hash.Hash, secret, salt, info []byte) io.Reader {
- prk := Extract(hash, secret, salt)
- return Expand(hash, prk, info)
-}
diff --git a/vendor/golang.org/x/crypto/internal/alias/alias.go b/vendor/golang.org/x/crypto/internal/alias/alias.go
deleted file mode 100644
index 551ff0c35..000000000
--- a/vendor/golang.org/x/crypto/internal/alias/alias.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !purego
-
-// Package alias implements memory aliasing tests.
-package alias
-
-import "unsafe"
-
-// AnyOverlap reports whether x and y share memory at any (not necessarily
-// corresponding) index. The memory beyond the slice length is ignored.
-func AnyOverlap(x, y []byte) bool {
- return len(x) > 0 && len(y) > 0 &&
- uintptr(unsafe.Pointer(&x[0])) <= uintptr(unsafe.Pointer(&y[len(y)-1])) &&
- uintptr(unsafe.Pointer(&y[0])) <= uintptr(unsafe.Pointer(&x[len(x)-1]))
-}
-
-// InexactOverlap reports whether x and y share memory at any non-corresponding
-// index. The memory beyond the slice length is ignored. Note that x and y can
-// have different lengths and still not have any inexact overlap.
-//
-// InexactOverlap can be used to implement the requirements of the crypto/cipher
-// AEAD, Block, BlockMode and Stream interfaces.
-func InexactOverlap(x, y []byte) bool {
- if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
- return false
- }
- return AnyOverlap(x, y)
-}
diff --git a/vendor/golang.org/x/crypto/internal/alias/alias_purego.go b/vendor/golang.org/x/crypto/internal/alias/alias_purego.go
deleted file mode 100644
index 6fe61b5c6..000000000
--- a/vendor/golang.org/x/crypto/internal/alias/alias_purego.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build purego
-
-// Package alias implements memory aliasing tests.
-package alias
-
-// This is the Google App Engine standard variant based on reflect
-// because the unsafe package and cgo are disallowed.
-
-import "reflect"
-
-// AnyOverlap reports whether x and y share memory at any (not necessarily
-// corresponding) index. The memory beyond the slice length is ignored.
-func AnyOverlap(x, y []byte) bool {
- return len(x) > 0 && len(y) > 0 &&
- reflect.ValueOf(&x[0]).Pointer() <= reflect.ValueOf(&y[len(y)-1]).Pointer() &&
- reflect.ValueOf(&y[0]).Pointer() <= reflect.ValueOf(&x[len(x)-1]).Pointer()
-}
-
-// InexactOverlap reports whether x and y share memory at any non-corresponding
-// index. The memory beyond the slice length is ignored. Note that x and y can
-// have different lengths and still not have any inexact overlap.
-//
-// InexactOverlap can be used to implement the requirements of the crypto/cipher
-// AEAD, Block, BlockMode and Stream interfaces.
-func InexactOverlap(x, y []byte) bool {
- if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
- return false
- }
- return AnyOverlap(x, y)
-}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go b/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go
deleted file mode 100644
index bd896bdc7..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build (!amd64 && !ppc64le && !ppc64 && !s390x) || !gc || purego
-
-package poly1305
-
-type mac struct{ macGeneric }
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/poly1305.go b/vendor/golang.org/x/crypto/internal/poly1305/poly1305.go
deleted file mode 100644
index 4aaea810a..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/poly1305.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package poly1305 implements Poly1305 one-time message authentication code as
-// specified in https://cr.yp.to/mac/poly1305-20050329.pdf.
-//
-// Poly1305 is a fast, one-time authentication function. It is infeasible for an
-// attacker to generate an authenticator for a message without the key. However, a
-// key must only be used for a single message. Authenticating two different
-// messages with the same key allows an attacker to forge authenticators for other
-// messages with the same key.
-//
-// Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was
-// used with a fixed key in order to generate one-time keys from an nonce.
-// However, in this package AES isn't used and the one-time key is specified
-// directly.
-package poly1305
-
-import "crypto/subtle"
-
-// TagSize is the size, in bytes, of a poly1305 authenticator.
-const TagSize = 16
-
-// Sum generates an authenticator for msg using a one-time key and puts the
-// 16-byte result into out. Authenticating two different messages with the same
-// key allows an attacker to forge messages at will.
-func Sum(out *[16]byte, m []byte, key *[32]byte) {
- h := New(key)
- h.Write(m)
- h.Sum(out[:0])
-}
-
-// Verify returns true if mac is a valid authenticator for m with the given key.
-func Verify(mac *[16]byte, m []byte, key *[32]byte) bool {
- var tmp [16]byte
- Sum(&tmp, m, key)
- return subtle.ConstantTimeCompare(tmp[:], mac[:]) == 1
-}
-
-// New returns a new MAC computing an authentication
-// tag of all data written to it with the given key.
-// This allows writing the message progressively instead
-// of passing it as a single slice. Common users should use
-// the Sum function instead.
-//
-// The key must be unique for each message, as authenticating
-// two different messages with the same key allows an attacker
-// to forge messages at will.
-func New(key *[32]byte) *MAC {
- m := &MAC{}
- initialize(key, &m.macState)
- return m
-}
-
-// MAC is an io.Writer computing an authentication tag
-// of the data written to it.
-//
-// MAC cannot be used like common hash.Hash implementations,
-// because using a poly1305 key twice breaks its security.
-// Therefore writing data to a running MAC after calling
-// Sum or Verify causes it to panic.
-type MAC struct {
- mac // platform-dependent implementation
-
- finalized bool
-}
-
-// Size returns the number of bytes Sum will return.
-func (h *MAC) Size() int { return TagSize }
-
-// Write adds more data to the running message authentication code.
-// It never returns an error.
-//
-// It must not be called after the first call of Sum or Verify.
-func (h *MAC) Write(p []byte) (n int, err error) {
- if h.finalized {
- panic("poly1305: write to MAC after Sum or Verify")
- }
- return h.mac.Write(p)
-}
-
-// Sum computes the authenticator of all data written to the
-// message authentication code.
-func (h *MAC) Sum(b []byte) []byte {
- var mac [TagSize]byte
- h.mac.Sum(&mac)
- h.finalized = true
- return append(b, mac[:]...)
-}
-
-// Verify returns whether the authenticator of all data written to
-// the message authentication code matches the expected value.
-func (h *MAC) Verify(expected []byte) bool {
- var mac [TagSize]byte
- h.mac.Sum(&mac)
- h.finalized = true
- return subtle.ConstantTimeCompare(expected, mac[:]) == 1
-}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go
deleted file mode 100644
index 164cd47d3..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build gc && !purego
-
-package poly1305
-
-//go:noescape
-func update(state *macState, msg []byte)
-
-// mac is a wrapper for macGeneric that redirects calls that would have gone to
-// updateGeneric to update.
-//
-// Its Write and Sum methods are otherwise identical to the macGeneric ones, but
-// using function pointers would carry a major performance cost.
-type mac struct{ macGeneric }
-
-func (h *mac) Write(p []byte) (int, error) {
- nn := len(p)
- if h.offset > 0 {
- n := copy(h.buffer[h.offset:], p)
- if h.offset+n < TagSize {
- h.offset += n
- return nn, nil
- }
- p = p[n:]
- h.offset = 0
- update(&h.macState, h.buffer[:])
- }
- if n := len(p) - (len(p) % TagSize); n > 0 {
- update(&h.macState, p[:n])
- p = p[n:]
- }
- if len(p) > 0 {
- h.offset += copy(h.buffer[h.offset:], p)
- }
- return nn, nil
-}
-
-func (h *mac) Sum(out *[16]byte) {
- state := h.macState
- if h.offset > 0 {
- update(&state, h.buffer[:h.offset])
- }
- finalize(out, &state.h, &state.s)
-}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s
deleted file mode 100644
index 133757384..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s
+++ /dev/null
@@ -1,93 +0,0 @@
-// Code generated by command: go run sum_amd64_asm.go -out ../sum_amd64.s -pkg poly1305. DO NOT EDIT.
-
-//go:build gc && !purego
-
-// func update(state *macState, msg []byte)
-TEXT ·update(SB), $0-32
- MOVQ state+0(FP), DI
- MOVQ msg_base+8(FP), SI
- MOVQ msg_len+16(FP), R15
- MOVQ (DI), R8
- MOVQ 8(DI), R9
- MOVQ 16(DI), R10
- MOVQ 24(DI), R11
- MOVQ 32(DI), R12
- CMPQ R15, $0x10
- JB bytes_between_0_and_15
-
-loop:
- ADDQ (SI), R8
- ADCQ 8(SI), R9
- ADCQ $0x01, R10
- LEAQ 16(SI), SI
-
-multiply:
- MOVQ R11, AX
- MULQ R8
- MOVQ AX, BX
- MOVQ DX, CX
- MOVQ R11, AX
- MULQ R9
- ADDQ AX, CX
- ADCQ $0x00, DX
- MOVQ R11, R13
- IMULQ R10, R13
- ADDQ DX, R13
- MOVQ R12, AX
- MULQ R8
- ADDQ AX, CX
- ADCQ $0x00, DX
- MOVQ DX, R8
- MOVQ R12, R14
- IMULQ R10, R14
- MOVQ R12, AX
- MULQ R9
- ADDQ AX, R13
- ADCQ DX, R14
- ADDQ R8, R13
- ADCQ $0x00, R14
- MOVQ BX, R8
- MOVQ CX, R9
- MOVQ R13, R10
- ANDQ $0x03, R10
- MOVQ R13, BX
- ANDQ $-4, BX
- ADDQ BX, R8
- ADCQ R14, R9
- ADCQ $0x00, R10
- SHRQ $0x02, R14, R13
- SHRQ $0x02, R14
- ADDQ R13, R8
- ADCQ R14, R9
- ADCQ $0x00, R10
- SUBQ $0x10, R15
- CMPQ R15, $0x10
- JAE loop
-
-bytes_between_0_and_15:
- TESTQ R15, R15
- JZ done
- MOVQ $0x00000001, BX
- XORQ CX, CX
- XORQ R13, R13
- ADDQ R15, SI
-
-flush_buffer:
- SHLQ $0x08, BX, CX
- SHLQ $0x08, BX
- MOVB -1(SI), R13
- XORQ R13, BX
- DECQ SI
- DECQ R15
- JNZ flush_buffer
- ADDQ BX, R8
- ADCQ CX, R9
- ADCQ $0x00, R10
- MOVQ $0x00000010, R15
- JMP multiply
-
-done:
- MOVQ R8, (DI)
- MOVQ R9, 8(DI)
- MOVQ R10, 16(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_generic.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_generic.go
deleted file mode 100644
index ec2202bd7..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/sum_generic.go
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This file provides the generic implementation of Sum and MAC. Other files
-// might provide optimized assembly implementations of some of this code.
-
-package poly1305
-
-import (
- "encoding/binary"
- "math/bits"
-)
-
-// Poly1305 [RFC 7539] is a relatively simple algorithm: the authentication tag
-// for a 64 bytes message is approximately
-//
-// s + m[0:16] * r⁴ + m[16:32] * r³ + m[32:48] * r² + m[48:64] * r mod 2¹³⁰ - 5
-//
-// for some secret r and s. It can be computed sequentially like
-//
-// for len(msg) > 0:
-// h += read(msg, 16)
-// h *= r
-// h %= 2¹³⁰ - 5
-// return h + s
-//
-// All the complexity is about doing performant constant-time math on numbers
-// larger than any available numeric type.
-
-func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) {
- h := newMACGeneric(key)
- h.Write(msg)
- h.Sum(out)
-}
-
-func newMACGeneric(key *[32]byte) macGeneric {
- m := macGeneric{}
- initialize(key, &m.macState)
- return m
-}
-
-// macState holds numbers in saturated 64-bit little-endian limbs. That is,
-// the value of [x0, x1, x2] is x[0] + x[1] * 2⁶⁴ + x[2] * 2¹²⁸.
-type macState struct {
- // h is the main accumulator. It is to be interpreted modulo 2¹³⁰ - 5, but
- // can grow larger during and after rounds. It must, however, remain below
- // 2 * (2¹³⁰ - 5).
- h [3]uint64
- // r and s are the private key components.
- r [2]uint64
- s [2]uint64
-}
-
-type macGeneric struct {
- macState
-
- buffer [TagSize]byte
- offset int
-}
-
-// Write splits the incoming message into TagSize chunks, and passes them to
-// update. It buffers incomplete chunks.
-func (h *macGeneric) Write(p []byte) (int, error) {
- nn := len(p)
- if h.offset > 0 {
- n := copy(h.buffer[h.offset:], p)
- if h.offset+n < TagSize {
- h.offset += n
- return nn, nil
- }
- p = p[n:]
- h.offset = 0
- updateGeneric(&h.macState, h.buffer[:])
- }
- if n := len(p) - (len(p) % TagSize); n > 0 {
- updateGeneric(&h.macState, p[:n])
- p = p[n:]
- }
- if len(p) > 0 {
- h.offset += copy(h.buffer[h.offset:], p)
- }
- return nn, nil
-}
-
-// Sum flushes the last incomplete chunk from the buffer, if any, and generates
-// the MAC output. It does not modify its state, in order to allow for multiple
-// calls to Sum, even if no Write is allowed after Sum.
-func (h *macGeneric) Sum(out *[TagSize]byte) {
- state := h.macState
- if h.offset > 0 {
- updateGeneric(&state, h.buffer[:h.offset])
- }
- finalize(out, &state.h, &state.s)
-}
-
-// [rMask0, rMask1] is the specified Poly1305 clamping mask in little-endian. It
-// clears some bits of the secret coefficient to make it possible to implement
-// multiplication more efficiently.
-const (
- rMask0 = 0x0FFFFFFC0FFFFFFF
- rMask1 = 0x0FFFFFFC0FFFFFFC
-)
-
-// initialize loads the 256-bit key into the two 128-bit secret values r and s.
-func initialize(key *[32]byte, m *macState) {
- m.r[0] = binary.LittleEndian.Uint64(key[0:8]) & rMask0
- m.r[1] = binary.LittleEndian.Uint64(key[8:16]) & rMask1
- m.s[0] = binary.LittleEndian.Uint64(key[16:24])
- m.s[1] = binary.LittleEndian.Uint64(key[24:32])
-}
-
-// uint128 holds a 128-bit number as two 64-bit limbs, for use with the
-// bits.Mul64 and bits.Add64 intrinsics.
-type uint128 struct {
- lo, hi uint64
-}
-
-func mul64(a, b uint64) uint128 {
- hi, lo := bits.Mul64(a, b)
- return uint128{lo, hi}
-}
-
-func add128(a, b uint128) uint128 {
- lo, c := bits.Add64(a.lo, b.lo, 0)
- hi, c := bits.Add64(a.hi, b.hi, c)
- if c != 0 {
- panic("poly1305: unexpected overflow")
- }
- return uint128{lo, hi}
-}
-
-func shiftRightBy2(a uint128) uint128 {
- a.lo = a.lo>>2 | (a.hi&3)<<62
- a.hi = a.hi >> 2
- return a
-}
-
-// updateGeneric absorbs msg into the state.h accumulator. For each chunk m of
-// 128 bits of message, it computes
-//
-// h₊ = (h + m) * r mod 2¹³⁰ - 5
-//
-// If the msg length is not a multiple of TagSize, it assumes the last
-// incomplete chunk is the final one.
-func updateGeneric(state *macState, msg []byte) {
- h0, h1, h2 := state.h[0], state.h[1], state.h[2]
- r0, r1 := state.r[0], state.r[1]
-
- for len(msg) > 0 {
- var c uint64
-
- // For the first step, h + m, we use a chain of bits.Add64 intrinsics.
- // The resulting value of h might exceed 2¹³⁰ - 5, but will be partially
- // reduced at the end of the multiplication below.
- //
- // The spec requires us to set a bit just above the message size, not to
- // hide leading zeroes. For full chunks, that's 1 << 128, so we can just
- // add 1 to the most significant (2¹²⁸) limb, h2.
- if len(msg) >= TagSize {
- h0, c = bits.Add64(h0, binary.LittleEndian.Uint64(msg[0:8]), 0)
- h1, c = bits.Add64(h1, binary.LittleEndian.Uint64(msg[8:16]), c)
- h2 += c + 1
-
- msg = msg[TagSize:]
- } else {
- var buf [TagSize]byte
- copy(buf[:], msg)
- buf[len(msg)] = 1
-
- h0, c = bits.Add64(h0, binary.LittleEndian.Uint64(buf[0:8]), 0)
- h1, c = bits.Add64(h1, binary.LittleEndian.Uint64(buf[8:16]), c)
- h2 += c
-
- msg = nil
- }
-
- // Multiplication of big number limbs is similar to elementary school
- // columnar multiplication. Instead of digits, there are 64-bit limbs.
- //
- // We are multiplying a 3 limbs number, h, by a 2 limbs number, r.
- //
- // h2 h1 h0 x
- // r1 r0 =
- // ----------------
- // h2r0 h1r0 h0r0 <-- individual 128-bit products
- // + h2r1 h1r1 h0r1
- // ------------------------
- // m3 m2 m1 m0 <-- result in 128-bit overlapping limbs
- // ------------------------
- // m3.hi m2.hi m1.hi m0.hi <-- carry propagation
- // + m3.lo m2.lo m1.lo m0.lo
- // -------------------------------
- // t4 t3 t2 t1 t0 <-- final result in 64-bit limbs
- //
- // The main difference from pen-and-paper multiplication is that we do
- // carry propagation in a separate step, as if we wrote two digit sums
- // at first (the 128-bit limbs), and then carried the tens all at once.
-
- h0r0 := mul64(h0, r0)
- h1r0 := mul64(h1, r0)
- h2r0 := mul64(h2, r0)
- h0r1 := mul64(h0, r1)
- h1r1 := mul64(h1, r1)
- h2r1 := mul64(h2, r1)
-
- // Since h2 is known to be at most 7 (5 + 1 + 1), and r0 and r1 have their
- // top 4 bits cleared by rMask{0,1}, we know that their product is not going
- // to overflow 64 bits, so we can ignore the high part of the products.
- //
- // This also means that the product doesn't have a fifth limb (t4).
- if h2r0.hi != 0 {
- panic("poly1305: unexpected overflow")
- }
- if h2r1.hi != 0 {
- panic("poly1305: unexpected overflow")
- }
-
- m0 := h0r0
- m1 := add128(h1r0, h0r1) // These two additions don't overflow thanks again
- m2 := add128(h2r0, h1r1) // to the 4 masked bits at the top of r0 and r1.
- m3 := h2r1
-
- t0 := m0.lo
- t1, c := bits.Add64(m1.lo, m0.hi, 0)
- t2, c := bits.Add64(m2.lo, m1.hi, c)
- t3, _ := bits.Add64(m3.lo, m2.hi, c)
-
- // Now we have the result as 4 64-bit limbs, and we need to reduce it
- // modulo 2¹³⁰ - 5. The special shape of this Crandall prime lets us do
- // a cheap partial reduction according to the reduction identity
- //
- // c * 2¹³⁰ + n = c * 5 + n mod 2¹³⁰ - 5
- //
- // because 2¹³⁰ = 5 mod 2¹³⁰ - 5. Partial reduction since the result is
- // likely to be larger than 2¹³⁰ - 5, but still small enough to fit the
- // assumptions we make about h in the rest of the code.
- //
- // See also https://speakerdeck.com/gtank/engineering-prime-numbers?slide=23
-
- // We split the final result at the 2¹³⁰ mark into h and cc, the carry.
- // Note that the carry bits are effectively shifted left by 2, in other
- // words, cc = c * 4 for the c in the reduction identity.
- h0, h1, h2 = t0, t1, t2&maskLow2Bits
- cc := uint128{t2 & maskNotLow2Bits, t3}
-
- // To add c * 5 to h, we first add cc = c * 4, and then add (cc >> 2) = c.
-
- h0, c = bits.Add64(h0, cc.lo, 0)
- h1, c = bits.Add64(h1, cc.hi, c)
- h2 += c
-
- cc = shiftRightBy2(cc)
-
- h0, c = bits.Add64(h0, cc.lo, 0)
- h1, c = bits.Add64(h1, cc.hi, c)
- h2 += c
-
- // h2 is at most 3 + 1 + 1 = 5, making the whole of h at most
- //
- // 5 * 2¹²⁸ + (2¹²⁸ - 1) = 6 * 2¹²⁸ - 1
- }
-
- state.h[0], state.h[1], state.h[2] = h0, h1, h2
-}
-
-const (
- maskLow2Bits uint64 = 0x0000000000000003
- maskNotLow2Bits uint64 = ^maskLow2Bits
-)
-
-// select64 returns x if v == 1 and y if v == 0, in constant time.
-func select64(v, x, y uint64) uint64 { return ^(v-1)&x | (v-1)&y }
-
-// [p0, p1, p2] is 2¹³⁰ - 5 in little endian order.
-const (
- p0 = 0xFFFFFFFFFFFFFFFB
- p1 = 0xFFFFFFFFFFFFFFFF
- p2 = 0x0000000000000003
-)
-
-// finalize completes the modular reduction of h and computes
-//
-// out = h + s mod 2¹²⁸
-func finalize(out *[TagSize]byte, h *[3]uint64, s *[2]uint64) {
- h0, h1, h2 := h[0], h[1], h[2]
-
- // After the partial reduction in updateGeneric, h might be more than
- // 2¹³⁰ - 5, but will be less than 2 * (2¹³⁰ - 5). To complete the reduction
- // in constant time, we compute t = h - (2¹³⁰ - 5), and select h as the
- // result if the subtraction underflows, and t otherwise.
-
- hMinusP0, b := bits.Sub64(h0, p0, 0)
- hMinusP1, b := bits.Sub64(h1, p1, b)
- _, b = bits.Sub64(h2, p2, b)
-
- // h = h if h < p else h - p
- h0 = select64(b, h0, hMinusP0)
- h1 = select64(b, h1, hMinusP1)
-
- // Finally, we compute the last Poly1305 step
- //
- // tag = h + s mod 2¹²⁸
- //
- // by just doing a wide addition with the 128 low bits of h and discarding
- // the overflow.
- h0, c := bits.Add64(h0, s[0], 0)
- h1, _ = bits.Add64(h1, s[1], c)
-
- binary.LittleEndian.PutUint64(out[0:8], h0)
- binary.LittleEndian.PutUint64(out[8:16], h1)
-}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64x.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64x.go
deleted file mode 100644
index 1a1679aaa..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64x.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2019 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.
-
-//go:build gc && !purego && (ppc64 || ppc64le)
-
-package poly1305
-
-//go:noescape
-func update(state *macState, msg []byte)
-
-// mac is a wrapper for macGeneric that redirects calls that would have gone to
-// updateGeneric to update.
-//
-// Its Write and Sum methods are otherwise identical to the macGeneric ones, but
-// using function pointers would carry a major performance cost.
-type mac struct{ macGeneric }
-
-func (h *mac) Write(p []byte) (int, error) {
- nn := len(p)
- if h.offset > 0 {
- n := copy(h.buffer[h.offset:], p)
- if h.offset+n < TagSize {
- h.offset += n
- return nn, nil
- }
- p = p[n:]
- h.offset = 0
- update(&h.macState, h.buffer[:])
- }
- if n := len(p) - (len(p) % TagSize); n > 0 {
- update(&h.macState, p[:n])
- p = p[n:]
- }
- if len(p) > 0 {
- h.offset += copy(h.buffer[h.offset:], p)
- }
- return nn, nil
-}
-
-func (h *mac) Sum(out *[16]byte) {
- state := h.macState
- if h.offset > 0 {
- update(&state, h.buffer[:h.offset])
- }
- finalize(out, &state.h, &state.s)
-}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64x.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64x.s
deleted file mode 100644
index 6899a1dab..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64x.s
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2019 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.
-
-//go:build gc && !purego && (ppc64 || ppc64le)
-
-#include "textflag.h"
-
-// This was ported from the amd64 implementation.
-
-#ifdef GOARCH_ppc64le
-#define LE_MOVD MOVD
-#define LE_MOVWZ MOVWZ
-#define LE_MOVHZ MOVHZ
-#else
-#define LE_MOVD MOVDBR
-#define LE_MOVWZ MOVWBR
-#define LE_MOVHZ MOVHBR
-#endif
-
-#define POLY1305_ADD(msg, h0, h1, h2, t0, t1, t2) \
- LE_MOVD (msg)( R0), t0; \
- LE_MOVD (msg)(R24), t1; \
- MOVD $1, t2; \
- ADDC t0, h0, h0; \
- ADDE t1, h1, h1; \
- ADDE t2, h2; \
- ADD $16, msg
-
-#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3, t4, t5) \
- MULLD r0, h0, t0; \
- MULHDU r0, h0, t1; \
- MULLD r0, h1, t4; \
- MULHDU r0, h1, t5; \
- ADDC t4, t1, t1; \
- MULLD r0, h2, t2; \
- MULHDU r1, h0, t4; \
- MULLD r1, h0, h0; \
- ADDE t5, t2, t2; \
- ADDC h0, t1, t1; \
- MULLD h2, r1, t3; \
- ADDZE t4, h0; \
- MULHDU r1, h1, t5; \
- MULLD r1, h1, t4; \
- ADDC t4, t2, t2; \
- ADDE t5, t3, t3; \
- ADDC h0, t2, t2; \
- MOVD $-4, t4; \
- ADDZE t3; \
- RLDICL $0, t2, $62, h2; \
- AND t2, t4, h0; \
- ADDC t0, h0, h0; \
- ADDE t3, t1, h1; \
- SLD $62, t3, t4; \
- SRD $2, t2; \
- ADDZE h2; \
- OR t4, t2, t2; \
- SRD $2, t3; \
- ADDC t2, h0, h0; \
- ADDE t3, h1, h1; \
- ADDZE h2
-
-// func update(state *[7]uint64, msg []byte)
-TEXT ·update(SB), $0-32
- MOVD state+0(FP), R3
- MOVD msg_base+8(FP), R4
- MOVD msg_len+16(FP), R5
-
- MOVD 0(R3), R8 // h0
- MOVD 8(R3), R9 // h1
- MOVD 16(R3), R10 // h2
- MOVD 24(R3), R11 // r0
- MOVD 32(R3), R12 // r1
-
- MOVD $8, R24
-
- CMP R5, $16
- BLT bytes_between_0_and_15
-
-loop:
- POLY1305_ADD(R4, R8, R9, R10, R20, R21, R22)
-
- PCALIGN $16
-multiply:
- POLY1305_MUL(R8, R9, R10, R11, R12, R16, R17, R18, R14, R20, R21)
- ADD $-16, R5
- CMP R5, $16
- BGE loop
-
-bytes_between_0_and_15:
- CMP R5, $0
- BEQ done
- MOVD $0, R16 // h0
- MOVD $0, R17 // h1
-
-flush_buffer:
- CMP R5, $8
- BLE just1
-
- MOVD $8, R21
- SUB R21, R5, R21
-
- // Greater than 8 -- load the rightmost remaining bytes in msg
- // and put into R17 (h1)
- LE_MOVD (R4)(R21), R17
- MOVD $16, R22
-
- // Find the offset to those bytes
- SUB R5, R22, R22
- SLD $3, R22
-
- // Shift to get only the bytes in msg
- SRD R22, R17, R17
-
- // Put 1 at high end
- MOVD $1, R23
- SLD $3, R21
- SLD R21, R23, R23
- OR R23, R17, R17
-
- // Remainder is 8
- MOVD $8, R5
-
-just1:
- CMP R5, $8
- BLT less8
-
- // Exactly 8
- LE_MOVD (R4), R16
-
- CMP R17, $0
-
- // Check if we've already set R17; if not
- // set 1 to indicate end of msg.
- BNE carry
- MOVD $1, R17
- BR carry
-
-less8:
- MOVD $0, R16 // h0
- MOVD $0, R22 // shift count
- CMP R5, $4
- BLT less4
- LE_MOVWZ (R4), R16
- ADD $4, R4
- ADD $-4, R5
- MOVD $32, R22
-
-less4:
- CMP R5, $2
- BLT less2
- LE_MOVHZ (R4), R21
- SLD R22, R21, R21
- OR R16, R21, R16
- ADD $16, R22
- ADD $-2, R5
- ADD $2, R4
-
-less2:
- CMP R5, $0
- BEQ insert1
- MOVBZ (R4), R21
- SLD R22, R21, R21
- OR R16, R21, R16
- ADD $8, R22
-
-insert1:
- // Insert 1 at end of msg
- MOVD $1, R21
- SLD R22, R21, R21
- OR R16, R21, R16
-
-carry:
- // Add new values to h0, h1, h2
- ADDC R16, R8
- ADDE R17, R9
- ADDZE R10, R10
- MOVD $16, R5
- ADD R5, R4
- BR multiply
-
-done:
- // Save h0, h1, h2 in state
- MOVD R8, 0(R3)
- MOVD R9, 8(R3)
- MOVD R10, 16(R3)
- RET
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go
deleted file mode 100644
index e1d033a49..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build gc && !purego
-
-package poly1305
-
-import (
- "golang.org/x/sys/cpu"
-)
-
-// updateVX is an assembly implementation of Poly1305 that uses vector
-// instructions. It must only be called if the vector facility (vx) is
-// available.
-//
-//go:noescape
-func updateVX(state *macState, msg []byte)
-
-// mac is a replacement for macGeneric that uses a larger buffer and redirects
-// calls that would have gone to updateGeneric to updateVX if the vector
-// facility is installed.
-//
-// A larger buffer is required for good performance because the vector
-// implementation has a higher fixed cost per call than the generic
-// implementation.
-type mac struct {
- macState
-
- buffer [16 * TagSize]byte // size must be a multiple of block size (16)
- offset int
-}
-
-func (h *mac) Write(p []byte) (int, error) {
- nn := len(p)
- if h.offset > 0 {
- n := copy(h.buffer[h.offset:], p)
- if h.offset+n < len(h.buffer) {
- h.offset += n
- return nn, nil
- }
- p = p[n:]
- h.offset = 0
- if cpu.S390X.HasVX {
- updateVX(&h.macState, h.buffer[:])
- } else {
- updateGeneric(&h.macState, h.buffer[:])
- }
- }
-
- tail := len(p) % len(h.buffer) // number of bytes to copy into buffer
- body := len(p) - tail // number of bytes to process now
- if body > 0 {
- if cpu.S390X.HasVX {
- updateVX(&h.macState, p[:body])
- } else {
- updateGeneric(&h.macState, p[:body])
- }
- }
- h.offset = copy(h.buffer[:], p[body:]) // copy tail bytes - can be 0
- return nn, nil
-}
-
-func (h *mac) Sum(out *[TagSize]byte) {
- state := h.macState
- remainder := h.buffer[:h.offset]
-
- // Use the generic implementation if we have 2 or fewer blocks left
- // to sum. The vector implementation has a higher startup time.
- if cpu.S390X.HasVX && len(remainder) > 2*TagSize {
- updateVX(&state, remainder)
- } else if len(remainder) > 0 {
- updateGeneric(&state, remainder)
- }
- finalize(out, &state.h, &state.s)
-}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s
deleted file mode 100644
index 0fe3a7c21..000000000
--- a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s
+++ /dev/null
@@ -1,503 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build gc && !purego
-
-#include "textflag.h"
-
-// This implementation of Poly1305 uses the vector facility (vx)
-// to process up to 2 blocks (32 bytes) per iteration using an
-// algorithm based on the one described in:
-//
-// NEON crypto, Daniel J. Bernstein & Peter Schwabe
-// https://cryptojedi.org/papers/neoncrypto-20120320.pdf
-//
-// This algorithm uses 5 26-bit limbs to represent a 130-bit
-// value. These limbs are, for the most part, zero extended and
-// placed into 64-bit vector register elements. Each vector
-// register is 128-bits wide and so holds 2 of these elements.
-// Using 26-bit limbs allows us plenty of headroom to accommodate
-// accumulations before and after multiplication without
-// overflowing either 32-bits (before multiplication) or 64-bits
-// (after multiplication).
-//
-// In order to parallelise the operations required to calculate
-// the sum we use two separate accumulators and then sum those
-// in an extra final step. For compatibility with the generic
-// implementation we perform this summation at the end of every
-// updateVX call.
-//
-// To use two accumulators we must multiply the message blocks
-// by r² rather than r. Only the final message block should be
-// multiplied by r.
-//
-// Example:
-//
-// We want to calculate the sum (h) for a 64 byte message (m):
-//
-// h = m[0:16]r⁴ + m[16:32]r³ + m[32:48]r² + m[48:64]r
-//
-// To do this we split the calculation into the even indices
-// and odd indices of the message. These form our SIMD 'lanes':
-//
-// h = m[ 0:16]r⁴ + m[32:48]r² + <- lane 0
-// m[16:32]r³ + m[48:64]r <- lane 1
-//
-// To calculate this iteratively we refactor so that both lanes
-// are written in terms of r² and r:
-//
-// h = (m[ 0:16]r² + m[32:48])r² + <- lane 0
-// (m[16:32]r² + m[48:64])r <- lane 1
-// ^ ^
-// | coefficients for second iteration
-// coefficients for first iteration
-//
-// So in this case we would have two iterations. In the first
-// both lanes are multiplied by r². In the second only the
-// first lane is multiplied by r² and the second lane is
-// instead multiplied by r. This gives use the odd and even
-// powers of r that we need from the original equation.
-//
-// Notation:
-//
-// h - accumulator
-// r - key
-// m - message
-//
-// [a, b] - SIMD register holding two 64-bit values
-// [a, b, c, d] - SIMD register holding four 32-bit values
-// xᵢ[n] - limb n of variable x with bit width i
-//
-// Limbs are expressed in little endian order, so for 26-bit
-// limbs x₂₆[4] will be the most significant limb and x₂₆[0]
-// will be the least significant limb.
-
-// masking constants
-#define MOD24 V0 // [0x0000000000ffffff, 0x0000000000ffffff] - mask low 24-bits
-#define MOD26 V1 // [0x0000000003ffffff, 0x0000000003ffffff] - mask low 26-bits
-
-// expansion constants (see EXPAND macro)
-#define EX0 V2
-#define EX1 V3
-#define EX2 V4
-
-// key (r², r or 1 depending on context)
-#define R_0 V5
-#define R_1 V6
-#define R_2 V7
-#define R_3 V8
-#define R_4 V9
-
-// precalculated coefficients (5r², 5r or 0 depending on context)
-#define R5_1 V10
-#define R5_2 V11
-#define R5_3 V12
-#define R5_4 V13
-
-// message block (m)
-#define M_0 V14
-#define M_1 V15
-#define M_2 V16
-#define M_3 V17
-#define M_4 V18
-
-// accumulator (h)
-#define H_0 V19
-#define H_1 V20
-#define H_2 V21
-#define H_3 V22
-#define H_4 V23
-
-// temporary registers (for short-lived values)
-#define T_0 V24
-#define T_1 V25
-#define T_2 V26
-#define T_3 V27
-#define T_4 V28
-
-GLOBL ·constants<>(SB), RODATA, $0x30
-// EX0
-DATA ·constants<>+0x00(SB)/8, $0x0006050403020100
-DATA ·constants<>+0x08(SB)/8, $0x1016151413121110
-// EX1
-DATA ·constants<>+0x10(SB)/8, $0x060c0b0a09080706
-DATA ·constants<>+0x18(SB)/8, $0x161c1b1a19181716
-// EX2
-DATA ·constants<>+0x20(SB)/8, $0x0d0d0d0d0d0f0e0d
-DATA ·constants<>+0x28(SB)/8, $0x1d1d1d1d1d1f1e1d
-
-// MULTIPLY multiplies each lane of f and g, partially reduced
-// modulo 2¹³⁰ - 5. The result, h, consists of partial products
-// in each lane that need to be reduced further to produce the
-// final result.
-//
-// h₁₃₀ = (f₁₃₀g₁₃₀) % 2¹³⁰ + (5f₁₃₀g₁₃₀) / 2¹³⁰
-//
-// Note that the multiplication by 5 of the high bits is
-// achieved by precalculating the multiplication of four of the
-// g coefficients by 5. These are g51-g54.
-#define MULTIPLY(f0, f1, f2, f3, f4, g0, g1, g2, g3, g4, g51, g52, g53, g54, h0, h1, h2, h3, h4) \
- VMLOF f0, g0, h0 \
- VMLOF f0, g3, h3 \
- VMLOF f0, g1, h1 \
- VMLOF f0, g4, h4 \
- VMLOF f0, g2, h2 \
- VMLOF f1, g54, T_0 \
- VMLOF f1, g2, T_3 \
- VMLOF f1, g0, T_1 \
- VMLOF f1, g3, T_4 \
- VMLOF f1, g1, T_2 \
- VMALOF f2, g53, h0, h0 \
- VMALOF f2, g1, h3, h3 \
- VMALOF f2, g54, h1, h1 \
- VMALOF f2, g2, h4, h4 \
- VMALOF f2, g0, h2, h2 \
- VMALOF f3, g52, T_0, T_0 \
- VMALOF f3, g0, T_3, T_3 \
- VMALOF f3, g53, T_1, T_1 \
- VMALOF f3, g1, T_4, T_4 \
- VMALOF f3, g54, T_2, T_2 \
- VMALOF f4, g51, h0, h0 \
- VMALOF f4, g54, h3, h3 \
- VMALOF f4, g52, h1, h1 \
- VMALOF f4, g0, h4, h4 \
- VMALOF f4, g53, h2, h2 \
- VAG T_0, h0, h0 \
- VAG T_3, h3, h3 \
- VAG T_1, h1, h1 \
- VAG T_4, h4, h4 \
- VAG T_2, h2, h2
-
-// REDUCE performs the following carry operations in four
-// stages, as specified in Bernstein & Schwabe:
-//
-// 1: h₂₆[0]->h₂₆[1] h₂₆[3]->h₂₆[4]
-// 2: h₂₆[1]->h₂₆[2] h₂₆[4]->h₂₆[0]
-// 3: h₂₆[0]->h₂₆[1] h₂₆[2]->h₂₆[3]
-// 4: h₂₆[3]->h₂₆[4]
-//
-// The result is that all of the limbs are limited to 26-bits
-// except for h₂₆[1] and h₂₆[4] which are limited to 27-bits.
-//
-// Note that although each limb is aligned at 26-bit intervals
-// they may contain values that exceed 2²⁶ - 1, hence the need
-// to carry the excess bits in each limb.
-#define REDUCE(h0, h1, h2, h3, h4) \
- VESRLG $26, h0, T_0 \
- VESRLG $26, h3, T_1 \
- VN MOD26, h0, h0 \
- VN MOD26, h3, h3 \
- VAG T_0, h1, h1 \
- VAG T_1, h4, h4 \
- VESRLG $26, h1, T_2 \
- VESRLG $26, h4, T_3 \
- VN MOD26, h1, h1 \
- VN MOD26, h4, h4 \
- VESLG $2, T_3, T_4 \
- VAG T_3, T_4, T_4 \
- VAG T_2, h2, h2 \
- VAG T_4, h0, h0 \
- VESRLG $26, h2, T_0 \
- VESRLG $26, h0, T_1 \
- VN MOD26, h2, h2 \
- VN MOD26, h0, h0 \
- VAG T_0, h3, h3 \
- VAG T_1, h1, h1 \
- VESRLG $26, h3, T_2 \
- VN MOD26, h3, h3 \
- VAG T_2, h4, h4
-
-// EXPAND splits the 128-bit little-endian values in0 and in1
-// into 26-bit big-endian limbs and places the results into
-// the first and second lane of d₂₆[0:4] respectively.
-//
-// The EX0, EX1 and EX2 constants are arrays of byte indices
-// for permutation. The permutation both reverses the bytes
-// in the input and ensures the bytes are copied into the
-// destination limb ready to be shifted into their final
-// position.
-#define EXPAND(in0, in1, d0, d1, d2, d3, d4) \
- VPERM in0, in1, EX0, d0 \
- VPERM in0, in1, EX1, d2 \
- VPERM in0, in1, EX2, d4 \
- VESRLG $26, d0, d1 \
- VESRLG $30, d2, d3 \
- VESRLG $4, d2, d2 \
- VN MOD26, d0, d0 \ // [in0₂₆[0], in1₂₆[0]]
- VN MOD26, d3, d3 \ // [in0₂₆[3], in1₂₆[3]]
- VN MOD26, d1, d1 \ // [in0₂₆[1], in1₂₆[1]]
- VN MOD24, d4, d4 \ // [in0₂₆[4], in1₂₆[4]]
- VN MOD26, d2, d2 // [in0₂₆[2], in1₂₆[2]]
-
-// func updateVX(state *macState, msg []byte)
-TEXT ·updateVX(SB), NOSPLIT, $0
- MOVD state+0(FP), R1
- LMG msg+8(FP), R2, R3 // R2=msg_base, R3=msg_len
-
- // load EX0, EX1 and EX2
- MOVD $·constants<>(SB), R5
- VLM (R5), EX0, EX2
-
- // generate masks
- VGMG $(64-24), $63, MOD24 // [0x00ffffff, 0x00ffffff]
- VGMG $(64-26), $63, MOD26 // [0x03ffffff, 0x03ffffff]
-
- // load h (accumulator) and r (key) from state
- VZERO T_1 // [0, 0]
- VL 0(R1), T_0 // [h₆₄[0], h₆₄[1]]
- VLEG $0, 16(R1), T_1 // [h₆₄[2], 0]
- VL 24(R1), T_2 // [r₆₄[0], r₆₄[1]]
- VPDI $0, T_0, T_2, T_3 // [h₆₄[0], r₆₄[0]]
- VPDI $5, T_0, T_2, T_4 // [h₆₄[1], r₆₄[1]]
-
- // unpack h and r into 26-bit limbs
- // note: h₆₄[2] may have the low 3 bits set, so h₂₆[4] is a 27-bit value
- VN MOD26, T_3, H_0 // [h₂₆[0], r₂₆[0]]
- VZERO H_1 // [0, 0]
- VZERO H_3 // [0, 0]
- VGMG $(64-12-14), $(63-12), T_0 // [0x03fff000, 0x03fff000] - 26-bit mask with low 12 bits masked out
- VESLG $24, T_1, T_1 // [h₆₄[2]<<24, 0]
- VERIMG $-26&63, T_3, MOD26, H_1 // [h₂₆[1], r₂₆[1]]
- VESRLG $+52&63, T_3, H_2 // [h₂₆[2], r₂₆[2]] - low 12 bits only
- VERIMG $-14&63, T_4, MOD26, H_3 // [h₂₆[1], r₂₆[1]]
- VESRLG $40, T_4, H_4 // [h₂₆[4], r₂₆[4]] - low 24 bits only
- VERIMG $+12&63, T_4, T_0, H_2 // [h₂₆[2], r₂₆[2]] - complete
- VO T_1, H_4, H_4 // [h₂₆[4], r₂₆[4]] - complete
-
- // replicate r across all 4 vector elements
- VREPF $3, H_0, R_0 // [r₂₆[0], r₂₆[0], r₂₆[0], r₂₆[0]]
- VREPF $3, H_1, R_1 // [r₂₆[1], r₂₆[1], r₂₆[1], r₂₆[1]]
- VREPF $3, H_2, R_2 // [r₂₆[2], r₂₆[2], r₂₆[2], r₂₆[2]]
- VREPF $3, H_3, R_3 // [r₂₆[3], r₂₆[3], r₂₆[3], r₂₆[3]]
- VREPF $3, H_4, R_4 // [r₂₆[4], r₂₆[4], r₂₆[4], r₂₆[4]]
-
- // zero out lane 1 of h
- VLEIG $1, $0, H_0 // [h₂₆[0], 0]
- VLEIG $1, $0, H_1 // [h₂₆[1], 0]
- VLEIG $1, $0, H_2 // [h₂₆[2], 0]
- VLEIG $1, $0, H_3 // [h₂₆[3], 0]
- VLEIG $1, $0, H_4 // [h₂₆[4], 0]
-
- // calculate 5r (ignore least significant limb)
- VREPIF $5, T_0
- VMLF T_0, R_1, R5_1 // [5r₂₆[1], 5r₂₆[1], 5r₂₆[1], 5r₂₆[1]]
- VMLF T_0, R_2, R5_2 // [5r₂₆[2], 5r₂₆[2], 5r₂₆[2], 5r₂₆[2]]
- VMLF T_0, R_3, R5_3 // [5r₂₆[3], 5r₂₆[3], 5r₂₆[3], 5r₂₆[3]]
- VMLF T_0, R_4, R5_4 // [5r₂₆[4], 5r₂₆[4], 5r₂₆[4], 5r₂₆[4]]
-
- // skip r² calculation if we are only calculating one block
- CMPBLE R3, $16, skip
-
- // calculate r²
- MULTIPLY(R_0, R_1, R_2, R_3, R_4, R_0, R_1, R_2, R_3, R_4, R5_1, R5_2, R5_3, R5_4, M_0, M_1, M_2, M_3, M_4)
- REDUCE(M_0, M_1, M_2, M_3, M_4)
- VGBM $0x0f0f, T_0
- VERIMG $0, M_0, T_0, R_0 // [r₂₆[0], r²₂₆[0], r₂₆[0], r²₂₆[0]]
- VERIMG $0, M_1, T_0, R_1 // [r₂₆[1], r²₂₆[1], r₂₆[1], r²₂₆[1]]
- VERIMG $0, M_2, T_0, R_2 // [r₂₆[2], r²₂₆[2], r₂₆[2], r²₂₆[2]]
- VERIMG $0, M_3, T_0, R_3 // [r₂₆[3], r²₂₆[3], r₂₆[3], r²₂₆[3]]
- VERIMG $0, M_4, T_0, R_4 // [r₂₆[4], r²₂₆[4], r₂₆[4], r²₂₆[4]]
-
- // calculate 5r² (ignore least significant limb)
- VREPIF $5, T_0
- VMLF T_0, R_1, R5_1 // [5r₂₆[1], 5r²₂₆[1], 5r₂₆[1], 5r²₂₆[1]]
- VMLF T_0, R_2, R5_2 // [5r₂₆[2], 5r²₂₆[2], 5r₂₆[2], 5r²₂₆[2]]
- VMLF T_0, R_3, R5_3 // [5r₂₆[3], 5r²₂₆[3], 5r₂₆[3], 5r²₂₆[3]]
- VMLF T_0, R_4, R5_4 // [5r₂₆[4], 5r²₂₆[4], 5r₂₆[4], 5r²₂₆[4]]
-
-loop:
- CMPBLE R3, $32, b2 // 2 or fewer blocks remaining, need to change key coefficients
-
- // load next 2 blocks from message
- VLM (R2), T_0, T_1
-
- // update message slice
- SUB $32, R3
- MOVD $32(R2), R2
-
- // unpack message blocks into 26-bit big-endian limbs
- EXPAND(T_0, T_1, M_0, M_1, M_2, M_3, M_4)
-
- // add 2¹²⁸ to each message block value
- VLEIB $4, $1, M_4
- VLEIB $12, $1, M_4
-
-multiply:
- // accumulate the incoming message
- VAG H_0, M_0, M_0
- VAG H_3, M_3, M_3
- VAG H_1, M_1, M_1
- VAG H_4, M_4, M_4
- VAG H_2, M_2, M_2
-
- // multiply the accumulator by the key coefficient
- MULTIPLY(M_0, M_1, M_2, M_3, M_4, R_0, R_1, R_2, R_3, R_4, R5_1, R5_2, R5_3, R5_4, H_0, H_1, H_2, H_3, H_4)
-
- // carry and partially reduce the partial products
- REDUCE(H_0, H_1, H_2, H_3, H_4)
-
- CMPBNE R3, $0, loop
-
-finish:
- // sum lane 0 and lane 1 and put the result in lane 1
- VZERO T_0
- VSUMQG H_0, T_0, H_0
- VSUMQG H_3, T_0, H_3
- VSUMQG H_1, T_0, H_1
- VSUMQG H_4, T_0, H_4
- VSUMQG H_2, T_0, H_2
-
- // reduce again after summation
- // TODO(mundaym): there might be a more efficient way to do this
- // now that we only have 1 active lane. For example, we could
- // simultaneously pack the values as we reduce them.
- REDUCE(H_0, H_1, H_2, H_3, H_4)
-
- // carry h[1] through to h[4] so that only h[4] can exceed 2²⁶ - 1
- // TODO(mundaym): in testing this final carry was unnecessary.
- // Needs a proof before it can be removed though.
- VESRLG $26, H_1, T_1
- VN MOD26, H_1, H_1
- VAQ T_1, H_2, H_2
- VESRLG $26, H_2, T_2
- VN MOD26, H_2, H_2
- VAQ T_2, H_3, H_3
- VESRLG $26, H_3, T_3
- VN MOD26, H_3, H_3
- VAQ T_3, H_4, H_4
-
- // h is now < 2(2¹³⁰ - 5)
- // Pack each lane in h₂₆[0:4] into h₁₂₈[0:1].
- VESLG $26, H_1, H_1
- VESLG $26, H_3, H_3
- VO H_0, H_1, H_0
- VO H_2, H_3, H_2
- VESLG $4, H_2, H_2
- VLEIB $7, $48, H_1
- VSLB H_1, H_2, H_2
- VO H_0, H_2, H_0
- VLEIB $7, $104, H_1
- VSLB H_1, H_4, H_3
- VO H_3, H_0, H_0
- VLEIB $7, $24, H_1
- VSRLB H_1, H_4, H_1
-
- // update state
- VSTEG $1, H_0, 0(R1)
- VSTEG $0, H_0, 8(R1)
- VSTEG $1, H_1, 16(R1)
- RET
-
-b2: // 2 or fewer blocks remaining
- CMPBLE R3, $16, b1
-
- // Load the 2 remaining blocks (17-32 bytes remaining).
- MOVD $-17(R3), R0 // index of final byte to load modulo 16
- VL (R2), T_0 // load full 16 byte block
- VLL R0, 16(R2), T_1 // load final (possibly partial) block and pad with zeros to 16 bytes
-
- // The Poly1305 algorithm requires that a 1 bit be appended to
- // each message block. If the final block is less than 16 bytes
- // long then it is easiest to insert the 1 before the message
- // block is split into 26-bit limbs. If, on the other hand, the
- // final message block is 16 bytes long then we append the 1 bit
- // after expansion as normal.
- MOVBZ $1, R0
- MOVD $-16(R3), R3 // index of byte in last block to insert 1 at (could be 16)
- CMPBEQ R3, $16, 2(PC) // skip the insertion if the final block is 16 bytes long
- VLVGB R3, R0, T_1 // insert 1 into the byte at index R3
-
- // Split both blocks into 26-bit limbs in the appropriate lanes.
- EXPAND(T_0, T_1, M_0, M_1, M_2, M_3, M_4)
-
- // Append a 1 byte to the end of the second to last block.
- VLEIB $4, $1, M_4
-
- // Append a 1 byte to the end of the last block only if it is a
- // full 16 byte block.
- CMPBNE R3, $16, 2(PC)
- VLEIB $12, $1, M_4
-
- // Finally, set up the coefficients for the final multiplication.
- // We have previously saved r and 5r in the 32-bit even indexes
- // of the R_[0-4] and R5_[1-4] coefficient registers.
- //
- // We want lane 0 to be multiplied by r² so that can be kept the
- // same. We want lane 1 to be multiplied by r so we need to move
- // the saved r value into the 32-bit odd index in lane 1 by
- // rotating the 64-bit lane by 32.
- VGBM $0x00ff, T_0 // [0, 0xffffffffffffffff] - mask lane 1 only
- VERIMG $32, R_0, T_0, R_0 // [_, r²₂₆[0], _, r₂₆[0]]
- VERIMG $32, R_1, T_0, R_1 // [_, r²₂₆[1], _, r₂₆[1]]
- VERIMG $32, R_2, T_0, R_2 // [_, r²₂₆[2], _, r₂₆[2]]
- VERIMG $32, R_3, T_0, R_3 // [_, r²₂₆[3], _, r₂₆[3]]
- VERIMG $32, R_4, T_0, R_4 // [_, r²₂₆[4], _, r₂₆[4]]
- VERIMG $32, R5_1, T_0, R5_1 // [_, 5r²₂₆[1], _, 5r₂₆[1]]
- VERIMG $32, R5_2, T_0, R5_2 // [_, 5r²₂₆[2], _, 5r₂₆[2]]
- VERIMG $32, R5_3, T_0, R5_3 // [_, 5r²₂₆[3], _, 5r₂₆[3]]
- VERIMG $32, R5_4, T_0, R5_4 // [_, 5r²₂₆[4], _, 5r₂₆[4]]
-
- MOVD $0, R3
- BR multiply
-
-skip:
- CMPBEQ R3, $0, finish
-
-b1: // 1 block remaining
-
- // Load the final block (1-16 bytes). This will be placed into
- // lane 0.
- MOVD $-1(R3), R0
- VLL R0, (R2), T_0 // pad to 16 bytes with zeros
-
- // The Poly1305 algorithm requires that a 1 bit be appended to
- // each message block. If the final block is less than 16 bytes
- // long then it is easiest to insert the 1 before the message
- // block is split into 26-bit limbs. If, on the other hand, the
- // final message block is 16 bytes long then we append the 1 bit
- // after expansion as normal.
- MOVBZ $1, R0
- CMPBEQ R3, $16, 2(PC)
- VLVGB R3, R0, T_0
-
- // Set the message block in lane 1 to the value 0 so that it
- // can be accumulated without affecting the final result.
- VZERO T_1
-
- // Split the final message block into 26-bit limbs in lane 0.
- // Lane 1 will be contain 0.
- EXPAND(T_0, T_1, M_0, M_1, M_2, M_3, M_4)
-
- // Append a 1 byte to the end of the last block only if it is a
- // full 16 byte block.
- CMPBNE R3, $16, 2(PC)
- VLEIB $4, $1, M_4
-
- // We have previously saved r and 5r in the 32-bit even indexes
- // of the R_[0-4] and R5_[1-4] coefficient registers.
- //
- // We want lane 0 to be multiplied by r so we need to move the
- // saved r value into the 32-bit odd index in lane 0. We want
- // lane 1 to be set to the value 1. This makes multiplication
- // a no-op. We do this by setting lane 1 in every register to 0
- // and then just setting the 32-bit index 3 in R_0 to 1.
- VZERO T_0
- MOVD $0, R0
- MOVD $0x10111213, R12
- VLVGP R12, R0, T_1 // [_, 0x10111213, _, 0x00000000]
- VPERM T_0, R_0, T_1, R_0 // [_, r₂₆[0], _, 0]
- VPERM T_0, R_1, T_1, R_1 // [_, r₂₆[1], _, 0]
- VPERM T_0, R_2, T_1, R_2 // [_, r₂₆[2], _, 0]
- VPERM T_0, R_3, T_1, R_3 // [_, r₂₆[3], _, 0]
- VPERM T_0, R_4, T_1, R_4 // [_, r₂₆[4], _, 0]
- VPERM T_0, R5_1, T_1, R5_1 // [_, 5r₂₆[1], _, 0]
- VPERM T_0, R5_2, T_1, R5_2 // [_, 5r₂₆[2], _, 0]
- VPERM T_0, R5_3, T_1, R5_3 // [_, 5r₂₆[3], _, 0]
- VPERM T_0, R5_4, T_1, R5_4 // [_, 5r₂₆[4], _, 0]
-
- // Set the value of lane 1 to be 1.
- VLEIF $3, $1, R_0 // [_, r₂₆[0], _, 1]
-
- MOVD $0, R3
- BR multiply
diff --git a/vendor/golang.org/x/crypto/sha3/doc.go b/vendor/golang.org/x/crypto/sha3/doc.go
deleted file mode 100644
index bbf391fe6..000000000
--- a/vendor/golang.org/x/crypto/sha3/doc.go
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package sha3 implements the SHA-3 fixed-output-length hash functions and
-// the SHAKE variable-output-length hash functions defined by FIPS-202.
-//
-// All types in this package also implement [encoding.BinaryMarshaler],
-// [encoding.BinaryAppender] and [encoding.BinaryUnmarshaler] to marshal and
-// unmarshal the internal state of the hash.
-//
-// Both types of hash function use the "sponge" construction and the Keccak
-// permutation. For a detailed specification see http://keccak.noekeon.org/
-//
-// # Guidance
-//
-// If you aren't sure what function you need, use SHAKE256 with at least 64
-// bytes of output. The SHAKE instances are faster than the SHA3 instances;
-// the latter have to allocate memory to conform to the hash.Hash interface.
-//
-// If you need a secret-key MAC (message authentication code), prepend the
-// secret key to the input, hash with SHAKE256 and read at least 32 bytes of
-// output.
-//
-// # Security strengths
-//
-// The SHA3-x (x equals 224, 256, 384, or 512) functions have a security
-// strength against preimage attacks of x bits. Since they only produce "x"
-// bits of output, their collision-resistance is only "x/2" bits.
-//
-// The SHAKE-256 and -128 functions have a generic security strength of 256 and
-// 128 bits against all attacks, provided that at least 2x bits of their output
-// is used. Requesting more than 64 or 32 bytes of output, respectively, does
-// not increase the collision-resistance of the SHAKE functions.
-//
-// # The sponge construction
-//
-// A sponge builds a pseudo-random function from a public pseudo-random
-// permutation, by applying the permutation to a state of "rate + capacity"
-// bytes, but hiding "capacity" of the bytes.
-//
-// A sponge starts out with a zero state. To hash an input using a sponge, up
-// to "rate" bytes of the input are XORed into the sponge's state. The sponge
-// is then "full" and the permutation is applied to "empty" it. This process is
-// repeated until all the input has been "absorbed". The input is then padded.
-// The digest is "squeezed" from the sponge in the same way, except that output
-// is copied out instead of input being XORed in.
-//
-// A sponge is parameterized by its generic security strength, which is equal
-// to half its capacity; capacity + rate is equal to the permutation's width.
-// Since the KeccakF-1600 permutation is 1600 bits (200 bytes) wide, this means
-// that the security strength of a sponge instance is equal to (1600 - bitrate) / 2.
-//
-// # Recommendations
-//
-// The SHAKE functions are recommended for most new uses. They can produce
-// output of arbitrary length. SHAKE256, with an output length of at least
-// 64 bytes, provides 256-bit security against all attacks. The Keccak team
-// recommends it for most applications upgrading from SHA2-512. (NIST chose a
-// much stronger, but much slower, sponge instance for SHA3-512.)
-//
-// The SHA-3 functions are "drop-in" replacements for the SHA-2 functions.
-// They produce output of the same length, with the same security strengths
-// against all attacks. This means, in particular, that SHA3-256 only has
-// 128-bit collision resistance, because its output length is 32 bytes.
-package sha3
diff --git a/vendor/golang.org/x/crypto/sha3/hashes.go b/vendor/golang.org/x/crypto/sha3/hashes.go
deleted file mode 100644
index 31fffbe04..000000000
--- a/vendor/golang.org/x/crypto/sha3/hashes.go
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package sha3
-
-// This file provides functions for creating instances of the SHA-3
-// and SHAKE hash functions, as well as utility functions for hashing
-// bytes.
-
-import (
- "crypto"
- "hash"
-)
-
-// New224 creates a new SHA3-224 hash.
-// Its generic security strength is 224 bits against preimage attacks,
-// and 112 bits against collision attacks.
-func New224() hash.Hash {
- return new224()
-}
-
-// New256 creates a new SHA3-256 hash.
-// Its generic security strength is 256 bits against preimage attacks,
-// and 128 bits against collision attacks.
-func New256() hash.Hash {
- return new256()
-}
-
-// New384 creates a new SHA3-384 hash.
-// Its generic security strength is 384 bits against preimage attacks,
-// and 192 bits against collision attacks.
-func New384() hash.Hash {
- return new384()
-}
-
-// New512 creates a new SHA3-512 hash.
-// Its generic security strength is 512 bits against preimage attacks,
-// and 256 bits against collision attacks.
-func New512() hash.Hash {
- return new512()
-}
-
-func init() {
- crypto.RegisterHash(crypto.SHA3_224, New224)
- crypto.RegisterHash(crypto.SHA3_256, New256)
- crypto.RegisterHash(crypto.SHA3_384, New384)
- crypto.RegisterHash(crypto.SHA3_512, New512)
-}
-
-const (
- dsbyteSHA3 = 0b00000110
- dsbyteKeccak = 0b00000001
- dsbyteShake = 0b00011111
- dsbyteCShake = 0b00000100
-
- // rateK[c] is the rate in bytes for Keccak[c] where c is the capacity in
- // bits. Given the sponge size is 1600 bits, the rate is 1600 - c bits.
- rateK256 = (1600 - 256) / 8
- rateK448 = (1600 - 448) / 8
- rateK512 = (1600 - 512) / 8
- rateK768 = (1600 - 768) / 8
- rateK1024 = (1600 - 1024) / 8
-)
-
-func new224Generic() *state {
- return &state{rate: rateK448, outputLen: 28, dsbyte: dsbyteSHA3}
-}
-
-func new256Generic() *state {
- return &state{rate: rateK512, outputLen: 32, dsbyte: dsbyteSHA3}
-}
-
-func new384Generic() *state {
- return &state{rate: rateK768, outputLen: 48, dsbyte: dsbyteSHA3}
-}
-
-func new512Generic() *state {
- return &state{rate: rateK1024, outputLen: 64, dsbyte: dsbyteSHA3}
-}
-
-// NewLegacyKeccak256 creates a new Keccak-256 hash.
-//
-// Only use this function if you require compatibility with an existing cryptosystem
-// that uses non-standard padding. All other users should use New256 instead.
-func NewLegacyKeccak256() hash.Hash {
- return &state{rate: rateK512, outputLen: 32, dsbyte: dsbyteKeccak}
-}
-
-// NewLegacyKeccak512 creates a new Keccak-512 hash.
-//
-// Only use this function if you require compatibility with an existing cryptosystem
-// that uses non-standard padding. All other users should use New512 instead.
-func NewLegacyKeccak512() hash.Hash {
- return &state{rate: rateK1024, outputLen: 64, dsbyte: dsbyteKeccak}
-}
-
-// Sum224 returns the SHA3-224 digest of the data.
-func Sum224(data []byte) (digest [28]byte) {
- h := New224()
- h.Write(data)
- h.Sum(digest[:0])
- return
-}
-
-// Sum256 returns the SHA3-256 digest of the data.
-func Sum256(data []byte) (digest [32]byte) {
- h := New256()
- h.Write(data)
- h.Sum(digest[:0])
- return
-}
-
-// Sum384 returns the SHA3-384 digest of the data.
-func Sum384(data []byte) (digest [48]byte) {
- h := New384()
- h.Write(data)
- h.Sum(digest[:0])
- return
-}
-
-// Sum512 returns the SHA3-512 digest of the data.
-func Sum512(data []byte) (digest [64]byte) {
- h := New512()
- h.Write(data)
- h.Sum(digest[:0])
- return
-}
diff --git a/vendor/golang.org/x/crypto/sha3/hashes_noasm.go b/vendor/golang.org/x/crypto/sha3/hashes_noasm.go
deleted file mode 100644
index 9d85fb621..000000000
--- a/vendor/golang.org/x/crypto/sha3/hashes_noasm.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2023 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.
-
-//go:build !gc || purego || !s390x
-
-package sha3
-
-func new224() *state {
- return new224Generic()
-}
-
-func new256() *state {
- return new256Generic()
-}
-
-func new384() *state {
- return new384Generic()
-}
-
-func new512() *state {
- return new512Generic()
-}
diff --git a/vendor/golang.org/x/crypto/sha3/keccakf.go b/vendor/golang.org/x/crypto/sha3/keccakf.go
deleted file mode 100644
index ce48b1dd3..000000000
--- a/vendor/golang.org/x/crypto/sha3/keccakf.go
+++ /dev/null
@@ -1,414 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !amd64 || purego || !gc
-
-package sha3
-
-import "math/bits"
-
-// rc stores the round constants for use in the ι step.
-var rc = [24]uint64{
- 0x0000000000000001,
- 0x0000000000008082,
- 0x800000000000808A,
- 0x8000000080008000,
- 0x000000000000808B,
- 0x0000000080000001,
- 0x8000000080008081,
- 0x8000000000008009,
- 0x000000000000008A,
- 0x0000000000000088,
- 0x0000000080008009,
- 0x000000008000000A,
- 0x000000008000808B,
- 0x800000000000008B,
- 0x8000000000008089,
- 0x8000000000008003,
- 0x8000000000008002,
- 0x8000000000000080,
- 0x000000000000800A,
- 0x800000008000000A,
- 0x8000000080008081,
- 0x8000000000008080,
- 0x0000000080000001,
- 0x8000000080008008,
-}
-
-// keccakF1600 applies the Keccak permutation to a 1600b-wide
-// state represented as a slice of 25 uint64s.
-func keccakF1600(a *[25]uint64) {
- // Implementation translated from Keccak-inplace.c
- // in the keccak reference code.
- var t, bc0, bc1, bc2, bc3, bc4, d0, d1, d2, d3, d4 uint64
-
- for i := 0; i < 24; i += 4 {
- // Combines the 5 steps in each round into 2 steps.
- // Unrolls 4 rounds per loop and spreads some steps across rounds.
-
- // Round 1
- bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
- bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
- bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
- bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
- bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
- d0 = bc4 ^ (bc1<<1 | bc1>>63)
- d1 = bc0 ^ (bc2<<1 | bc2>>63)
- d2 = bc1 ^ (bc3<<1 | bc3>>63)
- d3 = bc2 ^ (bc4<<1 | bc4>>63)
- d4 = bc3 ^ (bc0<<1 | bc0>>63)
-
- bc0 = a[0] ^ d0
- t = a[6] ^ d1
- bc1 = bits.RotateLeft64(t, 44)
- t = a[12] ^ d2
- bc2 = bits.RotateLeft64(t, 43)
- t = a[18] ^ d3
- bc3 = bits.RotateLeft64(t, 21)
- t = a[24] ^ d4
- bc4 = bits.RotateLeft64(t, 14)
- a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i]
- a[6] = bc1 ^ (bc3 &^ bc2)
- a[12] = bc2 ^ (bc4 &^ bc3)
- a[18] = bc3 ^ (bc0 &^ bc4)
- a[24] = bc4 ^ (bc1 &^ bc0)
-
- t = a[10] ^ d0
- bc2 = bits.RotateLeft64(t, 3)
- t = a[16] ^ d1
- bc3 = bits.RotateLeft64(t, 45)
- t = a[22] ^ d2
- bc4 = bits.RotateLeft64(t, 61)
- t = a[3] ^ d3
- bc0 = bits.RotateLeft64(t, 28)
- t = a[9] ^ d4
- bc1 = bits.RotateLeft64(t, 20)
- a[10] = bc0 ^ (bc2 &^ bc1)
- a[16] = bc1 ^ (bc3 &^ bc2)
- a[22] = bc2 ^ (bc4 &^ bc3)
- a[3] = bc3 ^ (bc0 &^ bc4)
- a[9] = bc4 ^ (bc1 &^ bc0)
-
- t = a[20] ^ d0
- bc4 = bits.RotateLeft64(t, 18)
- t = a[1] ^ d1
- bc0 = bits.RotateLeft64(t, 1)
- t = a[7] ^ d2
- bc1 = bits.RotateLeft64(t, 6)
- t = a[13] ^ d3
- bc2 = bits.RotateLeft64(t, 25)
- t = a[19] ^ d4
- bc3 = bits.RotateLeft64(t, 8)
- a[20] = bc0 ^ (bc2 &^ bc1)
- a[1] = bc1 ^ (bc3 &^ bc2)
- a[7] = bc2 ^ (bc4 &^ bc3)
- a[13] = bc3 ^ (bc0 &^ bc4)
- a[19] = bc4 ^ (bc1 &^ bc0)
-
- t = a[5] ^ d0
- bc1 = bits.RotateLeft64(t, 36)
- t = a[11] ^ d1
- bc2 = bits.RotateLeft64(t, 10)
- t = a[17] ^ d2
- bc3 = bits.RotateLeft64(t, 15)
- t = a[23] ^ d3
- bc4 = bits.RotateLeft64(t, 56)
- t = a[4] ^ d4
- bc0 = bits.RotateLeft64(t, 27)
- a[5] = bc0 ^ (bc2 &^ bc1)
- a[11] = bc1 ^ (bc3 &^ bc2)
- a[17] = bc2 ^ (bc4 &^ bc3)
- a[23] = bc3 ^ (bc0 &^ bc4)
- a[4] = bc4 ^ (bc1 &^ bc0)
-
- t = a[15] ^ d0
- bc3 = bits.RotateLeft64(t, 41)
- t = a[21] ^ d1
- bc4 = bits.RotateLeft64(t, 2)
- t = a[2] ^ d2
- bc0 = bits.RotateLeft64(t, 62)
- t = a[8] ^ d3
- bc1 = bits.RotateLeft64(t, 55)
- t = a[14] ^ d4
- bc2 = bits.RotateLeft64(t, 39)
- a[15] = bc0 ^ (bc2 &^ bc1)
- a[21] = bc1 ^ (bc3 &^ bc2)
- a[2] = bc2 ^ (bc4 &^ bc3)
- a[8] = bc3 ^ (bc0 &^ bc4)
- a[14] = bc4 ^ (bc1 &^ bc0)
-
- // Round 2
- bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
- bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
- bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
- bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
- bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
- d0 = bc4 ^ (bc1<<1 | bc1>>63)
- d1 = bc0 ^ (bc2<<1 | bc2>>63)
- d2 = bc1 ^ (bc3<<1 | bc3>>63)
- d3 = bc2 ^ (bc4<<1 | bc4>>63)
- d4 = bc3 ^ (bc0<<1 | bc0>>63)
-
- bc0 = a[0] ^ d0
- t = a[16] ^ d1
- bc1 = bits.RotateLeft64(t, 44)
- t = a[7] ^ d2
- bc2 = bits.RotateLeft64(t, 43)
- t = a[23] ^ d3
- bc3 = bits.RotateLeft64(t, 21)
- t = a[14] ^ d4
- bc4 = bits.RotateLeft64(t, 14)
- a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+1]
- a[16] = bc1 ^ (bc3 &^ bc2)
- a[7] = bc2 ^ (bc4 &^ bc3)
- a[23] = bc3 ^ (bc0 &^ bc4)
- a[14] = bc4 ^ (bc1 &^ bc0)
-
- t = a[20] ^ d0
- bc2 = bits.RotateLeft64(t, 3)
- t = a[11] ^ d1
- bc3 = bits.RotateLeft64(t, 45)
- t = a[2] ^ d2
- bc4 = bits.RotateLeft64(t, 61)
- t = a[18] ^ d3
- bc0 = bits.RotateLeft64(t, 28)
- t = a[9] ^ d4
- bc1 = bits.RotateLeft64(t, 20)
- a[20] = bc0 ^ (bc2 &^ bc1)
- a[11] = bc1 ^ (bc3 &^ bc2)
- a[2] = bc2 ^ (bc4 &^ bc3)
- a[18] = bc3 ^ (bc0 &^ bc4)
- a[9] = bc4 ^ (bc1 &^ bc0)
-
- t = a[15] ^ d0
- bc4 = bits.RotateLeft64(t, 18)
- t = a[6] ^ d1
- bc0 = bits.RotateLeft64(t, 1)
- t = a[22] ^ d2
- bc1 = bits.RotateLeft64(t, 6)
- t = a[13] ^ d3
- bc2 = bits.RotateLeft64(t, 25)
- t = a[4] ^ d4
- bc3 = bits.RotateLeft64(t, 8)
- a[15] = bc0 ^ (bc2 &^ bc1)
- a[6] = bc1 ^ (bc3 &^ bc2)
- a[22] = bc2 ^ (bc4 &^ bc3)
- a[13] = bc3 ^ (bc0 &^ bc4)
- a[4] = bc4 ^ (bc1 &^ bc0)
-
- t = a[10] ^ d0
- bc1 = bits.RotateLeft64(t, 36)
- t = a[1] ^ d1
- bc2 = bits.RotateLeft64(t, 10)
- t = a[17] ^ d2
- bc3 = bits.RotateLeft64(t, 15)
- t = a[8] ^ d3
- bc4 = bits.RotateLeft64(t, 56)
- t = a[24] ^ d4
- bc0 = bits.RotateLeft64(t, 27)
- a[10] = bc0 ^ (bc2 &^ bc1)
- a[1] = bc1 ^ (bc3 &^ bc2)
- a[17] = bc2 ^ (bc4 &^ bc3)
- a[8] = bc3 ^ (bc0 &^ bc4)
- a[24] = bc4 ^ (bc1 &^ bc0)
-
- t = a[5] ^ d0
- bc3 = bits.RotateLeft64(t, 41)
- t = a[21] ^ d1
- bc4 = bits.RotateLeft64(t, 2)
- t = a[12] ^ d2
- bc0 = bits.RotateLeft64(t, 62)
- t = a[3] ^ d3
- bc1 = bits.RotateLeft64(t, 55)
- t = a[19] ^ d4
- bc2 = bits.RotateLeft64(t, 39)
- a[5] = bc0 ^ (bc2 &^ bc1)
- a[21] = bc1 ^ (bc3 &^ bc2)
- a[12] = bc2 ^ (bc4 &^ bc3)
- a[3] = bc3 ^ (bc0 &^ bc4)
- a[19] = bc4 ^ (bc1 &^ bc0)
-
- // Round 3
- bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
- bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
- bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
- bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
- bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
- d0 = bc4 ^ (bc1<<1 | bc1>>63)
- d1 = bc0 ^ (bc2<<1 | bc2>>63)
- d2 = bc1 ^ (bc3<<1 | bc3>>63)
- d3 = bc2 ^ (bc4<<1 | bc4>>63)
- d4 = bc3 ^ (bc0<<1 | bc0>>63)
-
- bc0 = a[0] ^ d0
- t = a[11] ^ d1
- bc1 = bits.RotateLeft64(t, 44)
- t = a[22] ^ d2
- bc2 = bits.RotateLeft64(t, 43)
- t = a[8] ^ d3
- bc3 = bits.RotateLeft64(t, 21)
- t = a[19] ^ d4
- bc4 = bits.RotateLeft64(t, 14)
- a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+2]
- a[11] = bc1 ^ (bc3 &^ bc2)
- a[22] = bc2 ^ (bc4 &^ bc3)
- a[8] = bc3 ^ (bc0 &^ bc4)
- a[19] = bc4 ^ (bc1 &^ bc0)
-
- t = a[15] ^ d0
- bc2 = bits.RotateLeft64(t, 3)
- t = a[1] ^ d1
- bc3 = bits.RotateLeft64(t, 45)
- t = a[12] ^ d2
- bc4 = bits.RotateLeft64(t, 61)
- t = a[23] ^ d3
- bc0 = bits.RotateLeft64(t, 28)
- t = a[9] ^ d4
- bc1 = bits.RotateLeft64(t, 20)
- a[15] = bc0 ^ (bc2 &^ bc1)
- a[1] = bc1 ^ (bc3 &^ bc2)
- a[12] = bc2 ^ (bc4 &^ bc3)
- a[23] = bc3 ^ (bc0 &^ bc4)
- a[9] = bc4 ^ (bc1 &^ bc0)
-
- t = a[5] ^ d0
- bc4 = bits.RotateLeft64(t, 18)
- t = a[16] ^ d1
- bc0 = bits.RotateLeft64(t, 1)
- t = a[2] ^ d2
- bc1 = bits.RotateLeft64(t, 6)
- t = a[13] ^ d3
- bc2 = bits.RotateLeft64(t, 25)
- t = a[24] ^ d4
- bc3 = bits.RotateLeft64(t, 8)
- a[5] = bc0 ^ (bc2 &^ bc1)
- a[16] = bc1 ^ (bc3 &^ bc2)
- a[2] = bc2 ^ (bc4 &^ bc3)
- a[13] = bc3 ^ (bc0 &^ bc4)
- a[24] = bc4 ^ (bc1 &^ bc0)
-
- t = a[20] ^ d0
- bc1 = bits.RotateLeft64(t, 36)
- t = a[6] ^ d1
- bc2 = bits.RotateLeft64(t, 10)
- t = a[17] ^ d2
- bc3 = bits.RotateLeft64(t, 15)
- t = a[3] ^ d3
- bc4 = bits.RotateLeft64(t, 56)
- t = a[14] ^ d4
- bc0 = bits.RotateLeft64(t, 27)
- a[20] = bc0 ^ (bc2 &^ bc1)
- a[6] = bc1 ^ (bc3 &^ bc2)
- a[17] = bc2 ^ (bc4 &^ bc3)
- a[3] = bc3 ^ (bc0 &^ bc4)
- a[14] = bc4 ^ (bc1 &^ bc0)
-
- t = a[10] ^ d0
- bc3 = bits.RotateLeft64(t, 41)
- t = a[21] ^ d1
- bc4 = bits.RotateLeft64(t, 2)
- t = a[7] ^ d2
- bc0 = bits.RotateLeft64(t, 62)
- t = a[18] ^ d3
- bc1 = bits.RotateLeft64(t, 55)
- t = a[4] ^ d4
- bc2 = bits.RotateLeft64(t, 39)
- a[10] = bc0 ^ (bc2 &^ bc1)
- a[21] = bc1 ^ (bc3 &^ bc2)
- a[7] = bc2 ^ (bc4 &^ bc3)
- a[18] = bc3 ^ (bc0 &^ bc4)
- a[4] = bc4 ^ (bc1 &^ bc0)
-
- // Round 4
- bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20]
- bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21]
- bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22]
- bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23]
- bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24]
- d0 = bc4 ^ (bc1<<1 | bc1>>63)
- d1 = bc0 ^ (bc2<<1 | bc2>>63)
- d2 = bc1 ^ (bc3<<1 | bc3>>63)
- d3 = bc2 ^ (bc4<<1 | bc4>>63)
- d4 = bc3 ^ (bc0<<1 | bc0>>63)
-
- bc0 = a[0] ^ d0
- t = a[1] ^ d1
- bc1 = bits.RotateLeft64(t, 44)
- t = a[2] ^ d2
- bc2 = bits.RotateLeft64(t, 43)
- t = a[3] ^ d3
- bc3 = bits.RotateLeft64(t, 21)
- t = a[4] ^ d4
- bc4 = bits.RotateLeft64(t, 14)
- a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+3]
- a[1] = bc1 ^ (bc3 &^ bc2)
- a[2] = bc2 ^ (bc4 &^ bc3)
- a[3] = bc3 ^ (bc0 &^ bc4)
- a[4] = bc4 ^ (bc1 &^ bc0)
-
- t = a[5] ^ d0
- bc2 = bits.RotateLeft64(t, 3)
- t = a[6] ^ d1
- bc3 = bits.RotateLeft64(t, 45)
- t = a[7] ^ d2
- bc4 = bits.RotateLeft64(t, 61)
- t = a[8] ^ d3
- bc0 = bits.RotateLeft64(t, 28)
- t = a[9] ^ d4
- bc1 = bits.RotateLeft64(t, 20)
- a[5] = bc0 ^ (bc2 &^ bc1)
- a[6] = bc1 ^ (bc3 &^ bc2)
- a[7] = bc2 ^ (bc4 &^ bc3)
- a[8] = bc3 ^ (bc0 &^ bc4)
- a[9] = bc4 ^ (bc1 &^ bc0)
-
- t = a[10] ^ d0
- bc4 = bits.RotateLeft64(t, 18)
- t = a[11] ^ d1
- bc0 = bits.RotateLeft64(t, 1)
- t = a[12] ^ d2
- bc1 = bits.RotateLeft64(t, 6)
- t = a[13] ^ d3
- bc2 = bits.RotateLeft64(t, 25)
- t = a[14] ^ d4
- bc3 = bits.RotateLeft64(t, 8)
- a[10] = bc0 ^ (bc2 &^ bc1)
- a[11] = bc1 ^ (bc3 &^ bc2)
- a[12] = bc2 ^ (bc4 &^ bc3)
- a[13] = bc3 ^ (bc0 &^ bc4)
- a[14] = bc4 ^ (bc1 &^ bc0)
-
- t = a[15] ^ d0
- bc1 = bits.RotateLeft64(t, 36)
- t = a[16] ^ d1
- bc2 = bits.RotateLeft64(t, 10)
- t = a[17] ^ d2
- bc3 = bits.RotateLeft64(t, 15)
- t = a[18] ^ d3
- bc4 = bits.RotateLeft64(t, 56)
- t = a[19] ^ d4
- bc0 = bits.RotateLeft64(t, 27)
- a[15] = bc0 ^ (bc2 &^ bc1)
- a[16] = bc1 ^ (bc3 &^ bc2)
- a[17] = bc2 ^ (bc4 &^ bc3)
- a[18] = bc3 ^ (bc0 &^ bc4)
- a[19] = bc4 ^ (bc1 &^ bc0)
-
- t = a[20] ^ d0
- bc3 = bits.RotateLeft64(t, 41)
- t = a[21] ^ d1
- bc4 = bits.RotateLeft64(t, 2)
- t = a[22] ^ d2
- bc0 = bits.RotateLeft64(t, 62)
- t = a[23] ^ d3
- bc1 = bits.RotateLeft64(t, 55)
- t = a[24] ^ d4
- bc2 = bits.RotateLeft64(t, 39)
- a[20] = bc0 ^ (bc2 &^ bc1)
- a[21] = bc1 ^ (bc3 &^ bc2)
- a[22] = bc2 ^ (bc4 &^ bc3)
- a[23] = bc3 ^ (bc0 &^ bc4)
- a[24] = bc4 ^ (bc1 &^ bc0)
- }
-}
diff --git a/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go b/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go
deleted file mode 100644
index b908696be..000000000
--- a/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build amd64 && !purego && gc
-
-package sha3
-
-// This function is implemented in keccakf_amd64.s.
-
-//go:noescape
-
-func keccakF1600(a *[25]uint64)
diff --git a/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s b/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s
deleted file mode 100644
index 99e2f16e9..000000000
--- a/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s
+++ /dev/null
@@ -1,5419 +0,0 @@
-// Code generated by command: go run keccakf_amd64_asm.go -out ../keccakf_amd64.s -pkg sha3. DO NOT EDIT.
-
-//go:build amd64 && !purego && gc
-
-// func keccakF1600(a *[25]uint64)
-TEXT ·keccakF1600(SB), $200-8
- MOVQ a+0(FP), DI
-
- // Convert the user state into an internal state
- NOTQ 8(DI)
- NOTQ 16(DI)
- NOTQ 64(DI)
- NOTQ 96(DI)
- NOTQ 136(DI)
- NOTQ 160(DI)
-
- // Execute the KeccakF permutation
- MOVQ (DI), SI
- MOVQ 8(DI), BP
- MOVQ 32(DI), R15
- XORQ 40(DI), SI
- XORQ 48(DI), BP
- XORQ 72(DI), R15
- XORQ 80(DI), SI
- XORQ 88(DI), BP
- XORQ 112(DI), R15
- XORQ 120(DI), SI
- XORQ 128(DI), BP
- XORQ 152(DI), R15
- XORQ 160(DI), SI
- XORQ 168(DI), BP
- MOVQ 176(DI), DX
- MOVQ 184(DI), R8
- XORQ 192(DI), R15
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x0000000000000001, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x0000000000008082, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x800000000000808a, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000080008000, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x000000000000808b, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x0000000080000001, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000080008081, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000000008009, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x000000000000008a, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x0000000000000088, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x0000000080008009, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x000000008000000a, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x000000008000808b, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x800000000000008b, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000000008089, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000000008003, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000000008002, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000000000080, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x000000000000800a, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x800000008000000a, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000080008081, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000000008080, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(DI), R12
- XORQ 56(DI), DX
- XORQ R15, BX
- XORQ 96(DI), R12
- XORQ 136(DI), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(DI), R13
- XORQ 64(DI), R8
- XORQ SI, CX
- XORQ 104(DI), R13
- XORQ 144(DI), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (DI), R10
- MOVQ 48(DI), R11
- XORQ R13, R9
- MOVQ 96(DI), R12
- MOVQ 144(DI), R13
- MOVQ 192(DI), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x0000000080000001, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (SP)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(SP)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(SP)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(SP)
- MOVQ R12, 8(SP)
- MOVQ R12, BP
-
- // Result g
- MOVQ 72(DI), R11
- XORQ R9, R11
- MOVQ 80(DI), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(DI), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(DI), R13
- MOVQ 176(DI), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(SP)
- XORQ AX, SI
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(SP)
- XORQ AX, BP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(SP)
- NOTQ R14
- XORQ R10, R15
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(SP)
-
- // Result k
- MOVQ 8(DI), R10
- MOVQ 56(DI), R11
- MOVQ 104(DI), R12
- MOVQ 152(DI), R13
- MOVQ 160(DI), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(SP)
- XORQ AX, SI
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(SP)
- XORQ AX, BP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(SP)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(SP)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(SP)
- XORQ R10, R15
-
- // Result m
- MOVQ 40(DI), R11
- XORQ BX, R11
- MOVQ 88(DI), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(DI), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(DI), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(DI), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(SP)
- XORQ AX, SI
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(SP)
- XORQ AX, BP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(SP)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(SP)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(SP)
- XORQ R11, R15
-
- // Result s
- MOVQ 16(DI), R10
- MOVQ 64(DI), R11
- MOVQ 112(DI), R12
- XORQ DX, R10
- MOVQ 120(DI), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(DI), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(SP)
- ROLQ $0x27, R12
- XORQ R9, R15
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(SP)
- XORQ BX, SI
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(SP)
- XORQ CX, BP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(SP)
- MOVQ R8, 184(SP)
-
- // Prepare round
- MOVQ BP, BX
- ROLQ $0x01, BX
- MOVQ 16(SP), R12
- XORQ 56(SP), DX
- XORQ R15, BX
- XORQ 96(SP), R12
- XORQ 136(SP), DX
- XORQ DX, R12
- MOVQ R12, CX
- ROLQ $0x01, CX
- MOVQ 24(SP), R13
- XORQ 64(SP), R8
- XORQ SI, CX
- XORQ 104(SP), R13
- XORQ 144(SP), R8
- XORQ R8, R13
- MOVQ R13, DX
- ROLQ $0x01, DX
- MOVQ R15, R8
- XORQ BP, DX
- ROLQ $0x01, R8
- MOVQ SI, R9
- XORQ R12, R8
- ROLQ $0x01, R9
-
- // Result b
- MOVQ (SP), R10
- MOVQ 48(SP), R11
- XORQ R13, R9
- MOVQ 96(SP), R12
- MOVQ 144(SP), R13
- MOVQ 192(SP), R14
- XORQ CX, R11
- ROLQ $0x2c, R11
- XORQ DX, R12
- XORQ BX, R10
- ROLQ $0x2b, R12
- MOVQ R11, SI
- MOVQ $0x8000000080008008, AX
- ORQ R12, SI
- XORQ R10, AX
- XORQ AX, SI
- MOVQ SI, (DI)
- XORQ R9, R14
- ROLQ $0x0e, R14
- MOVQ R10, R15
- ANDQ R11, R15
- XORQ R14, R15
- MOVQ R15, 32(DI)
- XORQ R8, R13
- ROLQ $0x15, R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 16(DI)
- NOTQ R12
- ORQ R10, R14
- ORQ R13, R12
- XORQ R13, R14
- XORQ R11, R12
- MOVQ R14, 24(DI)
- MOVQ R12, 8(DI)
- NOP
-
- // Result g
- MOVQ 72(SP), R11
- XORQ R9, R11
- MOVQ 80(SP), R12
- ROLQ $0x14, R11
- XORQ BX, R12
- ROLQ $0x03, R12
- MOVQ 24(SP), R10
- MOVQ R11, AX
- ORQ R12, AX
- XORQ R8, R10
- MOVQ 128(SP), R13
- MOVQ 176(SP), R14
- ROLQ $0x1c, R10
- XORQ R10, AX
- MOVQ AX, 40(DI)
- NOP
- XORQ CX, R13
- ROLQ $0x2d, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 48(DI)
- NOP
- XORQ DX, R14
- ROLQ $0x3d, R14
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 64(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 72(DI)
- NOTQ R14
- NOP
- ORQ R14, R13
- XORQ R12, R13
- MOVQ R13, 56(DI)
-
- // Result k
- MOVQ 8(SP), R10
- MOVQ 56(SP), R11
- MOVQ 104(SP), R12
- MOVQ 152(SP), R13
- MOVQ 160(SP), R14
- XORQ DX, R11
- ROLQ $0x06, R11
- XORQ R8, R12
- ROLQ $0x19, R12
- MOVQ R11, AX
- ORQ R12, AX
- XORQ CX, R10
- ROLQ $0x01, R10
- XORQ R10, AX
- MOVQ AX, 80(DI)
- NOP
- XORQ R9, R13
- ROLQ $0x08, R13
- MOVQ R12, AX
- ANDQ R13, AX
- XORQ R11, AX
- MOVQ AX, 88(DI)
- NOP
- XORQ BX, R14
- ROLQ $0x12, R14
- NOTQ R13
- MOVQ R13, AX
- ANDQ R14, AX
- XORQ R12, AX
- MOVQ AX, 96(DI)
- MOVQ R14, AX
- ORQ R10, AX
- XORQ R13, AX
- MOVQ AX, 104(DI)
- ANDQ R11, R10
- XORQ R14, R10
- MOVQ R10, 112(DI)
- NOP
-
- // Result m
- MOVQ 40(SP), R11
- XORQ BX, R11
- MOVQ 88(SP), R12
- ROLQ $0x24, R11
- XORQ CX, R12
- MOVQ 32(SP), R10
- ROLQ $0x0a, R12
- MOVQ R11, AX
- MOVQ 136(SP), R13
- ANDQ R12, AX
- XORQ R9, R10
- MOVQ 184(SP), R14
- ROLQ $0x1b, R10
- XORQ R10, AX
- MOVQ AX, 120(DI)
- NOP
- XORQ DX, R13
- ROLQ $0x0f, R13
- MOVQ R12, AX
- ORQ R13, AX
- XORQ R11, AX
- MOVQ AX, 128(DI)
- NOP
- XORQ R8, R14
- ROLQ $0x38, R14
- NOTQ R13
- MOVQ R13, AX
- ORQ R14, AX
- XORQ R12, AX
- MOVQ AX, 136(DI)
- ORQ R10, R11
- XORQ R14, R11
- MOVQ R11, 152(DI)
- ANDQ R10, R14
- XORQ R13, R14
- MOVQ R14, 144(DI)
- NOP
-
- // Result s
- MOVQ 16(SP), R10
- MOVQ 64(SP), R11
- MOVQ 112(SP), R12
- XORQ DX, R10
- MOVQ 120(SP), R13
- ROLQ $0x3e, R10
- XORQ R8, R11
- MOVQ 168(SP), R14
- ROLQ $0x37, R11
- XORQ R9, R12
- MOVQ R10, R9
- XORQ CX, R14
- ROLQ $0x02, R14
- ANDQ R11, R9
- XORQ R14, R9
- MOVQ R9, 192(DI)
- ROLQ $0x27, R12
- NOP
- NOTQ R11
- XORQ BX, R13
- MOVQ R11, BX
- ANDQ R12, BX
- XORQ R10, BX
- MOVQ BX, 160(DI)
- NOP
- ROLQ $0x29, R13
- MOVQ R12, CX
- ORQ R13, CX
- XORQ R11, CX
- MOVQ CX, 168(DI)
- NOP
- MOVQ R13, DX
- MOVQ R14, R8
- ANDQ R14, DX
- ORQ R10, R8
- XORQ R12, DX
- XORQ R13, R8
- MOVQ DX, 176(DI)
- MOVQ R8, 184(DI)
-
- // Revert the internal state to the user state
- NOTQ 8(DI)
- NOTQ 16(DI)
- NOTQ 64(DI)
- NOTQ 96(DI)
- NOTQ 136(DI)
- NOTQ 160(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/sha3/sha3.go b/vendor/golang.org/x/crypto/sha3/sha3.go
deleted file mode 100644
index 6658c4447..000000000
--- a/vendor/golang.org/x/crypto/sha3/sha3.go
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package sha3
-
-import (
- "crypto/subtle"
- "encoding/binary"
- "errors"
- "unsafe"
-
- "golang.org/x/sys/cpu"
-)
-
-// spongeDirection indicates the direction bytes are flowing through the sponge.
-type spongeDirection int
-
-const (
- // spongeAbsorbing indicates that the sponge is absorbing input.
- spongeAbsorbing spongeDirection = iota
- // spongeSqueezing indicates that the sponge is being squeezed.
- spongeSqueezing
-)
-
-type state struct {
- a [1600 / 8]byte // main state of the hash
-
- // a[n:rate] is the buffer. If absorbing, it's the remaining space to XOR
- // into before running the permutation. If squeezing, it's the remaining
- // output to produce before running the permutation.
- n, rate int
-
- // dsbyte contains the "domain separation" bits and the first bit of
- // the padding. Sections 6.1 and 6.2 of [1] separate the outputs of the
- // SHA-3 and SHAKE functions by appending bitstrings to the message.
- // Using a little-endian bit-ordering convention, these are "01" for SHA-3
- // and "1111" for SHAKE, or 00000010b and 00001111b, respectively. Then the
- // padding rule from section 5.1 is applied to pad the message to a multiple
- // of the rate, which involves adding a "1" bit, zero or more "0" bits, and
- // a final "1" bit. We merge the first "1" bit from the padding into dsbyte,
- // giving 00000110b (0x06) and 00011111b (0x1f).
- // [1] http://csrc.nist.gov/publications/drafts/fips-202/fips_202_draft.pdf
- // "Draft FIPS 202: SHA-3 Standard: Permutation-Based Hash and
- // Extendable-Output Functions (May 2014)"
- dsbyte byte
-
- outputLen int // the default output size in bytes
- state spongeDirection // whether the sponge is absorbing or squeezing
-}
-
-// BlockSize returns the rate of sponge underlying this hash function.
-func (d *state) BlockSize() int { return d.rate }
-
-// Size returns the output size of the hash function in bytes.
-func (d *state) Size() int { return d.outputLen }
-
-// Reset clears the internal state by zeroing the sponge state and
-// the buffer indexes, and setting Sponge.state to absorbing.
-func (d *state) Reset() {
- // Zero the permutation's state.
- for i := range d.a {
- d.a[i] = 0
- }
- d.state = spongeAbsorbing
- d.n = 0
-}
-
-func (d *state) clone() *state {
- ret := *d
- return &ret
-}
-
-// permute applies the KeccakF-1600 permutation.
-func (d *state) permute() {
- var a *[25]uint64
- if cpu.IsBigEndian {
- a = new([25]uint64)
- for i := range a {
- a[i] = binary.LittleEndian.Uint64(d.a[i*8:])
- }
- } else {
- a = (*[25]uint64)(unsafe.Pointer(&d.a))
- }
-
- keccakF1600(a)
- d.n = 0
-
- if cpu.IsBigEndian {
- for i := range a {
- binary.LittleEndian.PutUint64(d.a[i*8:], a[i])
- }
- }
-}
-
-// pads appends the domain separation bits in dsbyte, applies
-// the multi-bitrate 10..1 padding rule, and permutes the state.
-func (d *state) padAndPermute() {
- // Pad with this instance's domain-separator bits. We know that there's
- // at least one byte of space in the sponge because, if it were full,
- // permute would have been called to empty it. dsbyte also contains the
- // first one bit for the padding. See the comment in the state struct.
- d.a[d.n] ^= d.dsbyte
- // This adds the final one bit for the padding. Because of the way that
- // bits are numbered from the LSB upwards, the final bit is the MSB of
- // the last byte.
- d.a[d.rate-1] ^= 0x80
- // Apply the permutation
- d.permute()
- d.state = spongeSqueezing
-}
-
-// Write absorbs more data into the hash's state. It panics if any
-// output has already been read.
-func (d *state) Write(p []byte) (n int, err error) {
- if d.state != spongeAbsorbing {
- panic("sha3: Write after Read")
- }
-
- n = len(p)
-
- for len(p) > 0 {
- x := subtle.XORBytes(d.a[d.n:d.rate], d.a[d.n:d.rate], p)
- d.n += x
- p = p[x:]
-
- // If the sponge is full, apply the permutation.
- if d.n == d.rate {
- d.permute()
- }
- }
-
- return
-}
-
-// Read squeezes an arbitrary number of bytes from the sponge.
-func (d *state) Read(out []byte) (n int, err error) {
- // If we're still absorbing, pad and apply the permutation.
- if d.state == spongeAbsorbing {
- d.padAndPermute()
- }
-
- n = len(out)
-
- // Now, do the squeezing.
- for len(out) > 0 {
- // Apply the permutation if we've squeezed the sponge dry.
- if d.n == d.rate {
- d.permute()
- }
-
- x := copy(out, d.a[d.n:d.rate])
- d.n += x
- out = out[x:]
- }
-
- return
-}
-
-// Sum applies padding to the hash state and then squeezes out the desired
-// number of output bytes. It panics if any output has already been read.
-func (d *state) Sum(in []byte) []byte {
- if d.state != spongeAbsorbing {
- panic("sha3: Sum after Read")
- }
-
- // Make a copy of the original hash so that caller can keep writing
- // and summing.
- dup := d.clone()
- hash := make([]byte, dup.outputLen, 64) // explicit cap to allow stack allocation
- dup.Read(hash)
- return append(in, hash...)
-}
-
-const (
- magicSHA3 = "sha\x08"
- magicShake = "sha\x09"
- magicCShake = "sha\x0a"
- magicKeccak = "sha\x0b"
- // magic || rate || main state || n || sponge direction
- marshaledSize = len(magicSHA3) + 1 + 200 + 1 + 1
-)
-
-func (d *state) MarshalBinary() ([]byte, error) {
- return d.AppendBinary(make([]byte, 0, marshaledSize))
-}
-
-func (d *state) AppendBinary(b []byte) ([]byte, error) {
- switch d.dsbyte {
- case dsbyteSHA3:
- b = append(b, magicSHA3...)
- case dsbyteShake:
- b = append(b, magicShake...)
- case dsbyteCShake:
- b = append(b, magicCShake...)
- case dsbyteKeccak:
- b = append(b, magicKeccak...)
- default:
- panic("unknown dsbyte")
- }
- // rate is at most 168, and n is at most rate.
- b = append(b, byte(d.rate))
- b = append(b, d.a[:]...)
- b = append(b, byte(d.n), byte(d.state))
- return b, nil
-}
-
-func (d *state) UnmarshalBinary(b []byte) error {
- if len(b) != marshaledSize {
- return errors.New("sha3: invalid hash state")
- }
-
- magic := string(b[:len(magicSHA3)])
- b = b[len(magicSHA3):]
- switch {
- case magic == magicSHA3 && d.dsbyte == dsbyteSHA3:
- case magic == magicShake && d.dsbyte == dsbyteShake:
- case magic == magicCShake && d.dsbyte == dsbyteCShake:
- case magic == magicKeccak && d.dsbyte == dsbyteKeccak:
- default:
- return errors.New("sha3: invalid hash state identifier")
- }
-
- rate := int(b[0])
- b = b[1:]
- if rate != d.rate {
- return errors.New("sha3: invalid hash state function")
- }
-
- copy(d.a[:], b)
- b = b[len(d.a):]
-
- n, state := int(b[0]), spongeDirection(b[1])
- if n > d.rate {
- return errors.New("sha3: invalid hash state")
- }
- d.n = n
- if state != spongeAbsorbing && state != spongeSqueezing {
- return errors.New("sha3: invalid hash state")
- }
- d.state = state
-
- return nil
-}
diff --git a/vendor/golang.org/x/crypto/sha3/sha3_s390x.go b/vendor/golang.org/x/crypto/sha3/sha3_s390x.go
deleted file mode 100644
index 00d8034ae..000000000
--- a/vendor/golang.org/x/crypto/sha3/sha3_s390x.go
+++ /dev/null
@@ -1,303 +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.
-
-//go:build gc && !purego
-
-package sha3
-
-// This file contains code for using the 'compute intermediate
-// message digest' (KIMD) and 'compute last message digest' (KLMD)
-// instructions to compute SHA-3 and SHAKE hashes on IBM Z.
-
-import (
- "hash"
-
- "golang.org/x/sys/cpu"
-)
-
-// codes represent 7-bit KIMD/KLMD function codes as defined in
-// the Principles of Operation.
-type code uint64
-
-const (
- // function codes for KIMD/KLMD
- sha3_224 code = 32
- sha3_256 = 33
- sha3_384 = 34
- sha3_512 = 35
- shake_128 = 36
- shake_256 = 37
- nopad = 0x100
-)
-
-// kimd is a wrapper for the 'compute intermediate message digest' instruction.
-// src must be a multiple of the rate for the given function code.
-//
-//go:noescape
-func kimd(function code, chain *[200]byte, src []byte)
-
-// klmd is a wrapper for the 'compute last message digest' instruction.
-// src padding is handled by the instruction.
-//
-//go:noescape
-func klmd(function code, chain *[200]byte, dst, src []byte)
-
-type asmState struct {
- a [200]byte // 1600 bit state
- buf []byte // care must be taken to ensure cap(buf) is a multiple of rate
- rate int // equivalent to block size
- storage [3072]byte // underlying storage for buf
- outputLen int // output length for full security
- function code // KIMD/KLMD function code
- state spongeDirection // whether the sponge is absorbing or squeezing
-}
-
-func newAsmState(function code) *asmState {
- var s asmState
- s.function = function
- switch function {
- case sha3_224:
- s.rate = 144
- s.outputLen = 28
- case sha3_256:
- s.rate = 136
- s.outputLen = 32
- case sha3_384:
- s.rate = 104
- s.outputLen = 48
- case sha3_512:
- s.rate = 72
- s.outputLen = 64
- case shake_128:
- s.rate = 168
- s.outputLen = 32
- case shake_256:
- s.rate = 136
- s.outputLen = 64
- default:
- panic("sha3: unrecognized function code")
- }
-
- // limit s.buf size to a multiple of s.rate
- s.resetBuf()
- return &s
-}
-
-func (s *asmState) clone() *asmState {
- c := *s
- c.buf = c.storage[:len(s.buf):cap(s.buf)]
- return &c
-}
-
-// copyIntoBuf copies b into buf. It will panic if there is not enough space to
-// store all of b.
-func (s *asmState) copyIntoBuf(b []byte) {
- bufLen := len(s.buf)
- s.buf = s.buf[:len(s.buf)+len(b)]
- copy(s.buf[bufLen:], b)
-}
-
-// resetBuf points buf at storage, sets the length to 0 and sets cap to be a
-// multiple of the rate.
-func (s *asmState) resetBuf() {
- max := (cap(s.storage) / s.rate) * s.rate
- s.buf = s.storage[:0:max]
-}
-
-// Write (via the embedded io.Writer interface) adds more data to the running hash.
-// It never returns an error.
-func (s *asmState) Write(b []byte) (int, error) {
- if s.state != spongeAbsorbing {
- panic("sha3: Write after Read")
- }
- length := len(b)
- for len(b) > 0 {
- if len(s.buf) == 0 && len(b) >= cap(s.buf) {
- // Hash the data directly and push any remaining bytes
- // into the buffer.
- remainder := len(b) % s.rate
- kimd(s.function, &s.a, b[:len(b)-remainder])
- if remainder != 0 {
- s.copyIntoBuf(b[len(b)-remainder:])
- }
- return length, nil
- }
-
- if len(s.buf) == cap(s.buf) {
- // flush the buffer
- kimd(s.function, &s.a, s.buf)
- s.buf = s.buf[:0]
- }
-
- // copy as much as we can into the buffer
- n := len(b)
- if len(b) > cap(s.buf)-len(s.buf) {
- n = cap(s.buf) - len(s.buf)
- }
- s.copyIntoBuf(b[:n])
- b = b[n:]
- }
- return length, nil
-}
-
-// Read squeezes an arbitrary number of bytes from the sponge.
-func (s *asmState) Read(out []byte) (n int, err error) {
- // The 'compute last message digest' instruction only stores the digest
- // at the first operand (dst) for SHAKE functions.
- if s.function != shake_128 && s.function != shake_256 {
- panic("sha3: can only call Read for SHAKE functions")
- }
-
- n = len(out)
-
- // need to pad if we were absorbing
- if s.state == spongeAbsorbing {
- s.state = spongeSqueezing
-
- // write hash directly into out if possible
- if len(out)%s.rate == 0 {
- klmd(s.function, &s.a, out, s.buf) // len(out) may be 0
- s.buf = s.buf[:0]
- return
- }
-
- // write hash into buffer
- max := cap(s.buf)
- if max > len(out) {
- max = (len(out)/s.rate)*s.rate + s.rate
- }
- klmd(s.function, &s.a, s.buf[:max], s.buf)
- s.buf = s.buf[:max]
- }
-
- for len(out) > 0 {
- // flush the buffer
- if len(s.buf) != 0 {
- c := copy(out, s.buf)
- out = out[c:]
- s.buf = s.buf[c:]
- continue
- }
-
- // write hash directly into out if possible
- if len(out)%s.rate == 0 {
- klmd(s.function|nopad, &s.a, out, nil)
- return
- }
-
- // write hash into buffer
- s.resetBuf()
- if cap(s.buf) > len(out) {
- s.buf = s.buf[:(len(out)/s.rate)*s.rate+s.rate]
- }
- klmd(s.function|nopad, &s.a, s.buf, nil)
- }
- return
-}
-
-// Sum appends the current hash to b and returns the resulting slice.
-// It does not change the underlying hash state.
-func (s *asmState) Sum(b []byte) []byte {
- if s.state != spongeAbsorbing {
- panic("sha3: Sum after Read")
- }
-
- // Copy the state to preserve the original.
- a := s.a
-
- // Hash the buffer. Note that we don't clear it because we
- // aren't updating the state.
- switch s.function {
- case sha3_224, sha3_256, sha3_384, sha3_512:
- klmd(s.function, &a, nil, s.buf)
- return append(b, a[:s.outputLen]...)
- case shake_128, shake_256:
- d := make([]byte, s.outputLen, 64)
- klmd(s.function, &a, d, s.buf)
- return append(b, d[:s.outputLen]...)
- default:
- panic("sha3: unknown function")
- }
-}
-
-// Reset resets the Hash to its initial state.
-func (s *asmState) Reset() {
- for i := range s.a {
- s.a[i] = 0
- }
- s.resetBuf()
- s.state = spongeAbsorbing
-}
-
-// Size returns the number of bytes Sum will return.
-func (s *asmState) Size() int {
- return s.outputLen
-}
-
-// BlockSize returns the hash's underlying block size.
-// The Write method must be able to accept any amount
-// of data, but it may operate more efficiently if all writes
-// are a multiple of the block size.
-func (s *asmState) BlockSize() int {
- return s.rate
-}
-
-// Clone returns a copy of the ShakeHash in its current state.
-func (s *asmState) Clone() ShakeHash {
- return s.clone()
-}
-
-// new224 returns an assembly implementation of SHA3-224 if available,
-// otherwise it returns a generic implementation.
-func new224() hash.Hash {
- if cpu.S390X.HasSHA3 {
- return newAsmState(sha3_224)
- }
- return new224Generic()
-}
-
-// new256 returns an assembly implementation of SHA3-256 if available,
-// otherwise it returns a generic implementation.
-func new256() hash.Hash {
- if cpu.S390X.HasSHA3 {
- return newAsmState(sha3_256)
- }
- return new256Generic()
-}
-
-// new384 returns an assembly implementation of SHA3-384 if available,
-// otherwise it returns a generic implementation.
-func new384() hash.Hash {
- if cpu.S390X.HasSHA3 {
- return newAsmState(sha3_384)
- }
- return new384Generic()
-}
-
-// new512 returns an assembly implementation of SHA3-512 if available,
-// otherwise it returns a generic implementation.
-func new512() hash.Hash {
- if cpu.S390X.HasSHA3 {
- return newAsmState(sha3_512)
- }
- return new512Generic()
-}
-
-// newShake128 returns an assembly implementation of SHAKE-128 if available,
-// otherwise it returns a generic implementation.
-func newShake128() ShakeHash {
- if cpu.S390X.HasSHA3 {
- return newAsmState(shake_128)
- }
- return newShake128Generic()
-}
-
-// newShake256 returns an assembly implementation of SHAKE-256 if available,
-// otherwise it returns a generic implementation.
-func newShake256() ShakeHash {
- if cpu.S390X.HasSHA3 {
- return newAsmState(shake_256)
- }
- return newShake256Generic()
-}
diff --git a/vendor/golang.org/x/crypto/sha3/sha3_s390x.s b/vendor/golang.org/x/crypto/sha3/sha3_s390x.s
deleted file mode 100644
index 826b862c7..000000000
--- a/vendor/golang.org/x/crypto/sha3/sha3_s390x.s
+++ /dev/null
@@ -1,33 +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.
-
-//go:build gc && !purego
-
-#include "textflag.h"
-
-// func kimd(function code, chain *[200]byte, src []byte)
-TEXT ·kimd(SB), NOFRAME|NOSPLIT, $0-40
- MOVD function+0(FP), R0
- MOVD chain+8(FP), R1
- LMG src+16(FP), R2, R3 // R2=base, R3=len
-
-continue:
- WORD $0xB93E0002 // KIMD --, R2
- BVS continue // continue if interrupted
- MOVD $0, R0 // reset R0 for pre-go1.8 compilers
- RET
-
-// func klmd(function code, chain *[200]byte, dst, src []byte)
-TEXT ·klmd(SB), NOFRAME|NOSPLIT, $0-64
- // TODO: SHAKE support
- MOVD function+0(FP), R0
- MOVD chain+8(FP), R1
- LMG dst+16(FP), R2, R3 // R2=base, R3=len
- LMG src+40(FP), R4, R5 // R4=base, R5=len
-
-continue:
- WORD $0xB93F0024 // KLMD R2, R4
- BVS continue // continue if interrupted
- MOVD $0, R0 // reset R0 for pre-go1.8 compilers
- RET
diff --git a/vendor/golang.org/x/crypto/sha3/shake.go b/vendor/golang.org/x/crypto/sha3/shake.go
deleted file mode 100644
index a6b3a4281..000000000
--- a/vendor/golang.org/x/crypto/sha3/shake.go
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package sha3
-
-// This file defines the ShakeHash interface, and provides
-// functions for creating SHAKE and cSHAKE instances, as well as utility
-// functions for hashing bytes to arbitrary-length output.
-//
-//
-// SHAKE implementation is based on FIPS PUB 202 [1]
-// cSHAKE implementations is based on NIST SP 800-185 [2]
-//
-// [1] https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
-// [2] https://doi.org/10.6028/NIST.SP.800-185
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "hash"
- "io"
- "math/bits"
-)
-
-// ShakeHash defines the interface to hash functions that support
-// arbitrary-length output. When used as a plain [hash.Hash], it
-// produces minimum-length outputs that provide full-strength generic
-// security.
-type ShakeHash interface {
- hash.Hash
-
- // Read reads more output from the hash; reading affects the hash's
- // state. (ShakeHash.Read is thus very different from Hash.Sum)
- // It never returns an error, but subsequent calls to Write or Sum
- // will panic.
- io.Reader
-
- // Clone returns a copy of the ShakeHash in its current state.
- Clone() ShakeHash
-}
-
-// cSHAKE specific context
-type cshakeState struct {
- *state // SHA-3 state context and Read/Write operations
-
- // initBlock is the cSHAKE specific initialization set of bytes. It is initialized
- // by newCShake function and stores concatenation of N followed by S, encoded
- // by the method specified in 3.3 of [1].
- // It is stored here in order for Reset() to be able to put context into
- // initial state.
- initBlock []byte
-}
-
-func bytepad(data []byte, rate int) []byte {
- out := make([]byte, 0, 9+len(data)+rate-1)
- out = append(out, leftEncode(uint64(rate))...)
- out = append(out, data...)
- if padlen := rate - len(out)%rate; padlen < rate {
- out = append(out, make([]byte, padlen)...)
- }
- return out
-}
-
-func leftEncode(x uint64) []byte {
- // Let n be the smallest positive integer for which 2^(8n) > x.
- n := (bits.Len64(x) + 7) / 8
- if n == 0 {
- n = 1
- }
- // Return n || x with n as a byte and x an n bytes in big-endian order.
- b := make([]byte, 9)
- binary.BigEndian.PutUint64(b[1:], x)
- b = b[9-n-1:]
- b[0] = byte(n)
- return b
-}
-
-func newCShake(N, S []byte, rate, outputLen int, dsbyte byte) ShakeHash {
- c := cshakeState{state: &state{rate: rate, outputLen: outputLen, dsbyte: dsbyte}}
- c.initBlock = make([]byte, 0, 9+len(N)+9+len(S)) // leftEncode returns max 9 bytes
- c.initBlock = append(c.initBlock, leftEncode(uint64(len(N))*8)...)
- c.initBlock = append(c.initBlock, N...)
- c.initBlock = append(c.initBlock, leftEncode(uint64(len(S))*8)...)
- c.initBlock = append(c.initBlock, S...)
- c.Write(bytepad(c.initBlock, c.rate))
- return &c
-}
-
-// Reset resets the hash to initial state.
-func (c *cshakeState) Reset() {
- c.state.Reset()
- c.Write(bytepad(c.initBlock, c.rate))
-}
-
-// Clone returns copy of a cSHAKE context within its current state.
-func (c *cshakeState) Clone() ShakeHash {
- b := make([]byte, len(c.initBlock))
- copy(b, c.initBlock)
- return &cshakeState{state: c.clone(), initBlock: b}
-}
-
-// Clone returns copy of SHAKE context within its current state.
-func (c *state) Clone() ShakeHash {
- return c.clone()
-}
-
-func (c *cshakeState) MarshalBinary() ([]byte, error) {
- return c.AppendBinary(make([]byte, 0, marshaledSize+len(c.initBlock)))
-}
-
-func (c *cshakeState) AppendBinary(b []byte) ([]byte, error) {
- b, err := c.state.AppendBinary(b)
- if err != nil {
- return nil, err
- }
- b = append(b, c.initBlock...)
- return b, nil
-}
-
-func (c *cshakeState) UnmarshalBinary(b []byte) error {
- if len(b) <= marshaledSize {
- return errors.New("sha3: invalid hash state")
- }
- if err := c.state.UnmarshalBinary(b[:marshaledSize]); err != nil {
- return err
- }
- c.initBlock = bytes.Clone(b[marshaledSize:])
- return nil
-}
-
-// NewShake128 creates a new SHAKE128 variable-output-length ShakeHash.
-// Its generic security strength is 128 bits against all attacks if at
-// least 32 bytes of its output are used.
-func NewShake128() ShakeHash {
- return newShake128()
-}
-
-// NewShake256 creates a new SHAKE256 variable-output-length ShakeHash.
-// Its generic security strength is 256 bits against all attacks if
-// at least 64 bytes of its output are used.
-func NewShake256() ShakeHash {
- return newShake256()
-}
-
-func newShake128Generic() *state {
- return &state{rate: rateK256, outputLen: 32, dsbyte: dsbyteShake}
-}
-
-func newShake256Generic() *state {
- return &state{rate: rateK512, outputLen: 64, dsbyte: dsbyteShake}
-}
-
-// NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash,
-// a customizable variant of SHAKE128.
-// N is used to define functions based on cSHAKE, it can be empty when plain cSHAKE is
-// desired. S is a customization byte string used for domain separation - two cSHAKE
-// computations on same input with different S yield unrelated outputs.
-// When N and S are both empty, this is equivalent to NewShake128.
-func NewCShake128(N, S []byte) ShakeHash {
- if len(N) == 0 && len(S) == 0 {
- return NewShake128()
- }
- return newCShake(N, S, rateK256, 32, dsbyteCShake)
-}
-
-// NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash,
-// a customizable variant of SHAKE256.
-// N is used to define functions based on cSHAKE, it can be empty when plain cSHAKE is
-// desired. S is a customization byte string used for domain separation - two cSHAKE
-// computations on same input with different S yield unrelated outputs.
-// When N and S are both empty, this is equivalent to NewShake256.
-func NewCShake256(N, S []byte) ShakeHash {
- if len(N) == 0 && len(S) == 0 {
- return NewShake256()
- }
- return newCShake(N, S, rateK512, 64, dsbyteCShake)
-}
-
-// ShakeSum128 writes an arbitrary-length digest of data into hash.
-func ShakeSum128(hash, data []byte) {
- h := NewShake128()
- h.Write(data)
- h.Read(hash)
-}
-
-// ShakeSum256 writes an arbitrary-length digest of data into hash.
-func ShakeSum256(hash, data []byte) {
- h := NewShake256()
- h.Write(data)
- h.Read(hash)
-}
diff --git a/vendor/golang.org/x/crypto/sha3/shake_noasm.go b/vendor/golang.org/x/crypto/sha3/shake_noasm.go
deleted file mode 100644
index 4276ba4ab..000000000
--- a/vendor/golang.org/x/crypto/sha3/shake_noasm.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2023 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.
-
-//go:build !gc || purego || !s390x
-
-package sha3
-
-func newShake128() *state {
- return newShake128Generic()
-}
-
-func newShake256() *state {
- return newShake256Generic()
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/client.go b/vendor/golang.org/x/crypto/ssh/agent/client.go
deleted file mode 100644
index 106708d28..000000000
--- a/vendor/golang.org/x/crypto/ssh/agent/client.go
+++ /dev/null
@@ -1,854 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package agent implements the ssh-agent protocol, and provides both
-// a client and a server. The client can talk to a standard ssh-agent
-// that uses UNIX sockets, and one could implement an alternative
-// ssh-agent process using the sample server.
-//
-// References:
-//
-// [PROTOCOL.agent]: https://tools.ietf.org/html/draft-miller-ssh-agent-00
-package agent
-
-import (
- "bytes"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/ed25519"
- "crypto/elliptic"
- "crypto/rsa"
- "encoding/base64"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "math/big"
- "sync"
-
- "golang.org/x/crypto/ssh"
-)
-
-// SignatureFlags represent additional flags that can be passed to the signature
-// requests an defined in [PROTOCOL.agent] section 4.5.1.
-type SignatureFlags uint32
-
-// SignatureFlag values as defined in [PROTOCOL.agent] section 5.3.
-const (
- SignatureFlagReserved SignatureFlags = 1 << iota
- SignatureFlagRsaSha256
- SignatureFlagRsaSha512
-)
-
-// Agent represents the capabilities of an ssh-agent.
-type Agent interface {
- // List returns the identities known to the agent.
- List() ([]*Key, error)
-
- // Sign has the agent sign the data using a protocol 2 key as defined
- // in [PROTOCOL.agent] section 2.6.2.
- Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error)
-
- // Add adds a private key to the agent.
- Add(key AddedKey) error
-
- // Remove removes all identities with the given public key.
- Remove(key ssh.PublicKey) error
-
- // RemoveAll removes all identities.
- RemoveAll() error
-
- // Lock locks the agent. Sign and Remove will fail, and List will empty an empty list.
- Lock(passphrase []byte) error
-
- // Unlock undoes the effect of Lock
- Unlock(passphrase []byte) error
-
- // Signers returns signers for all the known keys.
- Signers() ([]ssh.Signer, error)
-}
-
-type ExtendedAgent interface {
- Agent
-
- // SignWithFlags signs like Sign, but allows for additional flags to be sent/received
- SignWithFlags(key ssh.PublicKey, data []byte, flags SignatureFlags) (*ssh.Signature, error)
-
- // Extension processes a custom extension request. Standard-compliant agents are not
- // required to support any extensions, but this method allows agents to implement
- // vendor-specific methods or add experimental features. See [PROTOCOL.agent] section 4.7.
- // If agent extensions are unsupported entirely this method MUST return an
- // ErrExtensionUnsupported error. Similarly, if just the specific extensionType in
- // the request is unsupported by the agent then ErrExtensionUnsupported MUST be
- // returned.
- //
- // In the case of success, since [PROTOCOL.agent] section 4.7 specifies that the contents
- // of the response are unspecified (including the type of the message), the complete
- // response will be returned as a []byte slice, including the "type" byte of the message.
- Extension(extensionType string, contents []byte) ([]byte, error)
-}
-
-// ConstraintExtension describes an optional constraint defined by users.
-type ConstraintExtension struct {
- // ExtensionName consist of a UTF-8 string suffixed by the
- // implementation domain following the naming scheme defined
- // in Section 4.2 of RFC 4251, e.g. "foo@example.com".
- ExtensionName string
- // ExtensionDetails contains the actual content of the extended
- // constraint.
- ExtensionDetails []byte
-}
-
-// AddedKey describes an SSH key to be added to an Agent.
-type AddedKey struct {
- // PrivateKey must be a *rsa.PrivateKey, *dsa.PrivateKey,
- // ed25519.PrivateKey or *ecdsa.PrivateKey, which will be inserted into the
- // agent.
- PrivateKey interface{}
- // Certificate, if not nil, is communicated to the agent and will be
- // stored with the key.
- Certificate *ssh.Certificate
- // Comment is an optional, free-form string.
- Comment string
- // LifetimeSecs, if not zero, is the number of seconds that the
- // agent will store the key for.
- LifetimeSecs uint32
- // ConfirmBeforeUse, if true, requests that the agent confirm with the
- // user before each use of this key.
- ConfirmBeforeUse bool
- // ConstraintExtensions are the experimental or private-use constraints
- // defined by users.
- ConstraintExtensions []ConstraintExtension
-}
-
-// See [PROTOCOL.agent], section 3.
-const (
- agentRequestV1Identities = 1
- agentRemoveAllV1Identities = 9
-
- // 3.2 Requests from client to agent for protocol 2 key operations
- agentAddIdentity = 17
- agentRemoveIdentity = 18
- agentRemoveAllIdentities = 19
- agentAddIDConstrained = 25
-
- // 3.3 Key-type independent requests from client to agent
- agentAddSmartcardKey = 20
- agentRemoveSmartcardKey = 21
- agentLock = 22
- agentUnlock = 23
- agentAddSmartcardKeyConstrained = 26
-
- // 3.7 Key constraint identifiers
- agentConstrainLifetime = 1
- agentConstrainConfirm = 2
- // Constraint extension identifier up to version 2 of the protocol. A
- // backward incompatible change will be required if we want to add support
- // for SSH_AGENT_CONSTRAIN_MAXSIGN which uses the same ID.
- agentConstrainExtensionV00 = 3
- // Constraint extension identifier in version 3 and later of the protocol.
- agentConstrainExtension = 255
-)
-
-// maxAgentResponseBytes is the maximum agent reply size that is accepted. This
-// is a sanity check, not a limit in the spec.
-const maxAgentResponseBytes = 16 << 20
-
-// Agent messages:
-// These structures mirror the wire format of the corresponding ssh agent
-// messages found in [PROTOCOL.agent].
-
-// 3.4 Generic replies from agent to client
-const agentFailure = 5
-
-type failureAgentMsg struct{}
-
-const agentSuccess = 6
-
-type successAgentMsg struct{}
-
-// See [PROTOCOL.agent], section 2.5.2.
-const agentRequestIdentities = 11
-
-type requestIdentitiesAgentMsg struct{}
-
-// See [PROTOCOL.agent], section 2.5.2.
-const agentIdentitiesAnswer = 12
-
-type identitiesAnswerAgentMsg struct {
- NumKeys uint32 `sshtype:"12"`
- Keys []byte `ssh:"rest"`
-}
-
-// See [PROTOCOL.agent], section 2.6.2.
-const agentSignRequest = 13
-
-type signRequestAgentMsg struct {
- KeyBlob []byte `sshtype:"13"`
- Data []byte
- Flags uint32
-}
-
-// See [PROTOCOL.agent], section 2.6.2.
-
-// 3.6 Replies from agent to client for protocol 2 key operations
-const agentSignResponse = 14
-
-type signResponseAgentMsg struct {
- SigBlob []byte `sshtype:"14"`
-}
-
-type publicKey struct {
- Format string
- Rest []byte `ssh:"rest"`
-}
-
-// 3.7 Key constraint identifiers
-type constrainLifetimeAgentMsg struct {
- LifetimeSecs uint32 `sshtype:"1"`
-}
-
-type constrainExtensionAgentMsg struct {
- ExtensionName string `sshtype:"255|3"`
- ExtensionDetails []byte
-
- // Rest is a field used for parsing, not part of message
- Rest []byte `ssh:"rest"`
-}
-
-// See [PROTOCOL.agent], section 4.7
-const agentExtension = 27
-const agentExtensionFailure = 28
-
-// ErrExtensionUnsupported indicates that an extension defined in
-// [PROTOCOL.agent] section 4.7 is unsupported by the agent. Specifically this
-// error indicates that the agent returned a standard SSH_AGENT_FAILURE message
-// as the result of a SSH_AGENTC_EXTENSION request. Note that the protocol
-// specification (and therefore this error) does not distinguish between a
-// specific extension being unsupported and extensions being unsupported entirely.
-var ErrExtensionUnsupported = errors.New("agent: extension unsupported")
-
-type extensionAgentMsg struct {
- ExtensionType string `sshtype:"27"`
- // NOTE: this matches OpenSSH's PROTOCOL.agent, not the IETF draft [PROTOCOL.agent],
- // so that it matches what OpenSSH actually implements in the wild.
- Contents []byte `ssh:"rest"`
-}
-
-// Key represents a protocol 2 public key as defined in
-// [PROTOCOL.agent], section 2.5.2.
-type Key struct {
- Format string
- Blob []byte
- Comment string
-}
-
-func clientErr(err error) error {
- return fmt.Errorf("agent: client error: %v", err)
-}
-
-// String returns the storage form of an agent key with the format, base64
-// encoded serialized key, and the comment if it is not empty.
-func (k *Key) String() string {
- s := string(k.Format) + " " + base64.StdEncoding.EncodeToString(k.Blob)
-
- if k.Comment != "" {
- s += " " + k.Comment
- }
-
- return s
-}
-
-// Type returns the public key type.
-func (k *Key) Type() string {
- return k.Format
-}
-
-// Marshal returns key blob to satisfy the ssh.PublicKey interface.
-func (k *Key) Marshal() []byte {
- return k.Blob
-}
-
-// Verify satisfies the ssh.PublicKey interface.
-func (k *Key) Verify(data []byte, sig *ssh.Signature) error {
- pubKey, err := ssh.ParsePublicKey(k.Blob)
- if err != nil {
- return fmt.Errorf("agent: bad public key: %v", err)
- }
- return pubKey.Verify(data, sig)
-}
-
-type wireKey struct {
- Format string
- Rest []byte `ssh:"rest"`
-}
-
-func parseKey(in []byte) (out *Key, rest []byte, err error) {
- var record struct {
- Blob []byte
- Comment string
- Rest []byte `ssh:"rest"`
- }
-
- if err := ssh.Unmarshal(in, &record); err != nil {
- return nil, nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(record.Blob, &wk); err != nil {
- return nil, nil, err
- }
-
- return &Key{
- Format: wk.Format,
- Blob: record.Blob,
- Comment: record.Comment,
- }, record.Rest, nil
-}
-
-// client is a client for an ssh-agent process.
-type client struct {
- // conn is typically a *net.UnixConn
- conn io.ReadWriter
- // mu is used to prevent concurrent access to the agent
- mu sync.Mutex
-}
-
-// NewClient returns an Agent that talks to an ssh-agent process over
-// the given connection.
-func NewClient(rw io.ReadWriter) ExtendedAgent {
- return &client{conn: rw}
-}
-
-// call sends an RPC to the agent. On success, the reply is
-// unmarshaled into reply and replyType is set to the first byte of
-// the reply, which contains the type of the message.
-func (c *client) call(req []byte) (reply interface{}, err error) {
- buf, err := c.callRaw(req)
- if err != nil {
- return nil, err
- }
- reply, err = unmarshal(buf)
- if err != nil {
- return nil, clientErr(err)
- }
- return reply, nil
-}
-
-// callRaw sends an RPC to the agent. On success, the raw
-// bytes of the response are returned; no unmarshalling is
-// performed on the response.
-func (c *client) callRaw(req []byte) (reply []byte, err error) {
- c.mu.Lock()
- defer c.mu.Unlock()
-
- msg := make([]byte, 4+len(req))
- binary.BigEndian.PutUint32(msg, uint32(len(req)))
- copy(msg[4:], req)
- if _, err = c.conn.Write(msg); err != nil {
- return nil, clientErr(err)
- }
-
- var respSizeBuf [4]byte
- if _, err = io.ReadFull(c.conn, respSizeBuf[:]); err != nil {
- return nil, clientErr(err)
- }
- respSize := binary.BigEndian.Uint32(respSizeBuf[:])
- if respSize > maxAgentResponseBytes {
- return nil, clientErr(errors.New("response too large"))
- }
-
- buf := make([]byte, respSize)
- if _, err = io.ReadFull(c.conn, buf); err != nil {
- return nil, clientErr(err)
- }
- return buf, nil
-}
-
-func (c *client) simpleCall(req []byte) error {
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-func (c *client) RemoveAll() error {
- return c.simpleCall([]byte{agentRemoveAllIdentities})
-}
-
-func (c *client) Remove(key ssh.PublicKey) error {
- req := ssh.Marshal(&agentRemoveIdentityMsg{
- KeyBlob: key.Marshal(),
- })
- return c.simpleCall(req)
-}
-
-func (c *client) Lock(passphrase []byte) error {
- req := ssh.Marshal(&agentLockMsg{
- Passphrase: passphrase,
- })
- return c.simpleCall(req)
-}
-
-func (c *client) Unlock(passphrase []byte) error {
- req := ssh.Marshal(&agentUnlockMsg{
- Passphrase: passphrase,
- })
- return c.simpleCall(req)
-}
-
-// List returns the identities known to the agent.
-func (c *client) List() ([]*Key, error) {
- // see [PROTOCOL.agent] section 2.5.2.
- req := []byte{agentRequestIdentities}
-
- msg, err := c.call(req)
- if err != nil {
- return nil, err
- }
-
- switch msg := msg.(type) {
- case *identitiesAnswerAgentMsg:
- if msg.NumKeys > maxAgentResponseBytes/8 {
- return nil, errors.New("agent: too many keys in agent reply")
- }
- keys := make([]*Key, msg.NumKeys)
- data := msg.Keys
- for i := uint32(0); i < msg.NumKeys; i++ {
- var key *Key
- var err error
- if key, data, err = parseKey(data); err != nil {
- return nil, err
- }
- keys[i] = key
- }
- return keys, nil
- case *failureAgentMsg:
- return nil, errors.New("agent: failed to list keys")
- }
- panic("unreachable")
-}
-
-// Sign has the agent sign the data using a protocol 2 key as defined
-// in [PROTOCOL.agent] section 2.6.2.
-func (c *client) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error) {
- return c.SignWithFlags(key, data, 0)
-}
-
-func (c *client) SignWithFlags(key ssh.PublicKey, data []byte, flags SignatureFlags) (*ssh.Signature, error) {
- req := ssh.Marshal(signRequestAgentMsg{
- KeyBlob: key.Marshal(),
- Data: data,
- Flags: uint32(flags),
- })
-
- msg, err := c.call(req)
- if err != nil {
- return nil, err
- }
-
- switch msg := msg.(type) {
- case *signResponseAgentMsg:
- var sig ssh.Signature
- if err := ssh.Unmarshal(msg.SigBlob, &sig); err != nil {
- return nil, err
- }
-
- return &sig, nil
- case *failureAgentMsg:
- return nil, errors.New("agent: failed to sign challenge")
- }
- panic("unreachable")
-}
-
-// unmarshal parses an agent message in packet, returning the parsed
-// form and the message type of packet.
-func unmarshal(packet []byte) (interface{}, error) {
- if len(packet) < 1 {
- return nil, errors.New("agent: empty packet")
- }
- var msg interface{}
- switch packet[0] {
- case agentFailure:
- return new(failureAgentMsg), nil
- case agentSuccess:
- return new(successAgentMsg), nil
- case agentIdentitiesAnswer:
- msg = new(identitiesAnswerAgentMsg)
- case agentSignResponse:
- msg = new(signResponseAgentMsg)
- case agentV1IdentitiesAnswer:
- msg = new(agentV1IdentityMsg)
- default:
- return nil, fmt.Errorf("agent: unknown type tag %d", packet[0])
- }
- if err := ssh.Unmarshal(packet, msg); err != nil {
- return nil, err
- }
- return msg, nil
-}
-
-type rsaKeyMsg struct {
- Type string `sshtype:"17|25"`
- N *big.Int
- E *big.Int
- D *big.Int
- Iqmp *big.Int // IQMP = Inverse Q Mod P
- P *big.Int
- Q *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type dsaKeyMsg struct {
- Type string `sshtype:"17|25"`
- P *big.Int
- Q *big.Int
- G *big.Int
- Y *big.Int
- X *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ecdsaKeyMsg struct {
- Type string `sshtype:"17|25"`
- Curve string
- KeyBytes []byte
- D *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ed25519KeyMsg struct {
- Type string `sshtype:"17|25"`
- Pub []byte
- Priv []byte
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-// Insert adds a private key to the agent.
-func (c *client) insertKey(s interface{}, comment string, constraints []byte) error {
- var req []byte
- switch k := s.(type) {
- case *rsa.PrivateKey:
- if len(k.Primes) != 2 {
- return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
- }
- k.Precompute()
- req = ssh.Marshal(rsaKeyMsg{
- Type: ssh.KeyAlgoRSA,
- N: k.N,
- E: big.NewInt(int64(k.E)),
- D: k.D,
- Iqmp: k.Precomputed.Qinv,
- P: k.Primes[0],
- Q: k.Primes[1],
- Comments: comment,
- Constraints: constraints,
- })
- case *dsa.PrivateKey:
- req = ssh.Marshal(dsaKeyMsg{
- Type: ssh.KeyAlgoDSA,
- P: k.P,
- Q: k.Q,
- G: k.G,
- Y: k.Y,
- X: k.X,
- Comments: comment,
- Constraints: constraints,
- })
- case *ecdsa.PrivateKey:
- nistID := fmt.Sprintf("nistp%d", k.Params().BitSize)
- req = ssh.Marshal(ecdsaKeyMsg{
- Type: "ecdsa-sha2-" + nistID,
- Curve: nistID,
- KeyBytes: elliptic.Marshal(k.Curve, k.X, k.Y),
- D: k.D,
- Comments: comment,
- Constraints: constraints,
- })
- case ed25519.PrivateKey:
- req = ssh.Marshal(ed25519KeyMsg{
- Type: ssh.KeyAlgoED25519,
- Pub: []byte(k)[32:],
- Priv: []byte(k),
- Comments: comment,
- Constraints: constraints,
- })
- // This function originally supported only *ed25519.PrivateKey, however the
- // general idiom is to pass ed25519.PrivateKey by value, not by pointer.
- // We still support the pointer variant for backwards compatibility.
- case *ed25519.PrivateKey:
- req = ssh.Marshal(ed25519KeyMsg{
- Type: ssh.KeyAlgoED25519,
- Pub: []byte(*k)[32:],
- Priv: []byte(*k),
- Comments: comment,
- Constraints: constraints,
- })
- default:
- return fmt.Errorf("agent: unsupported key type %T", s)
- }
-
- // if constraints are present then the message type needs to be changed.
- if len(constraints) != 0 {
- req[0] = agentAddIDConstrained
- }
-
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-type rsaCertMsg struct {
- Type string `sshtype:"17|25"`
- CertBytes []byte
- D *big.Int
- Iqmp *big.Int // IQMP = Inverse Q Mod P
- P *big.Int
- Q *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type dsaCertMsg struct {
- Type string `sshtype:"17|25"`
- CertBytes []byte
- X *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ecdsaCertMsg struct {
- Type string `sshtype:"17|25"`
- CertBytes []byte
- D *big.Int
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-type ed25519CertMsg struct {
- Type string `sshtype:"17|25"`
- CertBytes []byte
- Pub []byte
- Priv []byte
- Comments string
- Constraints []byte `ssh:"rest"`
-}
-
-// Add adds a private key to the agent. If a certificate is given,
-// that certificate is added instead as public key.
-func (c *client) Add(key AddedKey) error {
- var constraints []byte
-
- if secs := key.LifetimeSecs; secs != 0 {
- constraints = append(constraints, ssh.Marshal(constrainLifetimeAgentMsg{secs})...)
- }
-
- if key.ConfirmBeforeUse {
- constraints = append(constraints, agentConstrainConfirm)
- }
-
- cert := key.Certificate
- if cert == nil {
- return c.insertKey(key.PrivateKey, key.Comment, constraints)
- }
- return c.insertCert(key.PrivateKey, cert, key.Comment, constraints)
-}
-
-func (c *client) insertCert(s interface{}, cert *ssh.Certificate, comment string, constraints []byte) error {
- var req []byte
- switch k := s.(type) {
- case *rsa.PrivateKey:
- if len(k.Primes) != 2 {
- return fmt.Errorf("agent: unsupported RSA key with %d primes", len(k.Primes))
- }
- k.Precompute()
- req = ssh.Marshal(rsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- D: k.D,
- Iqmp: k.Precomputed.Qinv,
- P: k.Primes[0],
- Q: k.Primes[1],
- Comments: comment,
- Constraints: constraints,
- })
- case *dsa.PrivateKey:
- req = ssh.Marshal(dsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- X: k.X,
- Comments: comment,
- Constraints: constraints,
- })
- case *ecdsa.PrivateKey:
- req = ssh.Marshal(ecdsaCertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- D: k.D,
- Comments: comment,
- Constraints: constraints,
- })
- case ed25519.PrivateKey:
- req = ssh.Marshal(ed25519CertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- Pub: []byte(k)[32:],
- Priv: []byte(k),
- Comments: comment,
- Constraints: constraints,
- })
- // This function originally supported only *ed25519.PrivateKey, however the
- // general idiom is to pass ed25519.PrivateKey by value, not by pointer.
- // We still support the pointer variant for backwards compatibility.
- case *ed25519.PrivateKey:
- req = ssh.Marshal(ed25519CertMsg{
- Type: cert.Type(),
- CertBytes: cert.Marshal(),
- Pub: []byte(*k)[32:],
- Priv: []byte(*k),
- Comments: comment,
- Constraints: constraints,
- })
- default:
- return fmt.Errorf("agent: unsupported key type %T", s)
- }
-
- // if constraints are present then the message type needs to be changed.
- if len(constraints) != 0 {
- req[0] = agentAddIDConstrained
- }
-
- signer, err := ssh.NewSignerFromKey(s)
- if err != nil {
- return err
- }
- if !bytes.Equal(cert.Key.Marshal(), signer.PublicKey().Marshal()) {
- return errors.New("agent: signer and cert have different public key")
- }
-
- resp, err := c.call(req)
- if err != nil {
- return err
- }
- if _, ok := resp.(*successAgentMsg); ok {
- return nil
- }
- return errors.New("agent: failure")
-}
-
-// Signers provides a callback for client authentication.
-func (c *client) Signers() ([]ssh.Signer, error) {
- keys, err := c.List()
- if err != nil {
- return nil, err
- }
-
- var result []ssh.Signer
- for _, k := range keys {
- result = append(result, &agentKeyringSigner{c, k})
- }
- return result, nil
-}
-
-type agentKeyringSigner struct {
- agent *client
- pub ssh.PublicKey
-}
-
-func (s *agentKeyringSigner) PublicKey() ssh.PublicKey {
- return s.pub
-}
-
-func (s *agentKeyringSigner) Sign(rand io.Reader, data []byte) (*ssh.Signature, error) {
- // The agent has its own entropy source, so the rand argument is ignored.
- return s.agent.Sign(s.pub, data)
-}
-
-func (s *agentKeyringSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*ssh.Signature, error) {
- if algorithm == "" || algorithm == underlyingAlgo(s.pub.Type()) {
- return s.Sign(rand, data)
- }
-
- var flags SignatureFlags
- switch algorithm {
- case ssh.KeyAlgoRSASHA256:
- flags = SignatureFlagRsaSha256
- case ssh.KeyAlgoRSASHA512:
- flags = SignatureFlagRsaSha512
- default:
- return nil, fmt.Errorf("agent: unsupported algorithm %q", algorithm)
- }
-
- return s.agent.SignWithFlags(s.pub, data, flags)
-}
-
-var _ ssh.AlgorithmSigner = &agentKeyringSigner{}
-
-// certKeyAlgoNames is a mapping from known certificate algorithm names to the
-// corresponding public key signature algorithm.
-//
-// This map must be kept in sync with the one in certs.go.
-var certKeyAlgoNames = map[string]string{
- ssh.CertAlgoRSAv01: ssh.KeyAlgoRSA,
- ssh.CertAlgoRSASHA256v01: ssh.KeyAlgoRSASHA256,
- ssh.CertAlgoRSASHA512v01: ssh.KeyAlgoRSASHA512,
- ssh.CertAlgoDSAv01: ssh.KeyAlgoDSA,
- ssh.CertAlgoECDSA256v01: ssh.KeyAlgoECDSA256,
- ssh.CertAlgoECDSA384v01: ssh.KeyAlgoECDSA384,
- ssh.CertAlgoECDSA521v01: ssh.KeyAlgoECDSA521,
- ssh.CertAlgoSKECDSA256v01: ssh.KeyAlgoSKECDSA256,
- ssh.CertAlgoED25519v01: ssh.KeyAlgoED25519,
- ssh.CertAlgoSKED25519v01: ssh.KeyAlgoSKED25519,
-}
-
-// underlyingAlgo returns the signature algorithm associated with algo (which is
-// an advertised or negotiated public key or host key algorithm). These are
-// usually the same, except for certificate algorithms.
-func underlyingAlgo(algo string) string {
- if a, ok := certKeyAlgoNames[algo]; ok {
- return a
- }
- return algo
-}
-
-// Calls an extension method. It is up to the agent implementation as to whether or not
-// any particular extension is supported and may always return an error. Because the
-// type of the response is up to the implementation, this returns the bytes of the
-// response and does not attempt any type of unmarshalling.
-func (c *client) Extension(extensionType string, contents []byte) ([]byte, error) {
- req := ssh.Marshal(extensionAgentMsg{
- ExtensionType: extensionType,
- Contents: contents,
- })
- buf, err := c.callRaw(req)
- if err != nil {
- return nil, err
- }
- if len(buf) == 0 {
- return nil, errors.New("agent: failure; empty response")
- }
- // [PROTOCOL.agent] section 4.7 indicates that an SSH_AGENT_FAILURE message
- // represents an agent that does not support the extension
- if buf[0] == agentFailure {
- return nil, ErrExtensionUnsupported
- }
- if buf[0] == agentExtensionFailure {
- return nil, errors.New("agent: generic extension failure")
- }
-
- return buf, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/forward.go b/vendor/golang.org/x/crypto/ssh/agent/forward.go
deleted file mode 100644
index fd24ba900..000000000
--- a/vendor/golang.org/x/crypto/ssh/agent/forward.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "errors"
- "io"
- "net"
- "sync"
-
- "golang.org/x/crypto/ssh"
-)
-
-// RequestAgentForwarding sets up agent forwarding for the session.
-// ForwardToAgent or ForwardToRemote should be called to route
-// the authentication requests.
-func RequestAgentForwarding(session *ssh.Session) error {
- ok, err := session.SendRequest("auth-agent-req@openssh.com", true, nil)
- if err != nil {
- return err
- }
- if !ok {
- return errors.New("forwarding request denied")
- }
- return nil
-}
-
-// ForwardToAgent routes authentication requests to the given keyring.
-func ForwardToAgent(client *ssh.Client, keyring Agent) error {
- channels := client.HandleChannelOpen(channelType)
- if channels == nil {
- return errors.New("agent: already have handler for " + channelType)
- }
-
- go func() {
- for ch := range channels {
- channel, reqs, err := ch.Accept()
- if err != nil {
- continue
- }
- go ssh.DiscardRequests(reqs)
- go func() {
- ServeAgent(keyring, channel)
- channel.Close()
- }()
- }
- }()
- return nil
-}
-
-const channelType = "auth-agent@openssh.com"
-
-// ForwardToRemote routes authentication requests to the ssh-agent
-// process serving on the given unix socket.
-func ForwardToRemote(client *ssh.Client, addr string) error {
- channels := client.HandleChannelOpen(channelType)
- if channels == nil {
- return errors.New("agent: already have handler for " + channelType)
- }
- conn, err := net.Dial("unix", addr)
- if err != nil {
- return err
- }
- conn.Close()
-
- go func() {
- for ch := range channels {
- channel, reqs, err := ch.Accept()
- if err != nil {
- continue
- }
- go ssh.DiscardRequests(reqs)
- go forwardUnixSocket(channel, addr)
- }
- }()
- return nil
-}
-
-func forwardUnixSocket(channel ssh.Channel, addr string) {
- conn, err := net.Dial("unix", addr)
- if err != nil {
- return
- }
-
- var wg sync.WaitGroup
- wg.Add(2)
- go func() {
- io.Copy(conn, channel)
- conn.(*net.UnixConn).CloseWrite()
- wg.Done()
- }()
- go func() {
- io.Copy(channel, conn)
- channel.CloseWrite()
- wg.Done()
- }()
-
- wg.Wait()
- conn.Close()
- channel.Close()
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/keyring.go b/vendor/golang.org/x/crypto/ssh/agent/keyring.go
deleted file mode 100644
index c1b436108..000000000
--- a/vendor/golang.org/x/crypto/ssh/agent/keyring.go
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "bytes"
- "crypto/rand"
- "crypto/subtle"
- "errors"
- "fmt"
- "sync"
- "time"
-
- "golang.org/x/crypto/ssh"
-)
-
-type privKey struct {
- signer ssh.Signer
- comment string
- expire *time.Time
-}
-
-type keyring struct {
- mu sync.Mutex
- keys []privKey
-
- locked bool
- passphrase []byte
-}
-
-var errLocked = errors.New("agent: locked")
-
-// NewKeyring returns an Agent that holds keys in memory. It is safe
-// for concurrent use by multiple goroutines.
-func NewKeyring() Agent {
- return &keyring{}
-}
-
-// RemoveAll removes all identities.
-func (r *keyring) RemoveAll() error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- r.keys = nil
- return nil
-}
-
-// removeLocked does the actual key removal. The caller must already be holding the
-// keyring mutex.
-func (r *keyring) removeLocked(want []byte) error {
- found := false
- for i := 0; i < len(r.keys); {
- if bytes.Equal(r.keys[i].signer.PublicKey().Marshal(), want) {
- found = true
- r.keys[i] = r.keys[len(r.keys)-1]
- r.keys = r.keys[:len(r.keys)-1]
- continue
- } else {
- i++
- }
- }
-
- if !found {
- return errors.New("agent: key not found")
- }
- return nil
-}
-
-// Remove removes all identities with the given public key.
-func (r *keyring) Remove(key ssh.PublicKey) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- return r.removeLocked(key.Marshal())
-}
-
-// Lock locks the agent. Sign and Remove will fail, and List will return an empty list.
-func (r *keyring) Lock(passphrase []byte) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
-
- r.locked = true
- r.passphrase = passphrase
- return nil
-}
-
-// Unlock undoes the effect of Lock
-func (r *keyring) Unlock(passphrase []byte) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if !r.locked {
- return errors.New("agent: not locked")
- }
- if 1 != subtle.ConstantTimeCompare(passphrase, r.passphrase) {
- return fmt.Errorf("agent: incorrect passphrase")
- }
-
- r.locked = false
- r.passphrase = nil
- return nil
-}
-
-// expireKeysLocked removes expired keys from the keyring. If a key was added
-// with a lifetimesecs contraint and seconds >= lifetimesecs seconds have
-// elapsed, it is removed. The caller *must* be holding the keyring mutex.
-func (r *keyring) expireKeysLocked() {
- for _, k := range r.keys {
- if k.expire != nil && time.Now().After(*k.expire) {
- r.removeLocked(k.signer.PublicKey().Marshal())
- }
- }
-}
-
-// List returns the identities known to the agent.
-func (r *keyring) List() ([]*Key, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- // section 2.7: locked agents return empty.
- return nil, nil
- }
-
- r.expireKeysLocked()
- var ids []*Key
- for _, k := range r.keys {
- pub := k.signer.PublicKey()
- ids = append(ids, &Key{
- Format: pub.Type(),
- Blob: pub.Marshal(),
- Comment: k.comment})
- }
- return ids, nil
-}
-
-// Insert adds a private key to the keyring. If a certificate
-// is given, that certificate is added as public key. Note that
-// any constraints given are ignored.
-func (r *keyring) Add(key AddedKey) error {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return errLocked
- }
- signer, err := ssh.NewSignerFromKey(key.PrivateKey)
-
- if err != nil {
- return err
- }
-
- if cert := key.Certificate; cert != nil {
- signer, err = ssh.NewCertSigner(cert, signer)
- if err != nil {
- return err
- }
- }
-
- p := privKey{
- signer: signer,
- comment: key.Comment,
- }
-
- if key.LifetimeSecs > 0 {
- t := time.Now().Add(time.Duration(key.LifetimeSecs) * time.Second)
- p.expire = &t
- }
-
- // If we already have a Signer with the same public key, replace it with the
- // new one.
- for idx, k := range r.keys {
- if bytes.Equal(k.signer.PublicKey().Marshal(), p.signer.PublicKey().Marshal()) {
- r.keys[idx] = p
- return nil
- }
- }
-
- r.keys = append(r.keys, p)
-
- return nil
-}
-
-// Sign returns a signature for the data.
-func (r *keyring) Sign(key ssh.PublicKey, data []byte) (*ssh.Signature, error) {
- return r.SignWithFlags(key, data, 0)
-}
-
-func (r *keyring) SignWithFlags(key ssh.PublicKey, data []byte, flags SignatureFlags) (*ssh.Signature, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return nil, errLocked
- }
-
- r.expireKeysLocked()
- wanted := key.Marshal()
- for _, k := range r.keys {
- if bytes.Equal(k.signer.PublicKey().Marshal(), wanted) {
- if flags == 0 {
- return k.signer.Sign(rand.Reader, data)
- } else {
- if algorithmSigner, ok := k.signer.(ssh.AlgorithmSigner); !ok {
- return nil, fmt.Errorf("agent: signature does not support non-default signature algorithm: %T", k.signer)
- } else {
- var algorithm string
- switch flags {
- case SignatureFlagRsaSha256:
- algorithm = ssh.KeyAlgoRSASHA256
- case SignatureFlagRsaSha512:
- algorithm = ssh.KeyAlgoRSASHA512
- default:
- return nil, fmt.Errorf("agent: unsupported signature flags: %d", flags)
- }
- return algorithmSigner.SignWithAlgorithm(rand.Reader, data, algorithm)
- }
- }
- }
- }
- return nil, errors.New("not found")
-}
-
-// Signers returns signers for all the known keys.
-func (r *keyring) Signers() ([]ssh.Signer, error) {
- r.mu.Lock()
- defer r.mu.Unlock()
- if r.locked {
- return nil, errLocked
- }
-
- r.expireKeysLocked()
- s := make([]ssh.Signer, 0, len(r.keys))
- for _, k := range r.keys {
- s = append(s, k.signer)
- }
- return s, nil
-}
-
-// The keyring does not support any extensions
-func (r *keyring) Extension(extensionType string, contents []byte) ([]byte, error) {
- return nil, ErrExtensionUnsupported
-}
diff --git a/vendor/golang.org/x/crypto/ssh/agent/server.go b/vendor/golang.org/x/crypto/ssh/agent/server.go
deleted file mode 100644
index e35ca7ce3..000000000
--- a/vendor/golang.org/x/crypto/ssh/agent/server.go
+++ /dev/null
@@ -1,570 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package agent
-
-import (
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/ed25519"
- "crypto/elliptic"
- "crypto/rsa"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "log"
- "math/big"
-
- "golang.org/x/crypto/ssh"
-)
-
-// server wraps an Agent and uses it to implement the agent side of
-// the SSH-agent, wire protocol.
-type server struct {
- agent Agent
-}
-
-func (s *server) processRequestBytes(reqData []byte) []byte {
- rep, err := s.processRequest(reqData)
- if err != nil {
- if err != errLocked {
- // TODO(hanwen): provide better logging interface?
- log.Printf("agent %d: %v", reqData[0], err)
- }
- return []byte{agentFailure}
- }
-
- if err == nil && rep == nil {
- return []byte{agentSuccess}
- }
-
- return ssh.Marshal(rep)
-}
-
-func marshalKey(k *Key) []byte {
- var record struct {
- Blob []byte
- Comment string
- }
- record.Blob = k.Marshal()
- record.Comment = k.Comment
-
- return ssh.Marshal(&record)
-}
-
-// See [PROTOCOL.agent], section 2.5.1.
-const agentV1IdentitiesAnswer = 2
-
-type agentV1IdentityMsg struct {
- Numkeys uint32 `sshtype:"2"`
-}
-
-type agentRemoveIdentityMsg struct {
- KeyBlob []byte `sshtype:"18"`
-}
-
-type agentLockMsg struct {
- Passphrase []byte `sshtype:"22"`
-}
-
-type agentUnlockMsg struct {
- Passphrase []byte `sshtype:"23"`
-}
-
-func (s *server) processRequest(data []byte) (interface{}, error) {
- switch data[0] {
- case agentRequestV1Identities:
- return &agentV1IdentityMsg{0}, nil
-
- case agentRemoveAllV1Identities:
- return nil, nil
-
- case agentRemoveIdentity:
- var req agentRemoveIdentityMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(req.KeyBlob, &wk); err != nil {
- return nil, err
- }
-
- return nil, s.agent.Remove(&Key{Format: wk.Format, Blob: req.KeyBlob})
-
- case agentRemoveAllIdentities:
- return nil, s.agent.RemoveAll()
-
- case agentLock:
- var req agentLockMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- return nil, s.agent.Lock(req.Passphrase)
-
- case agentUnlock:
- var req agentUnlockMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
- return nil, s.agent.Unlock(req.Passphrase)
-
- case agentSignRequest:
- var req signRequestAgentMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
-
- var wk wireKey
- if err := ssh.Unmarshal(req.KeyBlob, &wk); err != nil {
- return nil, err
- }
-
- k := &Key{
- Format: wk.Format,
- Blob: req.KeyBlob,
- }
-
- var sig *ssh.Signature
- var err error
- if extendedAgent, ok := s.agent.(ExtendedAgent); ok {
- sig, err = extendedAgent.SignWithFlags(k, req.Data, SignatureFlags(req.Flags))
- } else {
- sig, err = s.agent.Sign(k, req.Data)
- }
-
- if err != nil {
- return nil, err
- }
- return &signResponseAgentMsg{SigBlob: ssh.Marshal(sig)}, nil
-
- case agentRequestIdentities:
- keys, err := s.agent.List()
- if err != nil {
- return nil, err
- }
-
- rep := identitiesAnswerAgentMsg{
- NumKeys: uint32(len(keys)),
- }
- for _, k := range keys {
- rep.Keys = append(rep.Keys, marshalKey(k)...)
- }
- return rep, nil
-
- case agentAddIDConstrained, agentAddIdentity:
- return nil, s.insertIdentity(data)
-
- case agentExtension:
- // Return a stub object where the whole contents of the response gets marshaled.
- var responseStub struct {
- Rest []byte `ssh:"rest"`
- }
-
- if extendedAgent, ok := s.agent.(ExtendedAgent); !ok {
- // If this agent doesn't implement extensions, [PROTOCOL.agent] section 4.7
- // requires that we return a standard SSH_AGENT_FAILURE message.
- responseStub.Rest = []byte{agentFailure}
- } else {
- var req extensionAgentMsg
- if err := ssh.Unmarshal(data, &req); err != nil {
- return nil, err
- }
- res, err := extendedAgent.Extension(req.ExtensionType, req.Contents)
- if err != nil {
- // If agent extensions are unsupported, return a standard SSH_AGENT_FAILURE
- // message as required by [PROTOCOL.agent] section 4.7.
- if err == ErrExtensionUnsupported {
- responseStub.Rest = []byte{agentFailure}
- } else {
- // As the result of any other error processing an extension request,
- // [PROTOCOL.agent] section 4.7 requires that we return a
- // SSH_AGENT_EXTENSION_FAILURE code.
- responseStub.Rest = []byte{agentExtensionFailure}
- }
- } else {
- if len(res) == 0 {
- return nil, nil
- }
- responseStub.Rest = res
- }
- }
-
- return responseStub, nil
- }
-
- return nil, fmt.Errorf("unknown opcode %d", data[0])
-}
-
-func parseConstraints(constraints []byte) (lifetimeSecs uint32, confirmBeforeUse bool, extensions []ConstraintExtension, err error) {
- for len(constraints) != 0 {
- switch constraints[0] {
- case agentConstrainLifetime:
- lifetimeSecs = binary.BigEndian.Uint32(constraints[1:5])
- constraints = constraints[5:]
- case agentConstrainConfirm:
- confirmBeforeUse = true
- constraints = constraints[1:]
- case agentConstrainExtension, agentConstrainExtensionV00:
- var msg constrainExtensionAgentMsg
- if err = ssh.Unmarshal(constraints, &msg); err != nil {
- return 0, false, nil, err
- }
- extensions = append(extensions, ConstraintExtension{
- ExtensionName: msg.ExtensionName,
- ExtensionDetails: msg.ExtensionDetails,
- })
- constraints = msg.Rest
- default:
- return 0, false, nil, fmt.Errorf("unknown constraint type: %d", constraints[0])
- }
- }
- return
-}
-
-func setConstraints(key *AddedKey, constraintBytes []byte) error {
- lifetimeSecs, confirmBeforeUse, constraintExtensions, err := parseConstraints(constraintBytes)
- if err != nil {
- return err
- }
-
- key.LifetimeSecs = lifetimeSecs
- key.ConfirmBeforeUse = confirmBeforeUse
- key.ConstraintExtensions = constraintExtensions
- return nil
-}
-
-func parseRSAKey(req []byte) (*AddedKey, error) {
- var k rsaKeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- if k.E.BitLen() > 30 {
- return nil, errors.New("agent: RSA public exponent too large")
- }
- priv := &rsa.PrivateKey{
- PublicKey: rsa.PublicKey{
- E: int(k.E.Int64()),
- N: k.N,
- },
- D: k.D,
- Primes: []*big.Int{k.P, k.Q},
- }
- priv.Precompute()
-
- addedKey := &AddedKey{PrivateKey: priv, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseEd25519Key(req []byte) (*AddedKey, error) {
- var k ed25519KeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- priv := ed25519.PrivateKey(k.Priv)
-
- addedKey := &AddedKey{PrivateKey: &priv, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseDSAKey(req []byte) (*AddedKey, error) {
- var k dsaKeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- priv := &dsa.PrivateKey{
- PublicKey: dsa.PublicKey{
- Parameters: dsa.Parameters{
- P: k.P,
- Q: k.Q,
- G: k.G,
- },
- Y: k.Y,
- },
- X: k.X,
- }
-
- addedKey := &AddedKey{PrivateKey: priv, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func unmarshalECDSA(curveName string, keyBytes []byte, privScalar *big.Int) (priv *ecdsa.PrivateKey, err error) {
- priv = &ecdsa.PrivateKey{
- D: privScalar,
- }
-
- switch curveName {
- case "nistp256":
- priv.Curve = elliptic.P256()
- case "nistp384":
- priv.Curve = elliptic.P384()
- case "nistp521":
- priv.Curve = elliptic.P521()
- default:
- return nil, fmt.Errorf("agent: unknown curve %q", curveName)
- }
-
- priv.X, priv.Y = elliptic.Unmarshal(priv.Curve, keyBytes)
- if priv.X == nil || priv.Y == nil {
- return nil, errors.New("agent: point not on curve")
- }
-
- return priv, nil
-}
-
-func parseEd25519Cert(req []byte) (*AddedKey, error) {
- var k ed25519CertMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- pubKey, err := ssh.ParsePublicKey(k.CertBytes)
- if err != nil {
- return nil, err
- }
- priv := ed25519.PrivateKey(k.Priv)
- cert, ok := pubKey.(*ssh.Certificate)
- if !ok {
- return nil, errors.New("agent: bad ED25519 certificate")
- }
-
- addedKey := &AddedKey{PrivateKey: &priv, Certificate: cert, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseECDSAKey(req []byte) (*AddedKey, error) {
- var k ecdsaKeyMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
-
- priv, err := unmarshalECDSA(k.Curve, k.KeyBytes, k.D)
- if err != nil {
- return nil, err
- }
-
- addedKey := &AddedKey{PrivateKey: priv, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseRSACert(req []byte) (*AddedKey, error) {
- var k rsaCertMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
-
- pubKey, err := ssh.ParsePublicKey(k.CertBytes)
- if err != nil {
- return nil, err
- }
-
- cert, ok := pubKey.(*ssh.Certificate)
- if !ok {
- return nil, errors.New("agent: bad RSA certificate")
- }
-
- // An RSA publickey as marshaled by rsaPublicKey.Marshal() in keys.go
- var rsaPub struct {
- Name string
- E *big.Int
- N *big.Int
- }
- if err := ssh.Unmarshal(cert.Key.Marshal(), &rsaPub); err != nil {
- return nil, fmt.Errorf("agent: Unmarshal failed to parse public key: %v", err)
- }
-
- if rsaPub.E.BitLen() > 30 {
- return nil, errors.New("agent: RSA public exponent too large")
- }
-
- priv := rsa.PrivateKey{
- PublicKey: rsa.PublicKey{
- E: int(rsaPub.E.Int64()),
- N: rsaPub.N,
- },
- D: k.D,
- Primes: []*big.Int{k.Q, k.P},
- }
- priv.Precompute()
-
- addedKey := &AddedKey{PrivateKey: &priv, Certificate: cert, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseDSACert(req []byte) (*AddedKey, error) {
- var k dsaCertMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
- pubKey, err := ssh.ParsePublicKey(k.CertBytes)
- if err != nil {
- return nil, err
- }
- cert, ok := pubKey.(*ssh.Certificate)
- if !ok {
- return nil, errors.New("agent: bad DSA certificate")
- }
-
- // A DSA publickey as marshaled by dsaPublicKey.Marshal() in keys.go
- var w struct {
- Name string
- P, Q, G, Y *big.Int
- }
- if err := ssh.Unmarshal(cert.Key.Marshal(), &w); err != nil {
- return nil, fmt.Errorf("agent: Unmarshal failed to parse public key: %v", err)
- }
-
- priv := &dsa.PrivateKey{
- PublicKey: dsa.PublicKey{
- Parameters: dsa.Parameters{
- P: w.P,
- Q: w.Q,
- G: w.G,
- },
- Y: w.Y,
- },
- X: k.X,
- }
-
- addedKey := &AddedKey{PrivateKey: priv, Certificate: cert, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func parseECDSACert(req []byte) (*AddedKey, error) {
- var k ecdsaCertMsg
- if err := ssh.Unmarshal(req, &k); err != nil {
- return nil, err
- }
-
- pubKey, err := ssh.ParsePublicKey(k.CertBytes)
- if err != nil {
- return nil, err
- }
- cert, ok := pubKey.(*ssh.Certificate)
- if !ok {
- return nil, errors.New("agent: bad ECDSA certificate")
- }
-
- // An ECDSA publickey as marshaled by ecdsaPublicKey.Marshal() in keys.go
- var ecdsaPub struct {
- Name string
- ID string
- Key []byte
- }
- if err := ssh.Unmarshal(cert.Key.Marshal(), &ecdsaPub); err != nil {
- return nil, err
- }
-
- priv, err := unmarshalECDSA(ecdsaPub.ID, ecdsaPub.Key, k.D)
- if err != nil {
- return nil, err
- }
-
- addedKey := &AddedKey{PrivateKey: priv, Certificate: cert, Comment: k.Comments}
- if err := setConstraints(addedKey, k.Constraints); err != nil {
- return nil, err
- }
- return addedKey, nil
-}
-
-func (s *server) insertIdentity(req []byte) error {
- var record struct {
- Type string `sshtype:"17|25"`
- Rest []byte `ssh:"rest"`
- }
-
- if err := ssh.Unmarshal(req, &record); err != nil {
- return err
- }
-
- var addedKey *AddedKey
- var err error
-
- switch record.Type {
- case ssh.KeyAlgoRSA:
- addedKey, err = parseRSAKey(req)
- case ssh.KeyAlgoDSA:
- addedKey, err = parseDSAKey(req)
- case ssh.KeyAlgoECDSA256, ssh.KeyAlgoECDSA384, ssh.KeyAlgoECDSA521:
- addedKey, err = parseECDSAKey(req)
- case ssh.KeyAlgoED25519:
- addedKey, err = parseEd25519Key(req)
- case ssh.CertAlgoRSAv01:
- addedKey, err = parseRSACert(req)
- case ssh.CertAlgoDSAv01:
- addedKey, err = parseDSACert(req)
- case ssh.CertAlgoECDSA256v01, ssh.CertAlgoECDSA384v01, ssh.CertAlgoECDSA521v01:
- addedKey, err = parseECDSACert(req)
- case ssh.CertAlgoED25519v01:
- addedKey, err = parseEd25519Cert(req)
- default:
- return fmt.Errorf("agent: not implemented: %q", record.Type)
- }
-
- if err != nil {
- return err
- }
- return s.agent.Add(*addedKey)
-}
-
-// ServeAgent serves the agent protocol on the given connection. It
-// returns when an I/O error occurs.
-func ServeAgent(agent Agent, c io.ReadWriter) error {
- s := &server{agent}
-
- var length [4]byte
- for {
- if _, err := io.ReadFull(c, length[:]); err != nil {
- return err
- }
- l := binary.BigEndian.Uint32(length[:])
- if l == 0 {
- return fmt.Errorf("agent: request size is 0")
- }
- if l > maxAgentResponseBytes {
- // We also cap requests.
- return fmt.Errorf("agent: request too large: %d", l)
- }
-
- req := make([]byte, l)
- if _, err := io.ReadFull(c, req); err != nil {
- return err
- }
-
- repData := s.processRequestBytes(req)
- if len(repData) > maxAgentResponseBytes {
- return fmt.Errorf("agent: reply too large: %d bytes", len(repData))
- }
-
- binary.BigEndian.PutUint32(length[:], uint32(len(repData)))
- if _, err := c.Write(length[:]); err != nil {
- return err
- }
- if _, err := c.Write(repData); err != nil {
- return err
- }
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/buffer.go b/vendor/golang.org/x/crypto/ssh/buffer.go
deleted file mode 100644
index 1ab07d078..000000000
--- a/vendor/golang.org/x/crypto/ssh/buffer.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "io"
- "sync"
-)
-
-// buffer provides a linked list buffer for data exchange
-// between producer and consumer. Theoretically the buffer is
-// of unlimited capacity as it does no allocation of its own.
-type buffer struct {
- // protects concurrent access to head, tail and closed
- *sync.Cond
-
- head *element // the buffer that will be read first
- tail *element // the buffer that will be read last
-
- closed bool
-}
-
-// An element represents a single link in a linked list.
-type element struct {
- buf []byte
- next *element
-}
-
-// newBuffer returns an empty buffer that is not closed.
-func newBuffer() *buffer {
- e := new(element)
- b := &buffer{
- Cond: newCond(),
- head: e,
- tail: e,
- }
- return b
-}
-
-// write makes buf available for Read to receive.
-// buf must not be modified after the call to write.
-func (b *buffer) write(buf []byte) {
- b.Cond.L.Lock()
- e := &element{buf: buf}
- b.tail.next = e
- b.tail = e
- b.Cond.Signal()
- b.Cond.L.Unlock()
-}
-
-// eof closes the buffer. Reads from the buffer once all
-// the data has been consumed will receive io.EOF.
-func (b *buffer) eof() {
- b.Cond.L.Lock()
- b.closed = true
- b.Cond.Signal()
- b.Cond.L.Unlock()
-}
-
-// Read reads data from the internal buffer in buf. Reads will block
-// if no data is available, or until the buffer is closed.
-func (b *buffer) Read(buf []byte) (n int, err error) {
- b.Cond.L.Lock()
- defer b.Cond.L.Unlock()
-
- for len(buf) > 0 {
- // if there is data in b.head, copy it
- if len(b.head.buf) > 0 {
- r := copy(buf, b.head.buf)
- buf, b.head.buf = buf[r:], b.head.buf[r:]
- n += r
- continue
- }
- // if there is a next buffer, make it the head
- if len(b.head.buf) == 0 && b.head != b.tail {
- b.head = b.head.next
- continue
- }
-
- // if at least one byte has been copied, return
- if n > 0 {
- break
- }
-
- // if nothing was read, and there is nothing outstanding
- // check to see if the buffer is closed.
- if b.closed {
- err = io.EOF
- break
- }
- // out of buffers, wait for producer
- b.Cond.Wait()
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/ssh/certs.go b/vendor/golang.org/x/crypto/ssh/certs.go
deleted file mode 100644
index 27d0e14aa..000000000
--- a/vendor/golang.org/x/crypto/ssh/certs.go
+++ /dev/null
@@ -1,611 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "net"
- "sort"
- "time"
-)
-
-// Certificate algorithm names from [PROTOCOL.certkeys]. These values can appear
-// in Certificate.Type, PublicKey.Type, and ClientConfig.HostKeyAlgorithms.
-// Unlike key algorithm names, these are not passed to AlgorithmSigner nor
-// returned by MultiAlgorithmSigner and don't appear in the Signature.Format
-// field.
-const (
- CertAlgoRSAv01 = "ssh-rsa-cert-v01@openssh.com"
- CertAlgoDSAv01 = "ssh-dss-cert-v01@openssh.com"
- CertAlgoECDSA256v01 = "ecdsa-sha2-nistp256-cert-v01@openssh.com"
- CertAlgoECDSA384v01 = "ecdsa-sha2-nistp384-cert-v01@openssh.com"
- CertAlgoECDSA521v01 = "ecdsa-sha2-nistp521-cert-v01@openssh.com"
- CertAlgoSKECDSA256v01 = "sk-ecdsa-sha2-nistp256-cert-v01@openssh.com"
- CertAlgoED25519v01 = "ssh-ed25519-cert-v01@openssh.com"
- CertAlgoSKED25519v01 = "sk-ssh-ed25519-cert-v01@openssh.com"
-
- // CertAlgoRSASHA256v01 and CertAlgoRSASHA512v01 can't appear as a
- // Certificate.Type (or PublicKey.Type), but only in
- // ClientConfig.HostKeyAlgorithms.
- CertAlgoRSASHA256v01 = "rsa-sha2-256-cert-v01@openssh.com"
- CertAlgoRSASHA512v01 = "rsa-sha2-512-cert-v01@openssh.com"
-)
-
-const (
- // Deprecated: use CertAlgoRSAv01.
- CertSigAlgoRSAv01 = CertAlgoRSAv01
- // Deprecated: use CertAlgoRSASHA256v01.
- CertSigAlgoRSASHA2256v01 = CertAlgoRSASHA256v01
- // Deprecated: use CertAlgoRSASHA512v01.
- CertSigAlgoRSASHA2512v01 = CertAlgoRSASHA512v01
-)
-
-// Certificate types distinguish between host and user
-// certificates. The values can be set in the CertType field of
-// Certificate.
-const (
- UserCert = 1
- HostCert = 2
-)
-
-// Signature represents a cryptographic signature.
-type Signature struct {
- Format string
- Blob []byte
- Rest []byte `ssh:"rest"`
-}
-
-// CertTimeInfinity can be used for OpenSSHCertV01.ValidBefore to indicate that
-// a certificate does not expire.
-const CertTimeInfinity = 1<<64 - 1
-
-// An Certificate represents an OpenSSH certificate as defined in
-// [PROTOCOL.certkeys]?rev=1.8. The Certificate type implements the
-// PublicKey interface, so it can be unmarshaled using
-// ParsePublicKey.
-type Certificate struct {
- Nonce []byte
- Key PublicKey
- Serial uint64
- CertType uint32
- KeyId string
- ValidPrincipals []string
- ValidAfter uint64
- ValidBefore uint64
- Permissions
- Reserved []byte
- SignatureKey PublicKey
- Signature *Signature
-}
-
-// genericCertData holds the key-independent part of the certificate data.
-// Overall, certificates contain an nonce, public key fields and
-// key-independent fields.
-type genericCertData struct {
- Serial uint64
- CertType uint32
- KeyId string
- ValidPrincipals []byte
- ValidAfter uint64
- ValidBefore uint64
- CriticalOptions []byte
- Extensions []byte
- Reserved []byte
- SignatureKey []byte
- Signature []byte
-}
-
-func marshalStringList(namelist []string) []byte {
- var to []byte
- for _, name := range namelist {
- s := struct{ N string }{name}
- to = append(to, Marshal(&s)...)
- }
- return to
-}
-
-type optionsTuple struct {
- Key string
- Value []byte
-}
-
-type optionsTupleValue struct {
- Value string
-}
-
-// serialize a map of critical options or extensions
-// issue #10569 - per [PROTOCOL.certkeys] and SSH implementation,
-// we need two length prefixes for a non-empty string value
-func marshalTuples(tups map[string]string) []byte {
- keys := make([]string, 0, len(tups))
- for key := range tups {
- keys = append(keys, key)
- }
- sort.Strings(keys)
-
- var ret []byte
- for _, key := range keys {
- s := optionsTuple{Key: key}
- if value := tups[key]; len(value) > 0 {
- s.Value = Marshal(&optionsTupleValue{value})
- }
- ret = append(ret, Marshal(&s)...)
- }
- return ret
-}
-
-// issue #10569 - per [PROTOCOL.certkeys] and SSH implementation,
-// we need two length prefixes for a non-empty option value
-func parseTuples(in []byte) (map[string]string, error) {
- tups := map[string]string{}
- var lastKey string
- var haveLastKey bool
-
- for len(in) > 0 {
- var key, val, extra []byte
- var ok bool
-
- if key, in, ok = parseString(in); !ok {
- return nil, errShortRead
- }
- keyStr := string(key)
- // according to [PROTOCOL.certkeys], the names must be in
- // lexical order.
- if haveLastKey && keyStr <= lastKey {
- return nil, fmt.Errorf("ssh: certificate options are not in lexical order")
- }
- lastKey, haveLastKey = keyStr, true
- // the next field is a data field, which if non-empty has a string embedded
- if val, in, ok = parseString(in); !ok {
- return nil, errShortRead
- }
- if len(val) > 0 {
- val, extra, ok = parseString(val)
- if !ok {
- return nil, errShortRead
- }
- if len(extra) > 0 {
- return nil, fmt.Errorf("ssh: unexpected trailing data after certificate option value")
- }
- tups[keyStr] = string(val)
- } else {
- tups[keyStr] = ""
- }
- }
- return tups, nil
-}
-
-func parseCert(in []byte, privAlgo string) (*Certificate, error) {
- nonce, rest, ok := parseString(in)
- if !ok {
- return nil, errShortRead
- }
-
- key, rest, err := parsePubKey(rest, privAlgo)
- if err != nil {
- return nil, err
- }
-
- var g genericCertData
- if err := Unmarshal(rest, &g); err != nil {
- return nil, err
- }
-
- c := &Certificate{
- Nonce: nonce,
- Key: key,
- Serial: g.Serial,
- CertType: g.CertType,
- KeyId: g.KeyId,
- ValidAfter: g.ValidAfter,
- ValidBefore: g.ValidBefore,
- }
-
- for principals := g.ValidPrincipals; len(principals) > 0; {
- principal, rest, ok := parseString(principals)
- if !ok {
- return nil, errShortRead
- }
- c.ValidPrincipals = append(c.ValidPrincipals, string(principal))
- principals = rest
- }
-
- c.CriticalOptions, err = parseTuples(g.CriticalOptions)
- if err != nil {
- return nil, err
- }
- c.Extensions, err = parseTuples(g.Extensions)
- if err != nil {
- return nil, err
- }
- c.Reserved = g.Reserved
- k, err := ParsePublicKey(g.SignatureKey)
- if err != nil {
- return nil, err
- }
-
- c.SignatureKey = k
- c.Signature, rest, ok = parseSignatureBody(g.Signature)
- if !ok || len(rest) > 0 {
- return nil, errors.New("ssh: signature parse error")
- }
-
- return c, nil
-}
-
-type openSSHCertSigner struct {
- pub *Certificate
- signer Signer
-}
-
-type algorithmOpenSSHCertSigner struct {
- *openSSHCertSigner
- algorithmSigner AlgorithmSigner
-}
-
-// NewCertSigner returns a Signer that signs with the given Certificate, whose
-// private key is held by signer. It returns an error if the public key in cert
-// doesn't match the key used by signer.
-func NewCertSigner(cert *Certificate, signer Signer) (Signer, error) {
- if !bytes.Equal(cert.Key.Marshal(), signer.PublicKey().Marshal()) {
- return nil, errors.New("ssh: signer and cert have different public key")
- }
-
- switch s := signer.(type) {
- case MultiAlgorithmSigner:
- return &multiAlgorithmSigner{
- AlgorithmSigner: &algorithmOpenSSHCertSigner{
- &openSSHCertSigner{cert, signer}, s},
- supportedAlgorithms: s.Algorithms(),
- }, nil
- case AlgorithmSigner:
- return &algorithmOpenSSHCertSigner{
- &openSSHCertSigner{cert, signer}, s}, nil
- default:
- return &openSSHCertSigner{cert, signer}, nil
- }
-}
-
-func (s *openSSHCertSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
- return s.signer.Sign(rand, data)
-}
-
-func (s *openSSHCertSigner) PublicKey() PublicKey {
- return s.pub
-}
-
-func (s *algorithmOpenSSHCertSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
- return s.algorithmSigner.SignWithAlgorithm(rand, data, algorithm)
-}
-
-const sourceAddressCriticalOption = "source-address"
-
-// CertChecker does the work of verifying a certificate. Its methods
-// can be plugged into ClientConfig.HostKeyCallback and
-// ServerConfig.PublicKeyCallback. For the CertChecker to work,
-// minimally, the IsAuthority callback should be set.
-type CertChecker struct {
- // SupportedCriticalOptions lists the CriticalOptions that the
- // server application layer understands. These are only used
- // for user certificates.
- SupportedCriticalOptions []string
-
- // IsUserAuthority should return true if the key is recognized as an
- // authority for the given user certificate. This allows for
- // certificates to be signed by other certificates. This must be set
- // if this CertChecker will be checking user certificates.
- IsUserAuthority func(auth PublicKey) bool
-
- // IsHostAuthority should report whether the key is recognized as
- // an authority for this host. This allows for certificates to be
- // signed by other keys, and for those other keys to only be valid
- // signers for particular hostnames. This must be set if this
- // CertChecker will be checking host certificates.
- IsHostAuthority func(auth PublicKey, address string) bool
-
- // Clock is used for verifying time stamps. If nil, time.Now
- // is used.
- Clock func() time.Time
-
- // UserKeyFallback is called when CertChecker.Authenticate encounters a
- // public key that is not a certificate. It must implement validation
- // of user keys or else, if nil, all such keys are rejected.
- UserKeyFallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
-
- // HostKeyFallback is called when CertChecker.CheckHostKey encounters a
- // public key that is not a certificate. It must implement host key
- // validation or else, if nil, all such keys are rejected.
- HostKeyFallback HostKeyCallback
-
- // IsRevoked is called for each certificate so that revocation checking
- // can be implemented. It should return true if the given certificate
- // is revoked and false otherwise. If nil, no certificates are
- // considered to have been revoked.
- IsRevoked func(cert *Certificate) bool
-}
-
-// CheckHostKey checks a host key certificate. This method can be
-// plugged into ClientConfig.HostKeyCallback.
-func (c *CertChecker) CheckHostKey(addr string, remote net.Addr, key PublicKey) error {
- cert, ok := key.(*Certificate)
- if !ok {
- if c.HostKeyFallback != nil {
- return c.HostKeyFallback(addr, remote, key)
- }
- return errors.New("ssh: non-certificate host key")
- }
- if cert.CertType != HostCert {
- return fmt.Errorf("ssh: certificate presented as a host key has type %d", cert.CertType)
- }
- if !c.IsHostAuthority(cert.SignatureKey, addr) {
- return fmt.Errorf("ssh: no authorities for hostname: %v", addr)
- }
-
- hostname, _, err := net.SplitHostPort(addr)
- if err != nil {
- return err
- }
-
- // Pass hostname only as principal for host certificates (consistent with OpenSSH)
- return c.CheckCert(hostname, cert)
-}
-
-// Authenticate checks a user certificate. Authenticate can be used as
-// a value for ServerConfig.PublicKeyCallback.
-func (c *CertChecker) Authenticate(conn ConnMetadata, pubKey PublicKey) (*Permissions, error) {
- cert, ok := pubKey.(*Certificate)
- if !ok {
- if c.UserKeyFallback != nil {
- return c.UserKeyFallback(conn, pubKey)
- }
- return nil, errors.New("ssh: normal key pairs not accepted")
- }
-
- if cert.CertType != UserCert {
- return nil, fmt.Errorf("ssh: cert has type %d", cert.CertType)
- }
- if !c.IsUserAuthority(cert.SignatureKey) {
- return nil, fmt.Errorf("ssh: certificate signed by unrecognized authority")
- }
-
- if err := c.CheckCert(conn.User(), cert); err != nil {
- return nil, err
- }
-
- return &cert.Permissions, nil
-}
-
-// CheckCert checks CriticalOptions, ValidPrincipals, revocation, timestamp and
-// the signature of the certificate.
-func (c *CertChecker) CheckCert(principal string, cert *Certificate) error {
- if c.IsRevoked != nil && c.IsRevoked(cert) {
- return fmt.Errorf("ssh: certificate serial %d revoked", cert.Serial)
- }
-
- for opt := range cert.CriticalOptions {
- // sourceAddressCriticalOption will be enforced by
- // serverAuthenticate
- if opt == sourceAddressCriticalOption {
- continue
- }
-
- found := false
- for _, supp := range c.SupportedCriticalOptions {
- if supp == opt {
- found = true
- break
- }
- }
- if !found {
- return fmt.Errorf("ssh: unsupported critical option %q in certificate", opt)
- }
- }
-
- if len(cert.ValidPrincipals) > 0 {
- // By default, certs are valid for all users/hosts.
- found := false
- for _, p := range cert.ValidPrincipals {
- if p == principal {
- found = true
- break
- }
- }
- if !found {
- return fmt.Errorf("ssh: principal %q not in the set of valid principals for given certificate: %q", principal, cert.ValidPrincipals)
- }
- }
-
- clock := c.Clock
- if clock == nil {
- clock = time.Now
- }
-
- unixNow := clock().Unix()
- if after := int64(cert.ValidAfter); after < 0 || unixNow < int64(cert.ValidAfter) {
- return fmt.Errorf("ssh: cert is not yet valid")
- }
- if before := int64(cert.ValidBefore); cert.ValidBefore != uint64(CertTimeInfinity) && (unixNow >= before || before < 0) {
- return fmt.Errorf("ssh: cert has expired")
- }
- if err := cert.SignatureKey.Verify(cert.bytesForSigning(), cert.Signature); err != nil {
- return fmt.Errorf("ssh: certificate signature does not verify")
- }
-
- return nil
-}
-
-// SignCert signs the certificate with an authority, setting the Nonce,
-// SignatureKey, and Signature fields. If the authority implements the
-// MultiAlgorithmSigner interface the first algorithm in the list is used. This
-// is useful if you want to sign with a specific algorithm.
-func (c *Certificate) SignCert(rand io.Reader, authority Signer) error {
- c.Nonce = make([]byte, 32)
- if _, err := io.ReadFull(rand, c.Nonce); err != nil {
- return err
- }
- c.SignatureKey = authority.PublicKey()
-
- if v, ok := authority.(MultiAlgorithmSigner); ok {
- if len(v.Algorithms()) == 0 {
- return errors.New("the provided authority has no signature algorithm")
- }
- // Use the first algorithm in the list.
- sig, err := v.SignWithAlgorithm(rand, c.bytesForSigning(), v.Algorithms()[0])
- if err != nil {
- return err
- }
- c.Signature = sig
- return nil
- } else if v, ok := authority.(AlgorithmSigner); ok && v.PublicKey().Type() == KeyAlgoRSA {
- // Default to KeyAlgoRSASHA512 for ssh-rsa signers.
- // TODO: consider using KeyAlgoRSASHA256 as default.
- sig, err := v.SignWithAlgorithm(rand, c.bytesForSigning(), KeyAlgoRSASHA512)
- if err != nil {
- return err
- }
- c.Signature = sig
- return nil
- }
-
- sig, err := authority.Sign(rand, c.bytesForSigning())
- if err != nil {
- return err
- }
- c.Signature = sig
- return nil
-}
-
-// certKeyAlgoNames is a mapping from known certificate algorithm names to the
-// corresponding public key signature algorithm.
-//
-// This map must be kept in sync with the one in agent/client.go.
-var certKeyAlgoNames = map[string]string{
- CertAlgoRSAv01: KeyAlgoRSA,
- CertAlgoRSASHA256v01: KeyAlgoRSASHA256,
- CertAlgoRSASHA512v01: KeyAlgoRSASHA512,
- CertAlgoDSAv01: KeyAlgoDSA,
- CertAlgoECDSA256v01: KeyAlgoECDSA256,
- CertAlgoECDSA384v01: KeyAlgoECDSA384,
- CertAlgoECDSA521v01: KeyAlgoECDSA521,
- CertAlgoSKECDSA256v01: KeyAlgoSKECDSA256,
- CertAlgoED25519v01: KeyAlgoED25519,
- CertAlgoSKED25519v01: KeyAlgoSKED25519,
-}
-
-// underlyingAlgo returns the signature algorithm associated with algo (which is
-// an advertised or negotiated public key or host key algorithm). These are
-// usually the same, except for certificate algorithms.
-func underlyingAlgo(algo string) string {
- if a, ok := certKeyAlgoNames[algo]; ok {
- return a
- }
- return algo
-}
-
-// certificateAlgo returns the certificate algorithms that uses the provided
-// underlying signature algorithm.
-func certificateAlgo(algo string) (certAlgo string, ok bool) {
- for certName, algoName := range certKeyAlgoNames {
- if algoName == algo {
- return certName, true
- }
- }
- return "", false
-}
-
-func (cert *Certificate) bytesForSigning() []byte {
- c2 := *cert
- c2.Signature = nil
- out := c2.Marshal()
- // Drop trailing signature length.
- return out[:len(out)-4]
-}
-
-// Marshal serializes c into OpenSSH's wire format. It is part of the
-// PublicKey interface.
-func (c *Certificate) Marshal() []byte {
- generic := genericCertData{
- Serial: c.Serial,
- CertType: c.CertType,
- KeyId: c.KeyId,
- ValidPrincipals: marshalStringList(c.ValidPrincipals),
- ValidAfter: uint64(c.ValidAfter),
- ValidBefore: uint64(c.ValidBefore),
- CriticalOptions: marshalTuples(c.CriticalOptions),
- Extensions: marshalTuples(c.Extensions),
- Reserved: c.Reserved,
- SignatureKey: c.SignatureKey.Marshal(),
- }
- if c.Signature != nil {
- generic.Signature = Marshal(c.Signature)
- }
- genericBytes := Marshal(&generic)
- keyBytes := c.Key.Marshal()
- _, keyBytes, _ = parseString(keyBytes)
- prefix := Marshal(&struct {
- Name string
- Nonce []byte
- Key []byte `ssh:"rest"`
- }{c.Type(), c.Nonce, keyBytes})
-
- result := make([]byte, 0, len(prefix)+len(genericBytes))
- result = append(result, prefix...)
- result = append(result, genericBytes...)
- return result
-}
-
-// Type returns the certificate algorithm name. It is part of the PublicKey interface.
-func (c *Certificate) Type() string {
- certName, ok := certificateAlgo(c.Key.Type())
- if !ok {
- panic("unknown certificate type for key type " + c.Key.Type())
- }
- return certName
-}
-
-// Verify verifies a signature against the certificate's public
-// key. It is part of the PublicKey interface.
-func (c *Certificate) Verify(data []byte, sig *Signature) error {
- return c.Key.Verify(data, sig)
-}
-
-func parseSignatureBody(in []byte) (out *Signature, rest []byte, ok bool) {
- format, in, ok := parseString(in)
- if !ok {
- return
- }
-
- out = &Signature{
- Format: string(format),
- }
-
- if out.Blob, in, ok = parseString(in); !ok {
- return
- }
-
- switch out.Format {
- case KeyAlgoSKECDSA256, CertAlgoSKECDSA256v01, KeyAlgoSKED25519, CertAlgoSKED25519v01:
- out.Rest = in
- return out, nil, ok
- }
-
- return out, in, ok
-}
-
-func parseSignature(in []byte) (out *Signature, rest []byte, ok bool) {
- sigBytes, rest, ok := parseString(in)
- if !ok {
- return
- }
-
- out, trailing, ok := parseSignatureBody(sigBytes)
- if !ok || len(trailing) > 0 {
- return nil, nil, false
- }
- return
-}
diff --git a/vendor/golang.org/x/crypto/ssh/channel.go b/vendor/golang.org/x/crypto/ssh/channel.go
deleted file mode 100644
index cc0bb7ab6..000000000
--- a/vendor/golang.org/x/crypto/ssh/channel.go
+++ /dev/null
@@ -1,645 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "log"
- "sync"
-)
-
-const (
- minPacketLength = 9
- // channelMaxPacket contains the maximum number of bytes that will be
- // sent in a single packet. As per RFC 4253, section 6.1, 32k is also
- // the minimum.
- channelMaxPacket = 1 << 15
- // We follow OpenSSH here.
- channelWindowSize = 64 * channelMaxPacket
-)
-
-// NewChannel represents an incoming request to a channel. It must either be
-// accepted for use by calling Accept, or rejected by calling Reject.
-type NewChannel interface {
- // Accept accepts the channel creation request. It returns the Channel
- // and a Go channel containing SSH requests. The Go channel must be
- // serviced otherwise the Channel will hang.
- Accept() (Channel, <-chan *Request, error)
-
- // Reject rejects the channel creation request. After calling
- // this, no other methods on the Channel may be called.
- Reject(reason RejectionReason, message string) error
-
- // ChannelType returns the type of the channel, as supplied by the
- // client.
- ChannelType() string
-
- // ExtraData returns the arbitrary payload for this channel, as supplied
- // by the client. This data is specific to the channel type.
- ExtraData() []byte
-}
-
-// A Channel is an ordered, reliable, flow-controlled, duplex stream
-// that is multiplexed over an SSH connection.
-type Channel interface {
- // Read reads up to len(data) bytes from the channel.
- Read(data []byte) (int, error)
-
- // Write writes len(data) bytes to the channel.
- Write(data []byte) (int, error)
-
- // Close signals end of channel use. No data may be sent after this
- // call.
- Close() error
-
- // CloseWrite signals the end of sending in-band
- // data. Requests may still be sent, and the other side may
- // still send data
- CloseWrite() error
-
- // SendRequest sends a channel request. If wantReply is true,
- // it will wait for a reply and return the result as a
- // boolean, otherwise the return value will be false. Channel
- // requests are out-of-band messages so they may be sent even
- // if the data stream is closed or blocked by flow control.
- // If the channel is closed before a reply is returned, io.EOF
- // is returned.
- SendRequest(name string, wantReply bool, payload []byte) (bool, error)
-
- // Stderr returns an io.ReadWriter that writes to this channel
- // with the extended data type set to stderr. Stderr may
- // safely be read and written from a different goroutine than
- // Read and Write respectively.
- Stderr() io.ReadWriter
-}
-
-// Request is a request sent outside of the normal stream of
-// data. Requests can either be specific to an SSH channel, or they
-// can be global.
-type Request struct {
- Type string
- WantReply bool
- Payload []byte
-
- ch *channel
- mux *mux
-}
-
-// Reply sends a response to a request. It must be called for all requests
-// where WantReply is true and is a no-op otherwise. The payload argument is
-// ignored for replies to channel-specific requests.
-func (r *Request) Reply(ok bool, payload []byte) error {
- if !r.WantReply {
- return nil
- }
-
- if r.ch == nil {
- return r.mux.ackRequest(ok, payload)
- }
-
- return r.ch.ackRequest(ok)
-}
-
-// RejectionReason is an enumeration used when rejecting channel creation
-// requests. See RFC 4254, section 5.1.
-type RejectionReason uint32
-
-const (
- Prohibited RejectionReason = iota + 1
- ConnectionFailed
- UnknownChannelType
- ResourceShortage
-)
-
-// String converts the rejection reason to human readable form.
-func (r RejectionReason) String() string {
- switch r {
- case Prohibited:
- return "administratively prohibited"
- case ConnectionFailed:
- return "connect failed"
- case UnknownChannelType:
- return "unknown channel type"
- case ResourceShortage:
- return "resource shortage"
- }
- return fmt.Sprintf("unknown reason %d", int(r))
-}
-
-func min(a uint32, b int) uint32 {
- if a < uint32(b) {
- return a
- }
- return uint32(b)
-}
-
-type channelDirection uint8
-
-const (
- channelInbound channelDirection = iota
- channelOutbound
-)
-
-// channel is an implementation of the Channel interface that works
-// with the mux class.
-type channel struct {
- // R/O after creation
- chanType string
- extraData []byte
- localId, remoteId uint32
-
- // maxIncomingPayload and maxRemotePayload are the maximum
- // payload sizes of normal and extended data packets for
- // receiving and sending, respectively. The wire packet will
- // be 9 or 13 bytes larger (excluding encryption overhead).
- maxIncomingPayload uint32
- maxRemotePayload uint32
-
- mux *mux
-
- // decided is set to true if an accept or reject message has been sent
- // (for outbound channels) or received (for inbound channels).
- decided bool
-
- // direction contains either channelOutbound, for channels created
- // locally, or channelInbound, for channels created by the peer.
- direction channelDirection
-
- // Pending internal channel messages.
- msg chan interface{}
-
- // Since requests have no ID, there can be only one request
- // with WantReply=true outstanding. This lock is held by a
- // goroutine that has such an outgoing request pending.
- sentRequestMu sync.Mutex
-
- incomingRequests chan *Request
-
- sentEOF bool
-
- // thread-safe data
- remoteWin window
- pending *buffer
- extPending *buffer
-
- // windowMu protects myWindow, the flow-control window, and myConsumed,
- // the number of bytes consumed since we last increased myWindow
- windowMu sync.Mutex
- myWindow uint32
- myConsumed uint32
-
- // writeMu serializes calls to mux.conn.writePacket() and
- // protects sentClose and packetPool. This mutex must be
- // different from windowMu, as writePacket can block if there
- // is a key exchange pending.
- writeMu sync.Mutex
- sentClose bool
-
- // packetPool has a buffer for each extended channel ID to
- // save allocations during writes.
- packetPool map[uint32][]byte
-}
-
-// writePacket sends a packet. If the packet is a channel close, it updates
-// sentClose. This method takes the lock c.writeMu.
-func (ch *channel) writePacket(packet []byte) error {
- ch.writeMu.Lock()
- if ch.sentClose {
- ch.writeMu.Unlock()
- return io.EOF
- }
- ch.sentClose = (packet[0] == msgChannelClose)
- err := ch.mux.conn.writePacket(packet)
- ch.writeMu.Unlock()
- return err
-}
-
-func (ch *channel) sendMessage(msg interface{}) error {
- if debugMux {
- log.Printf("send(%d): %#v", ch.mux.chanList.offset, msg)
- }
-
- p := Marshal(msg)
- binary.BigEndian.PutUint32(p[1:], ch.remoteId)
- return ch.writePacket(p)
-}
-
-// WriteExtended writes data to a specific extended stream. These streams are
-// used, for example, for stderr.
-func (ch *channel) WriteExtended(data []byte, extendedCode uint32) (n int, err error) {
- if ch.sentEOF {
- return 0, io.EOF
- }
- // 1 byte message type, 4 bytes remoteId, 4 bytes data length
- opCode := byte(msgChannelData)
- headerLength := uint32(9)
- if extendedCode > 0 {
- headerLength += 4
- opCode = msgChannelExtendedData
- }
-
- ch.writeMu.Lock()
- packet := ch.packetPool[extendedCode]
- // We don't remove the buffer from packetPool, so
- // WriteExtended calls from different goroutines will be
- // flagged as errors by the race detector.
- ch.writeMu.Unlock()
-
- for len(data) > 0 {
- space := min(ch.maxRemotePayload, len(data))
- if space, err = ch.remoteWin.reserve(space); err != nil {
- return n, err
- }
- if want := headerLength + space; uint32(cap(packet)) < want {
- packet = make([]byte, want)
- } else {
- packet = packet[:want]
- }
-
- todo := data[:space]
-
- packet[0] = opCode
- binary.BigEndian.PutUint32(packet[1:], ch.remoteId)
- if extendedCode > 0 {
- binary.BigEndian.PutUint32(packet[5:], uint32(extendedCode))
- }
- binary.BigEndian.PutUint32(packet[headerLength-4:], uint32(len(todo)))
- copy(packet[headerLength:], todo)
- if err = ch.writePacket(packet); err != nil {
- return n, err
- }
-
- n += len(todo)
- data = data[len(todo):]
- }
-
- ch.writeMu.Lock()
- ch.packetPool[extendedCode] = packet
- ch.writeMu.Unlock()
-
- return n, err
-}
-
-func (ch *channel) handleData(packet []byte) error {
- headerLen := 9
- isExtendedData := packet[0] == msgChannelExtendedData
- if isExtendedData {
- headerLen = 13
- }
- if len(packet) < headerLen {
- // malformed data packet
- return parseError(packet[0])
- }
-
- var extended uint32
- if isExtendedData {
- extended = binary.BigEndian.Uint32(packet[5:])
- }
-
- length := binary.BigEndian.Uint32(packet[headerLen-4 : headerLen])
- if length == 0 {
- return nil
- }
- if length > ch.maxIncomingPayload {
- // TODO(hanwen): should send Disconnect?
- return errors.New("ssh: incoming packet exceeds maximum payload size")
- }
-
- data := packet[headerLen:]
- if length != uint32(len(data)) {
- return errors.New("ssh: wrong packet length")
- }
-
- ch.windowMu.Lock()
- if ch.myWindow < length {
- ch.windowMu.Unlock()
- // TODO(hanwen): should send Disconnect with reason?
- return errors.New("ssh: remote side wrote too much")
- }
- ch.myWindow -= length
- ch.windowMu.Unlock()
-
- if extended == 1 {
- ch.extPending.write(data)
- } else if extended > 0 {
- // discard other extended data.
- } else {
- ch.pending.write(data)
- }
- return nil
-}
-
-func (c *channel) adjustWindow(adj uint32) error {
- c.windowMu.Lock()
- // Since myConsumed and myWindow are managed on our side, and can never
- // exceed the initial window setting, we don't worry about overflow.
- c.myConsumed += adj
- var sendAdj uint32
- if (channelWindowSize-c.myWindow > 3*c.maxIncomingPayload) ||
- (c.myWindow < channelWindowSize/2) {
- sendAdj = c.myConsumed
- c.myConsumed = 0
- c.myWindow += sendAdj
- }
- c.windowMu.Unlock()
- if sendAdj == 0 {
- return nil
- }
- return c.sendMessage(windowAdjustMsg{
- AdditionalBytes: sendAdj,
- })
-}
-
-func (c *channel) ReadExtended(data []byte, extended uint32) (n int, err error) {
- switch extended {
- case 1:
- n, err = c.extPending.Read(data)
- case 0:
- n, err = c.pending.Read(data)
- default:
- return 0, fmt.Errorf("ssh: extended code %d unimplemented", extended)
- }
-
- if n > 0 {
- err = c.adjustWindow(uint32(n))
- // sendWindowAdjust can return io.EOF if the remote
- // peer has closed the connection, however we want to
- // defer forwarding io.EOF to the caller of Read until
- // the buffer has been drained.
- if n > 0 && err == io.EOF {
- err = nil
- }
- }
-
- return n, err
-}
-
-func (c *channel) close() {
- c.pending.eof()
- c.extPending.eof()
- close(c.msg)
- close(c.incomingRequests)
- c.writeMu.Lock()
- // This is not necessary for a normal channel teardown, but if
- // there was another error, it is.
- c.sentClose = true
- c.writeMu.Unlock()
- // Unblock writers.
- c.remoteWin.close()
-}
-
-// responseMessageReceived is called when a success or failure message is
-// received on a channel to check that such a message is reasonable for the
-// given channel.
-func (ch *channel) responseMessageReceived() error {
- if ch.direction == channelInbound {
- return errors.New("ssh: channel response message received on inbound channel")
- }
- if ch.decided {
- return errors.New("ssh: duplicate response received for channel")
- }
- ch.decided = true
- return nil
-}
-
-func (ch *channel) handlePacket(packet []byte) error {
- switch packet[0] {
- case msgChannelData, msgChannelExtendedData:
- return ch.handleData(packet)
- case msgChannelClose:
- ch.sendMessage(channelCloseMsg{PeersID: ch.remoteId})
- ch.mux.chanList.remove(ch.localId)
- ch.close()
- return nil
- case msgChannelEOF:
- // RFC 4254 is mute on how EOF affects dataExt messages but
- // it is logical to signal EOF at the same time.
- ch.extPending.eof()
- ch.pending.eof()
- return nil
- }
-
- decoded, err := decode(packet)
- if err != nil {
- return err
- }
-
- switch msg := decoded.(type) {
- case *channelOpenFailureMsg:
- if err := ch.responseMessageReceived(); err != nil {
- return err
- }
- ch.mux.chanList.remove(msg.PeersID)
- ch.msg <- msg
- case *channelOpenConfirmMsg:
- if err := ch.responseMessageReceived(); err != nil {
- return err
- }
- if msg.MaxPacketSize < minPacketLength || msg.MaxPacketSize > 1<<31 {
- return fmt.Errorf("ssh: invalid MaxPacketSize %d from peer", msg.MaxPacketSize)
- }
- ch.remoteId = msg.MyID
- ch.maxRemotePayload = msg.MaxPacketSize
- ch.remoteWin.add(msg.MyWindow)
- ch.msg <- msg
- case *windowAdjustMsg:
- if !ch.remoteWin.add(msg.AdditionalBytes) {
- return fmt.Errorf("ssh: invalid window update for %d bytes", msg.AdditionalBytes)
- }
- case *channelRequestMsg:
- req := Request{
- Type: msg.Request,
- WantReply: msg.WantReply,
- Payload: msg.RequestSpecificData,
- ch: ch,
- }
-
- ch.incomingRequests <- &req
- default:
- ch.msg <- msg
- }
- return nil
-}
-
-func (m *mux) newChannel(chanType string, direction channelDirection, extraData []byte) *channel {
- ch := &channel{
- remoteWin: window{Cond: newCond()},
- myWindow: channelWindowSize,
- pending: newBuffer(),
- extPending: newBuffer(),
- direction: direction,
- incomingRequests: make(chan *Request, chanSize),
- msg: make(chan interface{}, chanSize),
- chanType: chanType,
- extraData: extraData,
- mux: m,
- packetPool: make(map[uint32][]byte),
- }
- ch.localId = m.chanList.add(ch)
- return ch
-}
-
-var errUndecided = errors.New("ssh: must Accept or Reject channel")
-var errDecidedAlready = errors.New("ssh: can call Accept or Reject only once")
-
-type extChannel struct {
- code uint32
- ch *channel
-}
-
-func (e *extChannel) Write(data []byte) (n int, err error) {
- return e.ch.WriteExtended(data, e.code)
-}
-
-func (e *extChannel) Read(data []byte) (n int, err error) {
- return e.ch.ReadExtended(data, e.code)
-}
-
-func (ch *channel) Accept() (Channel, <-chan *Request, error) {
- if ch.decided {
- return nil, nil, errDecidedAlready
- }
- ch.maxIncomingPayload = channelMaxPacket
- confirm := channelOpenConfirmMsg{
- PeersID: ch.remoteId,
- MyID: ch.localId,
- MyWindow: ch.myWindow,
- MaxPacketSize: ch.maxIncomingPayload,
- }
- ch.decided = true
- if err := ch.sendMessage(confirm); err != nil {
- return nil, nil, err
- }
-
- return ch, ch.incomingRequests, nil
-}
-
-func (ch *channel) Reject(reason RejectionReason, message string) error {
- if ch.decided {
- return errDecidedAlready
- }
- reject := channelOpenFailureMsg{
- PeersID: ch.remoteId,
- Reason: reason,
- Message: message,
- Language: "en",
- }
- ch.decided = true
- return ch.sendMessage(reject)
-}
-
-func (ch *channel) Read(data []byte) (int, error) {
- if !ch.decided {
- return 0, errUndecided
- }
- return ch.ReadExtended(data, 0)
-}
-
-func (ch *channel) Write(data []byte) (int, error) {
- if !ch.decided {
- return 0, errUndecided
- }
- return ch.WriteExtended(data, 0)
-}
-
-func (ch *channel) CloseWrite() error {
- if !ch.decided {
- return errUndecided
- }
- ch.sentEOF = true
- return ch.sendMessage(channelEOFMsg{
- PeersID: ch.remoteId})
-}
-
-func (ch *channel) Close() error {
- if !ch.decided {
- return errUndecided
- }
-
- return ch.sendMessage(channelCloseMsg{
- PeersID: ch.remoteId})
-}
-
-// Extended returns an io.ReadWriter that sends and receives data on the given,
-// SSH extended stream. Such streams are used, for example, for stderr.
-func (ch *channel) Extended(code uint32) io.ReadWriter {
- if !ch.decided {
- return nil
- }
- return &extChannel{code, ch}
-}
-
-func (ch *channel) Stderr() io.ReadWriter {
- return ch.Extended(1)
-}
-
-func (ch *channel) SendRequest(name string, wantReply bool, payload []byte) (bool, error) {
- if !ch.decided {
- return false, errUndecided
- }
-
- if wantReply {
- ch.sentRequestMu.Lock()
- defer ch.sentRequestMu.Unlock()
- }
-
- msg := channelRequestMsg{
- PeersID: ch.remoteId,
- Request: name,
- WantReply: wantReply,
- RequestSpecificData: payload,
- }
-
- if err := ch.sendMessage(msg); err != nil {
- return false, err
- }
-
- if wantReply {
- m, ok := (<-ch.msg)
- if !ok {
- return false, io.EOF
- }
- switch m.(type) {
- case *channelRequestFailureMsg:
- return false, nil
- case *channelRequestSuccessMsg:
- return true, nil
- default:
- return false, fmt.Errorf("ssh: unexpected response to channel request: %#v", m)
- }
- }
-
- return false, nil
-}
-
-// ackRequest either sends an ack or nack to the channel request.
-func (ch *channel) ackRequest(ok bool) error {
- if !ch.decided {
- return errUndecided
- }
-
- var msg interface{}
- if !ok {
- msg = channelRequestFailureMsg{
- PeersID: ch.remoteId,
- }
- } else {
- msg = channelRequestSuccessMsg{
- PeersID: ch.remoteId,
- }
- }
- return ch.sendMessage(msg)
-}
-
-func (ch *channel) ChannelType() string {
- return ch.chanType
-}
-
-func (ch *channel) ExtraData() []byte {
- return ch.extraData
-}
diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go
deleted file mode 100644
index 741e984f3..000000000
--- a/vendor/golang.org/x/crypto/ssh/cipher.go
+++ /dev/null
@@ -1,789 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto/aes"
- "crypto/cipher"
- "crypto/des"
- "crypto/rc4"
- "crypto/subtle"
- "encoding/binary"
- "errors"
- "fmt"
- "hash"
- "io"
-
- "golang.org/x/crypto/chacha20"
- "golang.org/x/crypto/internal/poly1305"
-)
-
-const (
- packetSizeMultiple = 16 // TODO(huin) this should be determined by the cipher.
-
- // RFC 4253 section 6.1 defines a minimum packet size of 32768 that implementations
- // MUST be able to process (plus a few more kilobytes for padding and mac). The RFC
- // indicates implementations SHOULD be able to handle larger packet sizes, but then
- // waffles on about reasonable limits.
- //
- // OpenSSH caps their maxPacket at 256kB so we choose to do
- // the same. maxPacket is also used to ensure that uint32
- // length fields do not overflow, so it should remain well
- // below 4G.
- maxPacket = 256 * 1024
-)
-
-// noneCipher implements cipher.Stream and provides no encryption. It is used
-// by the transport before the first key-exchange.
-type noneCipher struct{}
-
-func (c noneCipher) XORKeyStream(dst, src []byte) {
- copy(dst, src)
-}
-
-func newAESCTR(key, iv []byte) (cipher.Stream, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
- return cipher.NewCTR(c, iv), nil
-}
-
-func newRC4(key, iv []byte) (cipher.Stream, error) {
- return rc4.NewCipher(key)
-}
-
-type cipherMode struct {
- keySize int
- ivSize int
- create func(key, iv []byte, macKey []byte, algs directionAlgorithms) (packetCipher, error)
-}
-
-func streamCipherMode(skip int, createFunc func(key, iv []byte) (cipher.Stream, error)) func(key, iv []byte, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- return func(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- stream, err := createFunc(key, iv)
- if err != nil {
- return nil, err
- }
-
- var streamDump []byte
- if skip > 0 {
- streamDump = make([]byte, 512)
- }
-
- for remainingToDump := skip; remainingToDump > 0; {
- dumpThisTime := remainingToDump
- if dumpThisTime > len(streamDump) {
- dumpThisTime = len(streamDump)
- }
- stream.XORKeyStream(streamDump[:dumpThisTime], streamDump[:dumpThisTime])
- remainingToDump -= dumpThisTime
- }
-
- mac := macModes[algs.MAC].new(macKey)
- return &streamPacketCipher{
- mac: mac,
- etm: macModes[algs.MAC].etm,
- macResult: make([]byte, mac.Size()),
- cipher: stream,
- }, nil
- }
-}
-
-// cipherModes documents properties of supported ciphers. Ciphers not included
-// are not supported and will not be negotiated, even if explicitly requested in
-// ClientConfig.Crypto.Ciphers.
-var cipherModes = map[string]*cipherMode{
- // Ciphers from RFC 4344, which introduced many CTR-based ciphers. Algorithms
- // are defined in the order specified in the RFC.
- "aes128-ctr": {16, aes.BlockSize, streamCipherMode(0, newAESCTR)},
- "aes192-ctr": {24, aes.BlockSize, streamCipherMode(0, newAESCTR)},
- "aes256-ctr": {32, aes.BlockSize, streamCipherMode(0, newAESCTR)},
-
- // Ciphers from RFC 4345, which introduces security-improved arcfour ciphers.
- // They are defined in the order specified in the RFC.
- "arcfour128": {16, 0, streamCipherMode(1536, newRC4)},
- "arcfour256": {32, 0, streamCipherMode(1536, newRC4)},
-
- // Cipher defined in RFC 4253, which describes SSH Transport Layer Protocol.
- // Note that this cipher is not safe, as stated in RFC 4253: "Arcfour (and
- // RC4) has problems with weak keys, and should be used with caution."
- // RFC 4345 introduces improved versions of Arcfour.
- "arcfour": {16, 0, streamCipherMode(0, newRC4)},
-
- // AEAD ciphers
- gcm128CipherID: {16, 12, newGCMCipher},
- gcm256CipherID: {32, 12, newGCMCipher},
- chacha20Poly1305ID: {64, 0, newChaCha20Cipher},
-
- // CBC mode is insecure and so is not included in the default config.
- // (See https://www.ieee-security.org/TC/SP2013/papers/4977a526.pdf). If absolutely
- // needed, it's possible to specify a custom Config to enable it.
- // You should expect that an active attacker can recover plaintext if
- // you do.
- aes128cbcID: {16, aes.BlockSize, newAESCBCCipher},
-
- // 3des-cbc is insecure and is not included in the default
- // config.
- tripledescbcID: {24, des.BlockSize, newTripleDESCBCCipher},
-}
-
-// prefixLen is the length of the packet prefix that contains the packet length
-// and number of padding bytes.
-const prefixLen = 5
-
-// streamPacketCipher is a packetCipher using a stream cipher.
-type streamPacketCipher struct {
- mac hash.Hash
- cipher cipher.Stream
- etm bool
-
- // The following members are to avoid per-packet allocations.
- prefix [prefixLen]byte
- seqNumBytes [4]byte
- padding [2 * packetSizeMultiple]byte
- packetData []byte
- macResult []byte
-}
-
-// readCipherPacket reads and decrypt a single packet from the reader argument.
-func (s *streamPacketCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- if _, err := io.ReadFull(r, s.prefix[:]); err != nil {
- return nil, err
- }
-
- var encryptedPaddingLength [1]byte
- if s.mac != nil && s.etm {
- copy(encryptedPaddingLength[:], s.prefix[4:5])
- s.cipher.XORKeyStream(s.prefix[4:5], s.prefix[4:5])
- } else {
- s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
- }
-
- length := binary.BigEndian.Uint32(s.prefix[0:4])
- paddingLength := uint32(s.prefix[4])
-
- var macSize uint32
- if s.mac != nil {
- s.mac.Reset()
- binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
- s.mac.Write(s.seqNumBytes[:])
- if s.etm {
- s.mac.Write(s.prefix[:4])
- s.mac.Write(encryptedPaddingLength[:])
- } else {
- s.mac.Write(s.prefix[:])
- }
- macSize = uint32(s.mac.Size())
- }
-
- if length <= paddingLength+1 {
- return nil, errors.New("ssh: invalid packet length, packet too small")
- }
-
- if length > maxPacket {
- return nil, errors.New("ssh: invalid packet length, packet too large")
- }
-
- // the maxPacket check above ensures that length-1+macSize
- // does not overflow.
- if uint32(cap(s.packetData)) < length-1+macSize {
- s.packetData = make([]byte, length-1+macSize)
- } else {
- s.packetData = s.packetData[:length-1+macSize]
- }
-
- if _, err := io.ReadFull(r, s.packetData); err != nil {
- return nil, err
- }
- mac := s.packetData[length-1:]
- data := s.packetData[:length-1]
-
- if s.mac != nil && s.etm {
- s.mac.Write(data)
- }
-
- s.cipher.XORKeyStream(data, data)
-
- if s.mac != nil {
- if !s.etm {
- s.mac.Write(data)
- }
- s.macResult = s.mac.Sum(s.macResult[:0])
- if subtle.ConstantTimeCompare(s.macResult, mac) != 1 {
- return nil, errors.New("ssh: MAC failure")
- }
- }
-
- return s.packetData[:length-paddingLength-1], nil
-}
-
-// writeCipherPacket encrypts and sends a packet of data to the writer argument
-func (s *streamPacketCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- if len(packet) > maxPacket {
- return errors.New("ssh: packet too large")
- }
-
- aadlen := 0
- if s.mac != nil && s.etm {
- // packet length is not encrypted for EtM modes
- aadlen = 4
- }
-
- paddingLength := packetSizeMultiple - (prefixLen+len(packet)-aadlen)%packetSizeMultiple
- if paddingLength < 4 {
- paddingLength += packetSizeMultiple
- }
-
- length := len(packet) + 1 + paddingLength
- binary.BigEndian.PutUint32(s.prefix[:], uint32(length))
- s.prefix[4] = byte(paddingLength)
- padding := s.padding[:paddingLength]
- if _, err := io.ReadFull(rand, padding); err != nil {
- return err
- }
-
- if s.mac != nil {
- s.mac.Reset()
- binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
- s.mac.Write(s.seqNumBytes[:])
-
- if s.etm {
- // For EtM algorithms, the packet length must stay unencrypted,
- // but the following data (padding length) must be encrypted
- s.cipher.XORKeyStream(s.prefix[4:5], s.prefix[4:5])
- }
-
- s.mac.Write(s.prefix[:])
-
- if !s.etm {
- // For non-EtM algorithms, the algorithm is applied on unencrypted data
- s.mac.Write(packet)
- s.mac.Write(padding)
- }
- }
-
- if !(s.mac != nil && s.etm) {
- // For EtM algorithms, the padding length has already been encrypted
- // and the packet length must remain unencrypted
- s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
- }
-
- s.cipher.XORKeyStream(packet, packet)
- s.cipher.XORKeyStream(padding, padding)
-
- if s.mac != nil && s.etm {
- // For EtM algorithms, packet and padding must be encrypted
- s.mac.Write(packet)
- s.mac.Write(padding)
- }
-
- if _, err := w.Write(s.prefix[:]); err != nil {
- return err
- }
- if _, err := w.Write(packet); err != nil {
- return err
- }
- if _, err := w.Write(padding); err != nil {
- return err
- }
-
- if s.mac != nil {
- s.macResult = s.mac.Sum(s.macResult[:0])
- if _, err := w.Write(s.macResult); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-type gcmCipher struct {
- aead cipher.AEAD
- prefix [4]byte
- iv []byte
- buf []byte
-}
-
-func newGCMCipher(key, iv, unusedMacKey []byte, unusedAlgs directionAlgorithms) (packetCipher, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
-
- aead, err := cipher.NewGCM(c)
- if err != nil {
- return nil, err
- }
-
- return &gcmCipher{
- aead: aead,
- iv: iv,
- }, nil
-}
-
-const gcmTagSize = 16
-
-func (c *gcmCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- // Pad out to multiple of 16 bytes. This is different from the
- // stream cipher because that encrypts the length too.
- padding := byte(packetSizeMultiple - (1+len(packet))%packetSizeMultiple)
- if padding < 4 {
- padding += packetSizeMultiple
- }
-
- length := uint32(len(packet) + int(padding) + 1)
- binary.BigEndian.PutUint32(c.prefix[:], length)
- if _, err := w.Write(c.prefix[:]); err != nil {
- return err
- }
-
- if cap(c.buf) < int(length) {
- c.buf = make([]byte, length)
- } else {
- c.buf = c.buf[:length]
- }
-
- c.buf[0] = padding
- copy(c.buf[1:], packet)
- if _, err := io.ReadFull(rand, c.buf[1+len(packet):]); err != nil {
- return err
- }
- c.buf = c.aead.Seal(c.buf[:0], c.iv, c.buf, c.prefix[:])
- if _, err := w.Write(c.buf); err != nil {
- return err
- }
- c.incIV()
-
- return nil
-}
-
-func (c *gcmCipher) incIV() {
- for i := 4 + 7; i >= 4; i-- {
- c.iv[i]++
- if c.iv[i] != 0 {
- break
- }
- }
-}
-
-func (c *gcmCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- if _, err := io.ReadFull(r, c.prefix[:]); err != nil {
- return nil, err
- }
- length := binary.BigEndian.Uint32(c.prefix[:])
- if length > maxPacket {
- return nil, errors.New("ssh: max packet length exceeded")
- }
-
- if cap(c.buf) < int(length+gcmTagSize) {
- c.buf = make([]byte, length+gcmTagSize)
- } else {
- c.buf = c.buf[:length+gcmTagSize]
- }
-
- if _, err := io.ReadFull(r, c.buf); err != nil {
- return nil, err
- }
-
- plain, err := c.aead.Open(c.buf[:0], c.iv, c.buf, c.prefix[:])
- if err != nil {
- return nil, err
- }
- c.incIV()
-
- if len(plain) == 0 {
- return nil, errors.New("ssh: empty packet")
- }
-
- padding := plain[0]
- if padding < 4 {
- // padding is a byte, so it automatically satisfies
- // the maximum size, which is 255.
- return nil, fmt.Errorf("ssh: illegal padding %d", padding)
- }
-
- if int(padding+1) >= len(plain) {
- return nil, fmt.Errorf("ssh: padding %d too large", padding)
- }
- plain = plain[1 : length-uint32(padding)]
- return plain, nil
-}
-
-// cbcCipher implements aes128-cbc cipher defined in RFC 4253 section 6.1
-type cbcCipher struct {
- mac hash.Hash
- macSize uint32
- decrypter cipher.BlockMode
- encrypter cipher.BlockMode
-
- // The following members are to avoid per-packet allocations.
- seqNumBytes [4]byte
- packetData []byte
- macResult []byte
-
- // Amount of data we should still read to hide which
- // verification error triggered.
- oracleCamouflage uint32
-}
-
-func newCBCCipher(c cipher.Block, key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- cbc := &cbcCipher{
- mac: macModes[algs.MAC].new(macKey),
- decrypter: cipher.NewCBCDecrypter(c, iv),
- encrypter: cipher.NewCBCEncrypter(c, iv),
- packetData: make([]byte, 1024),
- }
- if cbc.mac != nil {
- cbc.macSize = uint32(cbc.mac.Size())
- }
-
- return cbc, nil
-}
-
-func newAESCBCCipher(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
-
- cbc, err := newCBCCipher(c, key, iv, macKey, algs)
- if err != nil {
- return nil, err
- }
-
- return cbc, nil
-}
-
-func newTripleDESCBCCipher(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
- c, err := des.NewTripleDESCipher(key)
- if err != nil {
- return nil, err
- }
-
- cbc, err := newCBCCipher(c, key, iv, macKey, algs)
- if err != nil {
- return nil, err
- }
-
- return cbc, nil
-}
-
-func maxUInt32(a, b int) uint32 {
- if a > b {
- return uint32(a)
- }
- return uint32(b)
-}
-
-const (
- cbcMinPacketSizeMultiple = 8
- cbcMinPacketSize = 16
- cbcMinPaddingSize = 4
-)
-
-// cbcError represents a verification error that may leak information.
-type cbcError string
-
-func (e cbcError) Error() string { return string(e) }
-
-func (c *cbcCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- p, err := c.readCipherPacketLeaky(seqNum, r)
- if err != nil {
- if _, ok := err.(cbcError); ok {
- // Verification error: read a fixed amount of
- // data, to make distinguishing between
- // failing MAC and failing length check more
- // difficult.
- io.CopyN(io.Discard, r, int64(c.oracleCamouflage))
- }
- }
- return p, err
-}
-
-func (c *cbcCipher) readCipherPacketLeaky(seqNum uint32, r io.Reader) ([]byte, error) {
- blockSize := c.decrypter.BlockSize()
-
- // Read the header, which will include some of the subsequent data in the
- // case of block ciphers - this is copied back to the payload later.
- // How many bytes of payload/padding will be read with this first read.
- firstBlockLength := uint32((prefixLen + blockSize - 1) / blockSize * blockSize)
- firstBlock := c.packetData[:firstBlockLength]
- if _, err := io.ReadFull(r, firstBlock); err != nil {
- return nil, err
- }
-
- c.oracleCamouflage = maxPacket + 4 + c.macSize - firstBlockLength
-
- c.decrypter.CryptBlocks(firstBlock, firstBlock)
- length := binary.BigEndian.Uint32(firstBlock[:4])
- if length > maxPacket {
- return nil, cbcError("ssh: packet too large")
- }
- if length+4 < maxUInt32(cbcMinPacketSize, blockSize) {
- // The minimum size of a packet is 16 (or the cipher block size, whichever
- // is larger) bytes.
- return nil, cbcError("ssh: packet too small")
- }
- // The length of the packet (including the length field but not the MAC) must
- // be a multiple of the block size or 8, whichever is larger.
- if (length+4)%maxUInt32(cbcMinPacketSizeMultiple, blockSize) != 0 {
- return nil, cbcError("ssh: invalid packet length multiple")
- }
-
- paddingLength := uint32(firstBlock[4])
- if paddingLength < cbcMinPaddingSize || length <= paddingLength+1 {
- return nil, cbcError("ssh: invalid packet length")
- }
-
- // Positions within the c.packetData buffer:
- macStart := 4 + length
- paddingStart := macStart - paddingLength
-
- // Entire packet size, starting before length, ending at end of mac.
- entirePacketSize := macStart + c.macSize
-
- // Ensure c.packetData is large enough for the entire packet data.
- if uint32(cap(c.packetData)) < entirePacketSize {
- // Still need to upsize and copy, but this should be rare at runtime, only
- // on upsizing the packetData buffer.
- c.packetData = make([]byte, entirePacketSize)
- copy(c.packetData, firstBlock)
- } else {
- c.packetData = c.packetData[:entirePacketSize]
- }
-
- n, err := io.ReadFull(r, c.packetData[firstBlockLength:])
- if err != nil {
- return nil, err
- }
- c.oracleCamouflage -= uint32(n)
-
- remainingCrypted := c.packetData[firstBlockLength:macStart]
- c.decrypter.CryptBlocks(remainingCrypted, remainingCrypted)
-
- mac := c.packetData[macStart:]
- if c.mac != nil {
- c.mac.Reset()
- binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum)
- c.mac.Write(c.seqNumBytes[:])
- c.mac.Write(c.packetData[:macStart])
- c.macResult = c.mac.Sum(c.macResult[:0])
- if subtle.ConstantTimeCompare(c.macResult, mac) != 1 {
- return nil, cbcError("ssh: MAC failure")
- }
- }
-
- return c.packetData[prefixLen:paddingStart], nil
-}
-
-func (c *cbcCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
- effectiveBlockSize := maxUInt32(cbcMinPacketSizeMultiple, c.encrypter.BlockSize())
-
- // Length of encrypted portion of the packet (header, payload, padding).
- // Enforce minimum padding and packet size.
- encLength := maxUInt32(prefixLen+len(packet)+cbcMinPaddingSize, cbcMinPaddingSize)
- // Enforce block size.
- encLength = (encLength + effectiveBlockSize - 1) / effectiveBlockSize * effectiveBlockSize
-
- length := encLength - 4
- paddingLength := int(length) - (1 + len(packet))
-
- // Overall buffer contains: header, payload, padding, mac.
- // Space for the MAC is reserved in the capacity but not the slice length.
- bufferSize := encLength + c.macSize
- if uint32(cap(c.packetData)) < bufferSize {
- c.packetData = make([]byte, encLength, bufferSize)
- } else {
- c.packetData = c.packetData[:encLength]
- }
-
- p := c.packetData
-
- // Packet header.
- binary.BigEndian.PutUint32(p, length)
- p = p[4:]
- p[0] = byte(paddingLength)
-
- // Payload.
- p = p[1:]
- copy(p, packet)
-
- // Padding.
- p = p[len(packet):]
- if _, err := io.ReadFull(rand, p); err != nil {
- return err
- }
-
- if c.mac != nil {
- c.mac.Reset()
- binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum)
- c.mac.Write(c.seqNumBytes[:])
- c.mac.Write(c.packetData)
- // The MAC is now appended into the capacity reserved for it earlier.
- c.packetData = c.mac.Sum(c.packetData)
- }
-
- c.encrypter.CryptBlocks(c.packetData[:encLength], c.packetData[:encLength])
-
- if _, err := w.Write(c.packetData); err != nil {
- return err
- }
-
- return nil
-}
-
-const chacha20Poly1305ID = "chacha20-poly1305@openssh.com"
-
-// chacha20Poly1305Cipher implements the chacha20-poly1305@openssh.com
-// AEAD, which is described here:
-//
-// https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00
-//
-// the methods here also implement padding, which RFC 4253 Section 6
-// also requires of stream ciphers.
-type chacha20Poly1305Cipher struct {
- lengthKey [32]byte
- contentKey [32]byte
- buf []byte
-}
-
-func newChaCha20Cipher(key, unusedIV, unusedMACKey []byte, unusedAlgs directionAlgorithms) (packetCipher, error) {
- if len(key) != 64 {
- panic(len(key))
- }
-
- c := &chacha20Poly1305Cipher{
- buf: make([]byte, 256),
- }
-
- copy(c.contentKey[:], key[:32])
- copy(c.lengthKey[:], key[32:])
- return c, nil
-}
-
-func (c *chacha20Poly1305Cipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) {
- nonce := make([]byte, 12)
- binary.BigEndian.PutUint32(nonce[8:], seqNum)
- s, err := chacha20.NewUnauthenticatedCipher(c.contentKey[:], nonce)
- if err != nil {
- return nil, err
- }
- var polyKey, discardBuf [32]byte
- s.XORKeyStream(polyKey[:], polyKey[:])
- s.XORKeyStream(discardBuf[:], discardBuf[:]) // skip the next 32 bytes
-
- encryptedLength := c.buf[:4]
- if _, err := io.ReadFull(r, encryptedLength); err != nil {
- return nil, err
- }
-
- var lenBytes [4]byte
- ls, err := chacha20.NewUnauthenticatedCipher(c.lengthKey[:], nonce)
- if err != nil {
- return nil, err
- }
- ls.XORKeyStream(lenBytes[:], encryptedLength)
-
- length := binary.BigEndian.Uint32(lenBytes[:])
- if length > maxPacket {
- return nil, errors.New("ssh: invalid packet length, packet too large")
- }
-
- contentEnd := 4 + length
- packetEnd := contentEnd + poly1305.TagSize
- if uint32(cap(c.buf)) < packetEnd {
- c.buf = make([]byte, packetEnd)
- copy(c.buf[:], encryptedLength)
- } else {
- c.buf = c.buf[:packetEnd]
- }
-
- if _, err := io.ReadFull(r, c.buf[4:packetEnd]); err != nil {
- return nil, err
- }
-
- var mac [poly1305.TagSize]byte
- copy(mac[:], c.buf[contentEnd:packetEnd])
- if !poly1305.Verify(&mac, c.buf[:contentEnd], &polyKey) {
- return nil, errors.New("ssh: MAC failure")
- }
-
- plain := c.buf[4:contentEnd]
- s.XORKeyStream(plain, plain)
-
- if len(plain) == 0 {
- return nil, errors.New("ssh: empty packet")
- }
-
- padding := plain[0]
- if padding < 4 {
- // padding is a byte, so it automatically satisfies
- // the maximum size, which is 255.
- return nil, fmt.Errorf("ssh: illegal padding %d", padding)
- }
-
- if int(padding)+1 >= len(plain) {
- return nil, fmt.Errorf("ssh: padding %d too large", padding)
- }
-
- plain = plain[1 : len(plain)-int(padding)]
-
- return plain, nil
-}
-
-func (c *chacha20Poly1305Cipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, payload []byte) error {
- nonce := make([]byte, 12)
- binary.BigEndian.PutUint32(nonce[8:], seqNum)
- s, err := chacha20.NewUnauthenticatedCipher(c.contentKey[:], nonce)
- if err != nil {
- return err
- }
- var polyKey, discardBuf [32]byte
- s.XORKeyStream(polyKey[:], polyKey[:])
- s.XORKeyStream(discardBuf[:], discardBuf[:]) // skip the next 32 bytes
-
- // There is no blocksize, so fall back to multiple of 8 byte
- // padding, as described in RFC 4253, Sec 6.
- const packetSizeMultiple = 8
-
- padding := packetSizeMultiple - (1+len(payload))%packetSizeMultiple
- if padding < 4 {
- padding += packetSizeMultiple
- }
-
- // size (4 bytes), padding (1), payload, padding, tag.
- totalLength := 4 + 1 + len(payload) + padding + poly1305.TagSize
- if cap(c.buf) < totalLength {
- c.buf = make([]byte, totalLength)
- } else {
- c.buf = c.buf[:totalLength]
- }
-
- binary.BigEndian.PutUint32(c.buf, uint32(1+len(payload)+padding))
- ls, err := chacha20.NewUnauthenticatedCipher(c.lengthKey[:], nonce)
- if err != nil {
- return err
- }
- ls.XORKeyStream(c.buf, c.buf[:4])
- c.buf[4] = byte(padding)
- copy(c.buf[5:], payload)
- packetEnd := 5 + len(payload) + padding
- if _, err := io.ReadFull(rand, c.buf[5+len(payload):packetEnd]); err != nil {
- return err
- }
-
- s.XORKeyStream(c.buf[4:], c.buf[4:packetEnd])
-
- var mac [poly1305.TagSize]byte
- poly1305.Sum(&mac, c.buf[:packetEnd], &polyKey)
-
- copy(c.buf[packetEnd:], mac[:])
-
- if _, err := w.Write(c.buf); err != nil {
- return err
- }
- return nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/client.go b/vendor/golang.org/x/crypto/ssh/client.go
deleted file mode 100644
index fd8c49749..000000000
--- a/vendor/golang.org/x/crypto/ssh/client.go
+++ /dev/null
@@ -1,282 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "net"
- "os"
- "sync"
- "time"
-)
-
-// Client implements a traditional SSH client that supports shells,
-// subprocesses, TCP port/streamlocal forwarding and tunneled dialing.
-type Client struct {
- Conn
-
- handleForwardsOnce sync.Once // guards calling (*Client).handleForwards
-
- forwards forwardList // forwarded tcpip connections from the remote side
- mu sync.Mutex
- channelHandlers map[string]chan NewChannel
-}
-
-// HandleChannelOpen returns a channel on which NewChannel requests
-// for the given type are sent. If the type already is being handled,
-// nil is returned. The channel is closed when the connection is closed.
-func (c *Client) HandleChannelOpen(channelType string) <-chan NewChannel {
- c.mu.Lock()
- defer c.mu.Unlock()
- if c.channelHandlers == nil {
- // The SSH channel has been closed.
- c := make(chan NewChannel)
- close(c)
- return c
- }
-
- ch := c.channelHandlers[channelType]
- if ch != nil {
- return nil
- }
-
- ch = make(chan NewChannel, chanSize)
- c.channelHandlers[channelType] = ch
- return ch
-}
-
-// NewClient creates a Client on top of the given connection.
-func NewClient(c Conn, chans <-chan NewChannel, reqs <-chan *Request) *Client {
- conn := &Client{
- Conn: c,
- channelHandlers: make(map[string]chan NewChannel, 1),
- }
-
- go conn.handleGlobalRequests(reqs)
- go conn.handleChannelOpens(chans)
- go func() {
- conn.Wait()
- conn.forwards.closeAll()
- }()
- return conn
-}
-
-// NewClientConn establishes an authenticated SSH connection using c
-// as the underlying transport. The Request and NewChannel channels
-// must be serviced or the connection will hang.
-func NewClientConn(c net.Conn, addr string, config *ClientConfig) (Conn, <-chan NewChannel, <-chan *Request, error) {
- fullConf := *config
- fullConf.SetDefaults()
- if fullConf.HostKeyCallback == nil {
- c.Close()
- return nil, nil, nil, errors.New("ssh: must specify HostKeyCallback")
- }
-
- conn := &connection{
- sshConn: sshConn{conn: c, user: fullConf.User},
- }
-
- if err := conn.clientHandshake(addr, &fullConf); err != nil {
- c.Close()
- return nil, nil, nil, fmt.Errorf("ssh: handshake failed: %w", err)
- }
- conn.mux = newMux(conn.transport)
- return conn, conn.mux.incomingChannels, conn.mux.incomingRequests, nil
-}
-
-// clientHandshake performs the client side key exchange. See RFC 4253 Section
-// 7.
-func (c *connection) clientHandshake(dialAddress string, config *ClientConfig) error {
- if config.ClientVersion != "" {
- c.clientVersion = []byte(config.ClientVersion)
- } else {
- c.clientVersion = []byte(packageVersion)
- }
- var err error
- c.serverVersion, err = exchangeVersions(c.sshConn.conn, c.clientVersion)
- if err != nil {
- return err
- }
-
- c.transport = newClientTransport(
- newTransport(c.sshConn.conn, config.Rand, true /* is client */),
- c.clientVersion, c.serverVersion, config, dialAddress, c.sshConn.RemoteAddr())
- if err := c.transport.waitSession(); err != nil {
- return err
- }
-
- c.sessionID = c.transport.getSessionID()
- return c.clientAuthenticate(config)
-}
-
-// verifyHostKeySignature verifies the host key obtained in the key exchange.
-// algo is the negotiated algorithm, and may be a certificate type.
-func verifyHostKeySignature(hostKey PublicKey, algo string, result *kexResult) error {
- sig, rest, ok := parseSignatureBody(result.Signature)
- if len(rest) > 0 || !ok {
- return errors.New("ssh: signature parse error")
- }
-
- if a := underlyingAlgo(algo); sig.Format != a {
- return fmt.Errorf("ssh: invalid signature algorithm %q, expected %q", sig.Format, a)
- }
-
- return hostKey.Verify(result.H, sig)
-}
-
-// NewSession opens a new Session for this client. (A session is a remote
-// execution of a program.)
-func (c *Client) NewSession() (*Session, error) {
- ch, in, err := c.OpenChannel("session", nil)
- if err != nil {
- return nil, err
- }
- return newSession(ch, in)
-}
-
-func (c *Client) handleGlobalRequests(incoming <-chan *Request) {
- for r := range incoming {
- // This handles keepalive messages and matches
- // the behaviour of OpenSSH.
- r.Reply(false, nil)
- }
-}
-
-// handleChannelOpens channel open messages from the remote side.
-func (c *Client) handleChannelOpens(in <-chan NewChannel) {
- for ch := range in {
- c.mu.Lock()
- handler := c.channelHandlers[ch.ChannelType()]
- c.mu.Unlock()
-
- if handler != nil {
- handler <- ch
- } else {
- ch.Reject(UnknownChannelType, fmt.Sprintf("unknown channel type: %v", ch.ChannelType()))
- }
- }
-
- c.mu.Lock()
- for _, ch := range c.channelHandlers {
- close(ch)
- }
- c.channelHandlers = nil
- c.mu.Unlock()
-}
-
-// Dial starts a client connection to the given SSH server. It is a
-// convenience function that connects to the given network address,
-// initiates the SSH handshake, and then sets up a Client. For access
-// to incoming channels and requests, use net.Dial with NewClientConn
-// instead.
-func Dial(network, addr string, config *ClientConfig) (*Client, error) {
- conn, err := net.DialTimeout(network, addr, config.Timeout)
- if err != nil {
- return nil, err
- }
- c, chans, reqs, err := NewClientConn(conn, addr, config)
- if err != nil {
- return nil, err
- }
- return NewClient(c, chans, reqs), nil
-}
-
-// HostKeyCallback is the function type used for verifying server
-// keys. A HostKeyCallback must return nil if the host key is OK, or
-// an error to reject it. It receives the hostname as passed to Dial
-// or NewClientConn. The remote address is the RemoteAddr of the
-// net.Conn underlying 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 {
- // Config contains configuration that is shared between clients and
- // servers.
- Config
-
- // User contains the username to authenticate as.
- User string
-
- // Auth contains possible authentication methods to use with the
- // server. Only the first instance of a particular RFC 4252 method will
- // be used during authentication.
- Auth []AuthMethod
-
- // HostKeyCallback is called during the cryptographic
- // handshake to validate the server's host key. The client
- // configuration must supply this callback for the connection
- // to succeed. The functions InsecureIgnoreHostKey or
- // 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
-
- // HostKeyAlgorithms lists the public key algorithms that the client will
- // accept from the server for host key authentication, in order of
- // preference. If empty, a reasonable default is used. Any
- // string returned from a PublicKey.Type method may be used, or
- // any of the CertAlgo and KeyAlgo constants.
- HostKeyAlgorithms []string
-
- // Timeout is the maximum amount of time for the TCP connection to establish.
- //
- // A Timeout of zero means no timeout.
- Timeout time.Duration
-}
-
-// InsecureIgnoreHostKey returns a function that can be used for
-// ClientConfig.HostKeyCallback to accept any host key. It should
-// not be used for production code.
-func InsecureIgnoreHostKey() HostKeyCallback {
- return func(hostname string, remote net.Addr, key PublicKey) error {
- return nil
- }
-}
-
-type fixedHostKey struct {
- key PublicKey
-}
-
-func (f *fixedHostKey) check(hostname string, remote net.Addr, key PublicKey) error {
- if f.key == nil {
- return fmt.Errorf("ssh: required host key was nil")
- }
- if !bytes.Equal(key.Marshal(), f.key.Marshal()) {
- return fmt.Errorf("ssh: host key mismatch")
- }
- return nil
-}
-
-// FixedHostKey returns a function for use in
-// ClientConfig.HostKeyCallback to accept only a specific host key.
-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
deleted file mode 100644
index b86dde151..000000000
--- a/vendor/golang.org/x/crypto/ssh/client_auth.go
+++ /dev/null
@@ -1,796 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "strings"
-)
-
-type authResult int
-
-const (
- authFailure authResult = iota
- authPartialSuccess
- authSuccess
-)
-
-// clientAuthenticate authenticates with the remote server. See RFC 4252.
-func (c *connection) clientAuthenticate(config *ClientConfig) error {
- // initiate user auth session
- if err := c.transport.writePacket(Marshal(&serviceRequestMsg{serviceUserAuth})); err != nil {
- return err
- }
- packet, err := c.transport.readPacket()
- if err != nil {
- return err
- }
- // The server may choose to send a SSH_MSG_EXT_INFO at this point (if we
- // advertised willingness to receive one, which we always do) or not. See
- // RFC 8308, Section 2.4.
- extensions := make(map[string][]byte)
- if len(packet) > 0 && packet[0] == msgExtInfo {
- var extInfo extInfoMsg
- if err := Unmarshal(packet, &extInfo); err != nil {
- return err
- }
- payload := extInfo.Payload
- for i := uint32(0); i < extInfo.NumExtensions; i++ {
- name, rest, ok := parseString(payload)
- if !ok {
- return parseError(msgExtInfo)
- }
- value, rest, ok := parseString(rest)
- if !ok {
- return parseError(msgExtInfo)
- }
- extensions[string(name)] = value
- payload = rest
- }
- packet, err = c.transport.readPacket()
- if err != nil {
- return err
- }
- }
- var serviceAccept serviceAcceptMsg
- if err := Unmarshal(packet, &serviceAccept); err != nil {
- return err
- }
-
- // during the authentication phase the client first attempts the "none" method
- // then any untried methods suggested by the server.
- var tried []string
- var lastMethods []string
-
- sessionID := c.transport.getSessionID()
- for auth := AuthMethod(new(noneAuth)); auth != nil; {
- ok, methods, err := auth.auth(sessionID, config.User, c.transport, config.Rand, extensions)
- if err != nil {
- // On disconnect, return error immediately
- if _, ok := err.(*disconnectMsg); ok {
- return err
- }
- // We return the error later if there is no other method left to
- // try.
- ok = authFailure
- }
- if ok == authSuccess {
- // success
- return nil
- } else if ok == authFailure {
- if m := auth.method(); !contains(tried, m) {
- tried = append(tried, m)
- }
- }
- if methods == nil {
- methods = lastMethods
- }
- lastMethods = methods
-
- auth = nil
-
- findNext:
- for _, a := range config.Auth {
- candidateMethod := a.method()
- if contains(tried, candidateMethod) {
- continue
- }
- for _, meth := range methods {
- if meth == candidateMethod {
- auth = a
- break findNext
- }
- }
- }
-
- if auth == nil && err != nil {
- // We have an error and there are no other authentication methods to
- // try, so we return it.
- return err
- }
- }
- return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", tried)
-}
-
-func contains(list []string, e string) bool {
- for _, s := range list {
- if s == e {
- return true
- }
- }
- return false
-}
-
-// An AuthMethod represents an instance of an RFC 4252 authentication method.
-type AuthMethod interface {
- // auth authenticates user over transport t.
- // Returns true if authentication is successful.
- // If authentication is not successful, a []string of alternative
- // method names is returned. If the slice is nil, it will be ignored
- // and the previous set of possible methods will be reused.
- auth(session []byte, user string, p packetConn, rand io.Reader, extensions map[string][]byte) (authResult, []string, error)
-
- // method returns the RFC 4252 method name.
- method() string
-}
-
-// "none" authentication, RFC 4252 section 5.2.
-type noneAuth int
-
-func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
- if err := c.writePacket(Marshal(&userAuthRequestMsg{
- User: user,
- Service: serviceSSH,
- Method: "none",
- })); err != nil {
- return authFailure, nil, err
- }
-
- return handleAuthResponse(c)
-}
-
-func (n *noneAuth) method() string {
- return "none"
-}
-
-// passwordCallback is an AuthMethod that fetches the password through
-// a function call, e.g. by prompting the user.
-type passwordCallback func() (password string, err error)
-
-func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
- type passwordAuthMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Reply bool
- Password string
- }
-
- pw, err := cb()
- // REVIEW NOTE: is there a need to support skipping a password attempt?
- // The program may only find out that the user doesn't have a password
- // when prompting.
- if err != nil {
- return authFailure, nil, err
- }
-
- if err := c.writePacket(Marshal(&passwordAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- Reply: false,
- Password: pw,
- })); err != nil {
- return authFailure, nil, err
- }
-
- return handleAuthResponse(c)
-}
-
-func (cb passwordCallback) method() string {
- return "password"
-}
-
-// Password returns an AuthMethod using the given password.
-func Password(secret string) AuthMethod {
- return passwordCallback(func() (string, error) { return secret, nil })
-}
-
-// PasswordCallback returns an AuthMethod that uses a callback for
-// fetching a password.
-func PasswordCallback(prompt func() (secret string, err error)) AuthMethod {
- return passwordCallback(prompt)
-}
-
-type publickeyAuthMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- // HasSig indicates to the receiver packet that the auth request is signed and
- // should be used for authentication of the request.
- HasSig bool
- Algoname string
- PubKey []byte
- // Sig is tagged with "rest" so Marshal will exclude it during
- // validateKey
- Sig []byte `ssh:"rest"`
-}
-
-// publicKeyCallback is an AuthMethod that uses a set of key
-// pairs for authentication.
-type publicKeyCallback func() ([]Signer, error)
-
-func (cb publicKeyCallback) method() string {
- return "publickey"
-}
-
-func pickSignatureAlgorithm(signer Signer, extensions map[string][]byte) (MultiAlgorithmSigner, string, error) {
- var as MultiAlgorithmSigner
- keyFormat := signer.PublicKey().Type()
-
- // If the signer implements MultiAlgorithmSigner we use the algorithms it
- // support, if it implements AlgorithmSigner we assume it supports all
- // algorithms, otherwise only the key format one.
- switch s := signer.(type) {
- case MultiAlgorithmSigner:
- as = s
- case AlgorithmSigner:
- as = &multiAlgorithmSigner{
- AlgorithmSigner: s,
- supportedAlgorithms: algorithmsForKeyFormat(underlyingAlgo(keyFormat)),
- }
- default:
- as = &multiAlgorithmSigner{
- AlgorithmSigner: algorithmSignerWrapper{signer},
- supportedAlgorithms: []string{underlyingAlgo(keyFormat)},
- }
- }
-
- getFallbackAlgo := func() (string, error) {
- // Fallback to use if there is no "server-sig-algs" extension or a
- // common algorithm cannot be found. We use the public key format if the
- // MultiAlgorithmSigner supports it, otherwise we return an error.
- if !contains(as.Algorithms(), underlyingAlgo(keyFormat)) {
- return "", fmt.Errorf("ssh: no common public key signature algorithm, server only supports %q for key type %q, signer only supports %v",
- underlyingAlgo(keyFormat), keyFormat, as.Algorithms())
- }
- return keyFormat, nil
- }
-
- extPayload, ok := extensions["server-sig-algs"]
- if !ok {
- // If there is no "server-sig-algs" extension use the fallback
- // algorithm.
- algo, err := getFallbackAlgo()
- return as, algo, err
- }
-
- // The server-sig-algs extension only carries underlying signature
- // algorithm, but we are trying to select a protocol-level public key
- // algorithm, which might be a certificate type. Extend the list of server
- // supported algorithms to include the corresponding certificate algorithms.
- serverAlgos := strings.Split(string(extPayload), ",")
- for _, algo := range serverAlgos {
- if certAlgo, ok := certificateAlgo(algo); ok {
- serverAlgos = append(serverAlgos, certAlgo)
- }
- }
-
- // Filter algorithms based on those supported by MultiAlgorithmSigner.
- var keyAlgos []string
- for _, algo := range algorithmsForKeyFormat(keyFormat) {
- if contains(as.Algorithms(), underlyingAlgo(algo)) {
- keyAlgos = append(keyAlgos, algo)
- }
- }
-
- algo, err := findCommon("public key signature algorithm", keyAlgos, serverAlgos)
- if err != nil {
- // If there is no overlap, return the fallback algorithm to support
- // servers that fail to list all supported algorithms.
- algo, err := getFallbackAlgo()
- return as, algo, err
- }
- return as, algo, nil
-}
-
-func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader, extensions map[string][]byte) (authResult, []string, error) {
- // Authentication is performed by sending an enquiry to test if a key is
- // acceptable to the remote. If the key is acceptable, the client will
- // attempt to authenticate with the valid key. If not the client will repeat
- // the process with the remaining keys.
-
- signers, err := cb()
- if err != nil {
- return authFailure, nil, err
- }
- var methods []string
- var errSigAlgo error
-
- origSignersLen := len(signers)
- for idx := 0; idx < len(signers); idx++ {
- signer := signers[idx]
- pub := signer.PublicKey()
- as, algo, err := pickSignatureAlgorithm(signer, extensions)
- if err != nil && errSigAlgo == nil {
- // If we cannot negotiate a signature algorithm store the first
- // error so we can return it to provide a more meaningful message if
- // no other signers work.
- errSigAlgo = err
- continue
- }
- ok, err := validateKey(pub, algo, user, c)
- if err != nil {
- return authFailure, nil, err
- }
- // OpenSSH 7.2-7.7 advertises support for rsa-sha2-256 and rsa-sha2-512
- // in the "server-sig-algs" extension but doesn't support these
- // algorithms for certificate authentication, so if the server rejects
- // the key try to use the obtained algorithm as if "server-sig-algs" had
- // not been implemented if supported from the algorithm signer.
- if !ok && idx < origSignersLen && isRSACert(algo) && algo != CertAlgoRSAv01 {
- if contains(as.Algorithms(), KeyAlgoRSA) {
- // We retry using the compat algorithm after all signers have
- // been tried normally.
- signers = append(signers, &multiAlgorithmSigner{
- AlgorithmSigner: as,
- supportedAlgorithms: []string{KeyAlgoRSA},
- })
- }
- }
- if !ok {
- continue
- }
-
- pubKey := pub.Marshal()
- data := buildDataSignedForAuth(session, userAuthRequestMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- }, algo, pubKey)
- sign, err := as.SignWithAlgorithm(rand, data, underlyingAlgo(algo))
- if err != nil {
- return authFailure, nil, err
- }
-
- // manually wrap the serialized signature in a string
- s := Marshal(sign)
- sig := make([]byte, stringLength(len(s)))
- marshalString(sig, s)
- msg := publickeyAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: cb.method(),
- HasSig: true,
- Algoname: algo,
- PubKey: pubKey,
- Sig: sig,
- }
- p := Marshal(&msg)
- if err := c.writePacket(p); err != nil {
- return authFailure, nil, err
- }
- var success authResult
- success, methods, err = handleAuthResponse(c)
- if err != nil {
- return authFailure, nil, err
- }
-
- // If authentication succeeds or the list of available methods does not
- // contain the "publickey" method, do not attempt to authenticate with any
- // other keys. According to RFC 4252 Section 7, the latter can occur when
- // additional authentication methods are required.
- if success == authSuccess || !contains(methods, cb.method()) {
- return success, methods, err
- }
- }
-
- return authFailure, methods, errSigAlgo
-}
-
-// validateKey validates the key provided is acceptable to the server.
-func validateKey(key PublicKey, algo string, user string, c packetConn) (bool, error) {
- pubKey := key.Marshal()
- msg := publickeyAuthMsg{
- User: user,
- Service: serviceSSH,
- Method: "publickey",
- HasSig: false,
- Algoname: algo,
- PubKey: pubKey,
- }
- if err := c.writePacket(Marshal(&msg)); err != nil {
- return false, err
- }
-
- return confirmKeyAck(key, c)
-}
-
-func confirmKeyAck(key PublicKey, c packetConn) (bool, error) {
- pubKey := key.Marshal()
-
- for {
- packet, err := c.readPacket()
- if err != nil {
- return false, err
- }
- switch packet[0] {
- case msgUserAuthBanner:
- if err := handleBannerResponse(c, packet); err != nil {
- return false, err
- }
- case msgUserAuthPubKeyOk:
- var msg userAuthPubKeyOkMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return false, err
- }
- // According to RFC 4252 Section 7 the algorithm in
- // SSH_MSG_USERAUTH_PK_OK should match that of the request but some
- // servers send the key type instead. OpenSSH allows any algorithm
- // that matches the public key, so we do the same.
- // https://github.com/openssh/openssh-portable/blob/86bdd385/sshconnect2.c#L709
- if !contains(algorithmsForKeyFormat(key.Type()), msg.Algo) {
- return false, nil
- }
- if !bytes.Equal(msg.PubKey, pubKey) {
- return false, nil
- }
- return true, nil
- case msgUserAuthFailure:
- return false, nil
- default:
- return false, unexpectedMessageError(msgUserAuthPubKeyOk, packet[0])
- }
- }
-}
-
-// PublicKeys returns an AuthMethod that uses the given key
-// pairs.
-func PublicKeys(signers ...Signer) AuthMethod {
- return publicKeyCallback(func() ([]Signer, error) { return signers, nil })
-}
-
-// PublicKeysCallback returns an AuthMethod that runs the given
-// function to obtain a list of key pairs.
-func PublicKeysCallback(getSigners func() (signers []Signer, err error)) AuthMethod {
- return publicKeyCallback(getSigners)
-}
-
-// handleAuthResponse returns whether the preceding authentication request succeeded
-// along with a list of remaining authentication methods to try next and
-// an error if an unexpected response was received.
-func handleAuthResponse(c packetConn) (authResult, []string, error) {
- gotMsgExtInfo := false
- for {
- packet, err := c.readPacket()
- if err != nil {
- return authFailure, nil, err
- }
-
- switch packet[0] {
- case msgUserAuthBanner:
- if err := handleBannerResponse(c, packet); err != nil {
- return authFailure, nil, err
- }
- case msgExtInfo:
- // Ignore post-authentication RFC 8308 extensions, once.
- if gotMsgExtInfo {
- return authFailure, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0])
- }
- gotMsgExtInfo = true
- case msgUserAuthFailure:
- var msg userAuthFailureMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return authFailure, nil, err
- }
- if msg.PartialSuccess {
- return authPartialSuccess, msg.Methods, nil
- }
- return authFailure, msg.Methods, nil
- case msgUserAuthSuccess:
- return authSuccess, nil, nil
- default:
- return authFailure, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0])
- }
- }
-}
-
-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
-// successful authentication, the server may send a challenge with no
-// questions, for which the name and instruction messages should be
-// printed. RFC 4256 section 3.3 details how the UI should behave for
-// both CLI and GUI environments.
-type KeyboardInteractiveChallenge func(name, instruction string, questions []string, echos []bool) (answers []string, err error)
-
-// KeyboardInteractive returns an AuthMethod using a prompt/response
-// sequence controlled by the server.
-func KeyboardInteractive(challenge KeyboardInteractiveChallenge) AuthMethod {
- return challenge
-}
-
-func (cb KeyboardInteractiveChallenge) method() string {
- return "keyboard-interactive"
-}
-
-func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
- type initiateMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Language string
- Submethods string
- }
-
- if err := c.writePacket(Marshal(&initiateMsg{
- User: user,
- Service: serviceSSH,
- Method: "keyboard-interactive",
- })); err != nil {
- return authFailure, nil, err
- }
-
- gotMsgExtInfo := false
- gotUserAuthInfoRequest := false
- for {
- packet, err := c.readPacket()
- if err != nil {
- return authFailure, nil, err
- }
-
- // like handleAuthResponse, but with less options.
- switch packet[0] {
- case msgUserAuthBanner:
- if err := handleBannerResponse(c, packet); err != nil {
- return authFailure, nil, err
- }
- continue
- case msgExtInfo:
- // Ignore post-authentication RFC 8308 extensions, once.
- if gotMsgExtInfo {
- return authFailure, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
- }
- gotMsgExtInfo = true
- continue
- case msgUserAuthInfoRequest:
- // OK
- case msgUserAuthFailure:
- var msg userAuthFailureMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return authFailure, nil, err
- }
- if msg.PartialSuccess {
- return authPartialSuccess, msg.Methods, nil
- }
- if !gotUserAuthInfoRequest {
- return authFailure, msg.Methods, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
- }
- return authFailure, msg.Methods, nil
- case msgUserAuthSuccess:
- return authSuccess, nil, nil
- default:
- return authFailure, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
- }
-
- var msg userAuthInfoRequestMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return authFailure, nil, err
- }
- gotUserAuthInfoRequest = true
-
- // Manually unpack the prompt/echo pairs.
- rest := msg.Prompts
- var prompts []string
- var echos []bool
- for i := 0; i < int(msg.NumPrompts); i++ {
- prompt, r, ok := parseString(rest)
- if !ok || len(r) == 0 {
- return authFailure, nil, errors.New("ssh: prompt format error")
- }
- prompts = append(prompts, string(prompt))
- echos = append(echos, r[0] != 0)
- rest = r[1:]
- }
-
- if len(rest) != 0 {
- return authFailure, nil, errors.New("ssh: extra data following keyboard-interactive pairs")
- }
-
- answers, err := cb(msg.Name, msg.Instruction, prompts, echos)
- if err != nil {
- return authFailure, nil, err
- }
-
- if len(answers) != len(prompts) {
- return authFailure, nil, fmt.Errorf("ssh: incorrect number of answers from keyboard-interactive callback %d (expected %d)", len(answers), len(prompts))
- }
- responseLength := 1 + 4
- for _, a := range answers {
- responseLength += stringLength(len(a))
- }
- serialized := make([]byte, responseLength)
- p := serialized
- p[0] = msgUserAuthInfoResponse
- p = p[1:]
- p = marshalUint32(p, uint32(len(answers)))
- for _, a := range answers {
- p = marshalString(p, []byte(a))
- }
-
- if err := c.writePacket(serialized); err != nil {
- return authFailure, nil, err
- }
- }
-}
-
-type retryableAuthMethod struct {
- authMethod AuthMethod
- maxTries int
-}
-
-func (r *retryableAuthMethod) auth(session []byte, user string, c packetConn, rand io.Reader, extensions map[string][]byte) (ok authResult, methods []string, err error) {
- for i := 0; r.maxTries <= 0 || i < r.maxTries; i++ {
- ok, methods, err = r.authMethod.auth(session, user, c, rand, extensions)
- if ok != authFailure || err != nil { // either success, partial success or error terminate
- return ok, methods, err
- }
- }
- return ok, methods, err
-}
-
-func (r *retryableAuthMethod) method() string {
- return r.authMethod.method()
-}
-
-// RetryableAuthMethod is a decorator for other auth methods enabling them to
-// be retried up to maxTries before considering that AuthMethod itself failed.
-// If maxTries is <= 0, will retry indefinitely
-//
-// This is useful for interactive clients using challenge/response type
-// authentication (e.g. Keyboard-Interactive, Password, etc) where the user
-// could mistype their response resulting in the server issuing a
-// SSH_MSG_USERAUTH_FAILURE (rfc4252 #8 [password] and rfc4256 #3.4
-// [keyboard-interactive]); Without this decorator, the non-retryable
-// AuthMethod would be removed from future consideration, and never tried again
-// (and so the user would never be able to retry their entry).
-func RetryableAuthMethod(auth AuthMethod, maxTries int) AuthMethod {
- return &retryableAuthMethod{authMethod: auth, maxTries: maxTries}
-}
-
-// GSSAPIWithMICAuthMethod is an AuthMethod with "gssapi-with-mic" authentication.
-// See RFC 4462 section 3
-// gssAPIClient is implementation of the GSSAPIClient interface, see the definition of the interface for details.
-// target is the server host you want to log in to.
-func GSSAPIWithMICAuthMethod(gssAPIClient GSSAPIClient, target string) AuthMethod {
- if gssAPIClient == nil {
- panic("gss-api client must be not nil with enable gssapi-with-mic")
- }
- return &gssAPIWithMICCallback{gssAPIClient: gssAPIClient, target: target}
-}
-
-type gssAPIWithMICCallback struct {
- gssAPIClient GSSAPIClient
- target string
-}
-
-func (g *gssAPIWithMICCallback) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
- m := &userAuthRequestMsg{
- User: user,
- Service: serviceSSH,
- Method: g.method(),
- }
- // The GSS-API authentication method is initiated when the client sends an SSH_MSG_USERAUTH_REQUEST.
- // See RFC 4462 section 3.2.
- m.Payload = appendU32(m.Payload, 1)
- m.Payload = appendString(m.Payload, string(krb5OID))
- if err := c.writePacket(Marshal(m)); err != nil {
- return authFailure, nil, err
- }
- // The server responds to the SSH_MSG_USERAUTH_REQUEST with either an
- // SSH_MSG_USERAUTH_FAILURE if none of the mechanisms are supported or
- // with an SSH_MSG_USERAUTH_GSSAPI_RESPONSE.
- // See RFC 4462 section 3.3.
- // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication,so I don't want to check
- // selected mech if it is valid.
- packet, err := c.readPacket()
- if err != nil {
- return authFailure, nil, err
- }
- userAuthGSSAPIResp := &userAuthGSSAPIResponse{}
- if err := Unmarshal(packet, userAuthGSSAPIResp); err != nil {
- return authFailure, nil, err
- }
- // Start the loop into the exchange token.
- // See RFC 4462 section 3.4.
- var token []byte
- defer g.gssAPIClient.DeleteSecContext()
- for {
- // Initiates the establishment of a security context between the application and a remote peer.
- nextToken, needContinue, err := g.gssAPIClient.InitSecContext("host@"+g.target, token, false)
- if err != nil {
- return authFailure, nil, err
- }
- if len(nextToken) > 0 {
- if err := c.writePacket(Marshal(&userAuthGSSAPIToken{
- Token: nextToken,
- })); err != nil {
- return authFailure, nil, err
- }
- }
- if !needContinue {
- break
- }
- packet, err = c.readPacket()
- if err != nil {
- return authFailure, nil, err
- }
- switch packet[0] {
- case msgUserAuthFailure:
- var msg userAuthFailureMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return authFailure, nil, err
- }
- if msg.PartialSuccess {
- return authPartialSuccess, msg.Methods, nil
- }
- return authFailure, msg.Methods, nil
- case msgUserAuthGSSAPIError:
- userAuthGSSAPIErrorResp := &userAuthGSSAPIError{}
- if err := Unmarshal(packet, userAuthGSSAPIErrorResp); err != nil {
- return authFailure, nil, err
- }
- return authFailure, nil, fmt.Errorf("GSS-API Error:\n"+
- "Major Status: %d\n"+
- "Minor Status: %d\n"+
- "Error Message: %s\n", userAuthGSSAPIErrorResp.MajorStatus, userAuthGSSAPIErrorResp.MinorStatus,
- userAuthGSSAPIErrorResp.Message)
- case msgUserAuthGSSAPIToken:
- userAuthGSSAPITokenReq := &userAuthGSSAPIToken{}
- if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {
- return authFailure, nil, err
- }
- token = userAuthGSSAPITokenReq.Token
- }
- }
- // Binding Encryption Keys.
- // See RFC 4462 section 3.5.
- micField := buildMIC(string(session), user, "ssh-connection", "gssapi-with-mic")
- micToken, err := g.gssAPIClient.GetMIC(micField)
- if err != nil {
- return authFailure, nil, err
- }
- if err := c.writePacket(Marshal(&userAuthGSSAPIMIC{
- MIC: micToken,
- })); err != nil {
- return authFailure, nil, err
- }
- return handleAuthResponse(c)
-}
-
-func (g *gssAPIWithMICCallback) method() string {
- return "gssapi-with-mic"
-}
diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go
deleted file mode 100644
index 7e9c2cbc6..000000000
--- a/vendor/golang.org/x/crypto/ssh/common.go
+++ /dev/null
@@ -1,476 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto"
- "crypto/rand"
- "fmt"
- "io"
- "math"
- "sync"
-
- _ "crypto/sha1"
- _ "crypto/sha256"
- _ "crypto/sha512"
-)
-
-// These are string constants in the SSH protocol.
-const (
- compressionNone = "none"
- serviceUserAuth = "ssh-userauth"
- serviceSSH = "ssh-connection"
-)
-
-// supportedCiphers lists ciphers we support but might not recommend.
-var supportedCiphers = []string{
- "aes128-ctr", "aes192-ctr", "aes256-ctr",
- "aes128-gcm@openssh.com", gcm256CipherID,
- chacha20Poly1305ID,
- "arcfour256", "arcfour128", "arcfour",
- aes128cbcID,
- tripledescbcID,
-}
-
-// preferredCiphers specifies the default preference for ciphers.
-var preferredCiphers = []string{
- "aes128-gcm@openssh.com", gcm256CipherID,
- chacha20Poly1305ID,
- "aes128-ctr", "aes192-ctr", "aes256-ctr",
-}
-
-// supportedKexAlgos specifies the supported key-exchange algorithms in
-// preference order.
-var supportedKexAlgos = []string{
- kexAlgoCurve25519SHA256, kexAlgoCurve25519SHA256LibSSH,
- // P384 and P521 are not constant-time yet, but since we don't
- // reuse ephemeral keys, using them for ECDH should be OK.
- kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
- kexAlgoDH14SHA256, kexAlgoDH16SHA512, kexAlgoDH14SHA1,
- kexAlgoDH1SHA1,
-}
-
-// serverForbiddenKexAlgos contains key exchange algorithms, that are forbidden
-// for the server half.
-var serverForbiddenKexAlgos = map[string]struct{}{
- kexAlgoDHGEXSHA1: {}, // server half implementation is only minimal to satisfy the automated tests
- kexAlgoDHGEXSHA256: {}, // server half implementation is only minimal to satisfy the automated tests
-}
-
-// preferredKexAlgos specifies the default preference for key-exchange
-// algorithms in preference order. The diffie-hellman-group16-sha512 algorithm
-// is disabled by default because it is a bit slower than the others.
-var preferredKexAlgos = []string{
- kexAlgoCurve25519SHA256, kexAlgoCurve25519SHA256LibSSH,
- kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
- kexAlgoDH14SHA256, kexAlgoDH14SHA1,
-}
-
-// supportedHostKeyAlgos specifies the supported host-key algorithms (i.e. methods
-// of authenticating servers) in preference order.
-var supportedHostKeyAlgos = []string{
- CertAlgoRSASHA256v01, CertAlgoRSASHA512v01,
- CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,
- CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoED25519v01,
-
- KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
- KeyAlgoRSASHA256, KeyAlgoRSASHA512,
- KeyAlgoRSA, KeyAlgoDSA,
-
- KeyAlgoED25519,
-}
-
-// supportedMACs specifies a default set of MAC algorithms in preference order.
-// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
-// because they have reached the end of their useful life.
-var supportedMACs = []string{
- "hmac-sha2-256-etm@openssh.com", "hmac-sha2-512-etm@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha1", "hmac-sha1-96",
-}
-
-var supportedCompressions = []string{compressionNone}
-
-// hashFuncs keeps the mapping of supported signature algorithms to their
-// respective hashes needed for signing and verification.
-var hashFuncs = map[string]crypto.Hash{
- KeyAlgoRSA: crypto.SHA1,
- KeyAlgoRSASHA256: crypto.SHA256,
- KeyAlgoRSASHA512: crypto.SHA512,
- KeyAlgoDSA: crypto.SHA1,
- KeyAlgoECDSA256: crypto.SHA256,
- KeyAlgoECDSA384: crypto.SHA384,
- KeyAlgoECDSA521: crypto.SHA512,
- // KeyAlgoED25519 doesn't pre-hash.
- KeyAlgoSKECDSA256: crypto.SHA256,
- KeyAlgoSKED25519: crypto.SHA256,
-}
-
-// algorithmsForKeyFormat returns the supported signature algorithms for a given
-// public key format (PublicKey.Type), in order of preference. See RFC 8332,
-// Section 2. See also the note in sendKexInit on backwards compatibility.
-func algorithmsForKeyFormat(keyFormat string) []string {
- switch keyFormat {
- case KeyAlgoRSA:
- return []string{KeyAlgoRSASHA256, KeyAlgoRSASHA512, KeyAlgoRSA}
- case CertAlgoRSAv01:
- return []string{CertAlgoRSASHA256v01, CertAlgoRSASHA512v01, CertAlgoRSAv01}
- default:
- return []string{keyFormat}
- }
-}
-
-// isRSA returns whether algo is a supported RSA algorithm, including certificate
-// algorithms.
-func isRSA(algo string) bool {
- algos := algorithmsForKeyFormat(KeyAlgoRSA)
- return contains(algos, underlyingAlgo(algo))
-}
-
-func isRSACert(algo string) bool {
- _, ok := certKeyAlgoNames[algo]
- if !ok {
- return false
- }
- return isRSA(algo)
-}
-
-// supportedPubKeyAuthAlgos specifies the supported client public key
-// authentication algorithms. Note that this doesn't include certificate types
-// since those use the underlying algorithm. This list is sent to the client if
-// it supports the server-sig-algs extension. Order is irrelevant.
-var supportedPubKeyAuthAlgos = []string{
- KeyAlgoED25519,
- KeyAlgoSKED25519, KeyAlgoSKECDSA256,
- KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
- KeyAlgoRSASHA256, KeyAlgoRSASHA512, KeyAlgoRSA,
- KeyAlgoDSA,
-}
-
-// unexpectedMessageError results when the SSH message that we received didn't
-// match what we wanted.
-func unexpectedMessageError(expected, got uint8) error {
- return fmt.Errorf("ssh: unexpected message type %d (expected %d)", got, expected)
-}
-
-// parseError results from a malformed SSH message.
-func parseError(tag uint8) error {
- return fmt.Errorf("ssh: parse error in message type %d", tag)
-}
-
-func findCommon(what string, client []string, server []string) (common string, err error) {
- for _, c := range client {
- for _, s := range server {
- if c == s {
- return c, nil
- }
- }
- }
- return "", fmt.Errorf("ssh: no common algorithm for %s; client offered: %v, server offered: %v", what, client, server)
-}
-
-// directionAlgorithms records algorithm choices in one direction (either read or write)
-type directionAlgorithms struct {
- Cipher string
- MAC string
- Compression string
-}
-
-// rekeyBytes returns a rekeying intervals in bytes.
-func (a *directionAlgorithms) rekeyBytes() int64 {
- // According to RFC 4344 block ciphers should rekey after
- // 2^(BLOCKSIZE/4) blocks. For all AES flavors BLOCKSIZE is
- // 128.
- switch a.Cipher {
- case "aes128-ctr", "aes192-ctr", "aes256-ctr", gcm128CipherID, gcm256CipherID, aes128cbcID:
- return 16 * (1 << 32)
-
- }
-
- // For others, stick with RFC 4253 recommendation to rekey after 1 Gb of data.
- return 1 << 30
-}
-
-var aeadCiphers = map[string]bool{
- gcm128CipherID: true,
- gcm256CipherID: true,
- chacha20Poly1305ID: true,
-}
-
-type algorithms struct {
- kex string
- hostKey string
- w directionAlgorithms
- r directionAlgorithms
-}
-
-func findAgreedAlgorithms(isClient bool, clientKexInit, serverKexInit *kexInitMsg) (algs *algorithms, err error) {
- result := &algorithms{}
-
- result.kex, err = findCommon("key exchange", clientKexInit.KexAlgos, serverKexInit.KexAlgos)
- if err != nil {
- return
- }
-
- result.hostKey, err = findCommon("host key", clientKexInit.ServerHostKeyAlgos, serverKexInit.ServerHostKeyAlgos)
- if err != nil {
- return
- }
-
- stoc, ctos := &result.w, &result.r
- if isClient {
- ctos, stoc = stoc, ctos
- }
-
- ctos.Cipher, err = findCommon("client to server cipher", clientKexInit.CiphersClientServer, serverKexInit.CiphersClientServer)
- if err != nil {
- return
- }
-
- stoc.Cipher, err = findCommon("server to client cipher", clientKexInit.CiphersServerClient, serverKexInit.CiphersServerClient)
- if err != nil {
- return
- }
-
- if !aeadCiphers[ctos.Cipher] {
- ctos.MAC, err = findCommon("client to server MAC", clientKexInit.MACsClientServer, serverKexInit.MACsClientServer)
- if err != nil {
- return
- }
- }
-
- if !aeadCiphers[stoc.Cipher] {
- stoc.MAC, err = findCommon("server to client MAC", clientKexInit.MACsServerClient, serverKexInit.MACsServerClient)
- if err != nil {
- return
- }
- }
-
- ctos.Compression, err = findCommon("client to server compression", clientKexInit.CompressionClientServer, serverKexInit.CompressionClientServer)
- if err != nil {
- return
- }
-
- stoc.Compression, err = findCommon("server to client compression", clientKexInit.CompressionServerClient, serverKexInit.CompressionServerClient)
- if err != nil {
- return
- }
-
- return result, nil
-}
-
-// If rekeythreshold is too small, we can't make any progress sending
-// stuff.
-const minRekeyThreshold uint64 = 256
-
-// Config contains configuration data common to both ServerConfig and
-// ClientConfig.
-type Config struct {
- // Rand provides the source of entropy for cryptographic
- // primitives. If Rand is nil, the cryptographic random reader
- // in package crypto/rand will be used.
- Rand io.Reader
-
- // The maximum number of bytes sent or received after which a
- // new key is negotiated. It must be at least 256. If
- // unspecified, a size suitable for the chosen cipher is used.
- RekeyThreshold uint64
-
- // The allowed key exchanges algorithms. If unspecified then a default set
- // of algorithms is used. Unsupported values are silently ignored.
- KeyExchanges []string
-
- // The allowed cipher algorithms. If unspecified then a sensible default is
- // used. Unsupported values are silently ignored.
- Ciphers []string
-
- // The allowed MAC algorithms. If unspecified then a sensible default is
- // used. Unsupported values are silently ignored.
- MACs []string
-}
-
-// SetDefaults sets sensible values for unset fields in config. This is
-// exported for testing: Configs passed to SSH functions are copied and have
-// default values set automatically.
-func (c *Config) SetDefaults() {
- if c.Rand == nil {
- c.Rand = rand.Reader
- }
- if c.Ciphers == nil {
- c.Ciphers = preferredCiphers
- }
- var ciphers []string
- for _, c := range c.Ciphers {
- if cipherModes[c] != nil {
- // Ignore the cipher if we have no cipherModes definition.
- ciphers = append(ciphers, c)
- }
- }
- c.Ciphers = ciphers
-
- if c.KeyExchanges == nil {
- c.KeyExchanges = preferredKexAlgos
- }
- var kexs []string
- for _, k := range c.KeyExchanges {
- if kexAlgoMap[k] != nil {
- // Ignore the KEX if we have no kexAlgoMap definition.
- kexs = append(kexs, k)
- }
- }
- c.KeyExchanges = kexs
-
- if c.MACs == nil {
- c.MACs = supportedMACs
- }
- var macs []string
- for _, m := range c.MACs {
- if macModes[m] != nil {
- // Ignore the MAC if we have no macModes definition.
- macs = append(macs, m)
- }
- }
- c.MACs = macs
-
- if c.RekeyThreshold == 0 {
- // cipher specific default
- } else if c.RekeyThreshold < minRekeyThreshold {
- c.RekeyThreshold = minRekeyThreshold
- } else if c.RekeyThreshold >= math.MaxInt64 {
- // Avoid weirdness if somebody uses -1 as a threshold.
- c.RekeyThreshold = math.MaxInt64
- }
-}
-
-// buildDataSignedForAuth returns the data that is signed in order to prove
-// possession of a private key. See RFC 4252, section 7. algo is the advertised
-// algorithm, and may be a certificate type.
-func buildDataSignedForAuth(sessionID []byte, req userAuthRequestMsg, algo string, pubKey []byte) []byte {
- data := struct {
- Session []byte
- Type byte
- User string
- Service string
- Method string
- Sign bool
- Algo string
- PubKey []byte
- }{
- sessionID,
- msgUserAuthRequest,
- req.User,
- req.Service,
- req.Method,
- true,
- algo,
- pubKey,
- }
- return Marshal(data)
-}
-
-func appendU16(buf []byte, n uint16) []byte {
- return append(buf, byte(n>>8), byte(n))
-}
-
-func appendU32(buf []byte, n uint32) []byte {
- return append(buf, byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
-}
-
-func appendU64(buf []byte, n uint64) []byte {
- return append(buf,
- byte(n>>56), byte(n>>48), byte(n>>40), byte(n>>32),
- byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
-}
-
-func appendInt(buf []byte, n int) []byte {
- return appendU32(buf, uint32(n))
-}
-
-func appendString(buf []byte, s string) []byte {
- buf = appendU32(buf, uint32(len(s)))
- buf = append(buf, s...)
- return buf
-}
-
-func appendBool(buf []byte, b bool) []byte {
- if b {
- return append(buf, 1)
- }
- return append(buf, 0)
-}
-
-// newCond is a helper to hide the fact that there is no usable zero
-// value for sync.Cond.
-func newCond() *sync.Cond { return sync.NewCond(new(sync.Mutex)) }
-
-// window represents the buffer available to clients
-// wishing to write to a channel.
-type window struct {
- *sync.Cond
- win uint32 // RFC 4254 5.2 says the window size can grow to 2^32-1
- writeWaiters int
- closed bool
-}
-
-// add adds win to the amount of window available
-// for consumers.
-func (w *window) add(win uint32) bool {
- // a zero sized window adjust is a noop.
- if win == 0 {
- return true
- }
- w.L.Lock()
- if w.win+win < win {
- w.L.Unlock()
- return false
- }
- w.win += win
- // It is unusual that multiple goroutines would be attempting to reserve
- // window space, but not guaranteed. Use broadcast to notify all waiters
- // that additional window is available.
- w.Broadcast()
- w.L.Unlock()
- return true
-}
-
-// close sets the window to closed, so all reservations fail
-// immediately.
-func (w *window) close() {
- w.L.Lock()
- w.closed = true
- w.Broadcast()
- w.L.Unlock()
-}
-
-// reserve reserves win from the available window capacity.
-// If no capacity remains, reserve will block. reserve may
-// return less than requested.
-func (w *window) reserve(win uint32) (uint32, error) {
- var err error
- w.L.Lock()
- w.writeWaiters++
- w.Broadcast()
- for w.win == 0 && !w.closed {
- w.Wait()
- }
- w.writeWaiters--
- if w.win < win {
- win = w.win
- }
- w.win -= win
- if w.closed {
- err = io.EOF
- }
- w.L.Unlock()
- return win, err
-}
-
-// waitWriterBlocked waits until some goroutine is blocked for further
-// writes. It is used in tests only.
-func (w *window) waitWriterBlocked() {
- w.Cond.L.Lock()
- for w.writeWaiters == 0 {
- w.Cond.Wait()
- }
- w.Cond.L.Unlock()
-}
diff --git a/vendor/golang.org/x/crypto/ssh/connection.go b/vendor/golang.org/x/crypto/ssh/connection.go
deleted file mode 100644
index 8f345ee92..000000000
--- a/vendor/golang.org/x/crypto/ssh/connection.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "fmt"
- "net"
-)
-
-// OpenChannelError is returned if the other side rejects an
-// OpenChannel request.
-type OpenChannelError struct {
- Reason RejectionReason
- Message string
-}
-
-func (e *OpenChannelError) Error() string {
- return fmt.Sprintf("ssh: rejected: %s (%s)", e.Reason, e.Message)
-}
-
-// ConnMetadata holds metadata for the connection.
-type ConnMetadata interface {
- // User returns the user ID for this connection.
- User() string
-
- // SessionID returns the session hash, also denoted by H.
- SessionID() []byte
-
- // ClientVersion returns the client's version string as hashed
- // into the session ID.
- ClientVersion() []byte
-
- // ServerVersion returns the server's version string as hashed
- // into the session ID.
- ServerVersion() []byte
-
- // RemoteAddr returns the remote address for this connection.
- RemoteAddr() net.Addr
-
- // LocalAddr returns the local address for this connection.
- LocalAddr() net.Addr
-}
-
-// Conn represents an SSH connection for both server and client roles.
-// Conn is the basis for implementing an application layer, such
-// as ClientConn, which implements the traditional shell access for
-// clients.
-type Conn interface {
- ConnMetadata
-
- // SendRequest sends a global request, and returns the
- // reply. If wantReply is true, it returns the response status
- // and payload. See also RFC 4254, section 4.
- SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error)
-
- // OpenChannel tries to open an channel. If the request is
- // rejected, it returns *OpenChannelError. On success it returns
- // the SSH Channel and a Go channel for incoming, out-of-band
- // requests. The Go channel must be serviced, or the
- // connection will hang.
- OpenChannel(name string, data []byte) (Channel, <-chan *Request, error)
-
- // Close closes the underlying network connection
- Close() error
-
- // Wait blocks until the connection has shut down, and returns the
- // error causing the shutdown.
- Wait() error
-
- // TODO(hanwen): consider exposing:
- // RequestKeyChange
- // Disconnect
-}
-
-// DiscardRequests consumes and rejects all requests from the
-// passed-in channel.
-func DiscardRequests(in <-chan *Request) {
- for req := range in {
- if req.WantReply {
- req.Reply(false, nil)
- }
- }
-}
-
-// A connection represents an incoming connection.
-type connection struct {
- transport *handshakeTransport
- sshConn
-
- // The connection protocol.
- *mux
-}
-
-func (c *connection) Close() error {
- return c.sshConn.conn.Close()
-}
-
-// sshConn provides net.Conn metadata, but disallows direct reads and
-// writes.
-type sshConn struct {
- conn net.Conn
-
- user string
- sessionID []byte
- clientVersion []byte
- serverVersion []byte
-}
-
-func dup(src []byte) []byte {
- dst := make([]byte, len(src))
- copy(dst, src)
- return dst
-}
-
-func (c *sshConn) User() string {
- return c.user
-}
-
-func (c *sshConn) RemoteAddr() net.Addr {
- return c.conn.RemoteAddr()
-}
-
-func (c *sshConn) Close() error {
- return c.conn.Close()
-}
-
-func (c *sshConn) LocalAddr() net.Addr {
- return c.conn.LocalAddr()
-}
-
-func (c *sshConn) SessionID() []byte {
- return dup(c.sessionID)
-}
-
-func (c *sshConn) ClientVersion() []byte {
- return dup(c.clientVersion)
-}
-
-func (c *sshConn) ServerVersion() []byte {
- return dup(c.serverVersion)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/doc.go b/vendor/golang.org/x/crypto/ssh/doc.go
deleted file mode 100644
index f5d352fe3..000000000
--- a/vendor/golang.org/x/crypto/ssh/doc.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package ssh implements an SSH client and server.
-
-SSH is a transport security protocol, an authentication protocol and a
-family of application protocols. The most typical application level
-protocol is a remote shell and this is specifically implemented. However,
-the multiplexed nature of SSH is exposed to users that wish to support
-others.
-
-References:
-
- [PROTOCOL]: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL?rev=HEAD
- [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD
- [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1
-
-This package does not fall under the stability promise of the Go language itself,
-so its API may be changed when pressing needs arise.
-*/
-package ssh
diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go
deleted file mode 100644
index 56cdc7c21..000000000
--- a/vendor/golang.org/x/crypto/ssh/handshake.go
+++ /dev/null
@@ -1,806 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto/rand"
- "errors"
- "fmt"
- "io"
- "log"
- "net"
- "strings"
- "sync"
-)
-
-// debugHandshake, if set, prints messages sent and received. Key
-// exchange messages are printed as if DH were used, so the debug
-// messages are wrong when using ECDH.
-const debugHandshake = false
-
-// chanSize sets the amount of buffering SSH connections. This is
-// primarily for testing: setting chanSize=0 uncovers deadlocks more
-// quickly.
-const chanSize = 16
-
-// keyingTransport is a packet based transport that supports key
-// changes. It need not be thread-safe. It should pass through
-// msgNewKeys in both directions.
-type keyingTransport interface {
- packetConn
-
- // prepareKeyChange sets up a key change. The key change for a
- // direction will be effected if a msgNewKeys message is sent
- // or received.
- prepareKeyChange(*algorithms, *kexResult) error
-
- // setStrictMode sets the strict KEX mode, notably triggering
- // sequence number resets on sending or receiving msgNewKeys.
- // If the sequence number is already > 1 when setStrictMode
- // is called, an error is returned.
- setStrictMode() error
-
- // setInitialKEXDone indicates to the transport that the initial key exchange
- // was completed
- setInitialKEXDone()
-}
-
-// handshakeTransport implements rekeying on top of a keyingTransport
-// and offers a thread-safe writePacket() interface.
-type handshakeTransport struct {
- conn keyingTransport
- config *Config
-
- serverVersion []byte
- clientVersion []byte
-
- // hostKeys is non-empty if we are the server. In that case,
- // it contains all host keys that can be used to sign the
- // connection.
- hostKeys []Signer
-
- // publicKeyAuthAlgorithms is non-empty if we are the server. In that case,
- // it contains the supported client public key authentication algorithms.
- publicKeyAuthAlgorithms []string
-
- // hostKeyAlgorithms is non-empty if we are the client. In that case,
- // we accept these key types from the server as host key.
- hostKeyAlgorithms []string
-
- // On read error, incoming is closed, and readError is set.
- incoming chan []byte
- readError error
-
- mu sync.Mutex
- writeError error
- sentInitPacket []byte
- sentInitMsg *kexInitMsg
- pendingPackets [][]byte // Used when a key exchange is in progress.
- writePacketsLeft uint32
- writeBytesLeft int64
-
- // If the read loop wants to schedule a kex, it pings this
- // channel, and the write loop will send out a kex
- // message.
- requestKex chan struct{}
-
- // If the other side requests or confirms a kex, its kexInit
- // packet is sent here for the write loop to find it.
- startKex chan *pendingKex
- kexLoopDone chan struct{} // closed (with writeError non-nil) when kexLoop exits
-
- // data for host key checking
- hostKeyCallback HostKeyCallback
- 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
-
- // Counters exclusively owned by readLoop.
- readPacketsLeft uint32
- readBytesLeft int64
-
- // The session ID or nil if first kex did not complete yet.
- sessionID []byte
-
- // strictMode indicates if the other side of the handshake indicated
- // that we should be following the strict KEX protocol restrictions.
- strictMode bool
-}
-
-type pendingKex struct {
- otherInit []byte
- done chan error
-}
-
-func newHandshakeTransport(conn keyingTransport, config *Config, clientVersion, serverVersion []byte) *handshakeTransport {
- t := &handshakeTransport{
- conn: conn,
- serverVersion: serverVersion,
- clientVersion: clientVersion,
- incoming: make(chan []byte, chanSize),
- requestKex: make(chan struct{}, 1),
- startKex: make(chan *pendingKex),
- kexLoopDone: make(chan struct{}),
-
- config: config,
- }
- t.resetReadThresholds()
- t.resetWriteThresholds()
-
- // We always start with a mandatory key exchange.
- t.requestKex <- struct{}{}
- return t
-}
-
-func newClientTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ClientConfig, dialAddr string, addr net.Addr) *handshakeTransport {
- t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion)
- t.dialAddress = dialAddr
- t.remoteAddr = addr
- t.hostKeyCallback = config.HostKeyCallback
- t.bannerCallback = config.BannerCallback
- if config.HostKeyAlgorithms != nil {
- t.hostKeyAlgorithms = config.HostKeyAlgorithms
- } else {
- t.hostKeyAlgorithms = supportedHostKeyAlgos
- }
- go t.readLoop()
- go t.kexLoop()
- return t
-}
-
-func newServerTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ServerConfig) *handshakeTransport {
- t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion)
- t.hostKeys = config.hostKeys
- t.publicKeyAuthAlgorithms = config.PublicKeyAuthAlgorithms
- go t.readLoop()
- go t.kexLoop()
- return t
-}
-
-func (t *handshakeTransport) getSessionID() []byte {
- return t.sessionID
-}
-
-// waitSession waits for the session to be established. This should be
-// the first thing to call after instantiating handshakeTransport.
-func (t *handshakeTransport) waitSession() error {
- p, err := t.readPacket()
- if err != nil {
- return err
- }
- if p[0] != msgNewKeys {
- return fmt.Errorf("ssh: first packet should be msgNewKeys")
- }
-
- return nil
-}
-
-func (t *handshakeTransport) id() string {
- if len(t.hostKeys) > 0 {
- return "server"
- }
- return "client"
-}
-
-func (t *handshakeTransport) printPacket(p []byte, write bool) {
- action := "got"
- if write {
- action = "sent"
- }
-
- if p[0] == msgChannelData || p[0] == msgChannelExtendedData {
- log.Printf("%s %s data (packet %d bytes)", t.id(), action, len(p))
- } else {
- msg, err := decode(p)
- log.Printf("%s %s %T %v (%v)", t.id(), action, msg, msg, err)
- }
-}
-
-func (t *handshakeTransport) readPacket() ([]byte, error) {
- p, ok := <-t.incoming
- if !ok {
- return nil, t.readError
- }
- return p, nil
-}
-
-func (t *handshakeTransport) readLoop() {
- first := true
- for {
- p, err := t.readOnePacket(first)
- first = false
- if err != nil {
- t.readError = err
- close(t.incoming)
- break
- }
- // If this is the first kex, and strict KEX mode is enabled,
- // we don't ignore any messages, as they may be used to manipulate
- // the packet sequence numbers.
- if !(t.sessionID == nil && t.strictMode) && (p[0] == msgIgnore || p[0] == msgDebug) {
- continue
- }
- t.incoming <- p
- }
-
- // Stop writers too.
- t.recordWriteError(t.readError)
-
- // Unblock the writer should it wait for this.
- close(t.startKex)
-
- // Don't close t.requestKex; it's also written to from writePacket.
-}
-
-func (t *handshakeTransport) pushPacket(p []byte) error {
- if debugHandshake {
- t.printPacket(p, true)
- }
- return t.conn.writePacket(p)
-}
-
-func (t *handshakeTransport) getWriteError() error {
- t.mu.Lock()
- defer t.mu.Unlock()
- return t.writeError
-}
-
-func (t *handshakeTransport) recordWriteError(err error) {
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.writeError == nil && err != nil {
- t.writeError = err
- }
-}
-
-func (t *handshakeTransport) requestKeyExchange() {
- select {
- case t.requestKex <- struct{}{}:
- default:
- // something already requested a kex, so do nothing.
- }
-}
-
-func (t *handshakeTransport) resetWriteThresholds() {
- t.writePacketsLeft = packetRekeyThreshold
- if t.config.RekeyThreshold > 0 {
- t.writeBytesLeft = int64(t.config.RekeyThreshold)
- } else if t.algorithms != nil {
- t.writeBytesLeft = t.algorithms.w.rekeyBytes()
- } else {
- t.writeBytesLeft = 1 << 30
- }
-}
-
-func (t *handshakeTransport) kexLoop() {
-
-write:
- for t.getWriteError() == nil {
- var request *pendingKex
- var sent bool
-
- for request == nil || !sent {
- var ok bool
- select {
- case request, ok = <-t.startKex:
- if !ok {
- break write
- }
- case <-t.requestKex:
- break
- }
-
- if !sent {
- if err := t.sendKexInit(); err != nil {
- t.recordWriteError(err)
- break
- }
- sent = true
- }
- }
-
- if err := t.getWriteError(); err != nil {
- if request != nil {
- request.done <- err
- }
- break
- }
-
- // We're not servicing t.requestKex, but that is OK:
- // we never block on sending to t.requestKex.
-
- // We're not servicing t.startKex, but the remote end
- // has just sent us a kexInitMsg, so it can't send
- // another key change request, until we close the done
- // channel on the pendingKex request.
-
- err := t.enterKeyExchange(request.otherInit)
-
- t.mu.Lock()
- t.writeError = err
- t.sentInitPacket = nil
- t.sentInitMsg = nil
-
- t.resetWriteThresholds()
-
- // we have completed the key exchange. Since the
- // reader is still blocked, it is safe to clear out
- // the requestKex channel. This avoids the situation
- // where: 1) we consumed our own request for the
- // initial kex, and 2) the kex from the remote side
- // caused another send on the requestKex channel,
- clear:
- for {
- select {
- case <-t.requestKex:
- //
- default:
- break clear
- }
- }
-
- request.done <- t.writeError
-
- // kex finished. Push packets that we received while
- // the kex was in progress. Don't look at t.startKex
- // and don't increment writtenSinceKex: if we trigger
- // another kex while we are still busy with the last
- // one, things will become very confusing.
- for _, p := range t.pendingPackets {
- t.writeError = t.pushPacket(p)
- if t.writeError != nil {
- break
- }
- }
- t.pendingPackets = t.pendingPackets[:0]
- t.mu.Unlock()
- }
-
- // Unblock reader.
- t.conn.Close()
-
- // drain startKex channel. We don't service t.requestKex
- // because nobody does blocking sends there.
- for request := range t.startKex {
- request.done <- t.getWriteError()
- }
-
- // Mark that the loop is done so that Close can return.
- close(t.kexLoopDone)
-}
-
-// The protocol uses uint32 for packet counters, so we can't let them
-// reach 1<<32. We will actually read and write more packets than
-// this, though: the other side may send more packets, and after we
-// hit this limit on writing we will send a few more packets for the
-// key exchange itself.
-const packetRekeyThreshold = (1 << 31)
-
-func (t *handshakeTransport) resetReadThresholds() {
- t.readPacketsLeft = packetRekeyThreshold
- if t.config.RekeyThreshold > 0 {
- t.readBytesLeft = int64(t.config.RekeyThreshold)
- } else if t.algorithms != nil {
- t.readBytesLeft = t.algorithms.r.rekeyBytes()
- } else {
- t.readBytesLeft = 1 << 30
- }
-}
-
-func (t *handshakeTransport) readOnePacket(first bool) ([]byte, error) {
- p, err := t.conn.readPacket()
- if err != nil {
- return nil, err
- }
-
- if t.readPacketsLeft > 0 {
- t.readPacketsLeft--
- } else {
- t.requestKeyExchange()
- }
-
- if t.readBytesLeft > 0 {
- t.readBytesLeft -= int64(len(p))
- } else {
- t.requestKeyExchange()
- }
-
- if debugHandshake {
- t.printPacket(p, false)
- }
-
- if first && p[0] != msgKexInit {
- return nil, fmt.Errorf("ssh: first packet should be msgKexInit")
- }
-
- if p[0] != msgKexInit {
- return p, nil
- }
-
- firstKex := t.sessionID == nil
-
- kex := pendingKex{
- done: make(chan error, 1),
- otherInit: p,
- }
- t.startKex <- &kex
- err = <-kex.done
-
- if debugHandshake {
- log.Printf("%s exited key exchange (first %v), err %v", t.id(), firstKex, err)
- }
-
- if err != nil {
- return nil, err
- }
-
- t.resetReadThresholds()
-
- // By default, a key exchange is hidden from higher layers by
- // translating it into msgIgnore.
- successPacket := []byte{msgIgnore}
- if firstKex {
- // sendKexInit() for the first kex waits for
- // msgNewKeys so the authentication process is
- // guaranteed to happen over an encrypted transport.
- successPacket = []byte{msgNewKeys}
- }
-
- return successPacket, nil
-}
-
-const (
- kexStrictClient = "kex-strict-c-v00@openssh.com"
- kexStrictServer = "kex-strict-s-v00@openssh.com"
-)
-
-// sendKexInit sends a key change message.
-func (t *handshakeTransport) sendKexInit() error {
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.sentInitMsg != nil {
- // kexInits may be sent either in response to the other side,
- // or because our side wants to initiate a key change, so we
- // may have already sent a kexInit. In that case, don't send a
- // second kexInit.
- return nil
- }
-
- msg := &kexInitMsg{
- CiphersClientServer: t.config.Ciphers,
- CiphersServerClient: t.config.Ciphers,
- MACsClientServer: t.config.MACs,
- MACsServerClient: t.config.MACs,
- CompressionClientServer: supportedCompressions,
- CompressionServerClient: supportedCompressions,
- }
- io.ReadFull(rand.Reader, msg.Cookie[:])
-
- // We mutate the KexAlgos slice, in order to add the kex-strict extension algorithm,
- // and possibly to add the ext-info extension algorithm. Since the slice may be the
- // user owned KeyExchanges, we create our own slice in order to avoid using user
- // owned memory by mistake.
- msg.KexAlgos = make([]string, 0, len(t.config.KeyExchanges)+2) // room for kex-strict and ext-info
- msg.KexAlgos = append(msg.KexAlgos, t.config.KeyExchanges...)
-
- isServer := len(t.hostKeys) > 0
- if isServer {
- for _, k := range t.hostKeys {
- // If k is a MultiAlgorithmSigner, we restrict the signature
- // algorithms. If k is a AlgorithmSigner, presume it supports all
- // signature algorithms associated with the key format. If k is not
- // an AlgorithmSigner, we can only assume it only supports the
- // algorithms that matches the key format. (This means that Sign
- // can't pick a different default).
- keyFormat := k.PublicKey().Type()
-
- switch s := k.(type) {
- case MultiAlgorithmSigner:
- for _, algo := range algorithmsForKeyFormat(keyFormat) {
- if contains(s.Algorithms(), underlyingAlgo(algo)) {
- msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, algo)
- }
- }
- case AlgorithmSigner:
- msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, algorithmsForKeyFormat(keyFormat)...)
- default:
- msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, keyFormat)
- }
- }
-
- if t.sessionID == nil {
- msg.KexAlgos = append(msg.KexAlgos, kexStrictServer)
- }
- } else {
- msg.ServerHostKeyAlgos = t.hostKeyAlgorithms
-
- // As a client we opt in to receiving SSH_MSG_EXT_INFO so we know what
- // algorithms the server supports for public key authentication. See RFC
- // 8308, Section 2.1.
- //
- // We also send the strict KEX mode extension algorithm, in order to opt
- // into the strict KEX mode.
- if firstKeyExchange := t.sessionID == nil; firstKeyExchange {
- msg.KexAlgos = append(msg.KexAlgos, "ext-info-c")
- msg.KexAlgos = append(msg.KexAlgos, kexStrictClient)
- }
-
- }
-
- packet := Marshal(msg)
-
- // writePacket destroys the contents, so save a copy.
- packetCopy := make([]byte, len(packet))
- copy(packetCopy, packet)
-
- if err := t.pushPacket(packetCopy); err != nil {
- return err
- }
-
- t.sentInitMsg = msg
- t.sentInitPacket = packet
-
- return nil
-}
-
-func (t *handshakeTransport) writePacket(p []byte) error {
- switch p[0] {
- case msgKexInit:
- return errors.New("ssh: only handshakeTransport can send kexInit")
- case msgNewKeys:
- return errors.New("ssh: only handshakeTransport can send newKeys")
- }
-
- t.mu.Lock()
- defer t.mu.Unlock()
- if t.writeError != nil {
- return t.writeError
- }
-
- if t.sentInitMsg != nil {
- // Copy the packet so the writer can reuse the buffer.
- cp := make([]byte, len(p))
- copy(cp, p)
- t.pendingPackets = append(t.pendingPackets, cp)
- return nil
- }
-
- if t.writeBytesLeft > 0 {
- t.writeBytesLeft -= int64(len(p))
- } else {
- t.requestKeyExchange()
- }
-
- if t.writePacketsLeft > 0 {
- t.writePacketsLeft--
- } else {
- t.requestKeyExchange()
- }
-
- if err := t.pushPacket(p); err != nil {
- t.writeError = err
- }
-
- return nil
-}
-
-func (t *handshakeTransport) Close() error {
- // Close the connection. This should cause the readLoop goroutine to wake up
- // and close t.startKex, which will shut down kexLoop if running.
- err := t.conn.Close()
-
- // Wait for the kexLoop goroutine to complete.
- // At that point we know that the readLoop goroutine is complete too,
- // because kexLoop itself waits for readLoop to close the startKex channel.
- <-t.kexLoopDone
-
- return err
-}
-
-func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error {
- if debugHandshake {
- log.Printf("%s entered key exchange", t.id())
- }
-
- otherInit := &kexInitMsg{}
- if err := Unmarshal(otherInitPacket, otherInit); err != nil {
- return err
- }
-
- magics := handshakeMagics{
- clientVersion: t.clientVersion,
- serverVersion: t.serverVersion,
- clientKexInit: otherInitPacket,
- serverKexInit: t.sentInitPacket,
- }
-
- clientInit := otherInit
- serverInit := t.sentInitMsg
- isClient := len(t.hostKeys) == 0
- if isClient {
- clientInit, serverInit = serverInit, clientInit
-
- magics.clientKexInit = t.sentInitPacket
- magics.serverKexInit = otherInitPacket
- }
-
- var err error
- t.algorithms, err = findAgreedAlgorithms(isClient, clientInit, serverInit)
- if err != nil {
- return err
- }
-
- if t.sessionID == nil && ((isClient && contains(serverInit.KexAlgos, kexStrictServer)) || (!isClient && contains(clientInit.KexAlgos, kexStrictClient))) {
- t.strictMode = true
- if err := t.conn.setStrictMode(); err != nil {
- return err
- }
- }
-
- // We don't send FirstKexFollows, but we handle receiving it.
- //
- // RFC 4253 section 7 defines the kex and the agreement method for
- // first_kex_packet_follows. It states that the guessed packet
- // should be ignored if the "kex algorithm and/or the host
- // key algorithm is guessed wrong (server and client have
- // different preferred algorithm), or if any of the other
- // algorithms cannot be agreed upon". The other algorithms have
- // already been checked above so the kex algorithm and host key
- // algorithm are checked here.
- if otherInit.FirstKexFollows && (clientInit.KexAlgos[0] != serverInit.KexAlgos[0] || clientInit.ServerHostKeyAlgos[0] != serverInit.ServerHostKeyAlgos[0]) {
- // other side sent a kex message for the wrong algorithm,
- // which we have to ignore.
- if _, err := t.conn.readPacket(); err != nil {
- return err
- }
- }
-
- kex, ok := kexAlgoMap[t.algorithms.kex]
- if !ok {
- return fmt.Errorf("ssh: unexpected key exchange algorithm %v", t.algorithms.kex)
- }
-
- var result *kexResult
- if len(t.hostKeys) > 0 {
- result, err = t.server(kex, &magics)
- } else {
- result, err = t.client(kex, &magics)
- }
-
- if err != nil {
- return err
- }
-
- firstKeyExchange := t.sessionID == nil
- if firstKeyExchange {
- t.sessionID = result.H
- }
- result.SessionID = t.sessionID
-
- if err := t.conn.prepareKeyChange(t.algorithms, result); err != nil {
- return err
- }
- if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil {
- return err
- }
-
- // On the server side, after the first SSH_MSG_NEWKEYS, send a SSH_MSG_EXT_INFO
- // message with the server-sig-algs extension if the client supports it. See
- // RFC 8308, Sections 2.4 and 3.1, and [PROTOCOL], Section 1.9.
- if !isClient && firstKeyExchange && contains(clientInit.KexAlgos, "ext-info-c") {
- supportedPubKeyAuthAlgosList := strings.Join(t.publicKeyAuthAlgorithms, ",")
- extInfo := &extInfoMsg{
- NumExtensions: 2,
- Payload: make([]byte, 0, 4+15+4+len(supportedPubKeyAuthAlgosList)+4+16+4+1),
- }
- extInfo.Payload = appendInt(extInfo.Payload, len("server-sig-algs"))
- extInfo.Payload = append(extInfo.Payload, "server-sig-algs"...)
- extInfo.Payload = appendInt(extInfo.Payload, len(supportedPubKeyAuthAlgosList))
- extInfo.Payload = append(extInfo.Payload, supportedPubKeyAuthAlgosList...)
- extInfo.Payload = appendInt(extInfo.Payload, len("ping@openssh.com"))
- extInfo.Payload = append(extInfo.Payload, "ping@openssh.com"...)
- extInfo.Payload = appendInt(extInfo.Payload, 1)
- extInfo.Payload = append(extInfo.Payload, "0"...)
- if err := t.conn.writePacket(Marshal(extInfo)); err != nil {
- return err
- }
- }
-
- if packet, err := t.conn.readPacket(); err != nil {
- return err
- } else if packet[0] != msgNewKeys {
- return unexpectedMessageError(msgNewKeys, packet[0])
- }
-
- if firstKeyExchange {
- // Indicates to the transport that the first key exchange is completed
- // after receiving SSH_MSG_NEWKEYS.
- t.conn.setInitialKEXDone()
- }
-
- return nil
-}
-
-// algorithmSignerWrapper is an AlgorithmSigner that only supports the default
-// key format algorithm.
-//
-// This is technically a violation of the AlgorithmSigner interface, but it
-// should be unreachable given where we use this. Anyway, at least it returns an
-// error instead of panicing or producing an incorrect signature.
-type algorithmSignerWrapper struct {
- Signer
-}
-
-func (a algorithmSignerWrapper) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
- if algorithm != underlyingAlgo(a.PublicKey().Type()) {
- return nil, errors.New("ssh: internal error: algorithmSignerWrapper invoked with non-default algorithm")
- }
- return a.Sign(rand, data)
-}
-
-func pickHostKey(hostKeys []Signer, algo string) AlgorithmSigner {
- for _, k := range hostKeys {
- if s, ok := k.(MultiAlgorithmSigner); ok {
- if !contains(s.Algorithms(), underlyingAlgo(algo)) {
- continue
- }
- }
-
- if algo == k.PublicKey().Type() {
- return algorithmSignerWrapper{k}
- }
-
- k, ok := k.(AlgorithmSigner)
- if !ok {
- continue
- }
- for _, a := range algorithmsForKeyFormat(k.PublicKey().Type()) {
- if algo == a {
- return k
- }
- }
- }
- return nil
-}
-
-func (t *handshakeTransport) server(kex kexAlgorithm, magics *handshakeMagics) (*kexResult, error) {
- hostKey := pickHostKey(t.hostKeys, t.algorithms.hostKey)
- if hostKey == nil {
- return nil, errors.New("ssh: internal error: negotiated unsupported signature type")
- }
-
- r, err := kex.Server(t.conn, t.config.Rand, magics, hostKey, t.algorithms.hostKey)
- return r, err
-}
-
-func (t *handshakeTransport) client(kex kexAlgorithm, magics *handshakeMagics) (*kexResult, error) {
- result, err := kex.Client(t.conn, t.config.Rand, magics)
- if err != nil {
- return nil, err
- }
-
- hostKey, err := ParsePublicKey(result.HostKey)
- if err != nil {
- return nil, err
- }
-
- if err := verifyHostKeySignature(hostKey, t.algorithms.hostKey, result); err != nil {
- return nil, err
- }
-
- err = t.hostKeyCallback(t.dialAddress, t.remoteAddr, hostKey)
- if err != nil {
- return nil, err
- }
-
- return result, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go b/vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go
deleted file mode 100644
index af81d2665..000000000
--- a/vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package bcrypt_pbkdf implements bcrypt_pbkdf(3) from OpenBSD.
-//
-// See https://flak.tedunangst.com/post/bcrypt-pbkdf and
-// https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/bcrypt_pbkdf.c.
-package bcrypt_pbkdf
-
-import (
- "crypto/sha512"
- "errors"
- "golang.org/x/crypto/blowfish"
-)
-
-const blockSize = 32
-
-// Key derives a key from the password, salt and rounds count, returning a
-// []byte of length keyLen that can be used as cryptographic key.
-func Key(password, salt []byte, rounds, keyLen int) ([]byte, error) {
- if rounds < 1 {
- return nil, errors.New("bcrypt_pbkdf: number of rounds is too small")
- }
- if len(password) == 0 {
- return nil, errors.New("bcrypt_pbkdf: empty password")
- }
- if len(salt) == 0 || len(salt) > 1<<20 {
- return nil, errors.New("bcrypt_pbkdf: bad salt length")
- }
- if keyLen > 1024 {
- return nil, errors.New("bcrypt_pbkdf: keyLen is too large")
- }
-
- numBlocks := (keyLen + blockSize - 1) / blockSize
- key := make([]byte, numBlocks*blockSize)
-
- h := sha512.New()
- h.Write(password)
- shapass := h.Sum(nil)
-
- shasalt := make([]byte, 0, sha512.Size)
- cnt, tmp := make([]byte, 4), make([]byte, blockSize)
- for block := 1; block <= numBlocks; block++ {
- h.Reset()
- h.Write(salt)
- cnt[0] = byte(block >> 24)
- cnt[1] = byte(block >> 16)
- cnt[2] = byte(block >> 8)
- cnt[3] = byte(block)
- h.Write(cnt)
- bcryptHash(tmp, shapass, h.Sum(shasalt))
-
- out := make([]byte, blockSize)
- copy(out, tmp)
- for i := 2; i <= rounds; i++ {
- h.Reset()
- h.Write(tmp)
- bcryptHash(tmp, shapass, h.Sum(shasalt))
- for j := 0; j < len(out); j++ {
- out[j] ^= tmp[j]
- }
- }
-
- for i, v := range out {
- key[i*numBlocks+(block-1)] = v
- }
- }
- return key[:keyLen], nil
-}
-
-var magic = []byte("OxychromaticBlowfishSwatDynamite")
-
-func bcryptHash(out, shapass, shasalt []byte) {
- c, err := blowfish.NewSaltedCipher(shapass, shasalt)
- if err != nil {
- panic(err)
- }
- for i := 0; i < 64; i++ {
- blowfish.ExpandKey(shasalt, c)
- blowfish.ExpandKey(shapass, c)
- }
- copy(out, magic)
- for i := 0; i < 32; i += 8 {
- for j := 0; j < 64; j++ {
- c.Encrypt(out[i:i+8], out[i:i+8])
- }
- }
- // Swap bytes due to different endianness.
- for i := 0; i < 32; i += 4 {
- out[i+3], out[i+2], out[i+1], out[i] = out[i], out[i+1], out[i+2], out[i+3]
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/kex.go b/vendor/golang.org/x/crypto/ssh/kex.go
deleted file mode 100644
index 8a05f7990..000000000
--- a/vendor/golang.org/x/crypto/ssh/kex.go
+++ /dev/null
@@ -1,786 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "crypto"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/subtle"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "math/big"
-
- "golang.org/x/crypto/curve25519"
-)
-
-const (
- kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1"
- kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1"
- kexAlgoDH14SHA256 = "diffie-hellman-group14-sha256"
- kexAlgoDH16SHA512 = "diffie-hellman-group16-sha512"
- kexAlgoECDH256 = "ecdh-sha2-nistp256"
- kexAlgoECDH384 = "ecdh-sha2-nistp384"
- kexAlgoECDH521 = "ecdh-sha2-nistp521"
- kexAlgoCurve25519SHA256LibSSH = "curve25519-sha256@libssh.org"
- kexAlgoCurve25519SHA256 = "curve25519-sha256"
-
- // For the following kex only the client half contains a production
- // ready implementation. The server half only consists of a minimal
- // implementation to satisfy the automated tests.
- kexAlgoDHGEXSHA1 = "diffie-hellman-group-exchange-sha1"
- kexAlgoDHGEXSHA256 = "diffie-hellman-group-exchange-sha256"
-)
-
-// kexResult captures the outcome of a key exchange.
-type kexResult struct {
- // Session hash. See also RFC 4253, section 8.
- H []byte
-
- // Shared secret. See also RFC 4253, section 8.
- K []byte
-
- // Host key as hashed into H.
- HostKey []byte
-
- // Signature of H.
- Signature []byte
-
- // A cryptographic hash function that matches the security
- // level of the key exchange algorithm. It is used for
- // calculating H, and for deriving keys from H and K.
- Hash crypto.Hash
-
- // The session ID, which is the first H computed. This is used
- // to derive key material inside the transport.
- SessionID []byte
-}
-
-// handshakeMagics contains data that is always included in the
-// session hash.
-type handshakeMagics struct {
- clientVersion, serverVersion []byte
- clientKexInit, serverKexInit []byte
-}
-
-func (m *handshakeMagics) write(w io.Writer) {
- writeString(w, m.clientVersion)
- writeString(w, m.serverVersion)
- writeString(w, m.clientKexInit)
- writeString(w, m.serverKexInit)
-}
-
-// kexAlgorithm abstracts different key exchange algorithms.
-type kexAlgorithm interface {
- // Server runs server-side key agreement, signing the result
- // with a hostkey. algo is the negotiated algorithm, and may
- // be a certificate type.
- Server(p packetConn, rand io.Reader, magics *handshakeMagics, s AlgorithmSigner, algo string) (*kexResult, error)
-
- // Client runs the client-side key agreement. Caller is
- // responsible for verifying the host key signature.
- Client(p packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error)
-}
-
-// dhGroup is a multiplicative group suitable for implementing Diffie-Hellman key agreement.
-type dhGroup struct {
- g, p, pMinus1 *big.Int
- hashFunc crypto.Hash
-}
-
-func (group *dhGroup) diffieHellman(theirPublic, myPrivate *big.Int) (*big.Int, error) {
- if theirPublic.Cmp(bigOne) <= 0 || theirPublic.Cmp(group.pMinus1) >= 0 {
- return nil, errors.New("ssh: DH parameter out of bounds")
- }
- return new(big.Int).Exp(theirPublic, myPrivate, group.p), nil
-}
-
-func (group *dhGroup) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
- var x *big.Int
- for {
- var err error
- if x, err = rand.Int(randSource, group.pMinus1); err != nil {
- return nil, err
- }
- if x.Sign() > 0 {
- break
- }
- }
-
- X := new(big.Int).Exp(group.g, x, group.p)
- kexDHInit := kexDHInitMsg{
- X: X,
- }
- if err := c.writePacket(Marshal(&kexDHInit)); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var kexDHReply kexDHReplyMsg
- if err = Unmarshal(packet, &kexDHReply); err != nil {
- return nil, err
- }
-
- ki, err := group.diffieHellman(kexDHReply.Y, x)
- if err != nil {
- return nil, err
- }
-
- h := group.hashFunc.New()
- magics.write(h)
- writeString(h, kexDHReply.HostKey)
- writeInt(h, X)
- writeInt(h, kexDHReply.Y)
- K := make([]byte, intLength(ki))
- marshalInt(K, ki)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: kexDHReply.HostKey,
- Signature: kexDHReply.Signature,
- Hash: group.hashFunc,
- }, nil
-}
-
-func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
- packet, err := c.readPacket()
- if err != nil {
- return
- }
- var kexDHInit kexDHInitMsg
- if err = Unmarshal(packet, &kexDHInit); err != nil {
- return
- }
-
- var y *big.Int
- for {
- if y, err = rand.Int(randSource, group.pMinus1); err != nil {
- return
- }
- if y.Sign() > 0 {
- break
- }
- }
-
- Y := new(big.Int).Exp(group.g, y, group.p)
- ki, err := group.diffieHellman(kexDHInit.X, y)
- if err != nil {
- return nil, err
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- h := group.hashFunc.New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeInt(h, kexDHInit.X)
- writeInt(h, Y)
-
- K := make([]byte, intLength(ki))
- marshalInt(K, ki)
- h.Write(K)
-
- H := h.Sum(nil)
-
- // H is already a hash, but the hostkey signing will apply its
- // own key-specific hash algorithm.
- sig, err := signAndMarshal(priv, randSource, H, algo)
- if err != nil {
- return nil, err
- }
-
- kexDHReply := kexDHReplyMsg{
- HostKey: hostKeyBytes,
- Y: Y,
- Signature: sig,
- }
- packet = Marshal(&kexDHReply)
-
- err = c.writePacket(packet)
- return &kexResult{
- H: H,
- K: K,
- HostKey: hostKeyBytes,
- Signature: sig,
- Hash: group.hashFunc,
- }, err
-}
-
-// ecdh performs Elliptic Curve Diffie-Hellman key exchange as
-// described in RFC 5656, section 4.
-type ecdh struct {
- curve elliptic.Curve
-}
-
-func (kex *ecdh) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) {
- ephKey, err := ecdsa.GenerateKey(kex.curve, rand)
- if err != nil {
- return nil, err
- }
-
- kexInit := kexECDHInitMsg{
- ClientPubKey: elliptic.Marshal(kex.curve, ephKey.PublicKey.X, ephKey.PublicKey.Y),
- }
-
- serialized := Marshal(&kexInit)
- if err := c.writePacket(serialized); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var reply kexECDHReplyMsg
- if err = Unmarshal(packet, &reply); err != nil {
- return nil, err
- }
-
- x, y, err := unmarshalECKey(kex.curve, reply.EphemeralPubKey)
- if err != nil {
- return nil, err
- }
-
- // generate shared secret
- secret, _ := kex.curve.ScalarMult(x, y, ephKey.D.Bytes())
-
- h := ecHash(kex.curve).New()
- magics.write(h)
- writeString(h, reply.HostKey)
- writeString(h, kexInit.ClientPubKey)
- writeString(h, reply.EphemeralPubKey)
- K := make([]byte, intLength(secret))
- marshalInt(K, secret)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: reply.HostKey,
- Signature: reply.Signature,
- Hash: ecHash(kex.curve),
- }, nil
-}
-
-// unmarshalECKey parses and checks an EC key.
-func unmarshalECKey(curve elliptic.Curve, pubkey []byte) (x, y *big.Int, err error) {
- x, y = elliptic.Unmarshal(curve, pubkey)
- if x == nil {
- return nil, nil, errors.New("ssh: elliptic.Unmarshal failure")
- }
- if !validateECPublicKey(curve, x, y) {
- return nil, nil, errors.New("ssh: public key not on curve")
- }
- return x, y, nil
-}
-
-// validateECPublicKey checks that the point is a valid public key for
-// the given curve. See [SEC1], 3.2.2
-func validateECPublicKey(curve elliptic.Curve, x, y *big.Int) bool {
- if x.Sign() == 0 && y.Sign() == 0 {
- return false
- }
-
- if x.Cmp(curve.Params().P) >= 0 {
- return false
- }
-
- if y.Cmp(curve.Params().P) >= 0 {
- return false
- }
-
- if !curve.IsOnCurve(x, y) {
- return false
- }
-
- // We don't check if N * PubKey == 0, since
- //
- // - the NIST curves have cofactor = 1, so this is implicit.
- // (We don't foresee an implementation that supports non NIST
- // curves)
- //
- // - for ephemeral keys, we don't need to worry about small
- // subgroup attacks.
- return true
-}
-
-func (kex *ecdh) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var kexECDHInit kexECDHInitMsg
- if err = Unmarshal(packet, &kexECDHInit); err != nil {
- return nil, err
- }
-
- clientX, clientY, err := unmarshalECKey(kex.curve, kexECDHInit.ClientPubKey)
- if err != nil {
- return nil, err
- }
-
- // We could cache this key across multiple users/multiple
- // connection attempts, but the benefit is small. OpenSSH
- // generates a new key for each incoming connection.
- ephKey, err := ecdsa.GenerateKey(kex.curve, rand)
- if err != nil {
- return nil, err
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- serializedEphKey := elliptic.Marshal(kex.curve, ephKey.PublicKey.X, ephKey.PublicKey.Y)
-
- // generate shared secret
- secret, _ := kex.curve.ScalarMult(clientX, clientY, ephKey.D.Bytes())
-
- h := ecHash(kex.curve).New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeString(h, kexECDHInit.ClientPubKey)
- writeString(h, serializedEphKey)
-
- K := make([]byte, intLength(secret))
- marshalInt(K, secret)
- h.Write(K)
-
- H := h.Sum(nil)
-
- // H is already a hash, but the hostkey signing will apply its
- // own key-specific hash algorithm.
- sig, err := signAndMarshal(priv, rand, H, algo)
- if err != nil {
- return nil, err
- }
-
- reply := kexECDHReplyMsg{
- EphemeralPubKey: serializedEphKey,
- HostKey: hostKeyBytes,
- Signature: sig,
- }
-
- serialized := Marshal(&reply)
- if err := c.writePacket(serialized); err != nil {
- return nil, err
- }
-
- return &kexResult{
- H: H,
- K: K,
- HostKey: reply.HostKey,
- Signature: sig,
- Hash: ecHash(kex.curve),
- }, nil
-}
-
-// ecHash returns the hash to match the given elliptic curve, see RFC
-// 5656, section 6.2.1
-func ecHash(curve elliptic.Curve) crypto.Hash {
- bitSize := curve.Params().BitSize
- switch {
- case bitSize <= 256:
- return crypto.SHA256
- case bitSize <= 384:
- return crypto.SHA384
- }
- return crypto.SHA512
-}
-
-var kexAlgoMap = map[string]kexAlgorithm{}
-
-func init() {
- // This is the group called diffie-hellman-group1-sha1 in
- // RFC 4253 and Oakley Group 2 in RFC 2409.
- p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16)
- kexAlgoMap[kexAlgoDH1SHA1] = &dhGroup{
- g: new(big.Int).SetInt64(2),
- p: p,
- pMinus1: new(big.Int).Sub(p, bigOne),
- hashFunc: crypto.SHA1,
- }
-
- // This are the groups called diffie-hellman-group14-sha1 and
- // diffie-hellman-group14-sha256 in RFC 4253 and RFC 8268,
- // and Oakley Group 14 in RFC 3526.
- p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
- group14 := &dhGroup{
- g: new(big.Int).SetInt64(2),
- p: p,
- pMinus1: new(big.Int).Sub(p, bigOne),
- }
-
- kexAlgoMap[kexAlgoDH14SHA1] = &dhGroup{
- g: group14.g, p: group14.p, pMinus1: group14.pMinus1,
- hashFunc: crypto.SHA1,
- }
- kexAlgoMap[kexAlgoDH14SHA256] = &dhGroup{
- g: group14.g, p: group14.p, pMinus1: group14.pMinus1,
- hashFunc: crypto.SHA256,
- }
-
- // This is the group called diffie-hellman-group16-sha512 in RFC
- // 8268 and Oakley Group 16 in RFC 3526.
- p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF", 16)
-
- kexAlgoMap[kexAlgoDH16SHA512] = &dhGroup{
- g: new(big.Int).SetInt64(2),
- p: p,
- pMinus1: new(big.Int).Sub(p, bigOne),
- hashFunc: crypto.SHA512,
- }
-
- kexAlgoMap[kexAlgoECDH521] = &ecdh{elliptic.P521()}
- kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()}
- kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()}
- kexAlgoMap[kexAlgoCurve25519SHA256] = &curve25519sha256{}
- kexAlgoMap[kexAlgoCurve25519SHA256LibSSH] = &curve25519sha256{}
- kexAlgoMap[kexAlgoDHGEXSHA1] = &dhGEXSHA{hashFunc: crypto.SHA1}
- kexAlgoMap[kexAlgoDHGEXSHA256] = &dhGEXSHA{hashFunc: crypto.SHA256}
-}
-
-// curve25519sha256 implements the curve25519-sha256 (formerly known as
-// curve25519-sha256@libssh.org) key exchange method, as described in RFC 8731.
-type curve25519sha256 struct{}
-
-type curve25519KeyPair struct {
- priv [32]byte
- pub [32]byte
-}
-
-func (kp *curve25519KeyPair) generate(rand io.Reader) error {
- if _, err := io.ReadFull(rand, kp.priv[:]); err != nil {
- return err
- }
- curve25519.ScalarBaseMult(&kp.pub, &kp.priv)
- return nil
-}
-
-// curve25519Zeros is just an array of 32 zero bytes so that we have something
-// convenient to compare against in order to reject curve25519 points with the
-// wrong order.
-var curve25519Zeros [32]byte
-
-func (kex *curve25519sha256) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) {
- var kp curve25519KeyPair
- if err := kp.generate(rand); err != nil {
- return nil, err
- }
- if err := c.writePacket(Marshal(&kexECDHInitMsg{kp.pub[:]})); err != nil {
- return nil, err
- }
-
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var reply kexECDHReplyMsg
- if err = Unmarshal(packet, &reply); err != nil {
- return nil, err
- }
- if len(reply.EphemeralPubKey) != 32 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong length")
- }
-
- var servPub, secret [32]byte
- copy(servPub[:], reply.EphemeralPubKey)
- curve25519.ScalarMult(&secret, &kp.priv, &servPub)
- if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong order")
- }
-
- h := crypto.SHA256.New()
- magics.write(h)
- writeString(h, reply.HostKey)
- writeString(h, kp.pub[:])
- writeString(h, reply.EphemeralPubKey)
-
- ki := new(big.Int).SetBytes(secret[:])
- K := make([]byte, intLength(ki))
- marshalInt(K, ki)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: reply.HostKey,
- Signature: reply.Signature,
- Hash: crypto.SHA256,
- }, nil
-}
-
-func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
- packet, err := c.readPacket()
- if err != nil {
- return
- }
- var kexInit kexECDHInitMsg
- if err = Unmarshal(packet, &kexInit); err != nil {
- return
- }
-
- if len(kexInit.ClientPubKey) != 32 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong length")
- }
-
- var kp curve25519KeyPair
- if err := kp.generate(rand); err != nil {
- return nil, err
- }
-
- var clientPub, secret [32]byte
- copy(clientPub[:], kexInit.ClientPubKey)
- curve25519.ScalarMult(&secret, &kp.priv, &clientPub)
- if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 {
- return nil, errors.New("ssh: peer's curve25519 public value has wrong order")
- }
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- h := crypto.SHA256.New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- writeString(h, kexInit.ClientPubKey)
- writeString(h, kp.pub[:])
-
- ki := new(big.Int).SetBytes(secret[:])
- K := make([]byte, intLength(ki))
- marshalInt(K, ki)
- h.Write(K)
-
- H := h.Sum(nil)
-
- sig, err := signAndMarshal(priv, rand, H, algo)
- if err != nil {
- return nil, err
- }
-
- reply := kexECDHReplyMsg{
- EphemeralPubKey: kp.pub[:],
- HostKey: hostKeyBytes,
- Signature: sig,
- }
- if err := c.writePacket(Marshal(&reply)); err != nil {
- return nil, err
- }
- return &kexResult{
- H: H,
- K: K,
- HostKey: hostKeyBytes,
- Signature: sig,
- Hash: crypto.SHA256,
- }, nil
-}
-
-// dhGEXSHA implements the diffie-hellman-group-exchange-sha1 and
-// diffie-hellman-group-exchange-sha256 key agreement protocols,
-// as described in RFC 4419
-type dhGEXSHA struct {
- hashFunc crypto.Hash
-}
-
-const (
- dhGroupExchangeMinimumBits = 2048
- dhGroupExchangePreferredBits = 2048
- dhGroupExchangeMaximumBits = 8192
-)
-
-func (gex *dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
- // Send GexRequest
- kexDHGexRequest := kexDHGexRequestMsg{
- MinBits: dhGroupExchangeMinimumBits,
- PreferedBits: dhGroupExchangePreferredBits,
- MaxBits: dhGroupExchangeMaximumBits,
- }
- if err := c.writePacket(Marshal(&kexDHGexRequest)); err != nil {
- return nil, err
- }
-
- // Receive GexGroup
- packet, err := c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var msg kexDHGexGroupMsg
- if err = Unmarshal(packet, &msg); err != nil {
- return nil, err
- }
-
- // reject if p's bit length < dhGroupExchangeMinimumBits or > dhGroupExchangeMaximumBits
- if msg.P.BitLen() < dhGroupExchangeMinimumBits || msg.P.BitLen() > dhGroupExchangeMaximumBits {
- return nil, fmt.Errorf("ssh: server-generated gex p is out of range (%d bits)", msg.P.BitLen())
- }
-
- // Check if g is safe by verifying that 1 < g < p-1
- pMinusOne := new(big.Int).Sub(msg.P, bigOne)
- if msg.G.Cmp(bigOne) <= 0 || msg.G.Cmp(pMinusOne) >= 0 {
- return nil, fmt.Errorf("ssh: server provided gex g is not safe")
- }
-
- // Send GexInit
- pHalf := new(big.Int).Rsh(msg.P, 1)
- x, err := rand.Int(randSource, pHalf)
- if err != nil {
- return nil, err
- }
- X := new(big.Int).Exp(msg.G, x, msg.P)
- kexDHGexInit := kexDHGexInitMsg{
- X: X,
- }
- if err := c.writePacket(Marshal(&kexDHGexInit)); err != nil {
- return nil, err
- }
-
- // Receive GexReply
- packet, err = c.readPacket()
- if err != nil {
- return nil, err
- }
-
- var kexDHGexReply kexDHGexReplyMsg
- if err = Unmarshal(packet, &kexDHGexReply); err != nil {
- return nil, err
- }
-
- if kexDHGexReply.Y.Cmp(bigOne) <= 0 || kexDHGexReply.Y.Cmp(pMinusOne) >= 0 {
- return nil, errors.New("ssh: DH parameter out of bounds")
- }
- kInt := new(big.Int).Exp(kexDHGexReply.Y, x, msg.P)
-
- // Check if k is safe by verifying that k > 1 and k < p - 1
- if kInt.Cmp(bigOne) <= 0 || kInt.Cmp(pMinusOne) >= 0 {
- return nil, fmt.Errorf("ssh: derived k is not safe")
- }
-
- h := gex.hashFunc.New()
- magics.write(h)
- writeString(h, kexDHGexReply.HostKey)
- binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMinimumBits))
- binary.Write(h, binary.BigEndian, uint32(dhGroupExchangePreferredBits))
- binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMaximumBits))
- writeInt(h, msg.P)
- writeInt(h, msg.G)
- writeInt(h, X)
- writeInt(h, kexDHGexReply.Y)
- K := make([]byte, intLength(kInt))
- marshalInt(K, kInt)
- h.Write(K)
-
- return &kexResult{
- H: h.Sum(nil),
- K: K,
- HostKey: kexDHGexReply.HostKey,
- Signature: kexDHGexReply.Signature,
- Hash: gex.hashFunc,
- }, nil
-}
-
-// Server half implementation of the Diffie Hellman Key Exchange with SHA1 and SHA256.
-//
-// This is a minimal implementation to satisfy the automated tests.
-func (gex dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
- // Receive GexRequest
- packet, err := c.readPacket()
- if err != nil {
- return
- }
- var kexDHGexRequest kexDHGexRequestMsg
- if err = Unmarshal(packet, &kexDHGexRequest); err != nil {
- return
- }
-
- // Send GexGroup
- // This is the group called diffie-hellman-group14-sha1 in RFC
- // 4253 and Oakley Group 14 in RFC 3526.
- p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
- g := big.NewInt(2)
-
- msg := &kexDHGexGroupMsg{
- P: p,
- G: g,
- }
- if err := c.writePacket(Marshal(msg)); err != nil {
- return nil, err
- }
-
- // Receive GexInit
- packet, err = c.readPacket()
- if err != nil {
- return
- }
- var kexDHGexInit kexDHGexInitMsg
- if err = Unmarshal(packet, &kexDHGexInit); err != nil {
- return
- }
-
- pHalf := new(big.Int).Rsh(p, 1)
-
- y, err := rand.Int(randSource, pHalf)
- if err != nil {
- return
- }
- Y := new(big.Int).Exp(g, y, p)
-
- pMinusOne := new(big.Int).Sub(p, bigOne)
- if kexDHGexInit.X.Cmp(bigOne) <= 0 || kexDHGexInit.X.Cmp(pMinusOne) >= 0 {
- return nil, errors.New("ssh: DH parameter out of bounds")
- }
- kInt := new(big.Int).Exp(kexDHGexInit.X, y, p)
-
- hostKeyBytes := priv.PublicKey().Marshal()
-
- h := gex.hashFunc.New()
- magics.write(h)
- writeString(h, hostKeyBytes)
- binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMinimumBits))
- binary.Write(h, binary.BigEndian, uint32(dhGroupExchangePreferredBits))
- binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMaximumBits))
- writeInt(h, p)
- writeInt(h, g)
- writeInt(h, kexDHGexInit.X)
- writeInt(h, Y)
-
- K := make([]byte, intLength(kInt))
- marshalInt(K, kInt)
- h.Write(K)
-
- H := h.Sum(nil)
-
- // H is already a hash, but the hostkey signing will apply its
- // own key-specific hash algorithm.
- sig, err := signAndMarshal(priv, randSource, H, algo)
- if err != nil {
- return nil, err
- }
-
- kexDHGexReply := kexDHGexReplyMsg{
- HostKey: hostKeyBytes,
- Y: Y,
- Signature: sig,
- }
- packet = Marshal(&kexDHGexReply)
-
- err = c.writePacket(packet)
-
- return &kexResult{
- H: H,
- K: K,
- HostKey: hostKeyBytes,
- Signature: sig,
- Hash: gex.hashFunc,
- }, err
-}
diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go
deleted file mode 100644
index 98e6706d5..000000000
--- a/vendor/golang.org/x/crypto/ssh/keys.go
+++ /dev/null
@@ -1,1778 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "crypto"
- "crypto/aes"
- "crypto/cipher"
- "crypto/dsa"
- "crypto/ecdsa"
- "crypto/ed25519"
- "crypto/elliptic"
- "crypto/md5"
- "crypto/rand"
- "crypto/rsa"
- "crypto/sha256"
- "crypto/x509"
- "encoding/asn1"
- "encoding/base64"
- "encoding/binary"
- "encoding/hex"
- "encoding/pem"
- "errors"
- "fmt"
- "io"
- "math/big"
- "strings"
-
- "golang.org/x/crypto/ssh/internal/bcrypt_pbkdf"
-)
-
-// Public key algorithms names. These values can appear in PublicKey.Type,
-// ClientConfig.HostKeyAlgorithms, Signature.Format, or as AlgorithmSigner
-// arguments.
-const (
- KeyAlgoRSA = "ssh-rsa"
- KeyAlgoDSA = "ssh-dss"
- KeyAlgoECDSA256 = "ecdsa-sha2-nistp256"
- KeyAlgoSKECDSA256 = "sk-ecdsa-sha2-nistp256@openssh.com"
- KeyAlgoECDSA384 = "ecdsa-sha2-nistp384"
- KeyAlgoECDSA521 = "ecdsa-sha2-nistp521"
- KeyAlgoED25519 = "ssh-ed25519"
- KeyAlgoSKED25519 = "sk-ssh-ed25519@openssh.com"
-
- // KeyAlgoRSASHA256 and KeyAlgoRSASHA512 are only public key algorithms, not
- // public key formats, so they can't appear as a PublicKey.Type. The
- // corresponding PublicKey.Type is KeyAlgoRSA. See RFC 8332, Section 2.
- KeyAlgoRSASHA256 = "rsa-sha2-256"
- KeyAlgoRSASHA512 = "rsa-sha2-512"
-)
-
-const (
- // Deprecated: use KeyAlgoRSA.
- SigAlgoRSA = KeyAlgoRSA
- // Deprecated: use KeyAlgoRSASHA256.
- SigAlgoRSASHA2256 = KeyAlgoRSASHA256
- // Deprecated: use KeyAlgoRSASHA512.
- SigAlgoRSASHA2512 = KeyAlgoRSASHA512
-)
-
-// parsePubKey parses a public key of the given algorithm.
-// Use ParsePublicKey for keys with prepended algorithm.
-func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err error) {
- switch algo {
- case KeyAlgoRSA:
- return parseRSA(in)
- case KeyAlgoDSA:
- return parseDSA(in)
- case KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521:
- return parseECDSA(in)
- case KeyAlgoSKECDSA256:
- return parseSKECDSA(in)
- case KeyAlgoED25519:
- return parseED25519(in)
- case KeyAlgoSKED25519:
- return parseSKEd25519(in)
- case CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoSKECDSA256v01, CertAlgoED25519v01, CertAlgoSKED25519v01:
- cert, err := parseCert(in, certKeyAlgoNames[algo])
- if err != nil {
- return nil, nil, err
- }
- return cert, nil, nil
- }
- return nil, nil, fmt.Errorf("ssh: unknown key algorithm: %v", algo)
-}
-
-// parseAuthorizedKey parses a public key in OpenSSH authorized_keys format
-// (see sshd(8) manual page) once the options and key type fields have been
-// removed.
-func parseAuthorizedKey(in []byte) (out PublicKey, comment string, err error) {
- in = bytes.TrimSpace(in)
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- i = len(in)
- }
- base64Key := in[:i]
-
- key := make([]byte, base64.StdEncoding.DecodedLen(len(base64Key)))
- n, err := base64.StdEncoding.Decode(key, base64Key)
- if err != nil {
- return nil, "", err
- }
- key = key[:n]
- out, err = ParsePublicKey(key)
- if err != nil {
- return nil, "", err
- }
- comment = string(bytes.TrimSpace(in[i:]))
- return out, comment, nil
-}
-
-// ParseKnownHosts parses an entry in the format of the known_hosts file.
-//
-// The known_hosts format is documented in the sshd(8) manual page. This
-// function will parse a single entry from in. On successful return, marker
-// will contain the optional marker value (i.e. "cert-authority" or "revoked")
-// or else be empty, hosts will contain the hosts that this entry matches,
-// pubKey will contain the public key and comment will contain any trailing
-// comment at the end of the line. See the sshd(8) manual page for the various
-// forms that a host string can take.
-//
-// The unparsed remainder of the input will be returned in rest. This function
-// can be called repeatedly to parse multiple entries.
-//
-// If no entries were found in the input then err will be io.EOF. Otherwise a
-// non-nil err value indicates a parse error.
-func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey, comment string, rest []byte, err error) {
- for len(in) > 0 {
- end := bytes.IndexByte(in, '\n')
- if end != -1 {
- rest = in[end+1:]
- in = in[:end]
- } else {
- rest = nil
- }
-
- end = bytes.IndexByte(in, '\r')
- if end != -1 {
- in = in[:end]
- }
-
- in = bytes.TrimSpace(in)
- if len(in) == 0 || in[0] == '#' {
- in = rest
- continue
- }
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- // Strip out the beginning of the known_host key.
- // This is either an optional marker or a (set of) hostname(s).
- keyFields := bytes.Fields(in)
- if len(keyFields) < 3 || len(keyFields) > 5 {
- return "", nil, nil, "", nil, errors.New("ssh: invalid entry in known_hosts data")
- }
-
- // keyFields[0] is either "@cert-authority", "@revoked" or a comma separated
- // list of hosts
- marker := ""
- if keyFields[0][0] == '@' {
- marker = string(keyFields[0][1:])
- keyFields = keyFields[1:]
- }
-
- hosts := string(keyFields[0])
- // keyFields[1] contains the key type (e.g. “ssh-rsa”).
- // However, that information is duplicated inside the
- // base64-encoded key and so is ignored here.
-
- key := bytes.Join(keyFields[2:], []byte(" "))
- if pubKey, comment, err = parseAuthorizedKey(key); err != nil {
- return "", nil, nil, "", nil, err
- }
-
- return marker, strings.Split(hosts, ","), pubKey, comment, rest, nil
- }
-
- return "", nil, nil, "", nil, io.EOF
-}
-
-// ParseAuthorizedKey parses a public key from an authorized_keys
-// file used in OpenSSH according to the sshd(8) manual page.
-func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) {
- for len(in) > 0 {
- end := bytes.IndexByte(in, '\n')
- if end != -1 {
- rest = in[end+1:]
- in = in[:end]
- } else {
- rest = nil
- }
-
- end = bytes.IndexByte(in, '\r')
- if end != -1 {
- in = in[:end]
- }
-
- in = bytes.TrimSpace(in)
- if len(in) == 0 || in[0] == '#' {
- in = rest
- continue
- }
-
- i := bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
- return out, comment, options, rest, nil
- }
-
- // No key type recognised. Maybe there's an options field at
- // the beginning.
- var b byte
- inQuote := false
- var candidateOptions []string
- optionStart := 0
- for i, b = range in {
- isEnd := !inQuote && (b == ' ' || b == '\t')
- if (b == ',' && !inQuote) || isEnd {
- if i-optionStart > 0 {
- candidateOptions = append(candidateOptions, string(in[optionStart:i]))
- }
- optionStart = i + 1
- }
- if isEnd {
- break
- }
- if b == '"' && (i == 0 || (i > 0 && in[i-1] != '\\')) {
- inQuote = !inQuote
- }
- }
- for i < len(in) && (in[i] == ' ' || in[i] == '\t') {
- i++
- }
- if i == len(in) {
- // Invalid line: unmatched quote
- in = rest
- continue
- }
-
- in = in[i:]
- i = bytes.IndexAny(in, " \t")
- if i == -1 {
- in = rest
- continue
- }
-
- if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
- options = candidateOptions
- return out, comment, options, rest, nil
- }
-
- in = rest
- continue
- }
-
- return nil, "", nil, nil, errors.New("ssh: no key found")
-}
-
-// ParsePublicKey parses an SSH public key formatted for use in
-// the SSH wire protocol according to RFC 4253, section 6.6.
-func ParsePublicKey(in []byte) (out PublicKey, err error) {
- algo, in, ok := parseString(in)
- if !ok {
- return nil, errShortRead
- }
- var rest []byte
- out, rest, err = parsePubKey(in, string(algo))
- if len(rest) > 0 {
- return nil, errors.New("ssh: trailing junk in public key")
- }
-
- return out, err
-}
-
-// MarshalAuthorizedKey serializes key for inclusion in an OpenSSH
-// authorized_keys file. The return value ends with newline.
-func MarshalAuthorizedKey(key PublicKey) []byte {
- b := &bytes.Buffer{}
- b.WriteString(key.Type())
- b.WriteByte(' ')
- e := base64.NewEncoder(base64.StdEncoding, b)
- e.Write(key.Marshal())
- e.Close()
- b.WriteByte('\n')
- return b.Bytes()
-}
-
-// MarshalPrivateKey returns a PEM block with the private key serialized in the
-// OpenSSH format.
-func MarshalPrivateKey(key crypto.PrivateKey, comment string) (*pem.Block, error) {
- return marshalOpenSSHPrivateKey(key, comment, unencryptedOpenSSHMarshaler)
-}
-
-// MarshalPrivateKeyWithPassphrase returns a PEM block holding the encrypted
-// private key serialized in the OpenSSH format.
-func MarshalPrivateKeyWithPassphrase(key crypto.PrivateKey, comment string, passphrase []byte) (*pem.Block, error) {
- return marshalOpenSSHPrivateKey(key, comment, passphraseProtectedOpenSSHMarshaler(passphrase))
-}
-
-// PublicKey represents a public key using an unspecified algorithm.
-//
-// Some PublicKeys provided by this package also implement CryptoPublicKey.
-type PublicKey interface {
- // Type returns the key format name, e.g. "ssh-rsa".
- Type() string
-
- // Marshal returns the serialized key data in SSH wire format, with the name
- // prefix. To unmarshal the returned data, use the ParsePublicKey function.
- Marshal() []byte
-
- // Verify that sig is a signature on the given data using this key. This
- // method will hash the data appropriately first. sig.Format is allowed to
- // be any signature algorithm compatible with the key type, the caller
- // should check if it has more stringent requirements.
- Verify(data []byte, sig *Signature) error
-}
-
-// CryptoPublicKey, if implemented by a PublicKey,
-// returns the underlying crypto.PublicKey form of the key.
-type CryptoPublicKey interface {
- CryptoPublicKey() crypto.PublicKey
-}
-
-// A Signer can create signatures that verify against a public key.
-//
-// Some Signers provided by this package also implement MultiAlgorithmSigner.
-type Signer interface {
- // PublicKey returns the associated PublicKey.
- PublicKey() PublicKey
-
- // Sign returns a signature for the given data. This method will hash the
- // data appropriately first. The signature algorithm is expected to match
- // the key format returned by the PublicKey.Type method (and not to be any
- // alternative algorithm supported by the key format).
- Sign(rand io.Reader, data []byte) (*Signature, error)
-}
-
-// An AlgorithmSigner is a Signer that also supports specifying an algorithm to
-// use for signing.
-//
-// An AlgorithmSigner can't advertise the algorithms it supports, unless it also
-// implements MultiAlgorithmSigner, so it should be prepared to be invoked with
-// every algorithm supported by the public key format.
-type AlgorithmSigner interface {
- Signer
-
- // SignWithAlgorithm is like Signer.Sign, but allows specifying a desired
- // signing algorithm. Callers may pass an empty string for the algorithm in
- // which case the AlgorithmSigner will use a default algorithm. This default
- // doesn't currently control any behavior in this package.
- SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error)
-}
-
-// MultiAlgorithmSigner is an AlgorithmSigner that also reports the algorithms
-// supported by that signer.
-type MultiAlgorithmSigner interface {
- AlgorithmSigner
-
- // Algorithms returns the available algorithms in preference order. The list
- // must not be empty, and it must not include certificate types.
- Algorithms() []string
-}
-
-// NewSignerWithAlgorithms returns a signer restricted to the specified
-// algorithms. The algorithms must be set in preference order. The list must not
-// be empty, and it must not include certificate types. An error is returned if
-// the specified algorithms are incompatible with the public key type.
-func NewSignerWithAlgorithms(signer AlgorithmSigner, algorithms []string) (MultiAlgorithmSigner, error) {
- if len(algorithms) == 0 {
- return nil, errors.New("ssh: please specify at least one valid signing algorithm")
- }
- var signerAlgos []string
- supportedAlgos := algorithmsForKeyFormat(underlyingAlgo(signer.PublicKey().Type()))
- if s, ok := signer.(*multiAlgorithmSigner); ok {
- signerAlgos = s.Algorithms()
- } else {
- signerAlgos = supportedAlgos
- }
-
- for _, algo := range algorithms {
- if !contains(supportedAlgos, algo) {
- return nil, fmt.Errorf("ssh: algorithm %q is not supported for key type %q",
- algo, signer.PublicKey().Type())
- }
- if !contains(signerAlgos, algo) {
- return nil, fmt.Errorf("ssh: algorithm %q is restricted for the provided signer", algo)
- }
- }
- return &multiAlgorithmSigner{
- AlgorithmSigner: signer,
- supportedAlgorithms: algorithms,
- }, nil
-}
-
-type multiAlgorithmSigner struct {
- AlgorithmSigner
- supportedAlgorithms []string
-}
-
-func (s *multiAlgorithmSigner) Algorithms() []string {
- return s.supportedAlgorithms
-}
-
-func (s *multiAlgorithmSigner) isAlgorithmSupported(algorithm string) bool {
- if algorithm == "" {
- algorithm = underlyingAlgo(s.PublicKey().Type())
- }
- for _, algo := range s.supportedAlgorithms {
- if algorithm == algo {
- return true
- }
- }
- return false
-}
-
-func (s *multiAlgorithmSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
- if !s.isAlgorithmSupported(algorithm) {
- return nil, fmt.Errorf("ssh: algorithm %q is not supported: %v", algorithm, s.supportedAlgorithms)
- }
- return s.AlgorithmSigner.SignWithAlgorithm(rand, data, algorithm)
-}
-
-type rsaPublicKey rsa.PublicKey
-
-func (r *rsaPublicKey) Type() string {
- return "ssh-rsa"
-}
-
-// parseRSA parses an RSA key according to RFC 4253, section 6.6.
-func parseRSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- E *big.Int
- N *big.Int
- Rest []byte `ssh:"rest"`
- }
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- if w.E.BitLen() > 24 {
- return nil, nil, errors.New("ssh: exponent too large")
- }
- e := w.E.Int64()
- if e < 3 || e&1 == 0 {
- return nil, nil, errors.New("ssh: incorrect exponent")
- }
-
- var key rsa.PublicKey
- key.E = int(e)
- key.N = w.N
- return (*rsaPublicKey)(&key), w.Rest, nil
-}
-
-func (r *rsaPublicKey) Marshal() []byte {
- e := new(big.Int).SetInt64(int64(r.E))
- // RSA publickey struct layout should match the struct used by
- // parseRSACert in the x/crypto/ssh/agent package.
- wirekey := struct {
- Name string
- E *big.Int
- N *big.Int
- }{
- KeyAlgoRSA,
- e,
- r.N,
- }
- return Marshal(&wirekey)
-}
-
-func (r *rsaPublicKey) Verify(data []byte, sig *Signature) error {
- supportedAlgos := algorithmsForKeyFormat(r.Type())
- if !contains(supportedAlgos, sig.Format) {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, r.Type())
- }
- hash := hashFuncs[sig.Format]
- h := hash.New()
- h.Write(data)
- digest := h.Sum(nil)
-
- // Signatures in PKCS1v15 must match the key's modulus in
- // length. However with SSH, some signers provide RSA
- // signatures which are missing the MSB 0's of the bignum
- // represented. With ssh-rsa signatures, this is encouraged by
- // the spec (even though e.g. OpenSSH will give the full
- // length unconditionally). With rsa-sha2-* signatures, the
- // verifier is allowed to support these, even though they are
- // out of spec. See RFC 4253 Section 6.6 for ssh-rsa and RFC
- // 8332 Section 3 for rsa-sha2-* details.
- //
- // In practice:
- // * OpenSSH always allows "short" signatures:
- // https://github.com/openssh/openssh-portable/blob/V_9_8_P1/ssh-rsa.c#L526
- // but always generates padded signatures:
- // https://github.com/openssh/openssh-portable/blob/V_9_8_P1/ssh-rsa.c#L439
- //
- // * PuTTY versions 0.81 and earlier will generate short
- // signatures for all RSA signature variants. Note that
- // PuTTY is embedded in other software, such as WinSCP and
- // FileZilla. At the time of writing, a patch has been
- // applied to PuTTY to generate padded signatures for
- // rsa-sha2-*, but not yet released:
- // https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=a5bcf3d384e1bf15a51a6923c3724cbbee022d8e
- //
- // * SSH.NET versions 2024.0.0 and earlier will generate short
- // signatures for all RSA signature variants, fixed in 2024.1.0:
- // https://github.com/sshnet/SSH.NET/releases/tag/2024.1.0
- //
- // As a result, we pad these up to the key size by inserting
- // leading 0's.
- //
- // Note that support for short signatures with rsa-sha2-* may
- // be removed in the future due to such signatures not being
- // allowed by the spec.
- blob := sig.Blob
- keySize := (*rsa.PublicKey)(r).Size()
- if len(blob) < keySize {
- padded := make([]byte, keySize)
- copy(padded[keySize-len(blob):], blob)
- blob = padded
- }
- return rsa.VerifyPKCS1v15((*rsa.PublicKey)(r), hash, digest, blob)
-}
-
-func (r *rsaPublicKey) CryptoPublicKey() crypto.PublicKey {
- return (*rsa.PublicKey)(r)
-}
-
-type dsaPublicKey dsa.PublicKey
-
-func (k *dsaPublicKey) Type() string {
- return "ssh-dss"
-}
-
-func checkDSAParams(param *dsa.Parameters) error {
- // SSH specifies FIPS 186-2, which only provided a single size
- // (1024 bits) DSA key. FIPS 186-3 allows for larger key
- // sizes, which would confuse SSH.
- if l := param.P.BitLen(); l != 1024 {
- return fmt.Errorf("ssh: unsupported DSA key size %d", l)
- }
-
- return nil
-}
-
-// parseDSA parses an DSA key according to RFC 4253, section 6.6.
-func parseDSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- P, Q, G, Y *big.Int
- Rest []byte `ssh:"rest"`
- }
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- param := dsa.Parameters{
- P: w.P,
- Q: w.Q,
- G: w.G,
- }
- if err := checkDSAParams(¶m); err != nil {
- return nil, nil, err
- }
-
- key := &dsaPublicKey{
- Parameters: param,
- Y: w.Y,
- }
- return key, w.Rest, nil
-}
-
-func (k *dsaPublicKey) Marshal() []byte {
- // DSA publickey struct layout should match the struct used by
- // parseDSACert in the x/crypto/ssh/agent package.
- w := struct {
- Name string
- P, Q, G, Y *big.Int
- }{
- k.Type(),
- k.P,
- k.Q,
- k.G,
- k.Y,
- }
-
- return Marshal(&w)
-}
-
-func (k *dsaPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
- h := hashFuncs[sig.Format].New()
- h.Write(data)
- digest := h.Sum(nil)
-
- // Per RFC 4253, section 6.6,
- // The value for 'dss_signature_blob' is encoded as a string containing
- // r, followed by s (which are 160-bit integers, without lengths or
- // padding, unsigned, and in network byte order).
- // For DSS purposes, sig.Blob should be exactly 40 bytes in length.
- if len(sig.Blob) != 40 {
- return errors.New("ssh: DSA signature parse error")
- }
- r := new(big.Int).SetBytes(sig.Blob[:20])
- s := new(big.Int).SetBytes(sig.Blob[20:])
- if dsa.Verify((*dsa.PublicKey)(k), digest, r, s) {
- return nil
- }
- return errors.New("ssh: signature did not verify")
-}
-
-func (k *dsaPublicKey) CryptoPublicKey() crypto.PublicKey {
- return (*dsa.PublicKey)(k)
-}
-
-type dsaPrivateKey struct {
- *dsa.PrivateKey
-}
-
-func (k *dsaPrivateKey) PublicKey() PublicKey {
- return (*dsaPublicKey)(&k.PrivateKey.PublicKey)
-}
-
-func (k *dsaPrivateKey) Sign(rand io.Reader, data []byte) (*Signature, error) {
- return k.SignWithAlgorithm(rand, data, k.PublicKey().Type())
-}
-
-func (k *dsaPrivateKey) Algorithms() []string {
- return []string{k.PublicKey().Type()}
-}
-
-func (k *dsaPrivateKey) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
- if algorithm != "" && algorithm != k.PublicKey().Type() {
- return nil, fmt.Errorf("ssh: unsupported signature algorithm %s", algorithm)
- }
-
- h := hashFuncs[k.PublicKey().Type()].New()
- h.Write(data)
- digest := h.Sum(nil)
- r, s, err := dsa.Sign(rand, k.PrivateKey, digest)
- if err != nil {
- return nil, err
- }
-
- sig := make([]byte, 40)
- rb := r.Bytes()
- sb := s.Bytes()
-
- copy(sig[20-len(rb):20], rb)
- copy(sig[40-len(sb):], sb)
-
- return &Signature{
- Format: k.PublicKey().Type(),
- Blob: sig,
- }, nil
-}
-
-type ecdsaPublicKey ecdsa.PublicKey
-
-func (k *ecdsaPublicKey) Type() string {
- return "ecdsa-sha2-" + k.nistID()
-}
-
-func (k *ecdsaPublicKey) nistID() string {
- switch k.Params().BitSize {
- case 256:
- return "nistp256"
- case 384:
- return "nistp384"
- case 521:
- return "nistp521"
- }
- panic("ssh: unsupported ecdsa key size")
-}
-
-type ed25519PublicKey ed25519.PublicKey
-
-func (k ed25519PublicKey) Type() string {
- return KeyAlgoED25519
-}
-
-func parseED25519(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- KeyBytes []byte
- Rest []byte `ssh:"rest"`
- }
-
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- if l := len(w.KeyBytes); l != ed25519.PublicKeySize {
- return nil, nil, fmt.Errorf("invalid size %d for Ed25519 public key", l)
- }
-
- return ed25519PublicKey(w.KeyBytes), w.Rest, nil
-}
-
-func (k ed25519PublicKey) Marshal() []byte {
- w := struct {
- Name string
- KeyBytes []byte
- }{
- KeyAlgoED25519,
- []byte(k),
- }
- return Marshal(&w)
-}
-
-func (k ed25519PublicKey) Verify(b []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
- if l := len(k); l != ed25519.PublicKeySize {
- return fmt.Errorf("ssh: invalid size %d for Ed25519 public key", l)
- }
-
- if ok := ed25519.Verify(ed25519.PublicKey(k), b, sig.Blob); !ok {
- return errors.New("ssh: signature did not verify")
- }
-
- return nil
-}
-
-func (k ed25519PublicKey) CryptoPublicKey() crypto.PublicKey {
- return ed25519.PublicKey(k)
-}
-
-func supportedEllipticCurve(curve elliptic.Curve) bool {
- return curve == elliptic.P256() || curve == elliptic.P384() || curve == elliptic.P521()
-}
-
-// parseECDSA parses an ECDSA key according to RFC 5656, section 3.1.
-func parseECDSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- Curve string
- KeyBytes []byte
- Rest []byte `ssh:"rest"`
- }
-
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- key := new(ecdsa.PublicKey)
-
- switch w.Curve {
- case "nistp256":
- key.Curve = elliptic.P256()
- case "nistp384":
- key.Curve = elliptic.P384()
- case "nistp521":
- key.Curve = elliptic.P521()
- default:
- return nil, nil, errors.New("ssh: unsupported curve")
- }
-
- key.X, key.Y = elliptic.Unmarshal(key.Curve, w.KeyBytes)
- if key.X == nil || key.Y == nil {
- return nil, nil, errors.New("ssh: invalid curve point")
- }
- return (*ecdsaPublicKey)(key), w.Rest, nil
-}
-
-func (k *ecdsaPublicKey) Marshal() []byte {
- // See RFC 5656, section 3.1.
- keyBytes := elliptic.Marshal(k.Curve, k.X, k.Y)
- // ECDSA publickey struct layout should match the struct used by
- // parseECDSACert in the x/crypto/ssh/agent package.
- w := struct {
- Name string
- ID string
- Key []byte
- }{
- k.Type(),
- k.nistID(),
- keyBytes,
- }
-
- return Marshal(&w)
-}
-
-func (k *ecdsaPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
-
- h := hashFuncs[sig.Format].New()
- h.Write(data)
- digest := h.Sum(nil)
-
- // Per RFC 5656, section 3.1.2,
- // The ecdsa_signature_blob value has the following specific encoding:
- // mpint r
- // mpint s
- var ecSig struct {
- R *big.Int
- S *big.Int
- }
-
- if err := Unmarshal(sig.Blob, &ecSig); err != nil {
- return err
- }
-
- if ecdsa.Verify((*ecdsa.PublicKey)(k), digest, ecSig.R, ecSig.S) {
- return nil
- }
- return errors.New("ssh: signature did not verify")
-}
-
-func (k *ecdsaPublicKey) CryptoPublicKey() crypto.PublicKey {
- return (*ecdsa.PublicKey)(k)
-}
-
-// skFields holds the additional fields present in U2F/FIDO2 signatures.
-// See openssh/PROTOCOL.u2f 'SSH U2F Signatures' for details.
-type skFields struct {
- // Flags contains U2F/FIDO2 flags such as 'user present'
- Flags byte
- // Counter is a monotonic signature counter which can be
- // used to detect concurrent use of a private key, should
- // it be extracted from hardware.
- Counter uint32
-}
-
-type skECDSAPublicKey struct {
- // application is a URL-like string, typically "ssh:" for SSH.
- // see openssh/PROTOCOL.u2f for details.
- application string
- ecdsa.PublicKey
-}
-
-func (k *skECDSAPublicKey) Type() string {
- return KeyAlgoSKECDSA256
-}
-
-func (k *skECDSAPublicKey) nistID() string {
- return "nistp256"
-}
-
-func parseSKECDSA(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- Curve string
- KeyBytes []byte
- Application string
- Rest []byte `ssh:"rest"`
- }
-
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- key := new(skECDSAPublicKey)
- key.application = w.Application
-
- if w.Curve != "nistp256" {
- return nil, nil, errors.New("ssh: unsupported curve")
- }
- key.Curve = elliptic.P256()
-
- key.X, key.Y = elliptic.Unmarshal(key.Curve, w.KeyBytes)
- if key.X == nil || key.Y == nil {
- return nil, nil, errors.New("ssh: invalid curve point")
- }
-
- return key, w.Rest, nil
-}
-
-func (k *skECDSAPublicKey) Marshal() []byte {
- // See RFC 5656, section 3.1.
- keyBytes := elliptic.Marshal(k.Curve, k.X, k.Y)
- w := struct {
- Name string
- ID string
- Key []byte
- Application string
- }{
- k.Type(),
- k.nistID(),
- keyBytes,
- k.application,
- }
-
- return Marshal(&w)
-}
-
-func (k *skECDSAPublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
-
- h := hashFuncs[sig.Format].New()
- h.Write([]byte(k.application))
- appDigest := h.Sum(nil)
-
- h.Reset()
- h.Write(data)
- dataDigest := h.Sum(nil)
-
- var ecSig struct {
- R *big.Int
- S *big.Int
- }
- if err := Unmarshal(sig.Blob, &ecSig); err != nil {
- return err
- }
-
- var skf skFields
- if err := Unmarshal(sig.Rest, &skf); err != nil {
- return err
- }
-
- blob := struct {
- ApplicationDigest []byte `ssh:"rest"`
- Flags byte
- Counter uint32
- MessageDigest []byte `ssh:"rest"`
- }{
- appDigest,
- skf.Flags,
- skf.Counter,
- dataDigest,
- }
-
- original := Marshal(blob)
-
- h.Reset()
- h.Write(original)
- digest := h.Sum(nil)
-
- if ecdsa.Verify((*ecdsa.PublicKey)(&k.PublicKey), digest, ecSig.R, ecSig.S) {
- return nil
- }
- return errors.New("ssh: signature did not verify")
-}
-
-func (k *skECDSAPublicKey) CryptoPublicKey() crypto.PublicKey {
- return &k.PublicKey
-}
-
-type skEd25519PublicKey struct {
- // application is a URL-like string, typically "ssh:" for SSH.
- // see openssh/PROTOCOL.u2f for details.
- application string
- ed25519.PublicKey
-}
-
-func (k *skEd25519PublicKey) Type() string {
- return KeyAlgoSKED25519
-}
-
-func parseSKEd25519(in []byte) (out PublicKey, rest []byte, err error) {
- var w struct {
- KeyBytes []byte
- Application string
- Rest []byte `ssh:"rest"`
- }
-
- if err := Unmarshal(in, &w); err != nil {
- return nil, nil, err
- }
-
- if l := len(w.KeyBytes); l != ed25519.PublicKeySize {
- return nil, nil, fmt.Errorf("invalid size %d for Ed25519 public key", l)
- }
-
- key := new(skEd25519PublicKey)
- key.application = w.Application
- key.PublicKey = ed25519.PublicKey(w.KeyBytes)
-
- return key, w.Rest, nil
-}
-
-func (k *skEd25519PublicKey) Marshal() []byte {
- w := struct {
- Name string
- KeyBytes []byte
- Application string
- }{
- KeyAlgoSKED25519,
- []byte(k.PublicKey),
- k.application,
- }
- return Marshal(&w)
-}
-
-func (k *skEd25519PublicKey) Verify(data []byte, sig *Signature) error {
- if sig.Format != k.Type() {
- return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
- }
- if l := len(k.PublicKey); l != ed25519.PublicKeySize {
- return fmt.Errorf("invalid size %d for Ed25519 public key", l)
- }
-
- h := hashFuncs[sig.Format].New()
- h.Write([]byte(k.application))
- appDigest := h.Sum(nil)
-
- h.Reset()
- h.Write(data)
- dataDigest := h.Sum(nil)
-
- var edSig struct {
- Signature []byte `ssh:"rest"`
- }
-
- if err := Unmarshal(sig.Blob, &edSig); err != nil {
- return err
- }
-
- var skf skFields
- if err := Unmarshal(sig.Rest, &skf); err != nil {
- return err
- }
-
- blob := struct {
- ApplicationDigest []byte `ssh:"rest"`
- Flags byte
- Counter uint32
- MessageDigest []byte `ssh:"rest"`
- }{
- appDigest,
- skf.Flags,
- skf.Counter,
- dataDigest,
- }
-
- original := Marshal(blob)
-
- if ok := ed25519.Verify(k.PublicKey, original, edSig.Signature); !ok {
- return errors.New("ssh: signature did not verify")
- }
-
- return nil
-}
-
-func (k *skEd25519PublicKey) CryptoPublicKey() crypto.PublicKey {
- return k.PublicKey
-}
-
-// NewSignerFromKey takes an *rsa.PrivateKey, *dsa.PrivateKey,
-// *ecdsa.PrivateKey or any other crypto.Signer and returns a
-// corresponding Signer instance. ECDSA keys must use P-256, P-384 or
-// P-521. DSA keys must use parameter size L1024N160.
-func NewSignerFromKey(key interface{}) (Signer, error) {
- switch key := key.(type) {
- case crypto.Signer:
- return NewSignerFromSigner(key)
- case *dsa.PrivateKey:
- return newDSAPrivateKey(key)
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", key)
- }
-}
-
-func newDSAPrivateKey(key *dsa.PrivateKey) (Signer, error) {
- if err := checkDSAParams(&key.PublicKey.Parameters); err != nil {
- return nil, err
- }
-
- return &dsaPrivateKey{key}, nil
-}
-
-type wrappedSigner struct {
- signer crypto.Signer
- pubKey PublicKey
-}
-
-// NewSignerFromSigner takes any crypto.Signer implementation and
-// returns a corresponding Signer interface. This can be used, for
-// example, with keys kept in hardware modules.
-func NewSignerFromSigner(signer crypto.Signer) (Signer, error) {
- pubKey, err := NewPublicKey(signer.Public())
- if err != nil {
- return nil, err
- }
-
- return &wrappedSigner{signer, pubKey}, nil
-}
-
-func (s *wrappedSigner) PublicKey() PublicKey {
- return s.pubKey
-}
-
-func (s *wrappedSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
- return s.SignWithAlgorithm(rand, data, s.pubKey.Type())
-}
-
-func (s *wrappedSigner) Algorithms() []string {
- return algorithmsForKeyFormat(s.pubKey.Type())
-}
-
-func (s *wrappedSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
- if algorithm == "" {
- algorithm = s.pubKey.Type()
- }
-
- if !contains(s.Algorithms(), algorithm) {
- return nil, fmt.Errorf("ssh: unsupported signature algorithm %q for key format %q", algorithm, s.pubKey.Type())
- }
-
- hashFunc := hashFuncs[algorithm]
- var digest []byte
- if hashFunc != 0 {
- h := hashFunc.New()
- h.Write(data)
- digest = h.Sum(nil)
- } else {
- digest = data
- }
-
- signature, err := s.signer.Sign(rand, digest, hashFunc)
- if err != nil {
- return nil, err
- }
-
- // crypto.Signer.Sign is expected to return an ASN.1-encoded signature
- // for ECDSA and DSA, but that's not the encoding expected by SSH, so
- // re-encode.
- switch s.pubKey.(type) {
- case *ecdsaPublicKey, *dsaPublicKey:
- type asn1Signature struct {
- R, S *big.Int
- }
- asn1Sig := new(asn1Signature)
- _, err := asn1.Unmarshal(signature, asn1Sig)
- if err != nil {
- return nil, err
- }
-
- switch s.pubKey.(type) {
- case *ecdsaPublicKey:
- signature = Marshal(asn1Sig)
-
- case *dsaPublicKey:
- signature = make([]byte, 40)
- r := asn1Sig.R.Bytes()
- s := asn1Sig.S.Bytes()
- copy(signature[20-len(r):20], r)
- copy(signature[40-len(s):40], s)
- }
- }
-
- return &Signature{
- Format: algorithm,
- Blob: signature,
- }, nil
-}
-
-// NewPublicKey takes an *rsa.PublicKey, *dsa.PublicKey, *ecdsa.PublicKey,
-// or ed25519.PublicKey returns a corresponding PublicKey instance.
-// ECDSA keys must use P-256, P-384 or P-521.
-func NewPublicKey(key interface{}) (PublicKey, error) {
- switch key := key.(type) {
- case *rsa.PublicKey:
- return (*rsaPublicKey)(key), nil
- case *ecdsa.PublicKey:
- if !supportedEllipticCurve(key.Curve) {
- return nil, errors.New("ssh: only P-256, P-384 and P-521 EC keys are supported")
- }
- return (*ecdsaPublicKey)(key), nil
- case *dsa.PublicKey:
- return (*dsaPublicKey)(key), nil
- case ed25519.PublicKey:
- if l := len(key); l != ed25519.PublicKeySize {
- return nil, fmt.Errorf("ssh: invalid size %d for Ed25519 public key", l)
- }
- return ed25519PublicKey(key), nil
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", key)
- }
-}
-
-// ParsePrivateKey returns a Signer from a PEM encoded private key. It supports
-// the same keys as ParseRawPrivateKey. If the private key is encrypted, it
-// will return a PassphraseMissingError.
-func ParsePrivateKey(pemBytes []byte) (Signer, error) {
- key, err := ParseRawPrivateKey(pemBytes)
- if err != nil {
- return nil, err
- }
-
- return NewSignerFromKey(key)
-}
-
-// ParsePrivateKeyWithPassphrase returns a Signer from a PEM encoded private
-// key and passphrase. It supports the same keys as
-// ParseRawPrivateKeyWithPassphrase.
-func ParsePrivateKeyWithPassphrase(pemBytes, passphrase []byte) (Signer, error) {
- key, err := ParseRawPrivateKeyWithPassphrase(pemBytes, passphrase)
- if err != nil {
- return nil, err
- }
-
- return NewSignerFromKey(key)
-}
-
-// encryptedBlock tells whether a private key is
-// encrypted by examining its Proc-Type header
-// for a mention of ENCRYPTED
-// according to RFC 1421 Section 4.6.1.1.
-func encryptedBlock(block *pem.Block) bool {
- return strings.Contains(block.Headers["Proc-Type"], "ENCRYPTED")
-}
-
-// A PassphraseMissingError indicates that parsing this private key requires a
-// passphrase. Use ParsePrivateKeyWithPassphrase.
-type PassphraseMissingError struct {
- // PublicKey will be set if the private key format includes an unencrypted
- // public key along with the encrypted private key.
- PublicKey PublicKey
-}
-
-func (*PassphraseMissingError) Error() string {
- return "ssh: this private key is passphrase protected"
-}
-
-// ParseRawPrivateKey returns a private key from a PEM encoded private key. It supports
-// RSA, DSA, ECDSA, and Ed25519 private keys in PKCS#1, PKCS#8, OpenSSL, and OpenSSH
-// formats. If the private key is encrypted, it will return a PassphraseMissingError.
-func ParseRawPrivateKey(pemBytes []byte) (interface{}, error) {
- block, _ := pem.Decode(pemBytes)
- if block == nil {
- return nil, errors.New("ssh: no key found")
- }
-
- if encryptedBlock(block) {
- return nil, &PassphraseMissingError{}
- }
-
- switch block.Type {
- case "RSA PRIVATE KEY":
- return x509.ParsePKCS1PrivateKey(block.Bytes)
- // RFC5208 - https://tools.ietf.org/html/rfc5208
- case "PRIVATE KEY":
- return x509.ParsePKCS8PrivateKey(block.Bytes)
- case "EC PRIVATE KEY":
- return x509.ParseECPrivateKey(block.Bytes)
- case "DSA PRIVATE KEY":
- return ParseDSAPrivateKey(block.Bytes)
- case "OPENSSH PRIVATE KEY":
- return parseOpenSSHPrivateKey(block.Bytes, unencryptedOpenSSHKey)
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %q", block.Type)
- }
-}
-
-// ParseRawPrivateKeyWithPassphrase returns a private key decrypted with
-// passphrase from a PEM encoded private key. If the passphrase is wrong, it
-// will return x509.IncorrectPasswordError.
-func ParseRawPrivateKeyWithPassphrase(pemBytes, passphrase []byte) (interface{}, error) {
- block, _ := pem.Decode(pemBytes)
- if block == nil {
- return nil, errors.New("ssh: no key found")
- }
-
- if block.Type == "OPENSSH PRIVATE KEY" {
- return parseOpenSSHPrivateKey(block.Bytes, passphraseProtectedOpenSSHKey(passphrase))
- }
-
- if !encryptedBlock(block) || !x509.IsEncryptedPEMBlock(block) {
- return nil, errors.New("ssh: not an encrypted key")
- }
-
- buf, err := x509.DecryptPEMBlock(block, passphrase)
- if err != nil {
- if err == x509.IncorrectPasswordError {
- return nil, err
- }
- return nil, fmt.Errorf("ssh: cannot decode encrypted private keys: %v", err)
- }
-
- var result interface{}
-
- switch block.Type {
- case "RSA PRIVATE KEY":
- result, err = x509.ParsePKCS1PrivateKey(buf)
- case "EC PRIVATE KEY":
- result, err = x509.ParseECPrivateKey(buf)
- case "DSA PRIVATE KEY":
- result, err = ParseDSAPrivateKey(buf)
- default:
- err = fmt.Errorf("ssh: unsupported key type %q", block.Type)
- }
- // Because of deficiencies in the format, DecryptPEMBlock does not always
- // detect an incorrect password. In these cases decrypted DER bytes is
- // random noise. If the parsing of the key returns an asn1.StructuralError
- // we return x509.IncorrectPasswordError.
- if _, ok := err.(asn1.StructuralError); ok {
- return nil, x509.IncorrectPasswordError
- }
-
- return result, err
-}
-
-// ParseDSAPrivateKey returns a DSA private key from its ASN.1 DER encoding, as
-// specified by the OpenSSL DSA man page.
-func ParseDSAPrivateKey(der []byte) (*dsa.PrivateKey, error) {
- var k struct {
- Version int
- P *big.Int
- Q *big.Int
- G *big.Int
- Pub *big.Int
- Priv *big.Int
- }
- rest, err := asn1.Unmarshal(der, &k)
- if err != nil {
- return nil, errors.New("ssh: failed to parse DSA key: " + err.Error())
- }
- if len(rest) > 0 {
- return nil, errors.New("ssh: garbage after DSA key")
- }
-
- return &dsa.PrivateKey{
- PublicKey: dsa.PublicKey{
- Parameters: dsa.Parameters{
- P: k.P,
- Q: k.Q,
- G: k.G,
- },
- Y: k.Pub,
- },
- X: k.Priv,
- }, nil
-}
-
-func unencryptedOpenSSHKey(cipherName, kdfName, kdfOpts string, privKeyBlock []byte) ([]byte, error) {
- if kdfName != "none" || cipherName != "none" {
- return nil, &PassphraseMissingError{}
- }
- if kdfOpts != "" {
- return nil, errors.New("ssh: invalid openssh private key")
- }
- return privKeyBlock, nil
-}
-
-func passphraseProtectedOpenSSHKey(passphrase []byte) openSSHDecryptFunc {
- return func(cipherName, kdfName, kdfOpts string, privKeyBlock []byte) ([]byte, error) {
- if kdfName == "none" || cipherName == "none" {
- return nil, errors.New("ssh: key is not password protected")
- }
- if kdfName != "bcrypt" {
- return nil, fmt.Errorf("ssh: unknown KDF %q, only supports %q", kdfName, "bcrypt")
- }
-
- var opts struct {
- Salt string
- Rounds uint32
- }
- if err := Unmarshal([]byte(kdfOpts), &opts); err != nil {
- return nil, err
- }
-
- k, err := bcrypt_pbkdf.Key(passphrase, []byte(opts.Salt), int(opts.Rounds), 32+16)
- if err != nil {
- return nil, err
- }
- key, iv := k[:32], k[32:]
-
- c, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
- switch cipherName {
- case "aes256-ctr":
- ctr := cipher.NewCTR(c, iv)
- ctr.XORKeyStream(privKeyBlock, privKeyBlock)
- case "aes256-cbc":
- if len(privKeyBlock)%c.BlockSize() != 0 {
- return nil, fmt.Errorf("ssh: invalid encrypted private key length, not a multiple of the block size")
- }
- cbc := cipher.NewCBCDecrypter(c, iv)
- cbc.CryptBlocks(privKeyBlock, privKeyBlock)
- default:
- return nil, fmt.Errorf("ssh: unknown cipher %q, only supports %q or %q", cipherName, "aes256-ctr", "aes256-cbc")
- }
-
- return privKeyBlock, nil
- }
-}
-
-func unencryptedOpenSSHMarshaler(privKeyBlock []byte) ([]byte, string, string, string, error) {
- key := generateOpenSSHPadding(privKeyBlock, 8)
- return key, "none", "none", "", nil
-}
-
-func passphraseProtectedOpenSSHMarshaler(passphrase []byte) openSSHEncryptFunc {
- return func(privKeyBlock []byte) ([]byte, string, string, string, error) {
- salt := make([]byte, 16)
- if _, err := rand.Read(salt); err != nil {
- return nil, "", "", "", err
- }
-
- opts := struct {
- Salt []byte
- Rounds uint32
- }{salt, 16}
-
- // Derive key to encrypt the private key block.
- k, err := bcrypt_pbkdf.Key(passphrase, salt, int(opts.Rounds), 32+aes.BlockSize)
- if err != nil {
- return nil, "", "", "", err
- }
-
- // Add padding matching the block size of AES.
- keyBlock := generateOpenSSHPadding(privKeyBlock, aes.BlockSize)
-
- // Encrypt the private key using the derived secret.
-
- dst := make([]byte, len(keyBlock))
- key, iv := k[:32], k[32:]
- block, err := aes.NewCipher(key)
- if err != nil {
- return nil, "", "", "", err
- }
-
- stream := cipher.NewCTR(block, iv)
- stream.XORKeyStream(dst, keyBlock)
-
- return dst, "aes256-ctr", "bcrypt", string(Marshal(opts)), nil
- }
-}
-
-const privateKeyAuthMagic = "openssh-key-v1\x00"
-
-type openSSHDecryptFunc func(CipherName, KdfName, KdfOpts string, PrivKeyBlock []byte) ([]byte, error)
-type openSSHEncryptFunc func(PrivKeyBlock []byte) (ProtectedKeyBlock []byte, cipherName, kdfName, kdfOptions string, err error)
-
-type openSSHEncryptedPrivateKey struct {
- CipherName string
- KdfName string
- KdfOpts string
- NumKeys uint32
- PubKey []byte
- PrivKeyBlock []byte
-}
-
-type openSSHPrivateKey struct {
- Check1 uint32
- Check2 uint32
- Keytype string
- Rest []byte `ssh:"rest"`
-}
-
-type openSSHRSAPrivateKey struct {
- N *big.Int
- E *big.Int
- D *big.Int
- Iqmp *big.Int
- P *big.Int
- Q *big.Int
- Comment string
- Pad []byte `ssh:"rest"`
-}
-
-type openSSHEd25519PrivateKey struct {
- Pub []byte
- Priv []byte
- Comment string
- Pad []byte `ssh:"rest"`
-}
-
-type openSSHECDSAPrivateKey struct {
- Curve string
- Pub []byte
- D *big.Int
- Comment string
- Pad []byte `ssh:"rest"`
-}
-
-// parseOpenSSHPrivateKey parses an OpenSSH private key, using the decrypt
-// function to unwrap the encrypted portion. unencryptedOpenSSHKey can be used
-// as the decrypt function to parse an unencrypted private key. See
-// https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key.
-func parseOpenSSHPrivateKey(key []byte, decrypt openSSHDecryptFunc) (crypto.PrivateKey, error) {
- if len(key) < len(privateKeyAuthMagic) || string(key[:len(privateKeyAuthMagic)]) != privateKeyAuthMagic {
- return nil, errors.New("ssh: invalid openssh private key format")
- }
- remaining := key[len(privateKeyAuthMagic):]
-
- var w openSSHEncryptedPrivateKey
- if err := Unmarshal(remaining, &w); err != nil {
- return nil, err
- }
- if w.NumKeys != 1 {
- // We only support single key files, and so does OpenSSH.
- // https://github.com/openssh/openssh-portable/blob/4103a3ec7/sshkey.c#L4171
- return nil, errors.New("ssh: multi-key files are not supported")
- }
-
- privKeyBlock, err := decrypt(w.CipherName, w.KdfName, w.KdfOpts, w.PrivKeyBlock)
- if err != nil {
- if err, ok := err.(*PassphraseMissingError); ok {
- pub, errPub := ParsePublicKey(w.PubKey)
- if errPub != nil {
- return nil, fmt.Errorf("ssh: failed to parse embedded public key: %v", errPub)
- }
- err.PublicKey = pub
- }
- return nil, err
- }
-
- var pk1 openSSHPrivateKey
- if err := Unmarshal(privKeyBlock, &pk1); err != nil || pk1.Check1 != pk1.Check2 {
- if w.CipherName != "none" {
- return nil, x509.IncorrectPasswordError
- }
- return nil, errors.New("ssh: malformed OpenSSH key")
- }
-
- switch pk1.Keytype {
- case KeyAlgoRSA:
- var key openSSHRSAPrivateKey
- if err := Unmarshal(pk1.Rest, &key); err != nil {
- return nil, err
- }
-
- if err := checkOpenSSHKeyPadding(key.Pad); err != nil {
- return nil, err
- }
-
- pk := &rsa.PrivateKey{
- PublicKey: rsa.PublicKey{
- N: key.N,
- E: int(key.E.Int64()),
- },
- D: key.D,
- Primes: []*big.Int{key.P, key.Q},
- }
-
- if err := pk.Validate(); err != nil {
- return nil, err
- }
-
- pk.Precompute()
-
- return pk, nil
- case KeyAlgoED25519:
- var key openSSHEd25519PrivateKey
- if err := Unmarshal(pk1.Rest, &key); err != nil {
- return nil, err
- }
-
- if len(key.Priv) != ed25519.PrivateKeySize {
- return nil, errors.New("ssh: private key unexpected length")
- }
-
- if err := checkOpenSSHKeyPadding(key.Pad); err != nil {
- return nil, err
- }
-
- pk := ed25519.PrivateKey(make([]byte, ed25519.PrivateKeySize))
- copy(pk, key.Priv)
- return &pk, nil
- case KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521:
- var key openSSHECDSAPrivateKey
- if err := Unmarshal(pk1.Rest, &key); err != nil {
- return nil, err
- }
-
- if err := checkOpenSSHKeyPadding(key.Pad); err != nil {
- return nil, err
- }
-
- var curve elliptic.Curve
- switch key.Curve {
- case "nistp256":
- curve = elliptic.P256()
- case "nistp384":
- curve = elliptic.P384()
- case "nistp521":
- curve = elliptic.P521()
- default:
- return nil, errors.New("ssh: unhandled elliptic curve: " + key.Curve)
- }
-
- X, Y := elliptic.Unmarshal(curve, key.Pub)
- if X == nil || Y == nil {
- return nil, errors.New("ssh: failed to unmarshal public key")
- }
-
- if key.D.Cmp(curve.Params().N) >= 0 {
- return nil, errors.New("ssh: scalar is out of range")
- }
-
- x, y := curve.ScalarBaseMult(key.D.Bytes())
- if x.Cmp(X) != 0 || y.Cmp(Y) != 0 {
- return nil, errors.New("ssh: public key does not match private key")
- }
-
- return &ecdsa.PrivateKey{
- PublicKey: ecdsa.PublicKey{
- Curve: curve,
- X: X,
- Y: Y,
- },
- D: key.D,
- }, nil
- default:
- return nil, errors.New("ssh: unhandled key type")
- }
-}
-
-func marshalOpenSSHPrivateKey(key crypto.PrivateKey, comment string, encrypt openSSHEncryptFunc) (*pem.Block, error) {
- var w openSSHEncryptedPrivateKey
- var pk1 openSSHPrivateKey
-
- // Random check bytes.
- var check uint32
- if err := binary.Read(rand.Reader, binary.BigEndian, &check); err != nil {
- return nil, err
- }
-
- pk1.Check1 = check
- pk1.Check2 = check
- w.NumKeys = 1
-
- // Use a []byte directly on ed25519 keys.
- if k, ok := key.(*ed25519.PrivateKey); ok {
- key = *k
- }
-
- switch k := key.(type) {
- case *rsa.PrivateKey:
- E := new(big.Int).SetInt64(int64(k.PublicKey.E))
- // Marshal public key:
- // E and N are in reversed order in the public and private key.
- pubKey := struct {
- KeyType string
- E *big.Int
- N *big.Int
- }{
- KeyAlgoRSA,
- E, k.PublicKey.N,
- }
- w.PubKey = Marshal(pubKey)
-
- // Marshal private key.
- key := openSSHRSAPrivateKey{
- N: k.PublicKey.N,
- E: E,
- D: k.D,
- Iqmp: k.Precomputed.Qinv,
- P: k.Primes[0],
- Q: k.Primes[1],
- Comment: comment,
- }
- pk1.Keytype = KeyAlgoRSA
- pk1.Rest = Marshal(key)
- case ed25519.PrivateKey:
- pub := make([]byte, ed25519.PublicKeySize)
- priv := make([]byte, ed25519.PrivateKeySize)
- copy(pub, k[32:])
- copy(priv, k)
-
- // Marshal public key.
- pubKey := struct {
- KeyType string
- Pub []byte
- }{
- KeyAlgoED25519, pub,
- }
- w.PubKey = Marshal(pubKey)
-
- // Marshal private key.
- key := openSSHEd25519PrivateKey{
- Pub: pub,
- Priv: priv,
- Comment: comment,
- }
- pk1.Keytype = KeyAlgoED25519
- pk1.Rest = Marshal(key)
- case *ecdsa.PrivateKey:
- var curve, keyType string
- switch name := k.Curve.Params().Name; name {
- case "P-256":
- curve = "nistp256"
- keyType = KeyAlgoECDSA256
- case "P-384":
- curve = "nistp384"
- keyType = KeyAlgoECDSA384
- case "P-521":
- curve = "nistp521"
- keyType = KeyAlgoECDSA521
- default:
- return nil, errors.New("ssh: unhandled elliptic curve " + name)
- }
-
- pub := elliptic.Marshal(k.Curve, k.PublicKey.X, k.PublicKey.Y)
-
- // Marshal public key.
- pubKey := struct {
- KeyType string
- Curve string
- Pub []byte
- }{
- keyType, curve, pub,
- }
- w.PubKey = Marshal(pubKey)
-
- // Marshal private key.
- key := openSSHECDSAPrivateKey{
- Curve: curve,
- Pub: pub,
- D: k.D,
- Comment: comment,
- }
- pk1.Keytype = keyType
- pk1.Rest = Marshal(key)
- default:
- return nil, fmt.Errorf("ssh: unsupported key type %T", k)
- }
-
- var err error
- // Add padding and encrypt the key if necessary.
- w.PrivKeyBlock, w.CipherName, w.KdfName, w.KdfOpts, err = encrypt(Marshal(pk1))
- if err != nil {
- return nil, err
- }
-
- b := Marshal(w)
- block := &pem.Block{
- Type: "OPENSSH PRIVATE KEY",
- Bytes: append([]byte(privateKeyAuthMagic), b...),
- }
- return block, nil
-}
-
-func checkOpenSSHKeyPadding(pad []byte) error {
- for i, b := range pad {
- if int(b) != i+1 {
- return errors.New("ssh: padding not as expected")
- }
- }
- return nil
-}
-
-func generateOpenSSHPadding(block []byte, blockSize int) []byte {
- for i, l := 0, len(block); (l+i)%blockSize != 0; i++ {
- block = append(block, byte(i+1))
- }
- return block
-}
-
-// FingerprintLegacyMD5 returns the user presentation of the key's
-// fingerprint as described by RFC 4716 section 4.
-func FingerprintLegacyMD5(pubKey PublicKey) string {
- md5sum := md5.Sum(pubKey.Marshal())
- hexarray := make([]string, len(md5sum))
- for i, c := range md5sum {
- hexarray[i] = hex.EncodeToString([]byte{c})
- }
- return strings.Join(hexarray, ":")
-}
-
-// FingerprintSHA256 returns the user presentation of the key's
-// fingerprint as unpadded base64 encoded sha256 hash.
-// This format was introduced from OpenSSH 6.8.
-// https://www.openssh.com/txt/release-6.8
-// https://tools.ietf.org/html/rfc4648#section-3.2 (unpadded base64 encoding)
-func FingerprintSHA256(pubKey PublicKey) string {
- sha256sum := sha256.Sum256(pubKey.Marshal())
- hash := base64.RawStdEncoding.EncodeToString(sha256sum[:])
- return "SHA256:" + hash
-}
diff --git a/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go b/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go
deleted file mode 100644
index 7376a8dff..000000000
--- a/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go
+++ /dev/null
@@ -1,540 +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 knownhosts implements a parser for the OpenSSH known_hosts
-// host key database, and provides utility functions for writing
-// OpenSSH compliant known_hosts files.
-package knownhosts
-
-import (
- "bufio"
- "bytes"
- "crypto/hmac"
- "crypto/rand"
- "crypto/sha1"
- "encoding/base64"
- "errors"
- "fmt"
- "io"
- "net"
- "os"
- "strings"
-
- "golang.org/x/crypto/ssh"
-)
-
-// See the sshd manpage
-// (http://man.openbsd.org/sshd#SSH_KNOWN_HOSTS_FILE_FORMAT) for
-// background.
-
-type addr struct{ host, port string }
-
-func (a *addr) String() string {
- h := a.host
- if strings.Contains(h, ":") {
- h = "[" + h + "]"
- }
- return h + ":" + a.port
-}
-
-type matcher interface {
- match(addr) bool
-}
-
-type hostPattern struct {
- negate bool
- addr addr
-}
-
-func (p *hostPattern) String() string {
- n := ""
- if p.negate {
- n = "!"
- }
-
- return n + p.addr.String()
-}
-
-type hostPatterns []hostPattern
-
-func (ps hostPatterns) match(a addr) bool {
- matched := false
- for _, p := range ps {
- if !p.match(a) {
- continue
- }
- if p.negate {
- return false
- }
- matched = true
- }
- return matched
-}
-
-// See
-// https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/addrmatch.c
-// The matching of * has no regard for separators, unlike filesystem globs
-func wildcardMatch(pat []byte, str []byte) bool {
- for {
- if len(pat) == 0 {
- return len(str) == 0
- }
- if len(str) == 0 {
- return false
- }
-
- if pat[0] == '*' {
- if len(pat) == 1 {
- return true
- }
-
- for j := range str {
- if wildcardMatch(pat[1:], str[j:]) {
- return true
- }
- }
- return false
- }
-
- if pat[0] == '?' || pat[0] == str[0] {
- pat = pat[1:]
- str = str[1:]
- } else {
- return false
- }
- }
-}
-
-func (p *hostPattern) match(a addr) bool {
- return wildcardMatch([]byte(p.addr.host), []byte(a.host)) && p.addr.port == a.port
-}
-
-type keyDBLine struct {
- cert bool
- matcher matcher
- knownKey KnownKey
-}
-
-func serialize(k ssh.PublicKey) string {
- return k.Type() + " " + base64.StdEncoding.EncodeToString(k.Marshal())
-}
-
-func (l *keyDBLine) match(a addr) bool {
- return l.matcher.match(a)
-}
-
-type hostKeyDB struct {
- // Serialized version of revoked keys
- revoked map[string]*KnownKey
- lines []keyDBLine
-}
-
-func newHostKeyDB() *hostKeyDB {
- db := &hostKeyDB{
- revoked: make(map[string]*KnownKey),
- }
-
- return db
-}
-
-func keyEq(a, b ssh.PublicKey) bool {
- return bytes.Equal(a.Marshal(), b.Marshal())
-}
-
-// IsHostAuthority can be used as a callback in ssh.CertChecker
-func (db *hostKeyDB) IsHostAuthority(remote ssh.PublicKey, address string) bool {
- h, p, err := net.SplitHostPort(address)
- if err != nil {
- return false
- }
- a := addr{host: h, port: p}
-
- for _, l := range db.lines {
- if l.cert && keyEq(l.knownKey.Key, remote) && l.match(a) {
- return true
- }
- }
- return false
-}
-
-// IsRevoked can be used as a callback in ssh.CertChecker
-func (db *hostKeyDB) IsRevoked(key *ssh.Certificate) bool {
- _, ok := db.revoked[string(key.Marshal())]
- return ok
-}
-
-const markerCert = "@cert-authority"
-const markerRevoked = "@revoked"
-
-func nextWord(line []byte) (string, []byte) {
- i := bytes.IndexAny(line, "\t ")
- if i == -1 {
- return string(line), nil
- }
-
- return string(line[:i]), bytes.TrimSpace(line[i:])
-}
-
-func parseLine(line []byte) (marker, host string, key ssh.PublicKey, err error) {
- if w, next := nextWord(line); w == markerCert || w == markerRevoked {
- marker = w
- line = next
- }
-
- host, line = nextWord(line)
- if len(line) == 0 {
- return "", "", nil, errors.New("knownhosts: missing host pattern")
- }
-
- // ignore the keytype as it's in the key blob anyway.
- _, line = nextWord(line)
- if len(line) == 0 {
- return "", "", nil, errors.New("knownhosts: missing key type pattern")
- }
-
- keyBlob, _ := nextWord(line)
-
- keyBytes, err := base64.StdEncoding.DecodeString(keyBlob)
- if err != nil {
- return "", "", nil, err
- }
- key, err = ssh.ParsePublicKey(keyBytes)
- if err != nil {
- return "", "", nil, err
- }
-
- return marker, host, key, nil
-}
-
-func (db *hostKeyDB) parseLine(line []byte, filename string, linenum int) error {
- marker, pattern, key, err := parseLine(line)
- if err != nil {
- return err
- }
-
- if marker == markerRevoked {
- db.revoked[string(key.Marshal())] = &KnownKey{
- Key: key,
- Filename: filename,
- Line: linenum,
- }
-
- return nil
- }
-
- entry := keyDBLine{
- cert: marker == markerCert,
- knownKey: KnownKey{
- Filename: filename,
- Line: linenum,
- Key: key,
- },
- }
-
- if pattern[0] == '|' {
- entry.matcher, err = newHashedHost(pattern)
- } else {
- entry.matcher, err = newHostnameMatcher(pattern)
- }
-
- if err != nil {
- return err
- }
-
- db.lines = append(db.lines, entry)
- return nil
-}
-
-func newHostnameMatcher(pattern string) (matcher, error) {
- var hps hostPatterns
- for _, p := range strings.Split(pattern, ",") {
- if len(p) == 0 {
- continue
- }
-
- var a addr
- var negate bool
- if p[0] == '!' {
- negate = true
- p = p[1:]
- }
-
- if len(p) == 0 {
- return nil, errors.New("knownhosts: negation without following hostname")
- }
-
- var err error
- if p[0] == '[' {
- a.host, a.port, err = net.SplitHostPort(p)
- if err != nil {
- return nil, err
- }
- } else {
- a.host, a.port, err = net.SplitHostPort(p)
- if err != nil {
- a.host = p
- a.port = "22"
- }
- }
- hps = append(hps, hostPattern{
- negate: negate,
- addr: a,
- })
- }
- return hps, nil
-}
-
-// KnownKey represents a key declared in a known_hosts file.
-type KnownKey struct {
- Key ssh.PublicKey
- Filename string
- Line int
-}
-
-func (k *KnownKey) String() string {
- return fmt.Sprintf("%s:%d: %s", k.Filename, k.Line, serialize(k.Key))
-}
-
-// KeyError is returned if we did not find the key in the host key
-// database, or there was a mismatch. Typically, in batch
-// applications, this should be interpreted as failure. Interactive
-// applications can offer an interactive prompt to the user.
-type KeyError struct {
- // Want holds the accepted host keys. For each key algorithm,
- // there can be one hostkey. If Want is empty, the host is
- // unknown. If Want is non-empty, there was a mismatch, which
- // can signify a MITM attack.
- Want []KnownKey
-}
-
-func (u *KeyError) Error() string {
- if len(u.Want) == 0 {
- return "knownhosts: key is unknown"
- }
- return "knownhosts: key mismatch"
-}
-
-// RevokedError is returned if we found a key that was revoked.
-type RevokedError struct {
- Revoked KnownKey
-}
-
-func (r *RevokedError) Error() string {
- return "knownhosts: key is revoked"
-}
-
-// check checks a key against the host database. This should not be
-// used for verifying certificates.
-func (db *hostKeyDB) check(address string, remote net.Addr, remoteKey ssh.PublicKey) error {
- if revoked := db.revoked[string(remoteKey.Marshal())]; revoked != nil {
- return &RevokedError{Revoked: *revoked}
- }
-
- host, port, err := net.SplitHostPort(remote.String())
- if err != nil {
- return fmt.Errorf("knownhosts: SplitHostPort(%s): %v", remote, err)
- }
-
- hostToCheck := addr{host, port}
- if address != "" {
- // Give preference to the hostname if available.
- host, port, err := net.SplitHostPort(address)
- if err != nil {
- return fmt.Errorf("knownhosts: SplitHostPort(%s): %v", address, err)
- }
-
- hostToCheck = addr{host, port}
- }
-
- return db.checkAddr(hostToCheck, remoteKey)
-}
-
-// checkAddr checks if we can find the given public key for the
-// given address. If we only find an entry for the IP address,
-// or only the hostname, then this still succeeds.
-func (db *hostKeyDB) checkAddr(a addr, remoteKey ssh.PublicKey) error {
- // TODO(hanwen): are these the right semantics? What if there
- // is just a key for the IP address, but not for the
- // hostname?
-
- // Algorithm => key.
- knownKeys := map[string]KnownKey{}
- for _, l := range db.lines {
- if l.match(a) {
- typ := l.knownKey.Key.Type()
- if _, ok := knownKeys[typ]; !ok {
- knownKeys[typ] = l.knownKey
- }
- }
- }
-
- keyErr := &KeyError{}
- for _, v := range knownKeys {
- keyErr.Want = append(keyErr.Want, v)
- }
-
- // Unknown remote host.
- if len(knownKeys) == 0 {
- return keyErr
- }
-
- // If the remote host starts using a different, unknown key type, we
- // also interpret that as a mismatch.
- if known, ok := knownKeys[remoteKey.Type()]; !ok || !keyEq(known.Key, remoteKey) {
- return keyErr
- }
-
- return nil
-}
-
-// The Read function parses file contents.
-func (db *hostKeyDB) Read(r io.Reader, filename string) error {
- scanner := bufio.NewScanner(r)
-
- lineNum := 0
- for scanner.Scan() {
- lineNum++
- line := scanner.Bytes()
- line = bytes.TrimSpace(line)
- if len(line) == 0 || line[0] == '#' {
- continue
- }
-
- if err := db.parseLine(line, filename, lineNum); err != nil {
- return fmt.Errorf("knownhosts: %s:%d: %v", filename, lineNum, err)
- }
- }
- return scanner.Err()
-}
-
-// New creates a host key callback from the given OpenSSH host key
-// files. The returned callback is for use in
-// ssh.ClientConfig.HostKeyCallback. By preference, the key check
-// operates on the hostname if available, i.e. if a server changes its
-// IP address, the host key check will still succeed, even though a
-// record of the new IP address is not available.
-func New(files ...string) (ssh.HostKeyCallback, error) {
- db := newHostKeyDB()
- for _, fn := range files {
- f, err := os.Open(fn)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- if err := db.Read(f, fn); err != nil {
- return nil, err
- }
- }
-
- var certChecker ssh.CertChecker
- certChecker.IsHostAuthority = db.IsHostAuthority
- certChecker.IsRevoked = db.IsRevoked
- certChecker.HostKeyFallback = db.check
-
- return certChecker.CheckHostKey, nil
-}
-
-// Normalize normalizes an address into the form used in known_hosts
-func Normalize(address string) string {
- host, port, err := net.SplitHostPort(address)
- if err != nil {
- host = address
- port = "22"
- }
- entry := host
- if port != "22" {
- entry = "[" + entry + "]:" + port
- } else if strings.Contains(host, ":") && !strings.HasPrefix(host, "[") {
- entry = "[" + entry + "]"
- }
- return entry
-}
-
-// Line returns a line to add append to the known_hosts files.
-func Line(addresses []string, key ssh.PublicKey) string {
- var trimmed []string
- for _, a := range addresses {
- trimmed = append(trimmed, Normalize(a))
- }
-
- return strings.Join(trimmed, ",") + " " + serialize(key)
-}
-
-// HashHostname hashes the given hostname. The hostname is not
-// normalized before hashing.
-func HashHostname(hostname string) string {
- // TODO(hanwen): check if we can safely normalize this always.
- salt := make([]byte, sha1.Size)
-
- _, err := rand.Read(salt)
- if err != nil {
- panic(fmt.Sprintf("crypto/rand failure %v", err))
- }
-
- hash := hashHost(hostname, salt)
- return encodeHash(sha1HashType, salt, hash)
-}
-
-func decodeHash(encoded string) (hashType string, salt, hash []byte, err error) {
- if len(encoded) == 0 || encoded[0] != '|' {
- err = errors.New("knownhosts: hashed host must start with '|'")
- return
- }
- components := strings.Split(encoded, "|")
- if len(components) != 4 {
- err = fmt.Errorf("knownhosts: got %d components, want 3", len(components))
- return
- }
-
- hashType = components[1]
- if salt, err = base64.StdEncoding.DecodeString(components[2]); err != nil {
- return
- }
- if hash, err = base64.StdEncoding.DecodeString(components[3]); err != nil {
- return
- }
- return
-}
-
-func encodeHash(typ string, salt []byte, hash []byte) string {
- return strings.Join([]string{"",
- typ,
- base64.StdEncoding.EncodeToString(salt),
- base64.StdEncoding.EncodeToString(hash),
- }, "|")
-}
-
-// See https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/hostfile.c#120
-func hashHost(hostname string, salt []byte) []byte {
- mac := hmac.New(sha1.New, salt)
- mac.Write([]byte(hostname))
- return mac.Sum(nil)
-}
-
-type hashedHost struct {
- salt []byte
- hash []byte
-}
-
-const sha1HashType = "1"
-
-func newHashedHost(encoded string) (*hashedHost, error) {
- typ, salt, hash, err := decodeHash(encoded)
- if err != nil {
- return nil, err
- }
-
- // The type field seems for future algorithm agility, but it's
- // actually hardcoded in openssh currently, see
- // https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/hostfile.c#120
- if typ != sha1HashType {
- return nil, fmt.Errorf("knownhosts: got hash type %s, must be '1'", typ)
- }
-
- return &hashedHost{salt: salt, hash: hash}, nil
-}
-
-func (h *hashedHost) match(a addr) bool {
- return bytes.Equal(hashHost(Normalize(a.String()), h.salt), h.hash)
-}
diff --git a/vendor/golang.org/x/crypto/ssh/mac.go b/vendor/golang.org/x/crypto/ssh/mac.go
deleted file mode 100644
index 06a1b2750..000000000
--- a/vendor/golang.org/x/crypto/ssh/mac.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Message authentication support
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "crypto/sha256"
- "crypto/sha512"
- "hash"
-)
-
-type macMode struct {
- keySize int
- etm bool
- new func(key []byte) hash.Hash
-}
-
-// truncatingMAC wraps around a hash.Hash and truncates the output digest to
-// a given size.
-type truncatingMAC struct {
- length int
- hmac hash.Hash
-}
-
-func (t truncatingMAC) Write(data []byte) (int, error) {
- return t.hmac.Write(data)
-}
-
-func (t truncatingMAC) Sum(in []byte) []byte {
- out := t.hmac.Sum(in)
- return out[:len(in)+t.length]
-}
-
-func (t truncatingMAC) Reset() {
- t.hmac.Reset()
-}
-
-func (t truncatingMAC) Size() int {
- return t.length
-}
-
-func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() }
-
-var macModes = map[string]*macMode{
- "hmac-sha2-512-etm@openssh.com": {64, true, func(key []byte) hash.Hash {
- return hmac.New(sha512.New, key)
- }},
- "hmac-sha2-256-etm@openssh.com": {32, true, func(key []byte) hash.Hash {
- return hmac.New(sha256.New, key)
- }},
- "hmac-sha2-512": {64, false, func(key []byte) hash.Hash {
- return hmac.New(sha512.New, key)
- }},
- "hmac-sha2-256": {32, false, func(key []byte) hash.Hash {
- return hmac.New(sha256.New, key)
- }},
- "hmac-sha1": {20, false, func(key []byte) hash.Hash {
- return hmac.New(sha1.New, key)
- }},
- "hmac-sha1-96": {20, false, func(key []byte) hash.Hash {
- return truncatingMAC{12, hmac.New(sha1.New, key)}
- }},
-}
diff --git a/vendor/golang.org/x/crypto/ssh/messages.go b/vendor/golang.org/x/crypto/ssh/messages.go
deleted file mode 100644
index b55f86056..000000000
--- a/vendor/golang.org/x/crypto/ssh/messages.go
+++ /dev/null
@@ -1,891 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "math/big"
- "reflect"
- "strconv"
- "strings"
-)
-
-// These are SSH message type numbers. They are scattered around several
-// documents but many were taken from [SSH-PARAMETERS].
-const (
- msgIgnore = 2
- msgUnimplemented = 3
- msgDebug = 4
- msgNewKeys = 21
-)
-
-// SSH messages:
-//
-// These structures mirror the wire format of the corresponding SSH messages.
-// They are marshaled using reflection with the marshal and unmarshal functions
-// in this file. The only wrinkle is that a final member of type []byte with a
-// ssh tag of "rest" receives the remainder of a packet when unmarshaling.
-
-// See RFC 4253, section 11.1.
-const msgDisconnect = 1
-
-// disconnectMsg is the message that signals a disconnect. It is also
-// the error type returned from mux.Wait()
-type disconnectMsg struct {
- Reason uint32 `sshtype:"1"`
- Message string
- Language string
-}
-
-func (d *disconnectMsg) Error() string {
- return fmt.Sprintf("ssh: disconnect, reason %d: %s", d.Reason, d.Message)
-}
-
-// See RFC 4253, section 7.1.
-const msgKexInit = 20
-
-type kexInitMsg struct {
- Cookie [16]byte `sshtype:"20"`
- KexAlgos []string
- ServerHostKeyAlgos []string
- CiphersClientServer []string
- CiphersServerClient []string
- MACsClientServer []string
- MACsServerClient []string
- CompressionClientServer []string
- CompressionServerClient []string
- LanguagesClientServer []string
- LanguagesServerClient []string
- FirstKexFollows bool
- Reserved uint32
-}
-
-// See RFC 4253, section 8.
-
-// Diffie-Hellman
-const msgKexDHInit = 30
-
-type kexDHInitMsg struct {
- X *big.Int `sshtype:"30"`
-}
-
-const msgKexECDHInit = 30
-
-type kexECDHInitMsg struct {
- ClientPubKey []byte `sshtype:"30"`
-}
-
-const msgKexECDHReply = 31
-
-type kexECDHReplyMsg struct {
- HostKey []byte `sshtype:"31"`
- EphemeralPubKey []byte
- Signature []byte
-}
-
-const msgKexDHReply = 31
-
-type kexDHReplyMsg struct {
- HostKey []byte `sshtype:"31"`
- Y *big.Int
- Signature []byte
-}
-
-// See RFC 4419, section 5.
-const msgKexDHGexGroup = 31
-
-type kexDHGexGroupMsg struct {
- P *big.Int `sshtype:"31"`
- G *big.Int
-}
-
-const msgKexDHGexInit = 32
-
-type kexDHGexInitMsg struct {
- X *big.Int `sshtype:"32"`
-}
-
-const msgKexDHGexReply = 33
-
-type kexDHGexReplyMsg struct {
- HostKey []byte `sshtype:"33"`
- Y *big.Int
- Signature []byte
-}
-
-const msgKexDHGexRequest = 34
-
-type kexDHGexRequestMsg struct {
- MinBits uint32 `sshtype:"34"`
- PreferedBits uint32
- MaxBits uint32
-}
-
-// See RFC 4253, section 10.
-const msgServiceRequest = 5
-
-type serviceRequestMsg struct {
- Service string `sshtype:"5"`
-}
-
-// See RFC 4253, section 10.
-const msgServiceAccept = 6
-
-type serviceAcceptMsg struct {
- Service string `sshtype:"6"`
-}
-
-// See RFC 8308, section 2.3
-const msgExtInfo = 7
-
-type extInfoMsg struct {
- NumExtensions uint32 `sshtype:"7"`
- Payload []byte `ssh:"rest"`
-}
-
-// See RFC 4252, section 5.
-const msgUserAuthRequest = 50
-
-type userAuthRequestMsg struct {
- User string `sshtype:"50"`
- Service string
- Method string
- Payload []byte `ssh:"rest"`
-}
-
-// Used for debug printouts of packets.
-type userAuthSuccessMsg struct {
-}
-
-// See RFC 4252, section 5.1
-const msgUserAuthFailure = 51
-
-type userAuthFailureMsg struct {
- Methods []string `sshtype:"51"`
- 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
-
-type userAuthInfoRequestMsg struct {
- Name string `sshtype:"60"`
- Instruction string
- Language string
- NumPrompts uint32
- Prompts []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.1.
-const msgChannelOpen = 90
-
-type channelOpenMsg struct {
- ChanType string `sshtype:"90"`
- PeersID uint32
- PeersWindow uint32
- MaxPacketSize uint32
- TypeSpecificData []byte `ssh:"rest"`
-}
-
-const msgChannelExtendedData = 95
-const msgChannelData = 94
-
-// Used for debug print outs of packets.
-type channelDataMsg struct {
- PeersID uint32 `sshtype:"94"`
- Length uint32
- Rest []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.1.
-const msgChannelOpenConfirm = 91
-
-type channelOpenConfirmMsg struct {
- PeersID uint32 `sshtype:"91"`
- MyID uint32
- MyWindow uint32
- MaxPacketSize uint32
- TypeSpecificData []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.1.
-const msgChannelOpenFailure = 92
-
-type channelOpenFailureMsg struct {
- PeersID uint32 `sshtype:"92"`
- Reason RejectionReason
- Message string
- Language string
-}
-
-const msgChannelRequest = 98
-
-type channelRequestMsg struct {
- PeersID uint32 `sshtype:"98"`
- Request string
- WantReply bool
- RequestSpecificData []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 5.4.
-const msgChannelSuccess = 99
-
-type channelRequestSuccessMsg struct {
- PeersID uint32 `sshtype:"99"`
-}
-
-// See RFC 4254, section 5.4.
-const msgChannelFailure = 100
-
-type channelRequestFailureMsg struct {
- PeersID uint32 `sshtype:"100"`
-}
-
-// See RFC 4254, section 5.3
-const msgChannelClose = 97
-
-type channelCloseMsg struct {
- PeersID uint32 `sshtype:"97"`
-}
-
-// See RFC 4254, section 5.3
-const msgChannelEOF = 96
-
-type channelEOFMsg struct {
- PeersID uint32 `sshtype:"96"`
-}
-
-// See RFC 4254, section 4
-const msgGlobalRequest = 80
-
-type globalRequestMsg struct {
- Type string `sshtype:"80"`
- WantReply bool
- Data []byte `ssh:"rest"`
-}
-
-// See RFC 4254, section 4
-const msgRequestSuccess = 81
-
-type globalRequestSuccessMsg struct {
- Data []byte `ssh:"rest" sshtype:"81"`
-}
-
-// See RFC 4254, section 4
-const msgRequestFailure = 82
-
-type globalRequestFailureMsg struct {
- Data []byte `ssh:"rest" sshtype:"82"`
-}
-
-// See RFC 4254, section 5.2
-const msgChannelWindowAdjust = 93
-
-type windowAdjustMsg struct {
- PeersID uint32 `sshtype:"93"`
- AdditionalBytes uint32
-}
-
-// See RFC 4252, section 7
-const msgUserAuthPubKeyOk = 60
-
-type userAuthPubKeyOkMsg struct {
- Algo string `sshtype:"60"`
- PubKey []byte
-}
-
-// See RFC 4462, section 3
-const msgUserAuthGSSAPIResponse = 60
-
-type userAuthGSSAPIResponse struct {
- SupportMech []byte `sshtype:"60"`
-}
-
-const msgUserAuthGSSAPIToken = 61
-
-type userAuthGSSAPIToken struct {
- Token []byte `sshtype:"61"`
-}
-
-const msgUserAuthGSSAPIMIC = 66
-
-type userAuthGSSAPIMIC struct {
- MIC []byte `sshtype:"66"`
-}
-
-// See RFC 4462, section 3.9
-const msgUserAuthGSSAPIErrTok = 64
-
-type userAuthGSSAPIErrTok struct {
- ErrorToken []byte `sshtype:"64"`
-}
-
-// See RFC 4462, section 3.8
-const msgUserAuthGSSAPIError = 65
-
-type userAuthGSSAPIError struct {
- MajorStatus uint32 `sshtype:"65"`
- MinorStatus uint32
- Message string
- LanguageTag string
-}
-
-// Transport layer OpenSSH extension. See [PROTOCOL], section 1.9
-const msgPing = 192
-
-type pingMsg struct {
- Data string `sshtype:"192"`
-}
-
-// Transport layer OpenSSH extension. See [PROTOCOL], section 1.9
-const msgPong = 193
-
-type pongMsg struct {
- Data string `sshtype:"193"`
-}
-
-// typeTags returns the possible type bytes for the given reflect.Type, which
-// should be a struct. The possible values are separated by a '|' character.
-func typeTags(structType reflect.Type) (tags []byte) {
- tagStr := structType.Field(0).Tag.Get("sshtype")
-
- for _, tag := range strings.Split(tagStr, "|") {
- i, err := strconv.Atoi(tag)
- if err == nil {
- tags = append(tags, byte(i))
- }
- }
-
- return tags
-}
-
-func fieldError(t reflect.Type, field int, problem string) error {
- if problem != "" {
- problem = ": " + problem
- }
- return fmt.Errorf("ssh: unmarshal error for field %s of type %s%s", t.Field(field).Name, t.Name(), problem)
-}
-
-var errShortRead = errors.New("ssh: short read")
-
-// Unmarshal parses data in SSH wire format into a structure. The out
-// argument should be a pointer to struct. If the first member of the
-// struct has the "sshtype" tag set to a '|'-separated set of numbers
-// in decimal, the packet must start with one of those numbers. In
-// case of error, Unmarshal returns a ParseError or
-// UnexpectedMessageError.
-func Unmarshal(data []byte, out interface{}) error {
- v := reflect.ValueOf(out).Elem()
- structType := v.Type()
- expectedTypes := typeTags(structType)
-
- var expectedType byte
- if len(expectedTypes) > 0 {
- expectedType = expectedTypes[0]
- }
-
- if len(data) == 0 {
- return parseError(expectedType)
- }
-
- if len(expectedTypes) > 0 {
- goodType := false
- for _, e := range expectedTypes {
- if e > 0 && data[0] == e {
- goodType = true
- break
- }
- }
- if !goodType {
- return fmt.Errorf("ssh: unexpected message type %d (expected one of %v)", data[0], expectedTypes)
- }
- data = data[1:]
- }
-
- var ok bool
- for i := 0; i < v.NumField(); i++ {
- field := v.Field(i)
- t := field.Type()
- switch t.Kind() {
- case reflect.Bool:
- if len(data) < 1 {
- return errShortRead
- }
- field.SetBool(data[0] != 0)
- data = data[1:]
- case reflect.Array:
- if t.Elem().Kind() != reflect.Uint8 {
- return fieldError(structType, i, "array of unsupported type")
- }
- if len(data) < t.Len() {
- return errShortRead
- }
- for j, n := 0, t.Len(); j < n; j++ {
- field.Index(j).Set(reflect.ValueOf(data[j]))
- }
- data = data[t.Len():]
- case reflect.Uint64:
- var u64 uint64
- if u64, data, ok = parseUint64(data); !ok {
- return errShortRead
- }
- field.SetUint(u64)
- case reflect.Uint32:
- var u32 uint32
- if u32, data, ok = parseUint32(data); !ok {
- return errShortRead
- }
- field.SetUint(uint64(u32))
- case reflect.Uint8:
- if len(data) < 1 {
- return errShortRead
- }
- field.SetUint(uint64(data[0]))
- data = data[1:]
- case reflect.String:
- var s []byte
- if s, data, ok = parseString(data); !ok {
- return fieldError(structType, i, "")
- }
- field.SetString(string(s))
- case reflect.Slice:
- switch t.Elem().Kind() {
- case reflect.Uint8:
- if structType.Field(i).Tag.Get("ssh") == "rest" {
- field.Set(reflect.ValueOf(data))
- data = nil
- } else {
- var s []byte
- if s, data, ok = parseString(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(s))
- }
- case reflect.String:
- var nl []string
- if nl, data, ok = parseNameList(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(nl))
- default:
- return fieldError(structType, i, "slice of unsupported type")
- }
- case reflect.Ptr:
- if t == bigIntType {
- var n *big.Int
- if n, data, ok = parseInt(data); !ok {
- return errShortRead
- }
- field.Set(reflect.ValueOf(n))
- } else {
- return fieldError(structType, i, "pointer to unsupported type")
- }
- default:
- return fieldError(structType, i, fmt.Sprintf("unsupported type: %v", t))
- }
- }
-
- if len(data) != 0 {
- return parseError(expectedType)
- }
-
- return nil
-}
-
-// Marshal serializes the message in msg to SSH wire format. The msg
-// argument should be a struct or pointer to struct. If the first
-// member has the "sshtype" tag set to a number in decimal, that
-// number is prepended to the result. If the last of member has the
-// "ssh" tag set to "rest", its contents are appended to the output.
-func Marshal(msg interface{}) []byte {
- out := make([]byte, 0, 64)
- return marshalStruct(out, msg)
-}
-
-func marshalStruct(out []byte, msg interface{}) []byte {
- v := reflect.Indirect(reflect.ValueOf(msg))
- msgTypes := typeTags(v.Type())
- if len(msgTypes) > 0 {
- out = append(out, msgTypes[0])
- }
-
- for i, n := 0, v.NumField(); i < n; i++ {
- field := v.Field(i)
- switch t := field.Type(); t.Kind() {
- case reflect.Bool:
- var v uint8
- if field.Bool() {
- v = 1
- }
- out = append(out, v)
- case reflect.Array:
- if t.Elem().Kind() != reflect.Uint8 {
- panic(fmt.Sprintf("array of non-uint8 in field %d: %T", i, field.Interface()))
- }
- for j, l := 0, t.Len(); j < l; j++ {
- out = append(out, uint8(field.Index(j).Uint()))
- }
- case reflect.Uint32:
- out = appendU32(out, uint32(field.Uint()))
- case reflect.Uint64:
- out = appendU64(out, uint64(field.Uint()))
- case reflect.Uint8:
- out = append(out, uint8(field.Uint()))
- case reflect.String:
- s := field.String()
- out = appendInt(out, len(s))
- out = append(out, s...)
- case reflect.Slice:
- switch t.Elem().Kind() {
- case reflect.Uint8:
- if v.Type().Field(i).Tag.Get("ssh") != "rest" {
- out = appendInt(out, field.Len())
- }
- out = append(out, field.Bytes()...)
- case reflect.String:
- offset := len(out)
- out = appendU32(out, 0)
- if n := field.Len(); n > 0 {
- for j := 0; j < n; j++ {
- f := field.Index(j)
- if j != 0 {
- out = append(out, ',')
- }
- out = append(out, f.String()...)
- }
- // overwrite length value
- binary.BigEndian.PutUint32(out[offset:], uint32(len(out)-offset-4))
- }
- default:
- panic(fmt.Sprintf("slice of unknown type in field %d: %T", i, field.Interface()))
- }
- case reflect.Ptr:
- if t == bigIntType {
- var n *big.Int
- nValue := reflect.ValueOf(&n)
- nValue.Elem().Set(field)
- needed := intLength(n)
- oldLength := len(out)
-
- if cap(out)-len(out) < needed {
- newOut := make([]byte, len(out), 2*(len(out)+needed))
- copy(newOut, out)
- out = newOut
- }
- out = out[:oldLength+needed]
- marshalInt(out[oldLength:], n)
- } else {
- panic(fmt.Sprintf("pointer to unknown type in field %d: %T", i, field.Interface()))
- }
- }
- }
-
- return out
-}
-
-var bigOne = big.NewInt(1)
-
-func parseString(in []byte) (out, rest []byte, ok bool) {
- if len(in) < 4 {
- return
- }
- length := binary.BigEndian.Uint32(in)
- in = in[4:]
- if uint32(len(in)) < length {
- return
- }
- out = in[:length]
- rest = in[length:]
- ok = true
- return
-}
-
-var (
- comma = []byte{','}
- emptyNameList = []string{}
-)
-
-func parseNameList(in []byte) (out []string, rest []byte, ok bool) {
- contents, rest, ok := parseString(in)
- if !ok {
- return
- }
- if len(contents) == 0 {
- out = emptyNameList
- return
- }
- parts := bytes.Split(contents, comma)
- out = make([]string, len(parts))
- for i, part := range parts {
- out[i] = string(part)
- }
- return
-}
-
-func parseInt(in []byte) (out *big.Int, rest []byte, ok bool) {
- contents, rest, ok := parseString(in)
- if !ok {
- return
- }
- out = new(big.Int)
-
- if len(contents) > 0 && contents[0]&0x80 == 0x80 {
- // This is a negative number
- notBytes := make([]byte, len(contents))
- for i := range notBytes {
- notBytes[i] = ^contents[i]
- }
- out.SetBytes(notBytes)
- out.Add(out, bigOne)
- out.Neg(out)
- } else {
- // Positive number
- out.SetBytes(contents)
- }
- ok = true
- return
-}
-
-func parseUint32(in []byte) (uint32, []byte, bool) {
- if len(in) < 4 {
- return 0, nil, false
- }
- return binary.BigEndian.Uint32(in), in[4:], true
-}
-
-func parseUint64(in []byte) (uint64, []byte, bool) {
- if len(in) < 8 {
- return 0, nil, false
- }
- return binary.BigEndian.Uint64(in), in[8:], true
-}
-
-func intLength(n *big.Int) int {
- length := 4 /* length bytes */
- if n.Sign() < 0 {
- nMinus1 := new(big.Int).Neg(n)
- nMinus1.Sub(nMinus1, bigOne)
- bitLen := nMinus1.BitLen()
- if bitLen%8 == 0 {
- // The number will need 0xff padding
- length++
- }
- length += (bitLen + 7) / 8
- } else if n.Sign() == 0 {
- // A zero is the zero length string
- } else {
- bitLen := n.BitLen()
- if bitLen%8 == 0 {
- // The number will need 0x00 padding
- length++
- }
- length += (bitLen + 7) / 8
- }
-
- return length
-}
-
-func marshalUint32(to []byte, n uint32) []byte {
- binary.BigEndian.PutUint32(to, n)
- return to[4:]
-}
-
-func marshalUint64(to []byte, n uint64) []byte {
- binary.BigEndian.PutUint64(to, n)
- return to[8:]
-}
-
-func marshalInt(to []byte, n *big.Int) []byte {
- lengthBytes := to
- to = to[4:]
- length := 0
-
- if n.Sign() < 0 {
- // A negative number has to be converted to two's-complement
- // form. So we'll subtract 1 and invert. If the
- // most-significant-bit isn't set then we'll need to pad the
- // beginning with 0xff in order to keep the number negative.
- nMinus1 := new(big.Int).Neg(n)
- nMinus1.Sub(nMinus1, bigOne)
- bytes := nMinus1.Bytes()
- for i := range bytes {
- bytes[i] ^= 0xff
- }
- if len(bytes) == 0 || bytes[0]&0x80 == 0 {
- to[0] = 0xff
- to = to[1:]
- length++
- }
- nBytes := copy(to, bytes)
- to = to[nBytes:]
- length += nBytes
- } else if n.Sign() == 0 {
- // A zero is the zero length string
- } else {
- bytes := n.Bytes()
- if len(bytes) > 0 && bytes[0]&0x80 != 0 {
- // We'll have to pad this with a 0x00 in order to
- // stop it looking like a negative number.
- to[0] = 0
- to = to[1:]
- length++
- }
- nBytes := copy(to, bytes)
- to = to[nBytes:]
- length += nBytes
- }
-
- lengthBytes[0] = byte(length >> 24)
- lengthBytes[1] = byte(length >> 16)
- lengthBytes[2] = byte(length >> 8)
- lengthBytes[3] = byte(length)
- return to
-}
-
-func writeInt(w io.Writer, n *big.Int) {
- length := intLength(n)
- buf := make([]byte, length)
- marshalInt(buf, n)
- w.Write(buf)
-}
-
-func writeString(w io.Writer, s []byte) {
- var lengthBytes [4]byte
- lengthBytes[0] = byte(len(s) >> 24)
- lengthBytes[1] = byte(len(s) >> 16)
- lengthBytes[2] = byte(len(s) >> 8)
- lengthBytes[3] = byte(len(s))
- w.Write(lengthBytes[:])
- w.Write(s)
-}
-
-func stringLength(n int) int {
- return 4 + n
-}
-
-func marshalString(to []byte, s []byte) []byte {
- to[0] = byte(len(s) >> 24)
- to[1] = byte(len(s) >> 16)
- to[2] = byte(len(s) >> 8)
- to[3] = byte(len(s))
- to = to[4:]
- copy(to, s)
- return to[len(s):]
-}
-
-var bigIntType = reflect.TypeOf((*big.Int)(nil))
-
-// Decode a packet into its corresponding message.
-func decode(packet []byte) (interface{}, error) {
- var msg interface{}
- switch packet[0] {
- case msgDisconnect:
- msg = new(disconnectMsg)
- case msgServiceRequest:
- msg = new(serviceRequestMsg)
- case msgServiceAccept:
- msg = new(serviceAcceptMsg)
- case msgExtInfo:
- msg = new(extInfoMsg)
- case msgKexInit:
- msg = new(kexInitMsg)
- case msgKexDHInit:
- msg = new(kexDHInitMsg)
- case msgKexDHReply:
- msg = new(kexDHReplyMsg)
- case msgUserAuthRequest:
- msg = new(userAuthRequestMsg)
- case msgUserAuthSuccess:
- return new(userAuthSuccessMsg), nil
- case msgUserAuthFailure:
- msg = new(userAuthFailureMsg)
- case msgUserAuthPubKeyOk:
- msg = new(userAuthPubKeyOkMsg)
- case msgGlobalRequest:
- msg = new(globalRequestMsg)
- case msgRequestSuccess:
- msg = new(globalRequestSuccessMsg)
- case msgRequestFailure:
- msg = new(globalRequestFailureMsg)
- case msgChannelOpen:
- msg = new(channelOpenMsg)
- case msgChannelData:
- msg = new(channelDataMsg)
- case msgChannelOpenConfirm:
- msg = new(channelOpenConfirmMsg)
- case msgChannelOpenFailure:
- msg = new(channelOpenFailureMsg)
- case msgChannelWindowAdjust:
- msg = new(windowAdjustMsg)
- case msgChannelEOF:
- msg = new(channelEOFMsg)
- case msgChannelClose:
- msg = new(channelCloseMsg)
- case msgChannelRequest:
- msg = new(channelRequestMsg)
- case msgChannelSuccess:
- msg = new(channelRequestSuccessMsg)
- case msgChannelFailure:
- msg = new(channelRequestFailureMsg)
- case msgUserAuthGSSAPIToken:
- msg = new(userAuthGSSAPIToken)
- case msgUserAuthGSSAPIMIC:
- msg = new(userAuthGSSAPIMIC)
- case msgUserAuthGSSAPIErrTok:
- msg = new(userAuthGSSAPIErrTok)
- case msgUserAuthGSSAPIError:
- msg = new(userAuthGSSAPIError)
- default:
- return nil, unexpectedMessageError(0, packet[0])
- }
- if err := Unmarshal(packet, msg); err != nil {
- return nil, err
- }
- return msg, nil
-}
-
-var packetTypeNames = map[byte]string{
- msgDisconnect: "disconnectMsg",
- msgServiceRequest: "serviceRequestMsg",
- msgServiceAccept: "serviceAcceptMsg",
- msgExtInfo: "extInfoMsg",
- msgKexInit: "kexInitMsg",
- msgKexDHInit: "kexDHInitMsg",
- msgKexDHReply: "kexDHReplyMsg",
- msgUserAuthRequest: "userAuthRequestMsg",
- msgUserAuthSuccess: "userAuthSuccessMsg",
- msgUserAuthFailure: "userAuthFailureMsg",
- msgUserAuthPubKeyOk: "userAuthPubKeyOkMsg",
- msgGlobalRequest: "globalRequestMsg",
- msgRequestSuccess: "globalRequestSuccessMsg",
- msgRequestFailure: "globalRequestFailureMsg",
- msgChannelOpen: "channelOpenMsg",
- msgChannelData: "channelDataMsg",
- msgChannelOpenConfirm: "channelOpenConfirmMsg",
- msgChannelOpenFailure: "channelOpenFailureMsg",
- msgChannelWindowAdjust: "windowAdjustMsg",
- msgChannelEOF: "channelEOFMsg",
- msgChannelClose: "channelCloseMsg",
- msgChannelRequest: "channelRequestMsg",
- msgChannelSuccess: "channelRequestSuccessMsg",
- msgChannelFailure: "channelRequestFailureMsg",
-}
diff --git a/vendor/golang.org/x/crypto/ssh/mux.go b/vendor/golang.org/x/crypto/ssh/mux.go
deleted file mode 100644
index d2d24c635..000000000
--- a/vendor/golang.org/x/crypto/ssh/mux.go
+++ /dev/null
@@ -1,357 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "encoding/binary"
- "fmt"
- "io"
- "log"
- "sync"
- "sync/atomic"
-)
-
-// debugMux, if set, causes messages in the connection protocol to be
-// logged.
-const debugMux = false
-
-// chanList is a thread safe channel list.
-type chanList struct {
- // protects concurrent access to chans
- sync.Mutex
-
- // chans are indexed by the local id of the channel, which the
- // other side should send in the PeersId field.
- chans []*channel
-
- // This is a debugging aid: it offsets all IDs by this
- // amount. This helps distinguish otherwise identical
- // server/client muxes
- offset uint32
-}
-
-// Assigns a channel ID to the given channel.
-func (c *chanList) add(ch *channel) uint32 {
- c.Lock()
- defer c.Unlock()
- for i := range c.chans {
- if c.chans[i] == nil {
- c.chans[i] = ch
- return uint32(i) + c.offset
- }
- }
- c.chans = append(c.chans, ch)
- return uint32(len(c.chans)-1) + c.offset
-}
-
-// getChan returns the channel for the given ID.
-func (c *chanList) getChan(id uint32) *channel {
- id -= c.offset
-
- c.Lock()
- defer c.Unlock()
- if id < uint32(len(c.chans)) {
- return c.chans[id]
- }
- return nil
-}
-
-func (c *chanList) remove(id uint32) {
- id -= c.offset
- c.Lock()
- if id < uint32(len(c.chans)) {
- c.chans[id] = nil
- }
- c.Unlock()
-}
-
-// dropAll forgets all channels it knows, returning them in a slice.
-func (c *chanList) dropAll() []*channel {
- c.Lock()
- defer c.Unlock()
- var r []*channel
-
- for _, ch := range c.chans {
- if ch == nil {
- continue
- }
- r = append(r, ch)
- }
- c.chans = nil
- return r
-}
-
-// mux represents the state for the SSH connection protocol, which
-// multiplexes many channels onto a single packet transport.
-type mux struct {
- conn packetConn
- chanList chanList
-
- incomingChannels chan NewChannel
-
- globalSentMu sync.Mutex
- globalResponses chan interface{}
- incomingRequests chan *Request
-
- errCond *sync.Cond
- err error
-}
-
-// When debugging, each new chanList instantiation has a different
-// offset.
-var globalOff uint32
-
-func (m *mux) Wait() error {
- m.errCond.L.Lock()
- defer m.errCond.L.Unlock()
- for m.err == nil {
- m.errCond.Wait()
- }
- return m.err
-}
-
-// newMux returns a mux that runs over the given connection.
-func newMux(p packetConn) *mux {
- m := &mux{
- conn: p,
- incomingChannels: make(chan NewChannel, chanSize),
- globalResponses: make(chan interface{}, 1),
- incomingRequests: make(chan *Request, chanSize),
- errCond: newCond(),
- }
- if debugMux {
- m.chanList.offset = atomic.AddUint32(&globalOff, 1)
- }
-
- go m.loop()
- return m
-}
-
-func (m *mux) sendMessage(msg interface{}) error {
- p := Marshal(msg)
- if debugMux {
- log.Printf("send global(%d): %#v", m.chanList.offset, msg)
- }
- return m.conn.writePacket(p)
-}
-
-func (m *mux) SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error) {
- if wantReply {
- m.globalSentMu.Lock()
- defer m.globalSentMu.Unlock()
- }
-
- if err := m.sendMessage(globalRequestMsg{
- Type: name,
- WantReply: wantReply,
- Data: payload,
- }); err != nil {
- return false, nil, err
- }
-
- if !wantReply {
- return false, nil, nil
- }
-
- msg, ok := <-m.globalResponses
- if !ok {
- return false, nil, io.EOF
- }
- switch msg := msg.(type) {
- case *globalRequestFailureMsg:
- return false, msg.Data, nil
- case *globalRequestSuccessMsg:
- return true, msg.Data, nil
- default:
- return false, nil, fmt.Errorf("ssh: unexpected response to request: %#v", msg)
- }
-}
-
-// ackRequest must be called after processing a global request that
-// has WantReply set.
-func (m *mux) ackRequest(ok bool, data []byte) error {
- if ok {
- return m.sendMessage(globalRequestSuccessMsg{Data: data})
- }
- return m.sendMessage(globalRequestFailureMsg{Data: data})
-}
-
-func (m *mux) Close() error {
- return m.conn.Close()
-}
-
-// loop runs the connection machine. It will process packets until an
-// error is encountered. To synchronize on loop exit, use mux.Wait.
-func (m *mux) loop() {
- var err error
- for err == nil {
- err = m.onePacket()
- }
-
- for _, ch := range m.chanList.dropAll() {
- ch.close()
- }
-
- close(m.incomingChannels)
- close(m.incomingRequests)
- close(m.globalResponses)
-
- m.conn.Close()
-
- m.errCond.L.Lock()
- m.err = err
- m.errCond.Broadcast()
- m.errCond.L.Unlock()
-
- if debugMux {
- log.Println("loop exit", err)
- }
-}
-
-// onePacket reads and processes one packet.
-func (m *mux) onePacket() error {
- packet, err := m.conn.readPacket()
- if err != nil {
- return err
- }
-
- if debugMux {
- if packet[0] == msgChannelData || packet[0] == msgChannelExtendedData {
- log.Printf("decoding(%d): data packet - %d bytes", m.chanList.offset, len(packet))
- } else {
- p, _ := decode(packet)
- log.Printf("decoding(%d): %d %#v - %d bytes", m.chanList.offset, packet[0], p, len(packet))
- }
- }
-
- switch packet[0] {
- case msgChannelOpen:
- return m.handleChannelOpen(packet)
- case msgGlobalRequest, msgRequestSuccess, msgRequestFailure:
- return m.handleGlobalPacket(packet)
- case msgPing:
- var msg pingMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return fmt.Errorf("failed to unmarshal ping@openssh.com message: %w", err)
- }
- return m.sendMessage(pongMsg(msg))
- }
-
- // assume a channel packet.
- if len(packet) < 5 {
- return parseError(packet[0])
- }
- id := binary.BigEndian.Uint32(packet[1:])
- ch := m.chanList.getChan(id)
- if ch == nil {
- return m.handleUnknownChannelPacket(id, packet)
- }
-
- return ch.handlePacket(packet)
-}
-
-func (m *mux) handleGlobalPacket(packet []byte) error {
- msg, err := decode(packet)
- if err != nil {
- return err
- }
-
- switch msg := msg.(type) {
- case *globalRequestMsg:
- m.incomingRequests <- &Request{
- Type: msg.Type,
- WantReply: msg.WantReply,
- Payload: msg.Data,
- mux: m,
- }
- case *globalRequestSuccessMsg, *globalRequestFailureMsg:
- m.globalResponses <- msg
- default:
- panic(fmt.Sprintf("not a global message %#v", msg))
- }
-
- return nil
-}
-
-// handleChannelOpen schedules a channel to be Accept()ed.
-func (m *mux) handleChannelOpen(packet []byte) error {
- var msg channelOpenMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return err
- }
-
- if msg.MaxPacketSize < minPacketLength || msg.MaxPacketSize > 1<<31 {
- failMsg := channelOpenFailureMsg{
- PeersID: msg.PeersID,
- Reason: ConnectionFailed,
- Message: "invalid request",
- Language: "en_US.UTF-8",
- }
- return m.sendMessage(failMsg)
- }
-
- c := m.newChannel(msg.ChanType, channelInbound, msg.TypeSpecificData)
- c.remoteId = msg.PeersID
- c.maxRemotePayload = msg.MaxPacketSize
- c.remoteWin.add(msg.PeersWindow)
- m.incomingChannels <- c
- return nil
-}
-
-func (m *mux) OpenChannel(chanType string, extra []byte) (Channel, <-chan *Request, error) {
- ch, err := m.openChannel(chanType, extra)
- if err != nil {
- return nil, nil, err
- }
-
- return ch, ch.incomingRequests, nil
-}
-
-func (m *mux) openChannel(chanType string, extra []byte) (*channel, error) {
- ch := m.newChannel(chanType, channelOutbound, extra)
-
- ch.maxIncomingPayload = channelMaxPacket
-
- open := channelOpenMsg{
- ChanType: chanType,
- PeersWindow: ch.myWindow,
- MaxPacketSize: ch.maxIncomingPayload,
- TypeSpecificData: extra,
- PeersID: ch.localId,
- }
- if err := m.sendMessage(open); err != nil {
- return nil, err
- }
-
- switch msg := (<-ch.msg).(type) {
- case *channelOpenConfirmMsg:
- return ch, nil
- case *channelOpenFailureMsg:
- return nil, &OpenChannelError{msg.Reason, msg.Message}
- default:
- return nil, fmt.Errorf("ssh: unexpected packet in response to channel open: %T", msg)
- }
-}
-
-func (m *mux) handleUnknownChannelPacket(id uint32, packet []byte) error {
- msg, err := decode(packet)
- if err != nil {
- return err
- }
-
- switch msg := msg.(type) {
- // RFC 4254 section 5.4 says unrecognized channel requests should
- // receive a failure response.
- case *channelRequestMsg:
- if msg.WantReply {
- return m.sendMessage(channelRequestFailureMsg{
- PeersID: msg.PeersID,
- })
- }
- return nil
- default:
- return fmt.Errorf("ssh: invalid channel %d", id)
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go
deleted file mode 100644
index 5b5ccd96f..000000000
--- a/vendor/golang.org/x/crypto/ssh/server.go
+++ /dev/null
@@ -1,909 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "net"
- "strings"
-)
-
-// The Permissions type holds fine-grained permissions that are
-// specific to a user or a specific authentication method for a user.
-// The Permissions value for a successful authentication attempt is
-// available in ServerConn, so it can be used to pass information from
-// the user-authentication phase to the application layer.
-type Permissions struct {
- // CriticalOptions indicate restrictions to the default
- // permissions, and are typically used in conjunction with
- // user certificates. The standard for SSH certificates
- // defines "force-command" (only allow the given command to
- // execute) and "source-address" (only allow connections from
- // the given address). The SSH package currently only enforces
- // the "source-address" critical option. It is up to server
- // implementations to enforce other critical options, such as
- // "force-command", by checking them after the SSH handshake
- // is successful. In general, SSH servers should reject
- // connections that specify critical options that are unknown
- // or not supported.
- CriticalOptions map[string]string
-
- // Extensions are extra functionality that the server may
- // offer on authenticated connections. Lack of support for an
- // extension does not preclude authenticating a user. Common
- // extensions are "permit-agent-forwarding",
- // "permit-X11-forwarding". The Go SSH library currently does
- // not act on any extension, and it is up to server
- // implementations to honor them. Extensions can be used to
- // pass data from the authentication callbacks to the server
- // application layer.
- Extensions map[string]string
-}
-
-type GSSAPIWithMICConfig struct {
- // AllowLogin, must be set, is called when gssapi-with-mic
- // authentication is selected (RFC 4462 section 3). The srcName is from the
- // results of the GSS-API authentication. The format is username@DOMAIN.
- // GSSAPI just guarantees to the server who the user is, but not if they can log in, and with what permissions.
- // This callback is called after the user identity is established with GSSAPI to decide if the user can login with
- // which permissions. If the user is allowed to login, it should return a nil error.
- AllowLogin func(conn ConnMetadata, srcName string) (*Permissions, error)
-
- // Server must be set. It's the implementation
- // of the GSSAPIServer interface. See GSSAPIServer interface for details.
- Server GSSAPIServer
-}
-
-// ServerConfig holds server specific configuration data.
-type ServerConfig struct {
- // Config contains configuration shared between client and server.
- Config
-
- // PublicKeyAuthAlgorithms specifies the supported client public key
- // authentication algorithms. Note that this should not include certificate
- // types since those use the underlying algorithm. This list is sent to the
- // client if it supports the server-sig-algs extension. Order is irrelevant.
- // If unspecified then a default set of algorithms is used.
- PublicKeyAuthAlgorithms []string
-
- hostKeys []Signer
-
- // NoClientAuth is true if clients are allowed to connect without
- // authenticating.
- // To determine NoClientAuth at runtime, set NoClientAuth to true
- // and the optional NoClientAuthCallback to a non-nil value.
- NoClientAuth bool
-
- // NoClientAuthCallback, if non-nil, is called when a user
- // attempts to authenticate with auth method "none".
- // NoClientAuth must also be set to true for this be used, or
- // this func is unused.
- NoClientAuthCallback func(ConnMetadata) (*Permissions, error)
-
- // MaxAuthTries specifies the maximum number of authentication attempts
- // permitted per connection. If set to a negative number, the number of
- // attempts are unlimited. If set to zero, the number of attempts are limited
- // to 6.
- MaxAuthTries int
-
- // PasswordCallback, if non-nil, is called when a user
- // attempts to authenticate using a password.
- PasswordCallback func(conn ConnMetadata, password []byte) (*Permissions, error)
-
- // PublicKeyCallback, if non-nil, is called when a client
- // offers a public key for authentication. It must return a nil error
- // if the given public key can be used to authenticate the
- // given user. For example, see CertChecker.Authenticate. A
- // call to this function does not guarantee that the key
- // offered is in fact used to authenticate. To record any data
- // depending on the public key, store it inside a
- // Permissions.Extensions entry.
- PublicKeyCallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
-
- // KeyboardInteractiveCallback, if non-nil, is called when
- // keyboard-interactive authentication is selected (RFC
- // 4256). The client object's Challenge function should be
- // used to query the user. The callback may offer multiple
- // Challenge rounds. To avoid information leaks, the client
- // should be presented a challenge even if the user is
- // unknown.
- KeyboardInteractiveCallback func(conn ConnMetadata, client KeyboardInteractiveChallenge) (*Permissions, error)
-
- // AuthLogCallback, if non-nil, is called to log all authentication
- // attempts.
- AuthLogCallback func(conn ConnMetadata, method string, err error)
-
- // ServerVersion is the version identification string to announce in
- // the public handshake.
- // If empty, a reasonable default is used.
- // 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
-
- // GSSAPIWithMICConfig includes gssapi server and callback, which if both non-nil, is used
- // when gssapi-with-mic authentication is selected (RFC 4462 section 3).
- GSSAPIWithMICConfig *GSSAPIWithMICConfig
-}
-
-// AddHostKey adds a private key as a host key. If an existing host
-// key exists with the same public key format, it is replaced. Each server
-// config must have at least one host key.
-func (s *ServerConfig) AddHostKey(key Signer) {
- for i, k := range s.hostKeys {
- if k.PublicKey().Type() == key.PublicKey().Type() {
- s.hostKeys[i] = key
- return
- }
- }
-
- s.hostKeys = append(s.hostKeys, key)
-}
-
-// cachedPubKey contains the results of querying whether a public key is
-// acceptable for a user. This is a FIFO cache.
-type cachedPubKey struct {
- user string
- pubKeyData []byte
- result error
- perms *Permissions
-}
-
-// maxCachedPubKeys is the number of cache entries we store.
-//
-// Due to consistent misuse of the PublicKeyCallback API, we have reduced this
-// to 1, such that the only key in the cache is the most recently seen one. This
-// forces the behavior that the last call to PublicKeyCallback will always be
-// with the key that is used for authentication.
-const maxCachedPubKeys = 1
-
-// pubKeyCache caches tests for public keys. Since SSH clients
-// will query whether a public key is acceptable before attempting to
-// authenticate with it, we end up with duplicate queries for public
-// key validity. The cache only applies to a single ServerConn.
-type pubKeyCache struct {
- keys []cachedPubKey
-}
-
-// get returns the result for a given user/algo/key tuple.
-func (c *pubKeyCache) get(user string, pubKeyData []byte) (cachedPubKey, bool) {
- for _, k := range c.keys {
- if k.user == user && bytes.Equal(k.pubKeyData, pubKeyData) {
- return k, true
- }
- }
- return cachedPubKey{}, false
-}
-
-// add adds the given tuple to the cache.
-func (c *pubKeyCache) add(candidate cachedPubKey) {
- if len(c.keys) >= maxCachedPubKeys {
- c.keys = c.keys[1:]
- }
- c.keys = append(c.keys, candidate)
-}
-
-// ServerConn is an authenticated SSH connection, as seen from the
-// server
-type ServerConn struct {
- Conn
-
- // If the succeeding authentication callback returned a
- // non-nil Permissions pointer, it is stored here.
- Permissions *Permissions
-}
-
-// NewServerConn starts a new SSH server with c as the underlying
-// transport. It starts with a handshake and, if the handshake is
-// unsuccessful, it closes the connection and returns an error. The
-// Request and NewChannel channels must be serviced, or the connection
-// will hang.
-//
-// The returned error may be of type *ServerAuthError for
-// authentication errors.
-func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewChannel, <-chan *Request, error) {
- fullConf := *config
- fullConf.SetDefaults()
- if fullConf.MaxAuthTries == 0 {
- fullConf.MaxAuthTries = 6
- }
- if len(fullConf.PublicKeyAuthAlgorithms) == 0 {
- fullConf.PublicKeyAuthAlgorithms = supportedPubKeyAuthAlgos
- } else {
- for _, algo := range fullConf.PublicKeyAuthAlgorithms {
- if !contains(supportedPubKeyAuthAlgos, algo) {
- c.Close()
- return nil, nil, nil, fmt.Errorf("ssh: unsupported public key authentication algorithm %s", algo)
- }
- }
- }
- // Check if the config contains any unsupported key exchanges
- for _, kex := range fullConf.KeyExchanges {
- if _, ok := serverForbiddenKexAlgos[kex]; ok {
- c.Close()
- return nil, nil, nil, fmt.Errorf("ssh: unsupported key exchange %s for server", kex)
- }
- }
-
- s := &connection{
- sshConn: sshConn{conn: c},
- }
- perms, err := s.serverHandshake(&fullConf)
- if err != nil {
- c.Close()
- return nil, nil, nil, err
- }
- return &ServerConn{s, perms}, s.mux.incomingChannels, s.mux.incomingRequests, nil
-}
-
-// signAndMarshal signs the data with the appropriate algorithm,
-// and serializes the result in SSH wire format. algo is the negotiate
-// algorithm and may be a certificate type.
-func signAndMarshal(k AlgorithmSigner, rand io.Reader, data []byte, algo string) ([]byte, error) {
- sig, err := k.SignWithAlgorithm(rand, data, underlyingAlgo(algo))
- if err != nil {
- return nil, err
- }
-
- return Marshal(sig), nil
-}
-
-// handshake performs key exchange and user authentication.
-func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error) {
- if len(config.hostKeys) == 0 {
- return nil, errors.New("ssh: server has no host keys")
- }
-
- if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil &&
- config.KeyboardInteractiveCallback == nil && (config.GSSAPIWithMICConfig == nil ||
- config.GSSAPIWithMICConfig.AllowLogin == nil || config.GSSAPIWithMICConfig.Server == nil) {
- return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
- }
-
- if config.ServerVersion != "" {
- s.serverVersion = []byte(config.ServerVersion)
- } else {
- s.serverVersion = []byte(packageVersion)
- }
- var err error
- s.clientVersion, err = exchangeVersions(s.sshConn.conn, s.serverVersion)
- if err != nil {
- return nil, err
- }
-
- tr := newTransport(s.sshConn.conn, config.Rand, false /* not client */)
- s.transport = newServerTransport(tr, s.clientVersion, s.serverVersion, config)
-
- if err := s.transport.waitSession(); err != nil {
- return nil, err
- }
-
- // We just did the key change, so the session ID is established.
- s.sessionID = s.transport.getSessionID()
-
- var packet []byte
- if packet, err = s.transport.readPacket(); err != nil {
- return nil, err
- }
-
- var serviceRequest serviceRequestMsg
- if err = Unmarshal(packet, &serviceRequest); err != nil {
- return nil, err
- }
- if serviceRequest.Service != serviceUserAuth {
- return nil, errors.New("ssh: requested service '" + serviceRequest.Service + "' before authenticating")
- }
- serviceAccept := serviceAcceptMsg{
- Service: serviceUserAuth,
- }
- if err := s.transport.writePacket(Marshal(&serviceAccept)); err != nil {
- return nil, err
- }
-
- perms, err := s.serverAuthenticate(config)
- if err != nil {
- return nil, err
- }
- s.mux = newMux(s.transport)
- return perms, err
-}
-
-func checkSourceAddress(addr net.Addr, sourceAddrs string) error {
- if addr == nil {
- return errors.New("ssh: no address known for client, but source-address match required")
- }
-
- tcpAddr, ok := addr.(*net.TCPAddr)
- if !ok {
- return fmt.Errorf("ssh: remote address %v is not an TCP address when checking source-address match", addr)
- }
-
- for _, sourceAddr := range strings.Split(sourceAddrs, ",") {
- if allowedIP := net.ParseIP(sourceAddr); allowedIP != nil {
- if allowedIP.Equal(tcpAddr.IP) {
- return nil
- }
- } else {
- _, ipNet, err := net.ParseCIDR(sourceAddr)
- if err != nil {
- return fmt.Errorf("ssh: error parsing source-address restriction %q: %v", sourceAddr, err)
- }
-
- if ipNet.Contains(tcpAddr.IP) {
- return nil
- }
- }
- }
-
- return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr)
-}
-
-func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, token []byte, s *connection,
- sessionID []byte, userAuthReq userAuthRequestMsg) (authErr error, perms *Permissions, err error) {
- gssAPIServer := gssapiConfig.Server
- defer gssAPIServer.DeleteSecContext()
- var srcName string
- for {
- var (
- outToken []byte
- needContinue bool
- )
- outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(token)
- if err != nil {
- return err, nil, nil
- }
- if len(outToken) != 0 {
- if err := s.transport.writePacket(Marshal(&userAuthGSSAPIToken{
- Token: outToken,
- })); err != nil {
- return nil, nil, err
- }
- }
- if !needContinue {
- break
- }
- packet, err := s.transport.readPacket()
- if err != nil {
- return nil, nil, err
- }
- userAuthGSSAPITokenReq := &userAuthGSSAPIToken{}
- if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {
- return nil, nil, err
- }
- token = userAuthGSSAPITokenReq.Token
- }
- packet, err := s.transport.readPacket()
- if err != nil {
- return nil, nil, err
- }
- userAuthGSSAPIMICReq := &userAuthGSSAPIMIC{}
- if err := Unmarshal(packet, userAuthGSSAPIMICReq); err != nil {
- return nil, nil, err
- }
- mic := buildMIC(string(sessionID), userAuthReq.User, userAuthReq.Service, userAuthReq.Method)
- if err := gssAPIServer.VerifyMIC(mic, userAuthGSSAPIMICReq.MIC); err != nil {
- return err, nil, nil
- }
- perms, authErr = gssapiConfig.AllowLogin(s, srcName)
- return authErr, perms, nil
-}
-
-// isAlgoCompatible checks if the signature format is compatible with the
-// selected algorithm taking into account edge cases that occur with old
-// clients.
-func isAlgoCompatible(algo, sigFormat string) bool {
- // Compatibility for old clients.
- //
- // For certificate authentication with OpenSSH 7.2-7.7 signature format can
- // be rsa-sha2-256 or rsa-sha2-512 for the algorithm
- // ssh-rsa-cert-v01@openssh.com.
- //
- // With gpg-agent < 2.2.6 the algorithm can be rsa-sha2-256 or rsa-sha2-512
- // for signature format ssh-rsa.
- if isRSA(algo) && isRSA(sigFormat) {
- return true
- }
- // Standard case: the underlying algorithm must match the signature format.
- return underlyingAlgo(algo) == sigFormat
-}
-
-// ServerAuthError represents server authentication errors and is
-// sometimes returned by NewServerConn. It appends any authentication
-// errors that may occur, and is returned if all of the authentication
-// methods provided by the user failed to authenticate.
-type ServerAuthError struct {
- // Errors contains authentication errors returned by the authentication
- // callback methods. The first entry is typically ErrNoAuth.
- Errors []error
-}
-
-func (l ServerAuthError) Error() string {
- var errs []string
- for _, err := range l.Errors {
- errs = append(errs, err.Error())
- }
- return "[" + strings.Join(errs, ", ") + "]"
-}
-
-// ServerAuthCallbacks defines server-side authentication callbacks.
-type ServerAuthCallbacks struct {
- // PasswordCallback behaves like [ServerConfig.PasswordCallback].
- PasswordCallback func(conn ConnMetadata, password []byte) (*Permissions, error)
-
- // PublicKeyCallback behaves like [ServerConfig.PublicKeyCallback].
- PublicKeyCallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
-
- // KeyboardInteractiveCallback behaves like [ServerConfig.KeyboardInteractiveCallback].
- KeyboardInteractiveCallback func(conn ConnMetadata, client KeyboardInteractiveChallenge) (*Permissions, error)
-
- // GSSAPIWithMICConfig behaves like [ServerConfig.GSSAPIWithMICConfig].
- GSSAPIWithMICConfig *GSSAPIWithMICConfig
-}
-
-// PartialSuccessError can be returned by any of the [ServerConfig]
-// authentication callbacks to indicate to the client that authentication has
-// partially succeeded, but further steps are required.
-type PartialSuccessError struct {
- // Next defines the authentication callbacks to apply to further steps. The
- // available methods communicated to the client are based on the non-nil
- // ServerAuthCallbacks fields.
- Next ServerAuthCallbacks
-}
-
-func (p *PartialSuccessError) Error() string {
- return "ssh: authenticated with partial success"
-}
-
-// ErrNoAuth is the error value returned if no
-// authentication method has been passed yet. This happens as a normal
-// part of the authentication loop, since the client first tries
-// 'none' authentication to discover available methods.
-// It is returned in ServerAuthError.Errors from NewServerConn.
-var ErrNoAuth = errors.New("ssh: no auth passed yet")
-
-// BannerError is an error that can be returned by authentication handlers in
-// ServerConfig to send a banner message to the client.
-type BannerError struct {
- Err error
- Message string
-}
-
-func (b *BannerError) Unwrap() error {
- return b.Err
-}
-
-func (b *BannerError) Error() string {
- if b.Err == nil {
- return b.Message
- }
- return b.Err.Error()
-}
-
-func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, error) {
- sessionID := s.transport.getSessionID()
- var cache pubKeyCache
- var perms *Permissions
-
- authFailures := 0
- noneAuthCount := 0
- var authErrs []error
- var displayedBanner bool
- partialSuccessReturned := false
- // Set the initial authentication callbacks from the config. They can be
- // changed if a PartialSuccessError is returned.
- authConfig := ServerAuthCallbacks{
- PasswordCallback: config.PasswordCallback,
- PublicKeyCallback: config.PublicKeyCallback,
- KeyboardInteractiveCallback: config.KeyboardInteractiveCallback,
- GSSAPIWithMICConfig: config.GSSAPIWithMICConfig,
- }
-
-userAuthLoop:
- for {
- if authFailures >= config.MaxAuthTries && config.MaxAuthTries > 0 {
- discMsg := &disconnectMsg{
- Reason: 2,
- Message: "too many authentication failures",
- }
-
- if err := s.transport.writePacket(Marshal(discMsg)); err != nil {
- return nil, err
- }
- authErrs = append(authErrs, discMsg)
- return nil, &ServerAuthError{Errors: authErrs}
- }
-
- var userAuthReq userAuthRequestMsg
- if packet, err := s.transport.readPacket(); err != nil {
- if err == io.EOF {
- return nil, &ServerAuthError{Errors: authErrs}
- }
- return nil, err
- } else if err = Unmarshal(packet, &userAuthReq); err != nil {
- return nil, err
- }
-
- if userAuthReq.Service != serviceSSH {
- return nil, errors.New("ssh: client attempted to negotiate for unknown service: " + userAuthReq.Service)
- }
-
- if s.user != userAuthReq.User && partialSuccessReturned {
- return nil, fmt.Errorf("ssh: client changed the user after a partial success authentication, previous user %q, current user %q",
- s.user, userAuthReq.User)
- }
-
- s.user = userAuthReq.User
-
- if !displayedBanner && config.BannerCallback != nil {
- displayedBanner = true
- 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 := ErrNoAuth
-
- switch userAuthReq.Method {
- case "none":
- noneAuthCount++
- // We don't allow none authentication after a partial success
- // response.
- if config.NoClientAuth && !partialSuccessReturned {
- if config.NoClientAuthCallback != nil {
- perms, authErr = config.NoClientAuthCallback(s)
- } else {
- authErr = nil
- }
- }
- case "password":
- if authConfig.PasswordCallback == nil {
- authErr = errors.New("ssh: password auth not configured")
- break
- }
- payload := userAuthReq.Payload
- if len(payload) < 1 || payload[0] != 0 {
- return nil, parseError(msgUserAuthRequest)
- }
- payload = payload[1:]
- password, payload, ok := parseString(payload)
- if !ok || len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
-
- perms, authErr = authConfig.PasswordCallback(s, password)
- case "keyboard-interactive":
- if authConfig.KeyboardInteractiveCallback == nil {
- authErr = errors.New("ssh: keyboard-interactive auth not configured")
- break
- }
-
- prompter := &sshClientKeyboardInteractive{s}
- perms, authErr = authConfig.KeyboardInteractiveCallback(s, prompter.Challenge)
- case "publickey":
- if authConfig.PublicKeyCallback == nil {
- authErr = errors.New("ssh: publickey auth not configured")
- break
- }
- payload := userAuthReq.Payload
- if len(payload) < 1 {
- return nil, parseError(msgUserAuthRequest)
- }
- isQuery := payload[0] == 0
- payload = payload[1:]
- algoBytes, payload, ok := parseString(payload)
- if !ok {
- return nil, parseError(msgUserAuthRequest)
- }
- algo := string(algoBytes)
- if !contains(config.PublicKeyAuthAlgorithms, underlyingAlgo(algo)) {
- authErr = fmt.Errorf("ssh: algorithm %q not accepted", algo)
- break
- }
-
- pubKeyData, payload, ok := parseString(payload)
- if !ok {
- return nil, parseError(msgUserAuthRequest)
- }
-
- pubKey, err := ParsePublicKey(pubKeyData)
- if err != nil {
- return nil, err
- }
-
- candidate, ok := cache.get(s.user, pubKeyData)
- if !ok {
- candidate.user = s.user
- candidate.pubKeyData = pubKeyData
- candidate.perms, candidate.result = authConfig.PublicKeyCallback(s, pubKey)
- _, isPartialSuccessError := candidate.result.(*PartialSuccessError)
-
- if (candidate.result == nil || isPartialSuccessError) &&
- candidate.perms != nil &&
- candidate.perms.CriticalOptions != nil &&
- candidate.perms.CriticalOptions[sourceAddressCriticalOption] != "" {
- if err := checkSourceAddress(
- s.RemoteAddr(),
- candidate.perms.CriticalOptions[sourceAddressCriticalOption]); err != nil {
- candidate.result = err
- }
- }
- cache.add(candidate)
- }
-
- if isQuery {
- // The client can query if the given public key
- // would be okay.
-
- if len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
- _, isPartialSuccessError := candidate.result.(*PartialSuccessError)
- if candidate.result == nil || isPartialSuccessError {
- okMsg := userAuthPubKeyOkMsg{
- Algo: algo,
- PubKey: pubKeyData,
- }
- if err = s.transport.writePacket(Marshal(&okMsg)); err != nil {
- return nil, err
- }
- continue userAuthLoop
- }
- authErr = candidate.result
- } else {
- sig, payload, ok := parseSignature(payload)
- if !ok || len(payload) > 0 {
- return nil, parseError(msgUserAuthRequest)
- }
- // Ensure the declared public key algo is compatible with the
- // decoded one. This check will ensure we don't accept e.g.
- // ssh-rsa-cert-v01@openssh.com algorithm with ssh-rsa public
- // key type. The algorithm and public key type must be
- // consistent: both must be certificate algorithms, or neither.
- if !contains(algorithmsForKeyFormat(pubKey.Type()), algo) {
- authErr = fmt.Errorf("ssh: public key type %q not compatible with selected algorithm %q",
- pubKey.Type(), algo)
- break
- }
- // Ensure the public key algo and signature algo
- // are supported. Compare the private key
- // algorithm name that corresponds to algo with
- // sig.Format. This is usually the same, but
- // for certs, the names differ.
- if !contains(config.PublicKeyAuthAlgorithms, sig.Format) {
- authErr = fmt.Errorf("ssh: algorithm %q not accepted", sig.Format)
- break
- }
- if !isAlgoCompatible(algo, sig.Format) {
- authErr = fmt.Errorf("ssh: signature %q not compatible with selected algorithm %q", sig.Format, algo)
- break
- }
-
- signedData := buildDataSignedForAuth(sessionID, userAuthReq, algo, pubKeyData)
-
- if err := pubKey.Verify(signedData, sig); err != nil {
- return nil, err
- }
-
- authErr = candidate.result
- perms = candidate.perms
- }
- case "gssapi-with-mic":
- if authConfig.GSSAPIWithMICConfig == nil {
- authErr = errors.New("ssh: gssapi-with-mic auth not configured")
- break
- }
- gssapiConfig := authConfig.GSSAPIWithMICConfig
- userAuthRequestGSSAPI, err := parseGSSAPIPayload(userAuthReq.Payload)
- if err != nil {
- return nil, parseError(msgUserAuthRequest)
- }
- // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication.
- if userAuthRequestGSSAPI.N == 0 {
- authErr = fmt.Errorf("ssh: Mechanism negotiation is not supported")
- break
- }
- var i uint32
- present := false
- for i = 0; i < userAuthRequestGSSAPI.N; i++ {
- if userAuthRequestGSSAPI.OIDS[i].Equal(krb5Mesh) {
- present = true
- break
- }
- }
- if !present {
- authErr = fmt.Errorf("ssh: GSSAPI authentication must use the Kerberos V5 mechanism")
- break
- }
- // Initial server response, see RFC 4462 section 3.3.
- if err := s.transport.writePacket(Marshal(&userAuthGSSAPIResponse{
- SupportMech: krb5OID,
- })); err != nil {
- return nil, err
- }
- // Exchange token, see RFC 4462 section 3.4.
- packet, err := s.transport.readPacket()
- if err != nil {
- return nil, err
- }
- userAuthGSSAPITokenReq := &userAuthGSSAPIToken{}
- if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {
- return nil, err
- }
- authErr, perms, err = gssExchangeToken(gssapiConfig, userAuthGSSAPITokenReq.Token, s, sessionID,
- userAuthReq)
- if err != nil {
- return nil, err
- }
- default:
- authErr = fmt.Errorf("ssh: unknown method %q", userAuthReq.Method)
- }
-
- authErrs = append(authErrs, authErr)
-
- if config.AuthLogCallback != nil {
- config.AuthLogCallback(s, userAuthReq.Method, authErr)
- }
-
- var bannerErr *BannerError
- if errors.As(authErr, &bannerErr) {
- if bannerErr.Message != "" {
- bannerMsg := &userAuthBannerMsg{
- Message: bannerErr.Message,
- }
- if err := s.transport.writePacket(Marshal(bannerMsg)); err != nil {
- return nil, err
- }
- }
- }
-
- if authErr == nil {
- break userAuthLoop
- }
-
- var failureMsg userAuthFailureMsg
-
- if partialSuccess, ok := authErr.(*PartialSuccessError); ok {
- // After a partial success error we don't allow changing the user
- // name and execute the NoClientAuthCallback.
- partialSuccessReturned = true
-
- // In case a partial success is returned, the server may send
- // a new set of authentication methods.
- authConfig = partialSuccess.Next
-
- // Reset pubkey cache, as the new PublicKeyCallback might
- // accept a different set of public keys.
- cache = pubKeyCache{}
-
- // Send back a partial success message to the user.
- failureMsg.PartialSuccess = true
- } else {
- // Allow initial attempt of 'none' without penalty.
- if authFailures > 0 || userAuthReq.Method != "none" || noneAuthCount != 1 {
- authFailures++
- }
- if config.MaxAuthTries > 0 && authFailures >= config.MaxAuthTries {
- // If we have hit the max attempts, don't bother sending the
- // final SSH_MSG_USERAUTH_FAILURE message, since there are
- // no more authentication methods which can be attempted,
- // and this message may cause the client to re-attempt
- // authentication while we send the disconnect message.
- // Continue, and trigger the disconnect at the start of
- // the loop.
- //
- // The SSH specification is somewhat confusing about this,
- // RFC 4252 Section 5.1 requires each authentication failure
- // be responded to with a respective SSH_MSG_USERAUTH_FAILURE
- // message, but Section 4 says the server should disconnect
- // after some number of attempts, but it isn't explicit which
- // message should take precedence (i.e. should there be a failure
- // message than a disconnect message, or if we are going to
- // disconnect, should we only send that message.)
- //
- // Either way, OpenSSH disconnects immediately after the last
- // failed authentication attempt, and given they are typically
- // considered the golden implementation it seems reasonable
- // to match that behavior.
- continue
- }
- }
-
- if authConfig.PasswordCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "password")
- }
- if authConfig.PublicKeyCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "publickey")
- }
- if authConfig.KeyboardInteractiveCallback != nil {
- failureMsg.Methods = append(failureMsg.Methods, "keyboard-interactive")
- }
- if authConfig.GSSAPIWithMICConfig != nil && authConfig.GSSAPIWithMICConfig.Server != nil &&
- authConfig.GSSAPIWithMICConfig.AllowLogin != nil {
- failureMsg.Methods = append(failureMsg.Methods, "gssapi-with-mic")
- }
-
- if len(failureMsg.Methods) == 0 {
- return nil, errors.New("ssh: no authentication methods available")
- }
-
- if err := s.transport.writePacket(Marshal(&failureMsg)); err != nil {
- return nil, err
- }
- }
-
- if err := s.transport.writePacket([]byte{msgUserAuthSuccess}); err != nil {
- return nil, err
- }
- return perms, nil
-}
-
-// sshClientKeyboardInteractive implements a ClientKeyboardInteractive by
-// asking the client on the other side of a ServerConn.
-type sshClientKeyboardInteractive struct {
- *connection
-}
-
-func (c *sshClientKeyboardInteractive) Challenge(name, instruction string, questions []string, echos []bool) (answers []string, err error) {
- if len(questions) != len(echos) {
- return nil, errors.New("ssh: echos and questions must have equal length")
- }
-
- var prompts []byte
- for i := range questions {
- prompts = appendString(prompts, questions[i])
- prompts = appendBool(prompts, echos[i])
- }
-
- if err := c.transport.writePacket(Marshal(&userAuthInfoRequestMsg{
- Name: name,
- Instruction: instruction,
- NumPrompts: uint32(len(questions)),
- Prompts: prompts,
- })); err != nil {
- return nil, err
- }
-
- packet, err := c.transport.readPacket()
- if err != nil {
- return nil, err
- }
- if packet[0] != msgUserAuthInfoResponse {
- return nil, unexpectedMessageError(msgUserAuthInfoResponse, packet[0])
- }
- packet = packet[1:]
-
- n, packet, ok := parseUint32(packet)
- if !ok || int(n) != len(questions) {
- return nil, parseError(msgUserAuthInfoResponse)
- }
-
- for i := uint32(0); i < n; i++ {
- ans, rest, ok := parseString(packet)
- if !ok {
- return nil, parseError(msgUserAuthInfoResponse)
- }
-
- answers = append(answers, string(ans))
- packet = rest
- }
- if len(packet) != 0 {
- return nil, errors.New("ssh: junk at end of message")
- }
-
- return answers, nil
-}
diff --git a/vendor/golang.org/x/crypto/ssh/session.go b/vendor/golang.org/x/crypto/ssh/session.go
deleted file mode 100644
index acef62259..000000000
--- a/vendor/golang.org/x/crypto/ssh/session.go
+++ /dev/null
@@ -1,647 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-// Session implements an interactive session described in
-// "RFC 4254, section 6".
-
-import (
- "bytes"
- "encoding/binary"
- "errors"
- "fmt"
- "io"
- "sync"
-)
-
-type Signal string
-
-// POSIX signals as listed in RFC 4254 Section 6.10.
-const (
- SIGABRT Signal = "ABRT"
- SIGALRM Signal = "ALRM"
- SIGFPE Signal = "FPE"
- SIGHUP Signal = "HUP"
- SIGILL Signal = "ILL"
- SIGINT Signal = "INT"
- SIGKILL Signal = "KILL"
- SIGPIPE Signal = "PIPE"
- SIGQUIT Signal = "QUIT"
- SIGSEGV Signal = "SEGV"
- SIGTERM Signal = "TERM"
- SIGUSR1 Signal = "USR1"
- SIGUSR2 Signal = "USR2"
-)
-
-var signals = map[Signal]int{
- SIGABRT: 6,
- SIGALRM: 14,
- SIGFPE: 8,
- SIGHUP: 1,
- SIGILL: 4,
- SIGINT: 2,
- SIGKILL: 9,
- SIGPIPE: 13,
- SIGQUIT: 3,
- SIGSEGV: 11,
- SIGTERM: 15,
-}
-
-type TerminalModes map[uint8]uint32
-
-// POSIX terminal mode flags as listed in RFC 4254 Section 8.
-const (
- tty_OP_END = 0
- VINTR = 1
- VQUIT = 2
- VERASE = 3
- VKILL = 4
- VEOF = 5
- VEOL = 6
- VEOL2 = 7
- VSTART = 8
- VSTOP = 9
- VSUSP = 10
- VDSUSP = 11
- VREPRINT = 12
- VWERASE = 13
- VLNEXT = 14
- VFLUSH = 15
- VSWTCH = 16
- VSTATUS = 17
- VDISCARD = 18
- IGNPAR = 30
- PARMRK = 31
- INPCK = 32
- ISTRIP = 33
- INLCR = 34
- IGNCR = 35
- ICRNL = 36
- IUCLC = 37
- IXON = 38
- IXANY = 39
- IXOFF = 40
- IMAXBEL = 41
- IUTF8 = 42 // RFC 8160
- ISIG = 50
- ICANON = 51
- XCASE = 52
- ECHO = 53
- ECHOE = 54
- ECHOK = 55
- ECHONL = 56
- NOFLSH = 57
- TOSTOP = 58
- IEXTEN = 59
- ECHOCTL = 60
- ECHOKE = 61
- PENDIN = 62
- OPOST = 70
- OLCUC = 71
- ONLCR = 72
- OCRNL = 73
- ONOCR = 74
- ONLRET = 75
- CS7 = 90
- CS8 = 91
- PARENB = 92
- PARODD = 93
- TTY_OP_ISPEED = 128
- TTY_OP_OSPEED = 129
-)
-
-// A Session represents a connection to a remote command or shell.
-type Session struct {
- // Stdin specifies the remote process's standard input.
- // If Stdin is nil, the remote process reads from an empty
- // bytes.Buffer.
- Stdin io.Reader
-
- // Stdout and Stderr specify the remote process's standard
- // output and error.
- //
- // If either is nil, Run connects the corresponding file
- // descriptor to an instance of io.Discard. There is a
- // fixed amount of buffering that is shared for the two streams.
- // If either blocks it may eventually cause the remote
- // command to block.
- Stdout io.Writer
- Stderr io.Writer
-
- ch Channel // the channel backing this session
- started bool // true once Start, Run or Shell is invoked.
- copyFuncs []func() error
- errors chan error // one send per copyFunc
-
- // true if pipe method is active
- stdinpipe, stdoutpipe, stderrpipe bool
-
- // stdinPipeWriter is non-nil if StdinPipe has not been called
- // and Stdin was specified by the user; it is the write end of
- // a pipe connecting Session.Stdin to the stdin channel.
- stdinPipeWriter io.WriteCloser
-
- exitStatus chan error
-}
-
-// SendRequest sends an out-of-band channel request on the SSH channel
-// underlying the session.
-func (s *Session) SendRequest(name string, wantReply bool, payload []byte) (bool, error) {
- return s.ch.SendRequest(name, wantReply, payload)
-}
-
-func (s *Session) Close() error {
- return s.ch.Close()
-}
-
-// RFC 4254 Section 6.4.
-type setenvRequest struct {
- Name string
- Value string
-}
-
-// Setenv sets an environment variable that will be applied to any
-// command executed by Shell or Run.
-func (s *Session) Setenv(name, value string) error {
- msg := setenvRequest{
- Name: name,
- Value: value,
- }
- ok, err := s.ch.SendRequest("env", true, Marshal(&msg))
- if err == nil && !ok {
- err = errors.New("ssh: setenv failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.2.
-type ptyRequestMsg struct {
- Term string
- Columns uint32
- Rows uint32
- Width uint32
- Height uint32
- Modelist string
-}
-
-// RequestPty requests the association of a pty with the session on the remote host.
-func (s *Session) RequestPty(term string, h, w int, termmodes TerminalModes) error {
- var tm []byte
- for k, v := range termmodes {
- kv := struct {
- Key byte
- Val uint32
- }{k, v}
-
- tm = append(tm, Marshal(&kv)...)
- }
- tm = append(tm, tty_OP_END)
- req := ptyRequestMsg{
- Term: term,
- Columns: uint32(w),
- Rows: uint32(h),
- Width: uint32(w * 8),
- Height: uint32(h * 8),
- Modelist: string(tm),
- }
- ok, err := s.ch.SendRequest("pty-req", true, Marshal(&req))
- if err == nil && !ok {
- err = errors.New("ssh: pty-req failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.5.
-type subsystemRequestMsg struct {
- Subsystem string
-}
-
-// RequestSubsystem requests the association of a subsystem with the session on the remote host.
-// A subsystem is a predefined command that runs in the background when the ssh session is initiated
-func (s *Session) RequestSubsystem(subsystem string) error {
- msg := subsystemRequestMsg{
- Subsystem: subsystem,
- }
- ok, err := s.ch.SendRequest("subsystem", true, Marshal(&msg))
- if err == nil && !ok {
- err = errors.New("ssh: subsystem request failed")
- }
- return err
-}
-
-// RFC 4254 Section 6.7.
-type ptyWindowChangeMsg struct {
- Columns uint32
- Rows uint32
- Width uint32
- Height uint32
-}
-
-// WindowChange informs the remote host about a terminal window dimension change to h rows and w columns.
-func (s *Session) WindowChange(h, w int) error {
- req := ptyWindowChangeMsg{
- Columns: uint32(w),
- Rows: uint32(h),
- Width: uint32(w * 8),
- Height: uint32(h * 8),
- }
- _, err := s.ch.SendRequest("window-change", false, Marshal(&req))
- return err
-}
-
-// RFC 4254 Section 6.9.
-type signalMsg struct {
- Signal string
-}
-
-// Signal sends the given signal to the remote process.
-// sig is one of the SIG* constants.
-func (s *Session) Signal(sig Signal) error {
- msg := signalMsg{
- Signal: string(sig),
- }
-
- _, err := s.ch.SendRequest("signal", false, Marshal(&msg))
- return err
-}
-
-// RFC 4254 Section 6.5.
-type execMsg struct {
- Command string
-}
-
-// Start runs cmd on the remote host. Typically, the remote
-// server passes cmd to the shell for interpretation.
-// A Session only accepts one call to Run, Start or Shell.
-func (s *Session) Start(cmd string) error {
- if s.started {
- return errors.New("ssh: session already started")
- }
- req := execMsg{
- Command: cmd,
- }
-
- ok, err := s.ch.SendRequest("exec", true, Marshal(&req))
- if err == nil && !ok {
- err = fmt.Errorf("ssh: command %v failed", cmd)
- }
- if err != nil {
- return err
- }
- return s.start()
-}
-
-// Run runs cmd on the remote host. Typically, the remote
-// server passes cmd to the shell for interpretation.
-// A Session only accepts one call to Run, Start, Shell, Output,
-// or CombinedOutput.
-//
-// The returned error is nil if the command runs, has no problems
-// copying stdin, stdout, and stderr, and exits with a zero exit
-// status.
-//
-// If the remote server does not send an exit status, an error of type
-// *ExitMissingError is returned. If the command completes
-// unsuccessfully or is interrupted by a signal, the error is of type
-// *ExitError. Other error types may be returned for I/O problems.
-func (s *Session) Run(cmd string) error {
- err := s.Start(cmd)
- if err != nil {
- return err
- }
- return s.Wait()
-}
-
-// Output runs cmd on the remote host and returns its standard output.
-func (s *Session) Output(cmd string) ([]byte, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- var b bytes.Buffer
- s.Stdout = &b
- err := s.Run(cmd)
- return b.Bytes(), err
-}
-
-type singleWriter struct {
- b bytes.Buffer
- mu sync.Mutex
-}
-
-func (w *singleWriter) Write(p []byte) (int, error) {
- w.mu.Lock()
- defer w.mu.Unlock()
- return w.b.Write(p)
-}
-
-// CombinedOutput runs cmd on the remote host and returns its combined
-// standard output and standard error.
-func (s *Session) CombinedOutput(cmd string) ([]byte, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- if s.Stderr != nil {
- return nil, errors.New("ssh: Stderr already set")
- }
- var b singleWriter
- s.Stdout = &b
- s.Stderr = &b
- err := s.Run(cmd)
- return b.b.Bytes(), err
-}
-
-// Shell starts a login shell on the remote host. A Session only
-// accepts one call to Run, Start, Shell, Output, or CombinedOutput.
-func (s *Session) Shell() error {
- if s.started {
- return errors.New("ssh: session already started")
- }
-
- ok, err := s.ch.SendRequest("shell", true, nil)
- if err == nil && !ok {
- return errors.New("ssh: could not start shell")
- }
- if err != nil {
- return err
- }
- return s.start()
-}
-
-func (s *Session) start() error {
- s.started = true
-
- type F func(*Session)
- for _, setupFd := range []F{(*Session).stdin, (*Session).stdout, (*Session).stderr} {
- setupFd(s)
- }
-
- s.errors = make(chan error, len(s.copyFuncs))
- for _, fn := range s.copyFuncs {
- go func(fn func() error) {
- s.errors <- fn()
- }(fn)
- }
- return nil
-}
-
-// Wait waits for the remote command to exit.
-//
-// The returned error is nil if the command runs, has no problems
-// copying stdin, stdout, and stderr, and exits with a zero exit
-// status.
-//
-// If the remote server does not send an exit status, an error of type
-// *ExitMissingError is returned. If the command completes
-// unsuccessfully or is interrupted by a signal, the error is of type
-// *ExitError. Other error types may be returned for I/O problems.
-func (s *Session) Wait() error {
- if !s.started {
- return errors.New("ssh: session not started")
- }
- waitErr := <-s.exitStatus
-
- if s.stdinPipeWriter != nil {
- s.stdinPipeWriter.Close()
- }
- var copyError error
- for range s.copyFuncs {
- if err := <-s.errors; err != nil && copyError == nil {
- copyError = err
- }
- }
- if waitErr != nil {
- return waitErr
- }
- return copyError
-}
-
-func (s *Session) wait(reqs <-chan *Request) error {
- wm := Waitmsg{status: -1}
- // Wait for msg channel to be closed before returning.
- for msg := range reqs {
- switch msg.Type {
- case "exit-status":
- wm.status = int(binary.BigEndian.Uint32(msg.Payload))
- case "exit-signal":
- var sigval struct {
- Signal string
- CoreDumped bool
- Error string
- Lang string
- }
- if err := Unmarshal(msg.Payload, &sigval); err != nil {
- return err
- }
-
- // Must sanitize strings?
- wm.signal = sigval.Signal
- wm.msg = sigval.Error
- wm.lang = sigval.Lang
- default:
- // This handles keepalives and matches
- // OpenSSH's behaviour.
- if msg.WantReply {
- msg.Reply(false, nil)
- }
- }
- }
- if wm.status == 0 {
- return nil
- }
- if wm.status == -1 {
- // exit-status was never sent from server
- if wm.signal == "" {
- // signal was not sent either. RFC 4254
- // section 6.10 recommends against this
- // behavior, but it is allowed, so we let
- // clients handle it.
- return &ExitMissingError{}
- }
- wm.status = 128
- if _, ok := signals[Signal(wm.signal)]; ok {
- wm.status += signals[Signal(wm.signal)]
- }
- }
-
- return &ExitError{wm}
-}
-
-// ExitMissingError is returned if a session is torn down cleanly, but
-// the server sends no confirmation of the exit status.
-type ExitMissingError struct{}
-
-func (e *ExitMissingError) Error() string {
- return "wait: remote command exited without exit status or exit signal"
-}
-
-func (s *Session) stdin() {
- if s.stdinpipe {
- return
- }
- var stdin io.Reader
- if s.Stdin == nil {
- stdin = new(bytes.Buffer)
- } else {
- r, w := io.Pipe()
- go func() {
- _, err := io.Copy(w, s.Stdin)
- w.CloseWithError(err)
- }()
- stdin, s.stdinPipeWriter = r, w
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.ch, stdin)
- if err1 := s.ch.CloseWrite(); err == nil && err1 != io.EOF {
- err = err1
- }
- return err
- })
-}
-
-func (s *Session) stdout() {
- if s.stdoutpipe {
- return
- }
- if s.Stdout == nil {
- s.Stdout = io.Discard
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.Stdout, s.ch)
- return err
- })
-}
-
-func (s *Session) stderr() {
- if s.stderrpipe {
- return
- }
- if s.Stderr == nil {
- s.Stderr = io.Discard
- }
- s.copyFuncs = append(s.copyFuncs, func() error {
- _, err := io.Copy(s.Stderr, s.ch.Stderr())
- return err
- })
-}
-
-// sessionStdin reroutes Close to CloseWrite.
-type sessionStdin struct {
- io.Writer
- ch Channel
-}
-
-func (s *sessionStdin) Close() error {
- return s.ch.CloseWrite()
-}
-
-// StdinPipe returns a pipe that will be connected to the
-// remote command's standard input when the command starts.
-func (s *Session) StdinPipe() (io.WriteCloser, error) {
- if s.Stdin != nil {
- return nil, errors.New("ssh: Stdin already set")
- }
- if s.started {
- return nil, errors.New("ssh: StdinPipe after process started")
- }
- s.stdinpipe = true
- return &sessionStdin{s.ch, s.ch}, nil
-}
-
-// StdoutPipe returns a pipe that will be connected to the
-// remote command's standard output when the command starts.
-// There is a fixed amount of buffering that is shared between
-// stdout and stderr streams. If the StdoutPipe reader is
-// not serviced fast enough it may eventually cause the
-// remote command to block.
-func (s *Session) StdoutPipe() (io.Reader, error) {
- if s.Stdout != nil {
- return nil, errors.New("ssh: Stdout already set")
- }
- if s.started {
- return nil, errors.New("ssh: StdoutPipe after process started")
- }
- s.stdoutpipe = true
- return s.ch, nil
-}
-
-// StderrPipe returns a pipe that will be connected to the
-// remote command's standard error when the command starts.
-// There is a fixed amount of buffering that is shared between
-// stdout and stderr streams. If the StderrPipe reader is
-// not serviced fast enough it may eventually cause the
-// remote command to block.
-func (s *Session) StderrPipe() (io.Reader, error) {
- if s.Stderr != nil {
- return nil, errors.New("ssh: Stderr already set")
- }
- if s.started {
- return nil, errors.New("ssh: StderrPipe after process started")
- }
- s.stderrpipe = true
- return s.ch.Stderr(), nil
-}
-
-// newSession returns a new interactive session on the remote host.
-func newSession(ch Channel, reqs <-chan *Request) (*Session, error) {
- s := &Session{
- ch: ch,
- }
- s.exitStatus = make(chan error, 1)
- go func() {
- s.exitStatus <- s.wait(reqs)
- }()
-
- return s, nil
-}
-
-// An ExitError reports unsuccessful completion of a remote command.
-type ExitError struct {
- Waitmsg
-}
-
-func (e *ExitError) Error() string {
- return e.Waitmsg.String()
-}
-
-// Waitmsg stores the information about an exited remote command
-// as reported by Wait.
-type Waitmsg struct {
- status int
- signal string
- msg string
- lang string
-}
-
-// ExitStatus returns the exit status of the remote command.
-func (w Waitmsg) ExitStatus() int {
- return w.status
-}
-
-// Signal returns the exit signal of the remote command if
-// it was terminated violently.
-func (w Waitmsg) Signal() string {
- return w.signal
-}
-
-// Msg returns the exit message given by the remote command
-func (w Waitmsg) Msg() string {
- return w.msg
-}
-
-// Lang returns the language tag. See RFC 3066
-func (w Waitmsg) Lang() string {
- return w.lang
-}
-
-func (w Waitmsg) String() string {
- str := fmt.Sprintf("Process exited with status %v", w.status)
- if w.signal != "" {
- str += fmt.Sprintf(" from signal %v", w.signal)
- }
- if w.msg != "" {
- str += fmt.Sprintf(". Reason was: %v", w.msg)
- }
- return str
-}
diff --git a/vendor/golang.org/x/crypto/ssh/ssh_gss.go b/vendor/golang.org/x/crypto/ssh/ssh_gss.go
deleted file mode 100644
index 24bd7c8e8..000000000
--- a/vendor/golang.org/x/crypto/ssh/ssh_gss.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "encoding/asn1"
- "errors"
-)
-
-var krb5OID []byte
-
-func init() {
- krb5OID, _ = asn1.Marshal(krb5Mesh)
-}
-
-// GSSAPIClient provides the API to plug-in GSSAPI authentication for client logins.
-type GSSAPIClient interface {
- // InitSecContext initiates the establishment of a security context for GSS-API between the
- // ssh client and ssh server. Initially the token parameter should be specified as nil.
- // The routine may return a outputToken which should be transferred to
- // the ssh server, where the ssh server will present it to
- // AcceptSecContext. If no token need be sent, InitSecContext will indicate this by setting
- // needContinue to false. To complete the context
- // establishment, one or more reply tokens may be required from the ssh
- // server;if so, InitSecContext will return a needContinue which is true.
- // In this case, InitSecContext should be called again when the
- // reply token is received from the ssh server, passing the reply
- // token to InitSecContext via the token parameters.
- // See RFC 2743 section 2.2.1 and RFC 4462 section 3.4.
- InitSecContext(target string, token []byte, isGSSDelegCreds bool) (outputToken []byte, needContinue bool, err error)
- // GetMIC generates a cryptographic MIC for the SSH2 message, and places
- // the MIC in a token for transfer to the ssh server.
- // The contents of the MIC field are obtained by calling GSS_GetMIC()
- // over the following, using the GSS-API context that was just
- // established:
- // string session identifier
- // byte SSH_MSG_USERAUTH_REQUEST
- // string user name
- // string service
- // string "gssapi-with-mic"
- // See RFC 2743 section 2.3.1 and RFC 4462 3.5.
- GetMIC(micFiled []byte) ([]byte, error)
- // Whenever possible, it should be possible for
- // DeleteSecContext() calls to be successfully processed even
- // if other calls cannot succeed, thereby enabling context-related
- // resources to be released.
- // In addition to deleting established security contexts,
- // gss_delete_sec_context must also be able to delete "half-built"
- // security contexts resulting from an incomplete sequence of
- // InitSecContext()/AcceptSecContext() calls.
- // See RFC 2743 section 2.2.3.
- DeleteSecContext() error
-}
-
-// GSSAPIServer provides the API to plug in GSSAPI authentication for server logins.
-type GSSAPIServer interface {
- // AcceptSecContext allows a remotely initiated security context between the application
- // and a remote peer to be established by the ssh client. The routine may return a
- // outputToken which should be transferred to the ssh client,
- // where the ssh client will present it to InitSecContext.
- // If no token need be sent, AcceptSecContext will indicate this
- // by setting the needContinue to false. To
- // complete the context establishment, one or more reply tokens may be
- // required from the ssh client. if so, AcceptSecContext
- // will return a needContinue which is true, in which case it
- // should be called again when the reply token is received from the ssh
- // client, passing the token to AcceptSecContext via the
- // token parameters.
- // The srcName return value is the authenticated username.
- // See RFC 2743 section 2.2.2 and RFC 4462 section 3.4.
- AcceptSecContext(token []byte) (outputToken []byte, srcName string, needContinue bool, err error)
- // VerifyMIC verifies that a cryptographic MIC, contained in the token parameter,
- // fits the supplied message is received from the ssh client.
- // See RFC 2743 section 2.3.2.
- VerifyMIC(micField []byte, micToken []byte) error
- // Whenever possible, it should be possible for
- // DeleteSecContext() calls to be successfully processed even
- // if other calls cannot succeed, thereby enabling context-related
- // resources to be released.
- // In addition to deleting established security contexts,
- // gss_delete_sec_context must also be able to delete "half-built"
- // security contexts resulting from an incomplete sequence of
- // InitSecContext()/AcceptSecContext() calls.
- // See RFC 2743 section 2.2.3.
- DeleteSecContext() error
-}
-
-var (
- // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication,
- // so we also support the krb5 mechanism only.
- // See RFC 1964 section 1.
- krb5Mesh = asn1.ObjectIdentifier{1, 2, 840, 113554, 1, 2, 2}
-)
-
-// The GSS-API authentication method is initiated when the client sends an SSH_MSG_USERAUTH_REQUEST
-// See RFC 4462 section 3.2.
-type userAuthRequestGSSAPI struct {
- N uint32
- OIDS []asn1.ObjectIdentifier
-}
-
-func parseGSSAPIPayload(payload []byte) (*userAuthRequestGSSAPI, error) {
- n, rest, ok := parseUint32(payload)
- if !ok {
- return nil, errors.New("parse uint32 failed")
- }
- s := &userAuthRequestGSSAPI{
- N: n,
- OIDS: make([]asn1.ObjectIdentifier, n),
- }
- for i := 0; i < int(n); i++ {
- var (
- desiredMech []byte
- err error
- )
- desiredMech, rest, ok = parseString(rest)
- if !ok {
- return nil, errors.New("parse string failed")
- }
- if rest, err = asn1.Unmarshal(desiredMech, &s.OIDS[i]); err != nil {
- return nil, err
- }
-
- }
- return s, nil
-}
-
-// See RFC 4462 section 3.6.
-func buildMIC(sessionID string, username string, service string, authMethod string) []byte {
- out := make([]byte, 0, 0)
- out = appendString(out, sessionID)
- out = append(out, msgUserAuthRequest)
- out = appendString(out, username)
- out = appendString(out, service)
- out = appendString(out, authMethod)
- return out
-}
diff --git a/vendor/golang.org/x/crypto/ssh/streamlocal.go b/vendor/golang.org/x/crypto/ssh/streamlocal.go
deleted file mode 100644
index b171b330b..000000000
--- a/vendor/golang.org/x/crypto/ssh/streamlocal.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package ssh
-
-import (
- "errors"
- "io"
- "net"
-)
-
-// streamLocalChannelOpenDirectMsg is a struct used for SSH_MSG_CHANNEL_OPEN message
-// with "direct-streamlocal@openssh.com" string.
-//
-// See openssh-portable/PROTOCOL, section 2.4. connection: Unix domain socket forwarding
-// https://github.com/openssh/openssh-portable/blob/master/PROTOCOL#L235
-type streamLocalChannelOpenDirectMsg struct {
- socketPath string
- reserved0 string
- reserved1 uint32
-}
-
-// forwardedStreamLocalPayload is a struct used for SSH_MSG_CHANNEL_OPEN message
-// with "forwarded-streamlocal@openssh.com" string.
-type forwardedStreamLocalPayload struct {
- SocketPath string
- Reserved0 string
-}
-
-// streamLocalChannelForwardMsg is a struct used for SSH2_MSG_GLOBAL_REQUEST message
-// with "streamlocal-forward@openssh.com"/"cancel-streamlocal-forward@openssh.com" string.
-type streamLocalChannelForwardMsg struct {
- socketPath string
-}
-
-// ListenUnix is similar to ListenTCP but uses a Unix domain socket.
-func (c *Client) ListenUnix(socketPath string) (net.Listener, error) {
- c.handleForwardsOnce.Do(c.handleForwards)
- m := streamLocalChannelForwardMsg{
- socketPath,
- }
- // send message
- ok, _, err := c.SendRequest("streamlocal-forward@openssh.com", true, Marshal(&m))
- if err != nil {
- return nil, err
- }
- if !ok {
- return nil, errors.New("ssh: streamlocal-forward@openssh.com request denied by peer")
- }
- ch := c.forwards.add(&net.UnixAddr{Name: socketPath, Net: "unix"})
-
- return &unixListener{socketPath, c, ch}, nil
-}
-
-func (c *Client) dialStreamLocal(socketPath string) (Channel, error) {
- msg := streamLocalChannelOpenDirectMsg{
- socketPath: socketPath,
- }
- ch, in, err := c.OpenChannel("direct-streamlocal@openssh.com", Marshal(&msg))
- if err != nil {
- return nil, err
- }
- go DiscardRequests(in)
- return ch, err
-}
-
-type unixListener struct {
- socketPath string
-
- conn *Client
- in <-chan forward
-}
-
-// Accept waits for and returns the next connection to the listener.
-func (l *unixListener) Accept() (net.Conn, error) {
- s, ok := <-l.in
- if !ok {
- return nil, io.EOF
- }
- ch, incoming, err := s.newCh.Accept()
- if err != nil {
- return nil, err
- }
- go DiscardRequests(incoming)
-
- return &chanConn{
- Channel: ch,
- laddr: &net.UnixAddr{
- Name: l.socketPath,
- Net: "unix",
- },
- raddr: &net.UnixAddr{
- Name: "@",
- Net: "unix",
- },
- }, nil
-}
-
-// Close closes the listener.
-func (l *unixListener) Close() error {
- // this also closes the listener.
- l.conn.forwards.remove(&net.UnixAddr{Name: l.socketPath, Net: "unix"})
- m := streamLocalChannelForwardMsg{
- l.socketPath,
- }
- ok, _, err := l.conn.SendRequest("cancel-streamlocal-forward@openssh.com", true, Marshal(&m))
- if err == nil && !ok {
- err = errors.New("ssh: cancel-streamlocal-forward@openssh.com failed")
- }
- return err
-}
-
-// Addr returns the listener's network address.
-func (l *unixListener) Addr() net.Addr {
- return &net.UnixAddr{
- Name: l.socketPath,
- Net: "unix",
- }
-}
diff --git a/vendor/golang.org/x/crypto/ssh/tcpip.go b/vendor/golang.org/x/crypto/ssh/tcpip.go
deleted file mode 100644
index ef5059a11..000000000
--- a/vendor/golang.org/x/crypto/ssh/tcpip.go
+++ /dev/null
@@ -1,509 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "math/rand"
- "net"
- "strconv"
- "strings"
- "sync"
- "time"
-)
-
-// Listen requests the remote peer open a listening socket on
-// addr. Incoming connections will be available by calling Accept on
-// the returned net.Listener. The listener must be serviced, or the
-// SSH connection may hang.
-// N must be "tcp", "tcp4", "tcp6", or "unix".
-func (c *Client) Listen(n, addr string) (net.Listener, error) {
- switch n {
- case "tcp", "tcp4", "tcp6":
- laddr, err := net.ResolveTCPAddr(n, addr)
- if err != nil {
- return nil, err
- }
- return c.ListenTCP(laddr)
- case "unix":
- return c.ListenUnix(addr)
- default:
- return nil, fmt.Errorf("ssh: unsupported protocol: %s", n)
- }
-}
-
-// Automatic port allocation is broken with OpenSSH before 6.0. See
-// also https://bugzilla.mindrot.org/show_bug.cgi?id=2017. In
-// particular, OpenSSH 5.9 sends a channelOpenMsg with port number 0,
-// rather than the actual port number. This means you can never open
-// two different listeners with auto allocated ports. We work around
-// this by trying explicit ports until we succeed.
-
-const openSSHPrefix = "OpenSSH_"
-
-var portRandomizer = rand.New(rand.NewSource(time.Now().UnixNano()))
-
-// isBrokenOpenSSHVersion returns true if the given version string
-// specifies a version of OpenSSH that is known to have a bug in port
-// forwarding.
-func isBrokenOpenSSHVersion(versionStr string) bool {
- i := strings.Index(versionStr, openSSHPrefix)
- if i < 0 {
- return false
- }
- i += len(openSSHPrefix)
- j := i
- for ; j < len(versionStr); j++ {
- if versionStr[j] < '0' || versionStr[j] > '9' {
- break
- }
- }
- version, _ := strconv.Atoi(versionStr[i:j])
- return version < 6
-}
-
-// autoPortListenWorkaround simulates automatic port allocation by
-// trying random ports repeatedly.
-func (c *Client) autoPortListenWorkaround(laddr *net.TCPAddr) (net.Listener, error) {
- var sshListener net.Listener
- var err error
- const tries = 10
- for i := 0; i < tries; i++ {
- addr := *laddr
- addr.Port = 1024 + portRandomizer.Intn(60000)
- sshListener, err = c.ListenTCP(&addr)
- if err == nil {
- laddr.Port = addr.Port
- return sshListener, err
- }
- }
- return nil, fmt.Errorf("ssh: listen on random port failed after %d tries: %v", tries, err)
-}
-
-// RFC 4254 7.1
-type channelForwardMsg struct {
- addr string
- rport uint32
-}
-
-// handleForwards starts goroutines handling forwarded connections.
-// It's called on first use by (*Client).ListenTCP to not launch
-// goroutines until needed.
-func (c *Client) handleForwards() {
- go c.forwards.handleChannels(c.HandleChannelOpen("forwarded-tcpip"))
- go c.forwards.handleChannels(c.HandleChannelOpen("forwarded-streamlocal@openssh.com"))
-}
-
-// ListenTCP requests the remote peer open a listening socket
-// on laddr. Incoming connections will be available by calling
-// Accept on the returned net.Listener.
-func (c *Client) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) {
- c.handleForwardsOnce.Do(c.handleForwards)
- if laddr.Port == 0 && isBrokenOpenSSHVersion(string(c.ServerVersion())) {
- return c.autoPortListenWorkaround(laddr)
- }
-
- m := channelForwardMsg{
- laddr.IP.String(),
- uint32(laddr.Port),
- }
- // send message
- ok, resp, err := c.SendRequest("tcpip-forward", true, Marshal(&m))
- if err != nil {
- return nil, err
- }
- if !ok {
- return nil, errors.New("ssh: tcpip-forward request denied by peer")
- }
-
- // If the original port was 0, then the remote side will
- // supply a real port number in the response.
- if laddr.Port == 0 {
- var p struct {
- Port uint32
- }
- if err := Unmarshal(resp, &p); err != nil {
- return nil, err
- }
- laddr.Port = int(p.Port)
- }
-
- // Register this forward, using the port number we obtained.
- ch := c.forwards.add(laddr)
-
- return &tcpListener{laddr, c, ch}, nil
-}
-
-// forwardList stores a mapping between remote
-// forward requests and the tcpListeners.
-type forwardList struct {
- sync.Mutex
- entries []forwardEntry
-}
-
-// forwardEntry represents an established mapping of a laddr on a
-// remote ssh server to a channel connected to a tcpListener.
-type forwardEntry struct {
- laddr net.Addr
- c chan forward
-}
-
-// forward represents an incoming forwarded tcpip connection. The
-// arguments to add/remove/lookup should be address as specified in
-// the original forward-request.
-type forward struct {
- newCh NewChannel // the ssh client channel underlying this forward
- raddr net.Addr // the raddr of the incoming connection
-}
-
-func (l *forwardList) add(addr net.Addr) chan forward {
- l.Lock()
- defer l.Unlock()
- f := forwardEntry{
- laddr: addr,
- c: make(chan forward, 1),
- }
- l.entries = append(l.entries, f)
- return f.c
-}
-
-// See RFC 4254, section 7.2
-type forwardedTCPPayload struct {
- Addr string
- Port uint32
- OriginAddr string
- OriginPort uint32
-}
-
-// parseTCPAddr parses the originating address from the remote into a *net.TCPAddr.
-func parseTCPAddr(addr string, port uint32) (*net.TCPAddr, error) {
- if port == 0 || port > 65535 {
- return nil, fmt.Errorf("ssh: port number out of range: %d", port)
- }
- ip := net.ParseIP(string(addr))
- if ip == nil {
- return nil, fmt.Errorf("ssh: cannot parse IP address %q", addr)
- }
- return &net.TCPAddr{IP: ip, Port: int(port)}, nil
-}
-
-func (l *forwardList) handleChannels(in <-chan NewChannel) {
- for ch := range in {
- var (
- laddr net.Addr
- raddr net.Addr
- err error
- )
- switch channelType := ch.ChannelType(); channelType {
- case "forwarded-tcpip":
- var payload forwardedTCPPayload
- if err = Unmarshal(ch.ExtraData(), &payload); err != nil {
- ch.Reject(ConnectionFailed, "could not parse forwarded-tcpip payload: "+err.Error())
- continue
- }
-
- // RFC 4254 section 7.2 specifies that incoming
- // addresses should list the address, in string
- // format. It is implied that this should be an IP
- // address, as it would be impossible to connect to it
- // otherwise.
- laddr, err = parseTCPAddr(payload.Addr, payload.Port)
- if err != nil {
- ch.Reject(ConnectionFailed, err.Error())
- continue
- }
- raddr, err = parseTCPAddr(payload.OriginAddr, payload.OriginPort)
- if err != nil {
- ch.Reject(ConnectionFailed, err.Error())
- continue
- }
-
- case "forwarded-streamlocal@openssh.com":
- var payload forwardedStreamLocalPayload
- if err = Unmarshal(ch.ExtraData(), &payload); err != nil {
- ch.Reject(ConnectionFailed, "could not parse forwarded-streamlocal@openssh.com payload: "+err.Error())
- continue
- }
- laddr = &net.UnixAddr{
- Name: payload.SocketPath,
- Net: "unix",
- }
- raddr = &net.UnixAddr{
- Name: "@",
- Net: "unix",
- }
- default:
- panic(fmt.Errorf("ssh: unknown channel type %s", channelType))
- }
- if ok := l.forward(laddr, raddr, ch); !ok {
- // Section 7.2, implementations MUST reject spurious incoming
- // connections.
- ch.Reject(Prohibited, "no forward for address")
- continue
- }
-
- }
-}
-
-// remove removes the forward entry, and the channel feeding its
-// listener.
-func (l *forwardList) remove(addr net.Addr) {
- l.Lock()
- defer l.Unlock()
- for i, f := range l.entries {
- if addr.Network() == f.laddr.Network() && addr.String() == f.laddr.String() {
- l.entries = append(l.entries[:i], l.entries[i+1:]...)
- close(f.c)
- return
- }
- }
-}
-
-// closeAll closes and clears all forwards.
-func (l *forwardList) closeAll() {
- l.Lock()
- defer l.Unlock()
- for _, f := range l.entries {
- close(f.c)
- }
- l.entries = nil
-}
-
-func (l *forwardList) forward(laddr, raddr net.Addr, ch NewChannel) bool {
- l.Lock()
- defer l.Unlock()
- for _, f := range l.entries {
- if laddr.Network() == f.laddr.Network() && laddr.String() == f.laddr.String() {
- f.c <- forward{newCh: ch, raddr: raddr}
- return true
- }
- }
- return false
-}
-
-type tcpListener struct {
- laddr *net.TCPAddr
-
- conn *Client
- in <-chan forward
-}
-
-// Accept waits for and returns the next connection to the listener.
-func (l *tcpListener) Accept() (net.Conn, error) {
- s, ok := <-l.in
- if !ok {
- return nil, io.EOF
- }
- ch, incoming, err := s.newCh.Accept()
- if err != nil {
- return nil, err
- }
- go DiscardRequests(incoming)
-
- return &chanConn{
- Channel: ch,
- laddr: l.laddr,
- raddr: s.raddr,
- }, nil
-}
-
-// Close closes the listener.
-func (l *tcpListener) Close() error {
- m := channelForwardMsg{
- l.laddr.IP.String(),
- uint32(l.laddr.Port),
- }
-
- // this also closes the listener.
- l.conn.forwards.remove(l.laddr)
- ok, _, err := l.conn.SendRequest("cancel-tcpip-forward", true, Marshal(&m))
- if err == nil && !ok {
- err = errors.New("ssh: cancel-tcpip-forward failed")
- }
- return err
-}
-
-// Addr returns the listener's network address.
-func (l *tcpListener) Addr() net.Addr {
- return l.laddr
-}
-
-// DialContext initiates a connection to the addr from the remote host.
-//
-// The provided Context must be non-nil. If the context expires before the
-// connection is complete, an error is returned. Once successfully connected,
-// any expiration of the context will not affect the connection.
-//
-// See func Dial for additional information.
-func (c *Client) DialContext(ctx context.Context, n, addr string) (net.Conn, error) {
- if err := ctx.Err(); err != nil {
- return nil, err
- }
- type connErr struct {
- conn net.Conn
- err error
- }
- ch := make(chan connErr)
- go func() {
- conn, err := c.Dial(n, addr)
- select {
- case ch <- connErr{conn, err}:
- case <-ctx.Done():
- if conn != nil {
- conn.Close()
- }
- }
- }()
- select {
- case res := <-ch:
- return res.conn, res.err
- case <-ctx.Done():
- return nil, ctx.Err()
- }
-}
-
-// Dial initiates a connection to the addr from the remote host.
-// The resulting connection has a zero LocalAddr() and RemoteAddr().
-func (c *Client) Dial(n, addr string) (net.Conn, error) {
- var ch Channel
- switch n {
- case "tcp", "tcp4", "tcp6":
- // Parse the address into host and numeric port.
- host, portString, err := net.SplitHostPort(addr)
- if err != nil {
- return nil, err
- }
- port, err := strconv.ParseUint(portString, 10, 16)
- if err != nil {
- return nil, err
- }
- ch, err = c.dial(net.IPv4zero.String(), 0, host, int(port))
- if err != nil {
- return nil, err
- }
- // Use a zero address for local and remote address.
- zeroAddr := &net.TCPAddr{
- IP: net.IPv4zero,
- Port: 0,
- }
- return &chanConn{
- Channel: ch,
- laddr: zeroAddr,
- raddr: zeroAddr,
- }, nil
- case "unix":
- var err error
- ch, err = c.dialStreamLocal(addr)
- if err != nil {
- return nil, err
- }
- return &chanConn{
- Channel: ch,
- laddr: &net.UnixAddr{
- Name: "@",
- Net: "unix",
- },
- raddr: &net.UnixAddr{
- Name: addr,
- Net: "unix",
- },
- }, nil
- default:
- return nil, fmt.Errorf("ssh: unsupported protocol: %s", n)
- }
-}
-
-// DialTCP connects to the remote address raddr on the network net,
-// which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is used
-// as the local address for the connection.
-func (c *Client) DialTCP(n string, laddr, raddr *net.TCPAddr) (net.Conn, error) {
- if laddr == nil {
- laddr = &net.TCPAddr{
- IP: net.IPv4zero,
- Port: 0,
- }
- }
- ch, err := c.dial(laddr.IP.String(), laddr.Port, raddr.IP.String(), raddr.Port)
- if err != nil {
- return nil, err
- }
- return &chanConn{
- Channel: ch,
- laddr: laddr,
- raddr: raddr,
- }, nil
-}
-
-// RFC 4254 7.2
-type channelOpenDirectMsg struct {
- raddr string
- rport uint32
- laddr string
- lport uint32
-}
-
-func (c *Client) dial(laddr string, lport int, raddr string, rport int) (Channel, error) {
- msg := channelOpenDirectMsg{
- raddr: raddr,
- rport: uint32(rport),
- laddr: laddr,
- lport: uint32(lport),
- }
- ch, in, err := c.OpenChannel("direct-tcpip", Marshal(&msg))
- if err != nil {
- return nil, err
- }
- go DiscardRequests(in)
- return ch, err
-}
-
-type tcpChan struct {
- Channel // the backing channel
-}
-
-// chanConn fulfills the net.Conn interface without
-// the tcpChan having to hold laddr or raddr directly.
-type chanConn struct {
- Channel
- laddr, raddr net.Addr
-}
-
-// LocalAddr returns the local network address.
-func (t *chanConn) LocalAddr() net.Addr {
- return t.laddr
-}
-
-// RemoteAddr returns the remote network address.
-func (t *chanConn) RemoteAddr() net.Addr {
- return t.raddr
-}
-
-// SetDeadline sets the read and write deadlines associated
-// with the connection.
-func (t *chanConn) SetDeadline(deadline time.Time) error {
- if err := t.SetReadDeadline(deadline); err != nil {
- return err
- }
- return t.SetWriteDeadline(deadline)
-}
-
-// SetReadDeadline sets the read deadline.
-// A zero value for t means Read will not time out.
-// After the deadline, the error from Read will implement net.Error
-// with Timeout() == true.
-func (t *chanConn) SetReadDeadline(deadline time.Time) error {
- // for compatibility with previous version,
- // the error message contains "tcpChan"
- return errors.New("ssh: tcpChan: deadline not supported")
-}
-
-// SetWriteDeadline exists to satisfy the net.Conn interface
-// but is not implemented by this type. It always returns an error.
-func (t *chanConn) SetWriteDeadline(deadline time.Time) error {
- return errors.New("ssh: tcpChan: deadline not supported")
-}
diff --git a/vendor/golang.org/x/crypto/ssh/transport.go b/vendor/golang.org/x/crypto/ssh/transport.go
deleted file mode 100644
index 0424d2d37..000000000
--- a/vendor/golang.org/x/crypto/ssh/transport.go
+++ /dev/null
@@ -1,380 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package ssh
-
-import (
- "bufio"
- "bytes"
- "errors"
- "io"
- "log"
-)
-
-// debugTransport if set, will print packet types as they go over the
-// wire. No message decoding is done, to minimize the impact on timing.
-const debugTransport = false
-
-const (
- gcm128CipherID = "aes128-gcm@openssh.com"
- gcm256CipherID = "aes256-gcm@openssh.com"
- aes128cbcID = "aes128-cbc"
- tripledescbcID = "3des-cbc"
-)
-
-// packetConn represents a transport that implements packet based
-// operations.
-type packetConn interface {
- // Encrypt and send a packet of data to the remote peer.
- writePacket(packet []byte) error
-
- // Read a packet from the connection. The read is blocking,
- // i.e. if error is nil, then the returned byte slice is
- // always non-empty.
- readPacket() ([]byte, error)
-
- // Close closes the write-side of the connection.
- Close() error
-}
-
-// transport is the keyingTransport that implements the SSH packet
-// protocol.
-type transport struct {
- reader connectionState
- writer connectionState
-
- bufReader *bufio.Reader
- bufWriter *bufio.Writer
- rand io.Reader
- isClient bool
- io.Closer
-
- strictMode bool
- initialKEXDone bool
-}
-
-// packetCipher represents a combination of SSH encryption/MAC
-// protocol. A single instance should be used for one direction only.
-type packetCipher interface {
- // writeCipherPacket encrypts the packet and writes it to w. The
- // contents of the packet are generally scrambled.
- writeCipherPacket(seqnum uint32, w io.Writer, rand io.Reader, packet []byte) error
-
- // readCipherPacket reads and decrypts a packet of data. The
- // returned packet may be overwritten by future calls of
- // readPacket.
- readCipherPacket(seqnum uint32, r io.Reader) ([]byte, error)
-}
-
-// connectionState represents one side (read or write) of the
-// connection. This is necessary because each direction has its own
-// keys, and can even have its own algorithms
-type connectionState struct {
- packetCipher
- seqNum uint32
- dir direction
- pendingKeyChange chan packetCipher
-}
-
-func (t *transport) setStrictMode() error {
- if t.reader.seqNum != 1 {
- return errors.New("ssh: sequence number != 1 when strict KEX mode requested")
- }
- t.strictMode = true
- return nil
-}
-
-func (t *transport) setInitialKEXDone() {
- t.initialKEXDone = true
-}
-
-// prepareKeyChange sets up key material for a keychange. The key changes in
-// both directions are triggered by reading and writing a msgNewKey packet
-// respectively.
-func (t *transport) prepareKeyChange(algs *algorithms, kexResult *kexResult) error {
- ciph, err := newPacketCipher(t.reader.dir, algs.r, kexResult)
- if err != nil {
- return err
- }
- t.reader.pendingKeyChange <- ciph
-
- ciph, err = newPacketCipher(t.writer.dir, algs.w, kexResult)
- if err != nil {
- return err
- }
- t.writer.pendingKeyChange <- ciph
-
- return nil
-}
-
-func (t *transport) printPacket(p []byte, write bool) {
- if len(p) == 0 {
- return
- }
- who := "server"
- if t.isClient {
- who = "client"
- }
- what := "read"
- if write {
- what = "write"
- }
-
- log.Println(what, who, p[0])
-}
-
-// Read and decrypt next packet.
-func (t *transport) readPacket() (p []byte, err error) {
- for {
- p, err = t.reader.readPacket(t.bufReader, t.strictMode)
- if err != nil {
- break
- }
- // in strict mode we pass through DEBUG and IGNORE packets only during the initial KEX
- if len(p) == 0 || (t.strictMode && !t.initialKEXDone) || (p[0] != msgIgnore && p[0] != msgDebug) {
- break
- }
- }
- if debugTransport {
- t.printPacket(p, false)
- }
-
- return p, err
-}
-
-func (s *connectionState) readPacket(r *bufio.Reader, strictMode bool) ([]byte, error) {
- packet, err := s.packetCipher.readCipherPacket(s.seqNum, r)
- s.seqNum++
- if err == nil && len(packet) == 0 {
- err = errors.New("ssh: zero length packet")
- }
-
- if len(packet) > 0 {
- switch packet[0] {
- case msgNewKeys:
- select {
- case cipher := <-s.pendingKeyChange:
- s.packetCipher = cipher
- if strictMode {
- s.seqNum = 0
- }
- default:
- return nil, errors.New("ssh: got bogus newkeys message")
- }
-
- case msgDisconnect:
- // Transform a disconnect message into an
- // error. Since this is lowest level at which
- // we interpret message types, doing it here
- // ensures that we don't have to handle it
- // elsewhere.
- var msg disconnectMsg
- if err := Unmarshal(packet, &msg); err != nil {
- return nil, err
- }
- return nil, &msg
- }
- }
-
- // The packet may point to an internal buffer, so copy the
- // packet out here.
- fresh := make([]byte, len(packet))
- copy(fresh, packet)
-
- return fresh, err
-}
-
-func (t *transport) writePacket(packet []byte) error {
- if debugTransport {
- t.printPacket(packet, true)
- }
- return t.writer.writePacket(t.bufWriter, t.rand, packet, t.strictMode)
-}
-
-func (s *connectionState) writePacket(w *bufio.Writer, rand io.Reader, packet []byte, strictMode bool) error {
- changeKeys := len(packet) > 0 && packet[0] == msgNewKeys
-
- err := s.packetCipher.writeCipherPacket(s.seqNum, w, rand, packet)
- if err != nil {
- return err
- }
- if err = w.Flush(); err != nil {
- return err
- }
- s.seqNum++
- if changeKeys {
- select {
- case cipher := <-s.pendingKeyChange:
- s.packetCipher = cipher
- if strictMode {
- s.seqNum = 0
- }
- default:
- panic("ssh: no key material for msgNewKeys")
- }
- }
- return err
-}
-
-func newTransport(rwc io.ReadWriteCloser, rand io.Reader, isClient bool) *transport {
- t := &transport{
- bufReader: bufio.NewReader(rwc),
- bufWriter: bufio.NewWriter(rwc),
- rand: rand,
- reader: connectionState{
- packetCipher: &streamPacketCipher{cipher: noneCipher{}},
- pendingKeyChange: make(chan packetCipher, 1),
- },
- writer: connectionState{
- packetCipher: &streamPacketCipher{cipher: noneCipher{}},
- pendingKeyChange: make(chan packetCipher, 1),
- },
- Closer: rwc,
- }
- t.isClient = isClient
-
- if isClient {
- t.reader.dir = serverKeys
- t.writer.dir = clientKeys
- } else {
- t.reader.dir = clientKeys
- t.writer.dir = serverKeys
- }
-
- return t
-}
-
-type direction struct {
- ivTag []byte
- keyTag []byte
- macKeyTag []byte
-}
-
-var (
- serverKeys = direction{[]byte{'B'}, []byte{'D'}, []byte{'F'}}
- clientKeys = direction{[]byte{'A'}, []byte{'C'}, []byte{'E'}}
-)
-
-// setupKeys sets the cipher and MAC keys from kex.K, kex.H and sessionId, as
-// described in RFC 4253, section 6.4. direction should either be serverKeys
-// (to setup server->client keys) or clientKeys (for client->server keys).
-func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (packetCipher, error) {
- cipherMode := cipherModes[algs.Cipher]
-
- iv := make([]byte, cipherMode.ivSize)
- key := make([]byte, cipherMode.keySize)
-
- generateKeyMaterial(iv, d.ivTag, kex)
- generateKeyMaterial(key, d.keyTag, kex)
-
- var macKey []byte
- if !aeadCiphers[algs.Cipher] {
- macMode := macModes[algs.MAC]
- macKey = make([]byte, macMode.keySize)
- generateKeyMaterial(macKey, d.macKeyTag, kex)
- }
-
- return cipherModes[algs.Cipher].create(key, iv, macKey, algs)
-}
-
-// generateKeyMaterial fills out with key material generated from tag, K, H
-// and sessionId, as specified in RFC 4253, section 7.2.
-func generateKeyMaterial(out, tag []byte, r *kexResult) {
- var digestsSoFar []byte
-
- h := r.Hash.New()
- for len(out) > 0 {
- h.Reset()
- h.Write(r.K)
- h.Write(r.H)
-
- if len(digestsSoFar) == 0 {
- h.Write(tag)
- h.Write(r.SessionID)
- } else {
- h.Write(digestsSoFar)
- }
-
- digest := h.Sum(nil)
- n := copy(out, digest)
- out = out[n:]
- if len(out) > 0 {
- digestsSoFar = append(digestsSoFar, digest...)
- }
- }
-}
-
-const packageVersion = "SSH-2.0-Go"
-
-// Sends and receives a version line. The versionLine string should
-// be US ASCII, start with "SSH-2.0-", and should not include a
-// newline. exchangeVersions returns the other side's version line.
-func exchangeVersions(rw io.ReadWriter, versionLine []byte) (them []byte, err error) {
- // Contrary to the RFC, we do not ignore lines that don't
- // start with "SSH-2.0-" to make the library usable with
- // nonconforming servers.
- for _, c := range versionLine {
- // The spec disallows non US-ASCII chars, and
- // specifically forbids null chars.
- if c < 32 {
- return nil, errors.New("ssh: junk character in version line")
- }
- }
- if _, err = rw.Write(append(versionLine, '\r', '\n')); err != nil {
- return
- }
-
- them, err = readVersion(rw)
- return them, err
-}
-
-// maxVersionStringBytes is the maximum number of bytes that we'll
-// accept as a version string. RFC 4253 section 4.2 limits this at 255
-// chars
-const maxVersionStringBytes = 255
-
-// Read version string as specified by RFC 4253, section 4.2.
-func readVersion(r io.Reader) ([]byte, error) {
- versionString := make([]byte, 0, 64)
- var ok bool
- var buf [1]byte
-
- for length := 0; length < maxVersionStringBytes; length++ {
- _, err := io.ReadFull(r, buf[:])
- if err != nil {
- return nil, err
- }
- // The RFC says that the version should be terminated with \r\n
- // but several SSH servers actually only send a \n.
- if buf[0] == '\n' {
- if !bytes.HasPrefix(versionString, []byte("SSH-")) {
- // RFC 4253 says we need to ignore all version string lines
- // except the one containing the SSH version (provided that
- // all the lines do not exceed 255 bytes in total).
- versionString = versionString[:0]
- continue
- }
- ok = true
- break
- }
-
- // non ASCII chars are disallowed, but we are lenient,
- // since Go doesn't use null-terminated strings.
-
- // The RFC allows a comment after a space, however,
- // all of it (version and comments) goes into the
- // session hash.
- versionString = append(versionString, buf[0])
- }
-
- if !ok {
- return nil, errors.New("ssh: overflow reading version string")
- }
-
- // There might be a '\r' on the end which we should remove.
- if len(versionString) > 0 && versionString[len(versionString)-1] == '\r' {
- versionString = versionString[:len(versionString)-1]
- }
- return versionString, nil
-}
diff --git a/vendor/golang.org/x/exp/LICENSE b/vendor/golang.org/x/exp/LICENSE
deleted file mode 100644
index 2a7cf70da..000000000
--- a/vendor/golang.org/x/exp/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright 2009 The Go Authors.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google LLC nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/exp/PATENTS b/vendor/golang.org/x/exp/PATENTS
deleted file mode 100644
index 733099041..000000000
--- a/vendor/golang.org/x/exp/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/exp/constraints/constraints.go b/vendor/golang.org/x/exp/constraints/constraints.go
deleted file mode 100644
index 2c033dff4..000000000
--- a/vendor/golang.org/x/exp/constraints/constraints.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2021 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 constraints defines a set of useful constraints to be used
-// with type parameters.
-package constraints
-
-// Signed is a constraint that permits any signed integer type.
-// If future releases of Go add new predeclared signed integer types,
-// this constraint will be modified to include them.
-type Signed interface {
- ~int | ~int8 | ~int16 | ~int32 | ~int64
-}
-
-// Unsigned is a constraint that permits any unsigned integer type.
-// If future releases of Go add new predeclared unsigned integer types,
-// this constraint will be modified to include them.
-type Unsigned interface {
- ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
-}
-
-// Integer is a constraint that permits any integer type.
-// If future releases of Go add new predeclared integer types,
-// this constraint will be modified to include them.
-type Integer interface {
- Signed | Unsigned
-}
-
-// Float is a constraint that permits any floating-point type.
-// If future releases of Go add new predeclared floating-point types,
-// this constraint will be modified to include them.
-type Float interface {
- ~float32 | ~float64
-}
-
-// Complex is a constraint that permits any complex numeric type.
-// If future releases of Go add new predeclared complex numeric types,
-// this constraint will be modified to include them.
-type Complex interface {
- ~complex64 | ~complex128
-}
-
-// Ordered is a constraint that permits any ordered type: any type
-// that supports the operators < <= >= >.
-// If future releases of Go add new ordered types,
-// this constraint will be modified to include them.
-type Ordered interface {
- Integer | Float | ~string
-}
diff --git a/vendor/golang.org/x/exp/slices/cmp.go b/vendor/golang.org/x/exp/slices/cmp.go
deleted file mode 100644
index fbf1934a0..000000000
--- a/vendor/golang.org/x/exp/slices/cmp.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2023 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 slices
-
-import "golang.org/x/exp/constraints"
-
-// min is a version of the predeclared function from the Go 1.21 release.
-func min[T constraints.Ordered](a, b T) T {
- if a < b || isNaN(a) {
- return a
- }
- return b
-}
-
-// max is a version of the predeclared function from the Go 1.21 release.
-func max[T constraints.Ordered](a, b T) T {
- if a > b || isNaN(a) {
- return a
- }
- return b
-}
-
-// cmpLess is a copy of cmp.Less from the Go 1.21 release.
-func cmpLess[T constraints.Ordered](x, y T) bool {
- return (isNaN(x) && !isNaN(y)) || x < y
-}
-
-// cmpCompare is a copy of cmp.Compare from the Go 1.21 release.
-func cmpCompare[T constraints.Ordered](x, y T) int {
- xNaN := isNaN(x)
- yNaN := isNaN(y)
- if xNaN && yNaN {
- return 0
- }
- if xNaN || x < y {
- return -1
- }
- if yNaN || x > y {
- return +1
- }
- return 0
-}
diff --git a/vendor/golang.org/x/exp/slices/slices.go b/vendor/golang.org/x/exp/slices/slices.go
deleted file mode 100644
index 46ceac343..000000000
--- a/vendor/golang.org/x/exp/slices/slices.go
+++ /dev/null
@@ -1,515 +0,0 @@
-// Copyright 2021 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 slices defines various functions useful with slices of any type.
-package slices
-
-import (
- "unsafe"
-
- "golang.org/x/exp/constraints"
-)
-
-// Equal reports whether two slices are equal: the same length and all
-// elements equal. If the lengths are different, Equal returns false.
-// Otherwise, the elements are compared in increasing index order, and the
-// comparison stops at the first unequal pair.
-// Floating point NaNs are not considered equal.
-func Equal[S ~[]E, E comparable](s1, s2 S) bool {
- if len(s1) != len(s2) {
- return false
- }
- for i := range s1 {
- if s1[i] != s2[i] {
- return false
- }
- }
- return true
-}
-
-// EqualFunc reports whether two slices are equal using an equality
-// function on each pair of elements. If the lengths are different,
-// EqualFunc returns false. Otherwise, the elements are compared in
-// increasing index order, and the comparison stops at the first index
-// for which eq returns false.
-func EqualFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, eq func(E1, E2) bool) bool {
- if len(s1) != len(s2) {
- return false
- }
- for i, v1 := range s1 {
- v2 := s2[i]
- if !eq(v1, v2) {
- return false
- }
- }
- return true
-}
-
-// Compare compares the elements of s1 and s2, using [cmp.Compare] on each pair
-// of elements. The elements are compared sequentially, starting at index 0,
-// until one element is not equal to the other.
-// The result of comparing the first non-matching elements is returned.
-// If both slices are equal until one of them ends, the shorter slice is
-// considered less than the longer one.
-// The result is 0 if s1 == s2, -1 if s1 < s2, and +1 if s1 > s2.
-func Compare[S ~[]E, E constraints.Ordered](s1, s2 S) int {
- for i, v1 := range s1 {
- if i >= len(s2) {
- return +1
- }
- v2 := s2[i]
- if c := cmpCompare(v1, v2); c != 0 {
- return c
- }
- }
- if len(s1) < len(s2) {
- return -1
- }
- return 0
-}
-
-// CompareFunc is like [Compare] but uses a custom comparison function on each
-// pair of elements.
-// The result is the first non-zero result of cmp; if cmp always
-// returns 0 the result is 0 if len(s1) == len(s2), -1 if len(s1) < len(s2),
-// and +1 if len(s1) > len(s2).
-func CompareFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, cmp func(E1, E2) int) int {
- for i, v1 := range s1 {
- if i >= len(s2) {
- return +1
- }
- v2 := s2[i]
- if c := cmp(v1, v2); c != 0 {
- return c
- }
- }
- if len(s1) < len(s2) {
- return -1
- }
- return 0
-}
-
-// Index returns the index of the first occurrence of v in s,
-// or -1 if not present.
-func Index[S ~[]E, E comparable](s S, v E) int {
- for i := range s {
- if v == s[i] {
- return i
- }
- }
- return -1
-}
-
-// IndexFunc returns the first index i satisfying f(s[i]),
-// or -1 if none do.
-func IndexFunc[S ~[]E, E any](s S, f func(E) bool) int {
- for i := range s {
- if f(s[i]) {
- return i
- }
- }
- return -1
-}
-
-// Contains reports whether v is present in s.
-func Contains[S ~[]E, E comparable](s S, v E) bool {
- return Index(s, v) >= 0
-}
-
-// ContainsFunc reports whether at least one
-// element e of s satisfies f(e).
-func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool {
- return IndexFunc(s, f) >= 0
-}
-
-// Insert inserts the values v... into s at index i,
-// returning the modified slice.
-// The elements at s[i:] are shifted up to make room.
-// In the returned slice r, r[i] == v[0],
-// and r[i+len(v)] == value originally at r[i].
-// Insert panics if i is out of range.
-// This function is O(len(s) + len(v)).
-func Insert[S ~[]E, E any](s S, i int, v ...E) S {
- m := len(v)
- if m == 0 {
- return s
- }
- n := len(s)
- if i == n {
- return append(s, v...)
- }
- if n+m > cap(s) {
- // Use append rather than make so that we bump the size of
- // the slice up to the next storage class.
- // This is what Grow does but we don't call Grow because
- // that might copy the values twice.
- s2 := append(s[:i], make(S, n+m-i)...)
- copy(s2[i:], v)
- copy(s2[i+m:], s[i:])
- return s2
- }
- s = s[:n+m]
-
- // before:
- // s: aaaaaaaabbbbccccccccdddd
- // ^ ^ ^ ^
- // i i+m n n+m
- // after:
- // s: aaaaaaaavvvvbbbbcccccccc
- // ^ ^ ^ ^
- // i i+m n n+m
- //
- // a are the values that don't move in s.
- // v are the values copied in from v.
- // b and c are the values from s that are shifted up in index.
- // d are the values that get overwritten, never to be seen again.
-
- if !overlaps(v, s[i+m:]) {
- // Easy case - v does not overlap either the c or d regions.
- // (It might be in some of a or b, or elsewhere entirely.)
- // The data we copy up doesn't write to v at all, so just do it.
-
- copy(s[i+m:], s[i:])
-
- // Now we have
- // s: aaaaaaaabbbbbbbbcccccccc
- // ^ ^ ^ ^
- // i i+m n n+m
- // Note the b values are duplicated.
-
- copy(s[i:], v)
-
- // Now we have
- // s: aaaaaaaavvvvbbbbcccccccc
- // ^ ^ ^ ^
- // i i+m n n+m
- // That's the result we want.
- return s
- }
-
- // The hard case - v overlaps c or d. We can't just shift up
- // the data because we'd move or clobber the values we're trying
- // to insert.
- // So instead, write v on top of d, then rotate.
- copy(s[n:], v)
-
- // Now we have
- // s: aaaaaaaabbbbccccccccvvvv
- // ^ ^ ^ ^
- // i i+m n n+m
-
- rotateRight(s[i:], m)
-
- // Now we have
- // s: aaaaaaaavvvvbbbbcccccccc
- // ^ ^ ^ ^
- // i i+m n n+m
- // That's the result we want.
- return s
-}
-
-// clearSlice sets all elements up to the length of s to the zero value of E.
-// We may use the builtin clear func instead, and remove clearSlice, when upgrading
-// to Go 1.21+.
-func clearSlice[S ~[]E, E any](s S) {
- var zero E
- for i := range s {
- s[i] = zero
- }
-}
-
-// Delete removes the elements s[i:j] from s, returning the modified slice.
-// Delete panics if j > len(s) or s[i:j] is not a valid slice of s.
-// Delete is O(len(s)-i), so if many items must be deleted, it is better to
-// make a single call deleting them all together than to delete one at a time.
-// Delete zeroes the elements s[len(s)-(j-i):len(s)].
-func Delete[S ~[]E, E any](s S, i, j int) S {
- _ = s[i:j:len(s)] // bounds check
-
- if i == j {
- return s
- }
-
- oldlen := len(s)
- s = append(s[:i], s[j:]...)
- clearSlice(s[len(s):oldlen]) // zero/nil out the obsolete elements, for GC
- return s
-}
-
-// DeleteFunc removes any elements from s for which del returns true,
-// returning the modified slice.
-// DeleteFunc zeroes the elements between the new length and the original length.
-func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S {
- i := IndexFunc(s, del)
- if i == -1 {
- return s
- }
- // Don't start copying elements until we find one to delete.
- for j := i + 1; j < len(s); j++ {
- if v := s[j]; !del(v) {
- s[i] = v
- i++
- }
- }
- clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC
- return s[:i]
-}
-
-// Replace replaces the elements s[i:j] by the given v, and returns the
-// modified slice. Replace panics if s[i:j] is not a valid slice of s.
-// When len(v) < (j-i), Replace zeroes the elements between the new length and the original length.
-func Replace[S ~[]E, E any](s S, i, j int, v ...E) S {
- _ = s[i:j] // verify that i:j is a valid subslice
-
- if i == j {
- return Insert(s, i, v...)
- }
- if j == len(s) {
- return append(s[:i], v...)
- }
-
- tot := len(s[:i]) + len(v) + len(s[j:])
- if tot > cap(s) {
- // Too big to fit, allocate and copy over.
- s2 := append(s[:i], make(S, tot-i)...) // See Insert
- copy(s2[i:], v)
- copy(s2[i+len(v):], s[j:])
- return s2
- }
-
- r := s[:tot]
-
- if i+len(v) <= j {
- // Easy, as v fits in the deleted portion.
- copy(r[i:], v)
- if i+len(v) != j {
- copy(r[i+len(v):], s[j:])
- }
- clearSlice(s[tot:]) // zero/nil out the obsolete elements, for GC
- return r
- }
-
- // We are expanding (v is bigger than j-i).
- // The situation is something like this:
- // (example has i=4,j=8,len(s)=16,len(v)=6)
- // s: aaaaxxxxbbbbbbbbyy
- // ^ ^ ^ ^
- // i j len(s) tot
- // a: prefix of s
- // x: deleted range
- // b: more of s
- // y: area to expand into
-
- if !overlaps(r[i+len(v):], v) {
- // Easy, as v is not clobbered by the first copy.
- copy(r[i+len(v):], s[j:])
- copy(r[i:], v)
- return r
- }
-
- // This is a situation where we don't have a single place to which
- // we can copy v. Parts of it need to go to two different places.
- // We want to copy the prefix of v into y and the suffix into x, then
- // rotate |y| spots to the right.
- //
- // v[2:] v[:2]
- // | |
- // s: aaaavvvvbbbbbbbbvv
- // ^ ^ ^ ^
- // i j len(s) tot
- //
- // If either of those two destinations don't alias v, then we're good.
- y := len(v) - (j - i) // length of y portion
-
- if !overlaps(r[i:j], v) {
- copy(r[i:j], v[y:])
- copy(r[len(s):], v[:y])
- rotateRight(r[i:], y)
- return r
- }
- if !overlaps(r[len(s):], v) {
- copy(r[len(s):], v[:y])
- copy(r[i:j], v[y:])
- rotateRight(r[i:], y)
- return r
- }
-
- // Now we know that v overlaps both x and y.
- // That means that the entirety of b is *inside* v.
- // So we don't need to preserve b at all; instead we
- // can copy v first, then copy the b part of v out of
- // v to the right destination.
- k := startIdx(v, s[j:])
- copy(r[i:], v)
- copy(r[i+len(v):], r[i+k:])
- return r
-}
-
-// Clone returns a copy of the slice.
-// The elements are copied using assignment, so this is a shallow clone.
-func Clone[S ~[]E, E any](s S) S {
- // Preserve nil in case it matters.
- if s == nil {
- return nil
- }
- return append(S([]E{}), s...)
-}
-
-// Compact replaces consecutive runs of equal elements with a single copy.
-// This is like the uniq command found on Unix.
-// Compact modifies the contents of the slice s and returns the modified slice,
-// which may have a smaller length.
-// Compact zeroes the elements between the new length and the original length.
-func Compact[S ~[]E, E comparable](s S) S {
- if len(s) < 2 {
- return s
- }
- i := 1
- for k := 1; k < len(s); k++ {
- if s[k] != s[k-1] {
- if i != k {
- s[i] = s[k]
- }
- i++
- }
- }
- clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC
- return s[:i]
-}
-
-// CompactFunc is like [Compact] but uses an equality function to compare elements.
-// For runs of elements that compare equal, CompactFunc keeps the first one.
-// CompactFunc zeroes the elements between the new length and the original length.
-func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S {
- if len(s) < 2 {
- return s
- }
- i := 1
- for k := 1; k < len(s); k++ {
- if !eq(s[k], s[k-1]) {
- if i != k {
- s[i] = s[k]
- }
- i++
- }
- }
- clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC
- return s[:i]
-}
-
-// Grow increases the slice's capacity, if necessary, to guarantee space for
-// another n elements. After Grow(n), at least n elements can be appended
-// to the slice without another allocation. If n is negative or too large to
-// allocate the memory, Grow panics.
-func Grow[S ~[]E, E any](s S, n int) S {
- if n < 0 {
- panic("cannot be negative")
- }
- if n -= cap(s) - len(s); n > 0 {
- // TODO(https://go.dev/issue/53888): Make using []E instead of S
- // to workaround a compiler bug where the runtime.growslice optimization
- // does not take effect. Revert when the compiler is fixed.
- s = append([]E(s)[:cap(s)], make([]E, n)...)[:len(s)]
- }
- return s
-}
-
-// Clip removes unused capacity from the slice, returning s[:len(s):len(s)].
-func Clip[S ~[]E, E any](s S) S {
- return s[:len(s):len(s)]
-}
-
-// Rotation algorithm explanation:
-//
-// rotate left by 2
-// start with
-// 0123456789
-// split up like this
-// 01 234567 89
-// swap first 2 and last 2
-// 89 234567 01
-// join first parts
-// 89234567 01
-// recursively rotate first left part by 2
-// 23456789 01
-// join at the end
-// 2345678901
-//
-// rotate left by 8
-// start with
-// 0123456789
-// split up like this
-// 01 234567 89
-// swap first 2 and last 2
-// 89 234567 01
-// join last parts
-// 89 23456701
-// recursively rotate second part left by 6
-// 89 01234567
-// join at the end
-// 8901234567
-
-// TODO: There are other rotate algorithms.
-// This algorithm has the desirable property that it moves each element exactly twice.
-// The triple-reverse algorithm is simpler and more cache friendly, but takes more writes.
-// The follow-cycles algorithm can be 1-write but it is not very cache friendly.
-
-// rotateLeft rotates b left by n spaces.
-// s_final[i] = s_orig[i+r], wrapping around.
-func rotateLeft[E any](s []E, r int) {
- for r != 0 && r != len(s) {
- if r*2 <= len(s) {
- swap(s[:r], s[len(s)-r:])
- s = s[:len(s)-r]
- } else {
- swap(s[:len(s)-r], s[r:])
- s, r = s[len(s)-r:], r*2-len(s)
- }
- }
-}
-func rotateRight[E any](s []E, r int) {
- rotateLeft(s, len(s)-r)
-}
-
-// swap swaps the contents of x and y. x and y must be equal length and disjoint.
-func swap[E any](x, y []E) {
- for i := 0; i < len(x); i++ {
- x[i], y[i] = y[i], x[i]
- }
-}
-
-// overlaps reports whether the memory ranges a[0:len(a)] and b[0:len(b)] overlap.
-func overlaps[E any](a, b []E) bool {
- if len(a) == 0 || len(b) == 0 {
- return false
- }
- elemSize := unsafe.Sizeof(a[0])
- if elemSize == 0 {
- return false
- }
- // TODO: use a runtime/unsafe facility once one becomes available. See issue 12445.
- // Also see crypto/internal/alias/alias.go:AnyOverlap
- return uintptr(unsafe.Pointer(&a[0])) <= uintptr(unsafe.Pointer(&b[len(b)-1]))+(elemSize-1) &&
- uintptr(unsafe.Pointer(&b[0])) <= uintptr(unsafe.Pointer(&a[len(a)-1]))+(elemSize-1)
-}
-
-// startIdx returns the index in haystack where the needle starts.
-// prerequisite: the needle must be aliased entirely inside the haystack.
-func startIdx[E any](haystack, needle []E) int {
- p := &needle[0]
- for i := range haystack {
- if p == &haystack[i] {
- return i
- }
- }
- // TODO: what if the overlap is by a non-integral number of Es?
- panic("needle not found")
-}
-
-// Reverse reverses the elements of the slice in place.
-func Reverse[S ~[]E, E any](s S) {
- for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
- s[i], s[j] = s[j], s[i]
- }
-}
diff --git a/vendor/golang.org/x/exp/slices/sort.go b/vendor/golang.org/x/exp/slices/sort.go
deleted file mode 100644
index f58bbc7ba..000000000
--- a/vendor/golang.org/x/exp/slices/sort.go
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2022 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.
-
-//go:generate go run $GOROOT/src/sort/gen_sort_variants.go -exp
-
-package slices
-
-import (
- "math/bits"
-
- "golang.org/x/exp/constraints"
-)
-
-// Sort sorts a slice of any ordered type in ascending order.
-// When sorting floating-point numbers, NaNs are ordered before other values.
-func Sort[S ~[]E, E constraints.Ordered](x S) {
- n := len(x)
- pdqsortOrdered(x, 0, n, bits.Len(uint(n)))
-}
-
-// SortFunc sorts the slice x in ascending order as determined by the cmp
-// function. This sort is not guaranteed to be stable.
-// cmp(a, b) should return a negative number when a < b, a positive number when
-// a > b and zero when a == b or when a is not comparable to b in the sense
-// of the formal definition of Strict Weak Ordering.
-//
-// SortFunc requires that cmp is a strict weak ordering.
-// See https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings.
-// To indicate 'uncomparable', return 0 from the function.
-func SortFunc[S ~[]E, E any](x S, cmp func(a, b E) int) {
- n := len(x)
- pdqsortCmpFunc(x, 0, n, bits.Len(uint(n)), cmp)
-}
-
-// SortStableFunc sorts the slice x while keeping the original order of equal
-// elements, using cmp to compare elements in the same way as [SortFunc].
-func SortStableFunc[S ~[]E, E any](x S, cmp func(a, b E) int) {
- stableCmpFunc(x, len(x), cmp)
-}
-
-// IsSorted reports whether x is sorted in ascending order.
-func IsSorted[S ~[]E, E constraints.Ordered](x S) bool {
- for i := len(x) - 1; i > 0; i-- {
- if cmpLess(x[i], x[i-1]) {
- return false
- }
- }
- return true
-}
-
-// IsSortedFunc reports whether x is sorted in ascending order, with cmp as the
-// comparison function as defined by [SortFunc].
-func IsSortedFunc[S ~[]E, E any](x S, cmp func(a, b E) int) bool {
- for i := len(x) - 1; i > 0; i-- {
- if cmp(x[i], x[i-1]) < 0 {
- return false
- }
- }
- return true
-}
-
-// Min returns the minimal value in x. It panics if x is empty.
-// For floating-point numbers, Min propagates NaNs (any NaN value in x
-// forces the output to be NaN).
-func Min[S ~[]E, E constraints.Ordered](x S) E {
- if len(x) < 1 {
- panic("slices.Min: empty list")
- }
- m := x[0]
- for i := 1; i < len(x); i++ {
- m = min(m, x[i])
- }
- return m
-}
-
-// MinFunc returns the minimal value in x, using cmp to compare elements.
-// It panics if x is empty. If there is more than one minimal element
-// according to the cmp function, MinFunc returns the first one.
-func MinFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E {
- if len(x) < 1 {
- panic("slices.MinFunc: empty list")
- }
- m := x[0]
- for i := 1; i < len(x); i++ {
- if cmp(x[i], m) < 0 {
- m = x[i]
- }
- }
- return m
-}
-
-// Max returns the maximal value in x. It panics if x is empty.
-// For floating-point E, Max propagates NaNs (any NaN value in x
-// forces the output to be NaN).
-func Max[S ~[]E, E constraints.Ordered](x S) E {
- if len(x) < 1 {
- panic("slices.Max: empty list")
- }
- m := x[0]
- for i := 1; i < len(x); i++ {
- m = max(m, x[i])
- }
- return m
-}
-
-// MaxFunc returns the maximal value in x, using cmp to compare elements.
-// It panics if x is empty. If there is more than one maximal element
-// according to the cmp function, MaxFunc returns the first one.
-func MaxFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E {
- if len(x) < 1 {
- panic("slices.MaxFunc: empty list")
- }
- m := x[0]
- for i := 1; i < len(x); i++ {
- if cmp(x[i], m) > 0 {
- m = x[i]
- }
- }
- return m
-}
-
-// BinarySearch searches for target in a sorted slice and returns the position
-// where target is found, or the position where target would appear in the
-// sort order; it also returns a bool saying whether the target is really found
-// in the slice. The slice must be sorted in increasing order.
-func BinarySearch[S ~[]E, E constraints.Ordered](x S, target E) (int, bool) {
- // Inlining is faster than calling BinarySearchFunc with a lambda.
- n := len(x)
- // Define x[-1] < target and x[n] >= target.
- // Invariant: x[i-1] < target, x[j] >= target.
- i, j := 0, n
- for i < j {
- h := int(uint(i+j) >> 1) // avoid overflow when computing h
- // i ≤ h < j
- if cmpLess(x[h], target) {
- i = h + 1 // preserves x[i-1] < target
- } else {
- j = h // preserves x[j] >= target
- }
- }
- // i == j, x[i-1] < target, and x[j] (= x[i]) >= target => answer is i.
- return i, i < n && (x[i] == target || (isNaN(x[i]) && isNaN(target)))
-}
-
-// BinarySearchFunc works like [BinarySearch], but uses a custom comparison
-// function. The slice must be sorted in increasing order, where "increasing"
-// is defined by cmp. cmp should return 0 if the slice element matches
-// the target, a negative number if the slice element precedes the target,
-// or a positive number if the slice element follows the target.
-// cmp must implement the same ordering as the slice, such that if
-// cmp(a, t) < 0 and cmp(b, t) >= 0, then a must precede b in the slice.
-func BinarySearchFunc[S ~[]E, E, T any](x S, target T, cmp func(E, T) int) (int, bool) {
- n := len(x)
- // Define cmp(x[-1], target) < 0 and cmp(x[n], target) >= 0 .
- // Invariant: cmp(x[i - 1], target) < 0, cmp(x[j], target) >= 0.
- i, j := 0, n
- for i < j {
- h := int(uint(i+j) >> 1) // avoid overflow when computing h
- // i ≤ h < j
- if cmp(x[h], target) < 0 {
- i = h + 1 // preserves cmp(x[i - 1], target) < 0
- } else {
- j = h // preserves cmp(x[j], target) >= 0
- }
- }
- // i == j, cmp(x[i-1], target) < 0, and cmp(x[j], target) (= cmp(x[i], target)) >= 0 => answer is i.
- return i, i < n && cmp(x[i], target) == 0
-}
-
-type sortedHint int // hint for pdqsort when choosing the pivot
-
-const (
- unknownHint sortedHint = iota
- increasingHint
- decreasingHint
-)
-
-// xorshift paper: https://www.jstatsoft.org/article/view/v008i14/xorshift.pdf
-type xorshift uint64
-
-func (r *xorshift) Next() uint64 {
- *r ^= *r << 13
- *r ^= *r >> 17
- *r ^= *r << 5
- return uint64(*r)
-}
-
-func nextPowerOfTwo(length int) uint {
- return 1 << bits.Len(uint(length))
-}
-
-// isNaN reports whether x is a NaN without requiring the math package.
-// This will always return false if T is not floating-point.
-func isNaN[T constraints.Ordered](x T) bool {
- return x != x
-}
diff --git a/vendor/golang.org/x/exp/slices/zsortanyfunc.go b/vendor/golang.org/x/exp/slices/zsortanyfunc.go
deleted file mode 100644
index 06f2c7a24..000000000
--- a/vendor/golang.org/x/exp/slices/zsortanyfunc.go
+++ /dev/null
@@ -1,479 +0,0 @@
-// Code generated by gen_sort_variants.go; DO NOT EDIT.
-
-// Copyright 2022 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 slices
-
-// insertionSortCmpFunc sorts data[a:b] using insertion sort.
-func insertionSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) {
- for i := a + 1; i < b; i++ {
- for j := i; j > a && (cmp(data[j], data[j-1]) < 0); j-- {
- data[j], data[j-1] = data[j-1], data[j]
- }
- }
-}
-
-// siftDownCmpFunc implements the heap property on data[lo:hi].
-// first is an offset into the array where the root of the heap lies.
-func siftDownCmpFunc[E any](data []E, lo, hi, first int, cmp func(a, b E) int) {
- root := lo
- for {
- child := 2*root + 1
- if child >= hi {
- break
- }
- if child+1 < hi && (cmp(data[first+child], data[first+child+1]) < 0) {
- child++
- }
- if !(cmp(data[first+root], data[first+child]) < 0) {
- return
- }
- data[first+root], data[first+child] = data[first+child], data[first+root]
- root = child
- }
-}
-
-func heapSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) {
- first := a
- lo := 0
- hi := b - a
-
- // Build heap with greatest element at top.
- for i := (hi - 1) / 2; i >= 0; i-- {
- siftDownCmpFunc(data, i, hi, first, cmp)
- }
-
- // Pop elements, largest first, into end of data.
- for i := hi - 1; i >= 0; i-- {
- data[first], data[first+i] = data[first+i], data[first]
- siftDownCmpFunc(data, lo, i, first, cmp)
- }
-}
-
-// pdqsortCmpFunc sorts data[a:b].
-// The algorithm based on pattern-defeating quicksort(pdqsort), but without the optimizations from BlockQuicksort.
-// pdqsort paper: https://arxiv.org/pdf/2106.05123.pdf
-// C++ implementation: https://github.com/orlp/pdqsort
-// Rust implementation: https://docs.rs/pdqsort/latest/pdqsort/
-// limit is the number of allowed bad (very unbalanced) pivots before falling back to heapsort.
-func pdqsortCmpFunc[E any](data []E, a, b, limit int, cmp func(a, b E) int) {
- const maxInsertion = 12
-
- var (
- wasBalanced = true // whether the last partitioning was reasonably balanced
- wasPartitioned = true // whether the slice was already partitioned
- )
-
- for {
- length := b - a
-
- if length <= maxInsertion {
- insertionSortCmpFunc(data, a, b, cmp)
- return
- }
-
- // Fall back to heapsort if too many bad choices were made.
- if limit == 0 {
- heapSortCmpFunc(data, a, b, cmp)
- return
- }
-
- // If the last partitioning was imbalanced, we need to breaking patterns.
- if !wasBalanced {
- breakPatternsCmpFunc(data, a, b, cmp)
- limit--
- }
-
- pivot, hint := choosePivotCmpFunc(data, a, b, cmp)
- if hint == decreasingHint {
- reverseRangeCmpFunc(data, a, b, cmp)
- // The chosen pivot was pivot-a elements after the start of the array.
- // After reversing it is pivot-a elements before the end of the array.
- // The idea came from Rust's implementation.
- pivot = (b - 1) - (pivot - a)
- hint = increasingHint
- }
-
- // The slice is likely already sorted.
- if wasBalanced && wasPartitioned && hint == increasingHint {
- if partialInsertionSortCmpFunc(data, a, b, cmp) {
- return
- }
- }
-
- // Probably the slice contains many duplicate elements, partition the slice into
- // elements equal to and elements greater than the pivot.
- if a > 0 && !(cmp(data[a-1], data[pivot]) < 0) {
- mid := partitionEqualCmpFunc(data, a, b, pivot, cmp)
- a = mid
- continue
- }
-
- mid, alreadyPartitioned := partitionCmpFunc(data, a, b, pivot, cmp)
- wasPartitioned = alreadyPartitioned
-
- leftLen, rightLen := mid-a, b-mid
- balanceThreshold := length / 8
- if leftLen < rightLen {
- wasBalanced = leftLen >= balanceThreshold
- pdqsortCmpFunc(data, a, mid, limit, cmp)
- a = mid + 1
- } else {
- wasBalanced = rightLen >= balanceThreshold
- pdqsortCmpFunc(data, mid+1, b, limit, cmp)
- b = mid
- }
- }
-}
-
-// partitionCmpFunc does one quicksort partition.
-// Let p = data[pivot]
-// Moves elements in data[a:b] around, so that data[i]=p for inewpivot.
-// On return, data[newpivot] = p
-func partitionCmpFunc[E any](data []E, a, b, pivot int, cmp func(a, b E) int) (newpivot int, alreadyPartitioned bool) {
- data[a], data[pivot] = data[pivot], data[a]
- i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned
-
- for i <= j && (cmp(data[i], data[a]) < 0) {
- i++
- }
- for i <= j && !(cmp(data[j], data[a]) < 0) {
- j--
- }
- if i > j {
- data[j], data[a] = data[a], data[j]
- return j, true
- }
- data[i], data[j] = data[j], data[i]
- i++
- j--
-
- for {
- for i <= j && (cmp(data[i], data[a]) < 0) {
- i++
- }
- for i <= j && !(cmp(data[j], data[a]) < 0) {
- j--
- }
- if i > j {
- break
- }
- data[i], data[j] = data[j], data[i]
- i++
- j--
- }
- data[j], data[a] = data[a], data[j]
- return j, false
-}
-
-// partitionEqualCmpFunc partitions data[a:b] into elements equal to data[pivot] followed by elements greater than data[pivot].
-// It assumed that data[a:b] does not contain elements smaller than the data[pivot].
-func partitionEqualCmpFunc[E any](data []E, a, b, pivot int, cmp func(a, b E) int) (newpivot int) {
- data[a], data[pivot] = data[pivot], data[a]
- i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned
-
- for {
- for i <= j && !(cmp(data[a], data[i]) < 0) {
- i++
- }
- for i <= j && (cmp(data[a], data[j]) < 0) {
- j--
- }
- if i > j {
- break
- }
- data[i], data[j] = data[j], data[i]
- i++
- j--
- }
- return i
-}
-
-// partialInsertionSortCmpFunc partially sorts a slice, returns true if the slice is sorted at the end.
-func partialInsertionSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) bool {
- const (
- maxSteps = 5 // maximum number of adjacent out-of-order pairs that will get shifted
- shortestShifting = 50 // don't shift any elements on short arrays
- )
- i := a + 1
- for j := 0; j < maxSteps; j++ {
- for i < b && !(cmp(data[i], data[i-1]) < 0) {
- i++
- }
-
- if i == b {
- return true
- }
-
- if b-a < shortestShifting {
- return false
- }
-
- data[i], data[i-1] = data[i-1], data[i]
-
- // Shift the smaller one to the left.
- if i-a >= 2 {
- for j := i - 1; j >= 1; j-- {
- if !(cmp(data[j], data[j-1]) < 0) {
- break
- }
- data[j], data[j-1] = data[j-1], data[j]
- }
- }
- // Shift the greater one to the right.
- if b-i >= 2 {
- for j := i + 1; j < b; j++ {
- if !(cmp(data[j], data[j-1]) < 0) {
- break
- }
- data[j], data[j-1] = data[j-1], data[j]
- }
- }
- }
- return false
-}
-
-// breakPatternsCmpFunc scatters some elements around in an attempt to break some patterns
-// that might cause imbalanced partitions in quicksort.
-func breakPatternsCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) {
- length := b - a
- if length >= 8 {
- random := xorshift(length)
- modulus := nextPowerOfTwo(length)
-
- for idx := a + (length/4)*2 - 1; idx <= a+(length/4)*2+1; idx++ {
- other := int(uint(random.Next()) & (modulus - 1))
- if other >= length {
- other -= length
- }
- data[idx], data[a+other] = data[a+other], data[idx]
- }
- }
-}
-
-// choosePivotCmpFunc chooses a pivot in data[a:b].
-//
-// [0,8): chooses a static pivot.
-// [8,shortestNinther): uses the simple median-of-three method.
-// [shortestNinther,∞): uses the Tukey ninther method.
-func choosePivotCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) (pivot int, hint sortedHint) {
- const (
- shortestNinther = 50
- maxSwaps = 4 * 3
- )
-
- l := b - a
-
- var (
- swaps int
- i = a + l/4*1
- j = a + l/4*2
- k = a + l/4*3
- )
-
- if l >= 8 {
- if l >= shortestNinther {
- // Tukey ninther method, the idea came from Rust's implementation.
- i = medianAdjacentCmpFunc(data, i, &swaps, cmp)
- j = medianAdjacentCmpFunc(data, j, &swaps, cmp)
- k = medianAdjacentCmpFunc(data, k, &swaps, cmp)
- }
- // Find the median among i, j, k and stores it into j.
- j = medianCmpFunc(data, i, j, k, &swaps, cmp)
- }
-
- switch swaps {
- case 0:
- return j, increasingHint
- case maxSwaps:
- return j, decreasingHint
- default:
- return j, unknownHint
- }
-}
-
-// order2CmpFunc returns x,y where data[x] <= data[y], where x,y=a,b or x,y=b,a.
-func order2CmpFunc[E any](data []E, a, b int, swaps *int, cmp func(a, b E) int) (int, int) {
- if cmp(data[b], data[a]) < 0 {
- *swaps++
- return b, a
- }
- return a, b
-}
-
-// medianCmpFunc returns x where data[x] is the median of data[a],data[b],data[c], where x is a, b, or c.
-func medianCmpFunc[E any](data []E, a, b, c int, swaps *int, cmp func(a, b E) int) int {
- a, b = order2CmpFunc(data, a, b, swaps, cmp)
- b, c = order2CmpFunc(data, b, c, swaps, cmp)
- a, b = order2CmpFunc(data, a, b, swaps, cmp)
- return b
-}
-
-// medianAdjacentCmpFunc finds the median of data[a - 1], data[a], data[a + 1] and stores the index into a.
-func medianAdjacentCmpFunc[E any](data []E, a int, swaps *int, cmp func(a, b E) int) int {
- return medianCmpFunc(data, a-1, a, a+1, swaps, cmp)
-}
-
-func reverseRangeCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) {
- i := a
- j := b - 1
- for i < j {
- data[i], data[j] = data[j], data[i]
- i++
- j--
- }
-}
-
-func swapRangeCmpFunc[E any](data []E, a, b, n int, cmp func(a, b E) int) {
- for i := 0; i < n; i++ {
- data[a+i], data[b+i] = data[b+i], data[a+i]
- }
-}
-
-func stableCmpFunc[E any](data []E, n int, cmp func(a, b E) int) {
- blockSize := 20 // must be > 0
- a, b := 0, blockSize
- for b <= n {
- insertionSortCmpFunc(data, a, b, cmp)
- a = b
- b += blockSize
- }
- insertionSortCmpFunc(data, a, n, cmp)
-
- for blockSize < n {
- a, b = 0, 2*blockSize
- for b <= n {
- symMergeCmpFunc(data, a, a+blockSize, b, cmp)
- a = b
- b += 2 * blockSize
- }
- if m := a + blockSize; m < n {
- symMergeCmpFunc(data, a, m, n, cmp)
- }
- blockSize *= 2
- }
-}
-
-// symMergeCmpFunc merges the two sorted subsequences data[a:m] and data[m:b] using
-// the SymMerge algorithm from Pok-Son Kim and Arne Kutzner, "Stable Minimum
-// Storage Merging by Symmetric Comparisons", in Susanne Albers and Tomasz
-// Radzik, editors, Algorithms - ESA 2004, volume 3221 of Lecture Notes in
-// Computer Science, pages 714-723. Springer, 2004.
-//
-// Let M = m-a and N = b-n. Wolog M < N.
-// The recursion depth is bound by ceil(log(N+M)).
-// The algorithm needs O(M*log(N/M + 1)) calls to data.Less.
-// The algorithm needs O((M+N)*log(M)) calls to data.Swap.
-//
-// The paper gives O((M+N)*log(M)) as the number of assignments assuming a
-// rotation algorithm which uses O(M+N+gcd(M+N)) assignments. The argumentation
-// in the paper carries through for Swap operations, especially as the block
-// swapping rotate uses only O(M+N) Swaps.
-//
-// symMerge assumes non-degenerate arguments: a < m && m < b.
-// Having the caller check this condition eliminates many leaf recursion calls,
-// which improves performance.
-func symMergeCmpFunc[E any](data []E, a, m, b int, cmp func(a, b E) int) {
- // Avoid unnecessary recursions of symMerge
- // by direct insertion of data[a] into data[m:b]
- // if data[a:m] only contains one element.
- if m-a == 1 {
- // Use binary search to find the lowest index i
- // such that data[i] >= data[a] for m <= i < b.
- // Exit the search loop with i == b in case no such index exists.
- i := m
- j := b
- for i < j {
- h := int(uint(i+j) >> 1)
- if cmp(data[h], data[a]) < 0 {
- i = h + 1
- } else {
- j = h
- }
- }
- // Swap values until data[a] reaches the position before i.
- for k := a; k < i-1; k++ {
- data[k], data[k+1] = data[k+1], data[k]
- }
- return
- }
-
- // Avoid unnecessary recursions of symMerge
- // by direct insertion of data[m] into data[a:m]
- // if data[m:b] only contains one element.
- if b-m == 1 {
- // Use binary search to find the lowest index i
- // such that data[i] > data[m] for a <= i < m.
- // Exit the search loop with i == m in case no such index exists.
- i := a
- j := m
- for i < j {
- h := int(uint(i+j) >> 1)
- if !(cmp(data[m], data[h]) < 0) {
- i = h + 1
- } else {
- j = h
- }
- }
- // Swap values until data[m] reaches the position i.
- for k := m; k > i; k-- {
- data[k], data[k-1] = data[k-1], data[k]
- }
- return
- }
-
- mid := int(uint(a+b) >> 1)
- n := mid + m
- var start, r int
- if m > mid {
- start = n - b
- r = mid
- } else {
- start = a
- r = m
- }
- p := n - 1
-
- for start < r {
- c := int(uint(start+r) >> 1)
- if !(cmp(data[p-c], data[c]) < 0) {
- start = c + 1
- } else {
- r = c
- }
- }
-
- end := n - start
- if start < m && m < end {
- rotateCmpFunc(data, start, m, end, cmp)
- }
- if a < start && start < mid {
- symMergeCmpFunc(data, a, start, mid, cmp)
- }
- if mid < end && end < b {
- symMergeCmpFunc(data, mid, end, b, cmp)
- }
-}
-
-// rotateCmpFunc rotates two consecutive blocks u = data[a:m] and v = data[m:b] in data:
-// Data of the form 'x u v y' is changed to 'x v u y'.
-// rotate performs at most b-a many calls to data.Swap,
-// and it assumes non-degenerate arguments: a < m && m < b.
-func rotateCmpFunc[E any](data []E, a, m, b int, cmp func(a, b E) int) {
- i := m - a
- j := b - m
-
- for i != j {
- if i > j {
- swapRangeCmpFunc(data, m-i, m, j, cmp)
- i -= j
- } else {
- swapRangeCmpFunc(data, m-i, m+j-i, i, cmp)
- j -= i
- }
- }
- // i == j
- swapRangeCmpFunc(data, m-i, m, i, cmp)
-}
diff --git a/vendor/golang.org/x/exp/slices/zsortordered.go b/vendor/golang.org/x/exp/slices/zsortordered.go
deleted file mode 100644
index 99b47c398..000000000
--- a/vendor/golang.org/x/exp/slices/zsortordered.go
+++ /dev/null
@@ -1,481 +0,0 @@
-// Code generated by gen_sort_variants.go; DO NOT EDIT.
-
-// Copyright 2022 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 slices
-
-import "golang.org/x/exp/constraints"
-
-// insertionSortOrdered sorts data[a:b] using insertion sort.
-func insertionSortOrdered[E constraints.Ordered](data []E, a, b int) {
- for i := a + 1; i < b; i++ {
- for j := i; j > a && cmpLess(data[j], data[j-1]); j-- {
- data[j], data[j-1] = data[j-1], data[j]
- }
- }
-}
-
-// siftDownOrdered implements the heap property on data[lo:hi].
-// first is an offset into the array where the root of the heap lies.
-func siftDownOrdered[E constraints.Ordered](data []E, lo, hi, first int) {
- root := lo
- for {
- child := 2*root + 1
- if child >= hi {
- break
- }
- if child+1 < hi && cmpLess(data[first+child], data[first+child+1]) {
- child++
- }
- if !cmpLess(data[first+root], data[first+child]) {
- return
- }
- data[first+root], data[first+child] = data[first+child], data[first+root]
- root = child
- }
-}
-
-func heapSortOrdered[E constraints.Ordered](data []E, a, b int) {
- first := a
- lo := 0
- hi := b - a
-
- // Build heap with greatest element at top.
- for i := (hi - 1) / 2; i >= 0; i-- {
- siftDownOrdered(data, i, hi, first)
- }
-
- // Pop elements, largest first, into end of data.
- for i := hi - 1; i >= 0; i-- {
- data[first], data[first+i] = data[first+i], data[first]
- siftDownOrdered(data, lo, i, first)
- }
-}
-
-// pdqsortOrdered sorts data[a:b].
-// The algorithm based on pattern-defeating quicksort(pdqsort), but without the optimizations from BlockQuicksort.
-// pdqsort paper: https://arxiv.org/pdf/2106.05123.pdf
-// C++ implementation: https://github.com/orlp/pdqsort
-// Rust implementation: https://docs.rs/pdqsort/latest/pdqsort/
-// limit is the number of allowed bad (very unbalanced) pivots before falling back to heapsort.
-func pdqsortOrdered[E constraints.Ordered](data []E, a, b, limit int) {
- const maxInsertion = 12
-
- var (
- wasBalanced = true // whether the last partitioning was reasonably balanced
- wasPartitioned = true // whether the slice was already partitioned
- )
-
- for {
- length := b - a
-
- if length <= maxInsertion {
- insertionSortOrdered(data, a, b)
- return
- }
-
- // Fall back to heapsort if too many bad choices were made.
- if limit == 0 {
- heapSortOrdered(data, a, b)
- return
- }
-
- // If the last partitioning was imbalanced, we need to breaking patterns.
- if !wasBalanced {
- breakPatternsOrdered(data, a, b)
- limit--
- }
-
- pivot, hint := choosePivotOrdered(data, a, b)
- if hint == decreasingHint {
- reverseRangeOrdered(data, a, b)
- // The chosen pivot was pivot-a elements after the start of the array.
- // After reversing it is pivot-a elements before the end of the array.
- // The idea came from Rust's implementation.
- pivot = (b - 1) - (pivot - a)
- hint = increasingHint
- }
-
- // The slice is likely already sorted.
- if wasBalanced && wasPartitioned && hint == increasingHint {
- if partialInsertionSortOrdered(data, a, b) {
- return
- }
- }
-
- // Probably the slice contains many duplicate elements, partition the slice into
- // elements equal to and elements greater than the pivot.
- if a > 0 && !cmpLess(data[a-1], data[pivot]) {
- mid := partitionEqualOrdered(data, a, b, pivot)
- a = mid
- continue
- }
-
- mid, alreadyPartitioned := partitionOrdered(data, a, b, pivot)
- wasPartitioned = alreadyPartitioned
-
- leftLen, rightLen := mid-a, b-mid
- balanceThreshold := length / 8
- if leftLen < rightLen {
- wasBalanced = leftLen >= balanceThreshold
- pdqsortOrdered(data, a, mid, limit)
- a = mid + 1
- } else {
- wasBalanced = rightLen >= balanceThreshold
- pdqsortOrdered(data, mid+1, b, limit)
- b = mid
- }
- }
-}
-
-// partitionOrdered does one quicksort partition.
-// Let p = data[pivot]
-// Moves elements in data[a:b] around, so that data[i]=p for inewpivot.
-// On return, data[newpivot] = p
-func partitionOrdered[E constraints.Ordered](data []E, a, b, pivot int) (newpivot int, alreadyPartitioned bool) {
- data[a], data[pivot] = data[pivot], data[a]
- i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned
-
- for i <= j && cmpLess(data[i], data[a]) {
- i++
- }
- for i <= j && !cmpLess(data[j], data[a]) {
- j--
- }
- if i > j {
- data[j], data[a] = data[a], data[j]
- return j, true
- }
- data[i], data[j] = data[j], data[i]
- i++
- j--
-
- for {
- for i <= j && cmpLess(data[i], data[a]) {
- i++
- }
- for i <= j && !cmpLess(data[j], data[a]) {
- j--
- }
- if i > j {
- break
- }
- data[i], data[j] = data[j], data[i]
- i++
- j--
- }
- data[j], data[a] = data[a], data[j]
- return j, false
-}
-
-// partitionEqualOrdered partitions data[a:b] into elements equal to data[pivot] followed by elements greater than data[pivot].
-// It assumed that data[a:b] does not contain elements smaller than the data[pivot].
-func partitionEqualOrdered[E constraints.Ordered](data []E, a, b, pivot int) (newpivot int) {
- data[a], data[pivot] = data[pivot], data[a]
- i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned
-
- for {
- for i <= j && !cmpLess(data[a], data[i]) {
- i++
- }
- for i <= j && cmpLess(data[a], data[j]) {
- j--
- }
- if i > j {
- break
- }
- data[i], data[j] = data[j], data[i]
- i++
- j--
- }
- return i
-}
-
-// partialInsertionSortOrdered partially sorts a slice, returns true if the slice is sorted at the end.
-func partialInsertionSortOrdered[E constraints.Ordered](data []E, a, b int) bool {
- const (
- maxSteps = 5 // maximum number of adjacent out-of-order pairs that will get shifted
- shortestShifting = 50 // don't shift any elements on short arrays
- )
- i := a + 1
- for j := 0; j < maxSteps; j++ {
- for i < b && !cmpLess(data[i], data[i-1]) {
- i++
- }
-
- if i == b {
- return true
- }
-
- if b-a < shortestShifting {
- return false
- }
-
- data[i], data[i-1] = data[i-1], data[i]
-
- // Shift the smaller one to the left.
- if i-a >= 2 {
- for j := i - 1; j >= 1; j-- {
- if !cmpLess(data[j], data[j-1]) {
- break
- }
- data[j], data[j-1] = data[j-1], data[j]
- }
- }
- // Shift the greater one to the right.
- if b-i >= 2 {
- for j := i + 1; j < b; j++ {
- if !cmpLess(data[j], data[j-1]) {
- break
- }
- data[j], data[j-1] = data[j-1], data[j]
- }
- }
- }
- return false
-}
-
-// breakPatternsOrdered scatters some elements around in an attempt to break some patterns
-// that might cause imbalanced partitions in quicksort.
-func breakPatternsOrdered[E constraints.Ordered](data []E, a, b int) {
- length := b - a
- if length >= 8 {
- random := xorshift(length)
- modulus := nextPowerOfTwo(length)
-
- for idx := a + (length/4)*2 - 1; idx <= a+(length/4)*2+1; idx++ {
- other := int(uint(random.Next()) & (modulus - 1))
- if other >= length {
- other -= length
- }
- data[idx], data[a+other] = data[a+other], data[idx]
- }
- }
-}
-
-// choosePivotOrdered chooses a pivot in data[a:b].
-//
-// [0,8): chooses a static pivot.
-// [8,shortestNinther): uses the simple median-of-three method.
-// [shortestNinther,∞): uses the Tukey ninther method.
-func choosePivotOrdered[E constraints.Ordered](data []E, a, b int) (pivot int, hint sortedHint) {
- const (
- shortestNinther = 50
- maxSwaps = 4 * 3
- )
-
- l := b - a
-
- var (
- swaps int
- i = a + l/4*1
- j = a + l/4*2
- k = a + l/4*3
- )
-
- if l >= 8 {
- if l >= shortestNinther {
- // Tukey ninther method, the idea came from Rust's implementation.
- i = medianAdjacentOrdered(data, i, &swaps)
- j = medianAdjacentOrdered(data, j, &swaps)
- k = medianAdjacentOrdered(data, k, &swaps)
- }
- // Find the median among i, j, k and stores it into j.
- j = medianOrdered(data, i, j, k, &swaps)
- }
-
- switch swaps {
- case 0:
- return j, increasingHint
- case maxSwaps:
- return j, decreasingHint
- default:
- return j, unknownHint
- }
-}
-
-// order2Ordered returns x,y where data[x] <= data[y], where x,y=a,b or x,y=b,a.
-func order2Ordered[E constraints.Ordered](data []E, a, b int, swaps *int) (int, int) {
- if cmpLess(data[b], data[a]) {
- *swaps++
- return b, a
- }
- return a, b
-}
-
-// medianOrdered returns x where data[x] is the median of data[a],data[b],data[c], where x is a, b, or c.
-func medianOrdered[E constraints.Ordered](data []E, a, b, c int, swaps *int) int {
- a, b = order2Ordered(data, a, b, swaps)
- b, c = order2Ordered(data, b, c, swaps)
- a, b = order2Ordered(data, a, b, swaps)
- return b
-}
-
-// medianAdjacentOrdered finds the median of data[a - 1], data[a], data[a + 1] and stores the index into a.
-func medianAdjacentOrdered[E constraints.Ordered](data []E, a int, swaps *int) int {
- return medianOrdered(data, a-1, a, a+1, swaps)
-}
-
-func reverseRangeOrdered[E constraints.Ordered](data []E, a, b int) {
- i := a
- j := b - 1
- for i < j {
- data[i], data[j] = data[j], data[i]
- i++
- j--
- }
-}
-
-func swapRangeOrdered[E constraints.Ordered](data []E, a, b, n int) {
- for i := 0; i < n; i++ {
- data[a+i], data[b+i] = data[b+i], data[a+i]
- }
-}
-
-func stableOrdered[E constraints.Ordered](data []E, n int) {
- blockSize := 20 // must be > 0
- a, b := 0, blockSize
- for b <= n {
- insertionSortOrdered(data, a, b)
- a = b
- b += blockSize
- }
- insertionSortOrdered(data, a, n)
-
- for blockSize < n {
- a, b = 0, 2*blockSize
- for b <= n {
- symMergeOrdered(data, a, a+blockSize, b)
- a = b
- b += 2 * blockSize
- }
- if m := a + blockSize; m < n {
- symMergeOrdered(data, a, m, n)
- }
- blockSize *= 2
- }
-}
-
-// symMergeOrdered merges the two sorted subsequences data[a:m] and data[m:b] using
-// the SymMerge algorithm from Pok-Son Kim and Arne Kutzner, "Stable Minimum
-// Storage Merging by Symmetric Comparisons", in Susanne Albers and Tomasz
-// Radzik, editors, Algorithms - ESA 2004, volume 3221 of Lecture Notes in
-// Computer Science, pages 714-723. Springer, 2004.
-//
-// Let M = m-a and N = b-n. Wolog M < N.
-// The recursion depth is bound by ceil(log(N+M)).
-// The algorithm needs O(M*log(N/M + 1)) calls to data.Less.
-// The algorithm needs O((M+N)*log(M)) calls to data.Swap.
-//
-// The paper gives O((M+N)*log(M)) as the number of assignments assuming a
-// rotation algorithm which uses O(M+N+gcd(M+N)) assignments. The argumentation
-// in the paper carries through for Swap operations, especially as the block
-// swapping rotate uses only O(M+N) Swaps.
-//
-// symMerge assumes non-degenerate arguments: a < m && m < b.
-// Having the caller check this condition eliminates many leaf recursion calls,
-// which improves performance.
-func symMergeOrdered[E constraints.Ordered](data []E, a, m, b int) {
- // Avoid unnecessary recursions of symMerge
- // by direct insertion of data[a] into data[m:b]
- // if data[a:m] only contains one element.
- if m-a == 1 {
- // Use binary search to find the lowest index i
- // such that data[i] >= data[a] for m <= i < b.
- // Exit the search loop with i == b in case no such index exists.
- i := m
- j := b
- for i < j {
- h := int(uint(i+j) >> 1)
- if cmpLess(data[h], data[a]) {
- i = h + 1
- } else {
- j = h
- }
- }
- // Swap values until data[a] reaches the position before i.
- for k := a; k < i-1; k++ {
- data[k], data[k+1] = data[k+1], data[k]
- }
- return
- }
-
- // Avoid unnecessary recursions of symMerge
- // by direct insertion of data[m] into data[a:m]
- // if data[m:b] only contains one element.
- if b-m == 1 {
- // Use binary search to find the lowest index i
- // such that data[i] > data[m] for a <= i < m.
- // Exit the search loop with i == m in case no such index exists.
- i := a
- j := m
- for i < j {
- h := int(uint(i+j) >> 1)
- if !cmpLess(data[m], data[h]) {
- i = h + 1
- } else {
- j = h
- }
- }
- // Swap values until data[m] reaches the position i.
- for k := m; k > i; k-- {
- data[k], data[k-1] = data[k-1], data[k]
- }
- return
- }
-
- mid := int(uint(a+b) >> 1)
- n := mid + m
- var start, r int
- if m > mid {
- start = n - b
- r = mid
- } else {
- start = a
- r = m
- }
- p := n - 1
-
- for start < r {
- c := int(uint(start+r) >> 1)
- if !cmpLess(data[p-c], data[c]) {
- start = c + 1
- } else {
- r = c
- }
- }
-
- end := n - start
- if start < m && m < end {
- rotateOrdered(data, start, m, end)
- }
- if a < start && start < mid {
- symMergeOrdered(data, a, start, mid)
- }
- if mid < end && end < b {
- symMergeOrdered(data, mid, end, b)
- }
-}
-
-// rotateOrdered rotates two consecutive blocks u = data[a:m] and v = data[m:b] in data:
-// Data of the form 'x u v y' is changed to 'x v u y'.
-// rotate performs at most b-a many calls to data.Swap,
-// and it assumes non-degenerate arguments: a < m && m < b.
-func rotateOrdered[E constraints.Ordered](data []E, a, m, b int) {
- i := m - a
- j := b - m
-
- for i != j {
- if i > j {
- swapRangeOrdered(data, m-i, m, j)
- i -= j
- } else {
- swapRangeOrdered(data, m-i, m+j-i, i)
- j -= i
- }
- }
- // i == j
- swapRangeOrdered(data, m-i, m, i)
-}
diff --git a/vendor/golang.org/x/exp/slog/attr.go b/vendor/golang.org/x/exp/slog/attr.go
deleted file mode 100644
index a180d0e1d..000000000
--- a/vendor/golang.org/x/exp/slog/attr.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2022 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 slog
-
-import (
- "fmt"
- "time"
-)
-
-// An Attr is a key-value pair.
-type Attr struct {
- Key string
- Value Value
-}
-
-// String returns an Attr for a string value.
-func String(key, value string) Attr {
- return Attr{key, StringValue(value)}
-}
-
-// Int64 returns an Attr for an int64.
-func Int64(key string, value int64) Attr {
- return Attr{key, Int64Value(value)}
-}
-
-// Int converts an int to an int64 and returns
-// an Attr with that value.
-func Int(key string, value int) Attr {
- return Int64(key, int64(value))
-}
-
-// Uint64 returns an Attr for a uint64.
-func Uint64(key string, v uint64) Attr {
- return Attr{key, Uint64Value(v)}
-}
-
-// Float64 returns an Attr for a floating-point number.
-func Float64(key string, v float64) Attr {
- return Attr{key, Float64Value(v)}
-}
-
-// Bool returns an Attr for a bool.
-func Bool(key string, v bool) Attr {
- return Attr{key, BoolValue(v)}
-}
-
-// Time returns an Attr for a time.Time.
-// It discards the monotonic portion.
-func Time(key string, v time.Time) Attr {
- return Attr{key, TimeValue(v)}
-}
-
-// Duration returns an Attr for a time.Duration.
-func Duration(key string, v time.Duration) Attr {
- return Attr{key, DurationValue(v)}
-}
-
-// Group returns an Attr for a Group Value.
-// The first argument is the key; the remaining arguments
-// are converted to Attrs as in [Logger.Log].
-//
-// Use Group to collect several key-value pairs under a single
-// key on a log line, or as the result of LogValue
-// in order to log a single value as multiple Attrs.
-func Group(key string, args ...any) Attr {
- return Attr{key, GroupValue(argsToAttrSlice(args)...)}
-}
-
-func argsToAttrSlice(args []any) []Attr {
- var (
- attr Attr
- attrs []Attr
- )
- for len(args) > 0 {
- attr, args = argsToAttr(args)
- attrs = append(attrs, attr)
- }
- return attrs
-}
-
-// Any returns an Attr for the supplied value.
-// See [Value.AnyValue] for how values are treated.
-func Any(key string, value any) Attr {
- return Attr{key, AnyValue(value)}
-}
-
-// Equal reports whether a and b have equal keys and values.
-func (a Attr) Equal(b Attr) bool {
- return a.Key == b.Key && a.Value.Equal(b.Value)
-}
-
-func (a Attr) String() string {
- return fmt.Sprintf("%s=%s", a.Key, a.Value)
-}
-
-// isEmpty reports whether a has an empty key and a nil value.
-// That can be written as Attr{} or Any("", nil).
-func (a Attr) isEmpty() bool {
- return a.Key == "" && a.Value.num == 0 && a.Value.any == nil
-}
diff --git a/vendor/golang.org/x/exp/slog/doc.go b/vendor/golang.org/x/exp/slog/doc.go
deleted file mode 100644
index 4beaf8674..000000000
--- a/vendor/golang.org/x/exp/slog/doc.go
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright 2022 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 slog provides structured logging,
-in which log records include a message,
-a severity level, and various other attributes
-expressed as key-value pairs.
-
-It defines a type, [Logger],
-which provides several methods (such as [Logger.Info] and [Logger.Error])
-for reporting events of interest.
-
-Each Logger is associated with a [Handler].
-A Logger output method creates a [Record] from the method arguments
-and passes it to the Handler, which decides how to handle it.
-There is a default Logger accessible through top-level functions
-(such as [Info] and [Error]) that call the corresponding Logger methods.
-
-A log record consists of a time, a level, a message, and a set of key-value
-pairs, where the keys are strings and the values may be of any type.
-As an example,
-
- slog.Info("hello", "count", 3)
-
-creates a record containing the time of the call,
-a level of Info, the message "hello", and a single
-pair with key "count" and value 3.
-
-The [Info] top-level function calls the [Logger.Info] method on the default Logger.
-In addition to [Logger.Info], there are methods for Debug, Warn and Error levels.
-Besides these convenience methods for common levels,
-there is also a [Logger.Log] method which takes the level as an argument.
-Each of these methods has a corresponding top-level function that uses the
-default logger.
-
-The default handler formats the log record's message, time, level, and attributes
-as a string and passes it to the [log] package.
-
- 2022/11/08 15:28:26 INFO hello count=3
-
-For more control over the output format, create a logger with a different handler.
-This statement uses [New] to create a new logger with a TextHandler
-that writes structured records in text form to standard error:
-
- logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
-
-[TextHandler] output is a sequence of key=value pairs, easily and unambiguously
-parsed by machine. This statement:
-
- logger.Info("hello", "count", 3)
-
-produces this output:
-
- time=2022-11-08T15:28:26.000-05:00 level=INFO msg=hello count=3
-
-The package also provides [JSONHandler], whose output is line-delimited JSON:
-
- logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
- logger.Info("hello", "count", 3)
-
-produces this output:
-
- {"time":"2022-11-08T15:28:26.000000000-05:00","level":"INFO","msg":"hello","count":3}
-
-Both [TextHandler] and [JSONHandler] can be configured with [HandlerOptions].
-There are options for setting the minimum level (see Levels, below),
-displaying the source file and line of the log call, and
-modifying attributes before they are logged.
-
-Setting a logger as the default with
-
- slog.SetDefault(logger)
-
-will cause the top-level functions like [Info] to use it.
-[SetDefault] also updates the default logger used by the [log] package,
-so that existing applications that use [log.Printf] and related functions
-will send log records to the logger's handler without needing to be rewritten.
-
-Some attributes are common to many log calls.
-For example, you may wish to include the URL or trace identifier of a server request
-with all log events arising from the request.
-Rather than repeat the attribute with every log call, you can use [Logger.With]
-to construct a new Logger containing the attributes:
-
- logger2 := logger.With("url", r.URL)
-
-The arguments to With are the same key-value pairs used in [Logger.Info].
-The result is a new Logger with the same handler as the original, but additional
-attributes that will appear in the output of every call.
-
-# Levels
-
-A [Level] is an integer representing the importance or severity of a log event.
-The higher the level, the more severe the event.
-This package defines constants for the most common levels,
-but any int can be used as a level.
-
-In an application, you may wish to log messages only at a certain level or greater.
-One common configuration is to log messages at Info or higher levels,
-suppressing debug logging until it is needed.
-The built-in handlers can be configured with the minimum level to output by
-setting [HandlerOptions.Level].
-The program's `main` function typically does this.
-The default value is LevelInfo.
-
-Setting the [HandlerOptions.Level] field to a [Level] value
-fixes the handler's minimum level throughout its lifetime.
-Setting it to a [LevelVar] allows the level to be varied dynamically.
-A LevelVar holds a Level and is safe to read or write from multiple
-goroutines.
-To vary the level dynamically for an entire program, first initialize
-a global LevelVar:
-
- var programLevel = new(slog.LevelVar) // Info by default
-
-Then use the LevelVar to construct a handler, and make it the default:
-
- h := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel})
- slog.SetDefault(slog.New(h))
-
-Now the program can change its logging level with a single statement:
-
- programLevel.Set(slog.LevelDebug)
-
-# Groups
-
-Attributes can be collected into groups.
-A group has a name that is used to qualify the names of its attributes.
-How this qualification is displayed depends on the handler.
-[TextHandler] separates the group and attribute names with a dot.
-[JSONHandler] treats each group as a separate JSON object, with the group name as the key.
-
-Use [Group] to create a Group attribute from a name and a list of key-value pairs:
-
- slog.Group("request",
- "method", r.Method,
- "url", r.URL)
-
-TextHandler would display this group as
-
- request.method=GET request.url=http://example.com
-
-JSONHandler would display it as
-
- "request":{"method":"GET","url":"http://example.com"}
-
-Use [Logger.WithGroup] to qualify all of a Logger's output
-with a group name. Calling WithGroup on a Logger results in a
-new Logger with the same Handler as the original, but with all
-its attributes qualified by the group name.
-
-This can help prevent duplicate attribute keys in large systems,
-where subsystems might use the same keys.
-Pass each subsystem a different Logger with its own group name so that
-potential duplicates are qualified:
-
- logger := slog.Default().With("id", systemID)
- parserLogger := logger.WithGroup("parser")
- parseInput(input, parserLogger)
-
-When parseInput logs with parserLogger, its keys will be qualified with "parser",
-so even if it uses the common key "id", the log line will have distinct keys.
-
-# Contexts
-
-Some handlers may wish to include information from the [context.Context] that is
-available at the call site. One example of such information
-is the identifier for the current span when tracing is enabled.
-
-The [Logger.Log] and [Logger.LogAttrs] methods take a context as a first
-argument, as do their corresponding top-level functions.
-
-Although the convenience methods on Logger (Info and so on) and the
-corresponding top-level functions do not take a context, the alternatives ending
-in "Context" do. For example,
-
- slog.InfoContext(ctx, "message")
-
-It is recommended to pass a context to an output method if one is available.
-
-# Attrs and Values
-
-An [Attr] is a key-value pair. The Logger output methods accept Attrs as well as
-alternating keys and values. The statement
-
- slog.Info("hello", slog.Int("count", 3))
-
-behaves the same as
-
- slog.Info("hello", "count", 3)
-
-There are convenience constructors for [Attr] such as [Int], [String], and [Bool]
-for common types, as well as the function [Any] for constructing Attrs of any
-type.
-
-The value part of an Attr is a type called [Value].
-Like an [any], a Value can hold any Go value,
-but it can represent typical values, including all numbers and strings,
-without an allocation.
-
-For the most efficient log output, use [Logger.LogAttrs].
-It is similar to [Logger.Log] but accepts only Attrs, not alternating
-keys and values; this allows it, too, to avoid allocation.
-
-The call
-
- logger.LogAttrs(nil, slog.LevelInfo, "hello", slog.Int("count", 3))
-
-is the most efficient way to achieve the same output as
-
- slog.Info("hello", "count", 3)
-
-# Customizing a type's logging behavior
-
-If a type implements the [LogValuer] interface, the [Value] returned from its LogValue
-method is used for logging. You can use this to control how values of the type
-appear in logs. For example, you can redact secret information like passwords,
-or gather a struct's fields in a Group. See the examples under [LogValuer] for
-details.
-
-A LogValue method may return a Value that itself implements [LogValuer]. The [Value.Resolve]
-method handles these cases carefully, avoiding infinite loops and unbounded recursion.
-Handler authors and others may wish to use Value.Resolve instead of calling LogValue directly.
-
-# Wrapping output methods
-
-The logger functions use reflection over the call stack to find the file name
-and line number of the logging call within the application. This can produce
-incorrect source information for functions that wrap slog. For instance, if you
-define this function in file mylog.go:
-
- func Infof(format string, args ...any) {
- slog.Default().Info(fmt.Sprintf(format, args...))
- }
-
-and you call it like this in main.go:
-
- Infof(slog.Default(), "hello, %s", "world")
-
-then slog will report the source file as mylog.go, not main.go.
-
-A correct implementation of Infof will obtain the source location
-(pc) and pass it to NewRecord.
-The Infof function in the package-level example called "wrapping"
-demonstrates how to do this.
-
-# Working with Records
-
-Sometimes a Handler will need to modify a Record
-before passing it on to another Handler or backend.
-A Record contains a mixture of simple public fields (e.g. Time, Level, Message)
-and hidden fields that refer to state (such as attributes) indirectly. This
-means that modifying a simple copy of a Record (e.g. by calling
-[Record.Add] or [Record.AddAttrs] to add attributes)
-may have unexpected effects on the original.
-Before modifying a Record, use [Clone] to
-create a copy that shares no state with the original,
-or create a new Record with [NewRecord]
-and build up its Attrs by traversing the old ones with [Record.Attrs].
-
-# Performance considerations
-
-If profiling your application demonstrates that logging is taking significant time,
-the following suggestions may help.
-
-If many log lines have a common attribute, use [Logger.With] to create a Logger with
-that attribute. The built-in handlers will format that attribute only once, at the
-call to [Logger.With]. The [Handler] interface is designed to allow that optimization,
-and a well-written Handler should take advantage of it.
-
-The arguments to a log call are always evaluated, even if the log event is discarded.
-If possible, defer computation so that it happens only if the value is actually logged.
-For example, consider the call
-
- slog.Info("starting request", "url", r.URL.String()) // may compute String unnecessarily
-
-The URL.String method will be called even if the logger discards Info-level events.
-Instead, pass the URL directly:
-
- slog.Info("starting request", "url", &r.URL) // calls URL.String only if needed
-
-The built-in [TextHandler] will call its String method, but only
-if the log event is enabled.
-Avoiding the call to String also preserves the structure of the underlying value.
-For example [JSONHandler] emits the components of the parsed URL as a JSON object.
-If you want to avoid eagerly paying the cost of the String call
-without causing the handler to potentially inspect the structure of the value,
-wrap the value in a fmt.Stringer implementation that hides its Marshal methods.
-
-You can also use the [LogValuer] interface to avoid unnecessary work in disabled log
-calls. Say you need to log some expensive value:
-
- slog.Debug("frobbing", "value", computeExpensiveValue(arg))
-
-Even if this line is disabled, computeExpensiveValue will be called.
-To avoid that, define a type implementing LogValuer:
-
- type expensive struct { arg int }
-
- func (e expensive) LogValue() slog.Value {
- return slog.AnyValue(computeExpensiveValue(e.arg))
- }
-
-Then use a value of that type in log calls:
-
- slog.Debug("frobbing", "value", expensive{arg})
-
-Now computeExpensiveValue will only be called when the line is enabled.
-
-The built-in handlers acquire a lock before calling [io.Writer.Write]
-to ensure that each record is written in one piece. User-defined
-handlers are responsible for their own locking.
-*/
-package slog
diff --git a/vendor/golang.org/x/exp/slog/handler.go b/vendor/golang.org/x/exp/slog/handler.go
deleted file mode 100644
index bd635cb81..000000000
--- a/vendor/golang.org/x/exp/slog/handler.go
+++ /dev/null
@@ -1,577 +0,0 @@
-// Copyright 2022 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 slog
-
-import (
- "context"
- "fmt"
- "io"
- "reflect"
- "strconv"
- "sync"
- "time"
-
- "golang.org/x/exp/slices"
- "golang.org/x/exp/slog/internal/buffer"
-)
-
-// A Handler handles log records produced by a Logger..
-//
-// A typical handler may print log records to standard error,
-// or write them to a file or database, or perhaps augment them
-// with additional attributes and pass them on to another handler.
-//
-// Any of the Handler's methods may be called concurrently with itself
-// or with other methods. It is the responsibility of the Handler to
-// manage this concurrency.
-//
-// Users of the slog package should not invoke Handler methods directly.
-// They should use the methods of [Logger] instead.
-type Handler interface {
- // Enabled reports whether the handler handles records at the given level.
- // The handler ignores records whose level is lower.
- // It is called early, before any arguments are processed,
- // to save effort if the log event should be discarded.
- // If called from a Logger method, the first argument is the context
- // passed to that method, or context.Background() if nil was passed
- // or the method does not take a context.
- // The context is passed so Enabled can use its values
- // to make a decision.
- Enabled(context.Context, Level) bool
-
- // Handle handles the Record.
- // It will only be called when Enabled returns true.
- // The Context argument is as for Enabled.
- // It is present solely to provide Handlers access to the context's values.
- // Canceling the context should not affect record processing.
- // (Among other things, log messages may be necessary to debug a
- // cancellation-related problem.)
- //
- // Handle methods that produce output should observe the following rules:
- // - If r.Time is the zero time, ignore the time.
- // - If r.PC is zero, ignore it.
- // - Attr's values should be resolved.
- // - If an Attr's key and value are both the zero value, ignore the Attr.
- // This can be tested with attr.Equal(Attr{}).
- // - If a group's key is empty, inline the group's Attrs.
- // - If a group has no Attrs (even if it has a non-empty key),
- // ignore it.
- Handle(context.Context, Record) error
-
- // WithAttrs returns a new Handler whose attributes consist of
- // both the receiver's attributes and the arguments.
- // The Handler owns the slice: it may retain, modify or discard it.
- WithAttrs(attrs []Attr) Handler
-
- // WithGroup returns a new Handler with the given group appended to
- // the receiver's existing groups.
- // The keys of all subsequent attributes, whether added by With or in a
- // Record, should be qualified by the sequence of group names.
- //
- // How this qualification happens is up to the Handler, so long as
- // this Handler's attribute keys differ from those of another Handler
- // with a different sequence of group names.
- //
- // A Handler should treat WithGroup as starting a Group of Attrs that ends
- // at the end of the log event. That is,
- //
- // logger.WithGroup("s").LogAttrs(level, msg, slog.Int("a", 1), slog.Int("b", 2))
- //
- // should behave like
- //
- // logger.LogAttrs(level, msg, slog.Group("s", slog.Int("a", 1), slog.Int("b", 2)))
- //
- // If the name is empty, WithGroup returns the receiver.
- WithGroup(name string) Handler
-}
-
-type defaultHandler struct {
- ch *commonHandler
- // log.Output, except for testing
- output func(calldepth int, message string) error
-}
-
-func newDefaultHandler(output func(int, string) error) *defaultHandler {
- return &defaultHandler{
- ch: &commonHandler{json: false},
- output: output,
- }
-}
-
-func (*defaultHandler) Enabled(_ context.Context, l Level) bool {
- return l >= LevelInfo
-}
-
-// Collect the level, attributes and message in a string and
-// write it with the default log.Logger.
-// Let the log.Logger handle time and file/line.
-func (h *defaultHandler) Handle(ctx context.Context, r Record) error {
- buf := buffer.New()
- buf.WriteString(r.Level.String())
- buf.WriteByte(' ')
- buf.WriteString(r.Message)
- state := h.ch.newHandleState(buf, true, " ", nil)
- defer state.free()
- state.appendNonBuiltIns(r)
-
- // skip [h.output, defaultHandler.Handle, handlerWriter.Write, log.Output]
- return h.output(4, buf.String())
-}
-
-func (h *defaultHandler) WithAttrs(as []Attr) Handler {
- return &defaultHandler{h.ch.withAttrs(as), h.output}
-}
-
-func (h *defaultHandler) WithGroup(name string) Handler {
- return &defaultHandler{h.ch.withGroup(name), h.output}
-}
-
-// HandlerOptions are options for a TextHandler or JSONHandler.
-// A zero HandlerOptions consists entirely of default values.
-type HandlerOptions struct {
- // AddSource causes the handler to compute the source code position
- // of the log statement and add a SourceKey attribute to the output.
- AddSource bool
-
- // Level reports the minimum record level that will be logged.
- // The handler discards records with lower levels.
- // If Level is nil, the handler assumes LevelInfo.
- // The handler calls Level.Level for each record processed;
- // to adjust the minimum level dynamically, use a LevelVar.
- Level Leveler
-
- // ReplaceAttr is called to rewrite each non-group attribute before it is logged.
- // The attribute's value has been resolved (see [Value.Resolve]).
- // If ReplaceAttr returns an Attr with Key == "", the attribute is discarded.
- //
- // The built-in attributes with keys "time", "level", "source", and "msg"
- // are passed to this function, except that time is omitted
- // if zero, and source is omitted if AddSource is false.
- //
- // The first argument is a list of currently open groups that contain the
- // Attr. It must not be retained or modified. ReplaceAttr is never called
- // for Group attributes, only their contents. For example, the attribute
- // list
- //
- // Int("a", 1), Group("g", Int("b", 2)), Int("c", 3)
- //
- // results in consecutive calls to ReplaceAttr with the following arguments:
- //
- // nil, Int("a", 1)
- // []string{"g"}, Int("b", 2)
- // nil, Int("c", 3)
- //
- // ReplaceAttr can be used to change the default keys of the built-in
- // attributes, convert types (for example, to replace a `time.Time` with the
- // integer seconds since the Unix epoch), sanitize personal information, or
- // remove attributes from the output.
- ReplaceAttr func(groups []string, a Attr) Attr
-}
-
-// Keys for "built-in" attributes.
-const (
- // TimeKey is the key used by the built-in handlers for the time
- // when the log method is called. The associated Value is a [time.Time].
- TimeKey = "time"
- // LevelKey is the key used by the built-in handlers for the level
- // of the log call. The associated value is a [Level].
- LevelKey = "level"
- // MessageKey is the key used by the built-in handlers for the
- // message of the log call. The associated value is a string.
- MessageKey = "msg"
- // SourceKey is the key used by the built-in handlers for the source file
- // and line of the log call. The associated value is a string.
- SourceKey = "source"
-)
-
-type commonHandler struct {
- json bool // true => output JSON; false => output text
- opts HandlerOptions
- preformattedAttrs []byte
- groupPrefix string // for text: prefix of groups opened in preformatting
- groups []string // all groups started from WithGroup
- nOpenGroups int // the number of groups opened in preformattedAttrs
- mu sync.Mutex
- w io.Writer
-}
-
-func (h *commonHandler) clone() *commonHandler {
- // We can't use assignment because we can't copy the mutex.
- return &commonHandler{
- json: h.json,
- opts: h.opts,
- preformattedAttrs: slices.Clip(h.preformattedAttrs),
- groupPrefix: h.groupPrefix,
- groups: slices.Clip(h.groups),
- nOpenGroups: h.nOpenGroups,
- w: h.w,
- }
-}
-
-// enabled reports whether l is greater than or equal to the
-// minimum level.
-func (h *commonHandler) enabled(l Level) bool {
- minLevel := LevelInfo
- if h.opts.Level != nil {
- minLevel = h.opts.Level.Level()
- }
- return l >= minLevel
-}
-
-func (h *commonHandler) withAttrs(as []Attr) *commonHandler {
- h2 := h.clone()
- // Pre-format the attributes as an optimization.
- prefix := buffer.New()
- defer prefix.Free()
- prefix.WriteString(h.groupPrefix)
- state := h2.newHandleState((*buffer.Buffer)(&h2.preformattedAttrs), false, "", prefix)
- defer state.free()
- if len(h2.preformattedAttrs) > 0 {
- state.sep = h.attrSep()
- }
- state.openGroups()
- for _, a := range as {
- state.appendAttr(a)
- }
- // Remember the new prefix for later keys.
- h2.groupPrefix = state.prefix.String()
- // Remember how many opened groups are in preformattedAttrs,
- // so we don't open them again when we handle a Record.
- h2.nOpenGroups = len(h2.groups)
- return h2
-}
-
-func (h *commonHandler) withGroup(name string) *commonHandler {
- if name == "" {
- return h
- }
- h2 := h.clone()
- h2.groups = append(h2.groups, name)
- return h2
-}
-
-func (h *commonHandler) handle(r Record) error {
- state := h.newHandleState(buffer.New(), true, "", nil)
- defer state.free()
- if h.json {
- state.buf.WriteByte('{')
- }
- // Built-in attributes. They are not in a group.
- stateGroups := state.groups
- state.groups = nil // So ReplaceAttrs sees no groups instead of the pre groups.
- rep := h.opts.ReplaceAttr
- // time
- if !r.Time.IsZero() {
- key := TimeKey
- val := r.Time.Round(0) // strip monotonic to match Attr behavior
- if rep == nil {
- state.appendKey(key)
- state.appendTime(val)
- } else {
- state.appendAttr(Time(key, val))
- }
- }
- // level
- key := LevelKey
- val := r.Level
- if rep == nil {
- state.appendKey(key)
- state.appendString(val.String())
- } else {
- state.appendAttr(Any(key, val))
- }
- // source
- if h.opts.AddSource {
- state.appendAttr(Any(SourceKey, r.source()))
- }
- key = MessageKey
- msg := r.Message
- if rep == nil {
- state.appendKey(key)
- state.appendString(msg)
- } else {
- state.appendAttr(String(key, msg))
- }
- state.groups = stateGroups // Restore groups passed to ReplaceAttrs.
- state.appendNonBuiltIns(r)
- state.buf.WriteByte('\n')
-
- h.mu.Lock()
- defer h.mu.Unlock()
- _, err := h.w.Write(*state.buf)
- return err
-}
-
-func (s *handleState) appendNonBuiltIns(r Record) {
- // preformatted Attrs
- if len(s.h.preformattedAttrs) > 0 {
- s.buf.WriteString(s.sep)
- s.buf.Write(s.h.preformattedAttrs)
- s.sep = s.h.attrSep()
- }
- // Attrs in Record -- unlike the built-in ones, they are in groups started
- // from WithGroup.
- s.prefix = buffer.New()
- defer s.prefix.Free()
- s.prefix.WriteString(s.h.groupPrefix)
- s.openGroups()
- r.Attrs(func(a Attr) bool {
- s.appendAttr(a)
- return true
- })
- if s.h.json {
- // Close all open groups.
- for range s.h.groups {
- s.buf.WriteByte('}')
- }
- // Close the top-level object.
- s.buf.WriteByte('}')
- }
-}
-
-// attrSep returns the separator between attributes.
-func (h *commonHandler) attrSep() string {
- if h.json {
- return ","
- }
- return " "
-}
-
-// handleState holds state for a single call to commonHandler.handle.
-// The initial value of sep determines whether to emit a separator
-// before the next key, after which it stays true.
-type handleState struct {
- h *commonHandler
- buf *buffer.Buffer
- freeBuf bool // should buf be freed?
- sep string // separator to write before next key
- prefix *buffer.Buffer // for text: key prefix
- groups *[]string // pool-allocated slice of active groups, for ReplaceAttr
-}
-
-var groupPool = sync.Pool{New: func() any {
- s := make([]string, 0, 10)
- return &s
-}}
-
-func (h *commonHandler) newHandleState(buf *buffer.Buffer, freeBuf bool, sep string, prefix *buffer.Buffer) handleState {
- s := handleState{
- h: h,
- buf: buf,
- freeBuf: freeBuf,
- sep: sep,
- prefix: prefix,
- }
- if h.opts.ReplaceAttr != nil {
- s.groups = groupPool.Get().(*[]string)
- *s.groups = append(*s.groups, h.groups[:h.nOpenGroups]...)
- }
- return s
-}
-
-func (s *handleState) free() {
- if s.freeBuf {
- s.buf.Free()
- }
- if gs := s.groups; gs != nil {
- *gs = (*gs)[:0]
- groupPool.Put(gs)
- }
-}
-
-func (s *handleState) openGroups() {
- for _, n := range s.h.groups[s.h.nOpenGroups:] {
- s.openGroup(n)
- }
-}
-
-// Separator for group names and keys.
-const keyComponentSep = '.'
-
-// openGroup starts a new group of attributes
-// with the given name.
-func (s *handleState) openGroup(name string) {
- if s.h.json {
- s.appendKey(name)
- s.buf.WriteByte('{')
- s.sep = ""
- } else {
- s.prefix.WriteString(name)
- s.prefix.WriteByte(keyComponentSep)
- }
- // Collect group names for ReplaceAttr.
- if s.groups != nil {
- *s.groups = append(*s.groups, name)
- }
-}
-
-// closeGroup ends the group with the given name.
-func (s *handleState) closeGroup(name string) {
- if s.h.json {
- s.buf.WriteByte('}')
- } else {
- (*s.prefix) = (*s.prefix)[:len(*s.prefix)-len(name)-1 /* for keyComponentSep */]
- }
- s.sep = s.h.attrSep()
- if s.groups != nil {
- *s.groups = (*s.groups)[:len(*s.groups)-1]
- }
-}
-
-// appendAttr appends the Attr's key and value using app.
-// It handles replacement and checking for an empty key.
-// after replacement).
-func (s *handleState) appendAttr(a Attr) {
- if rep := s.h.opts.ReplaceAttr; rep != nil && a.Value.Kind() != KindGroup {
- var gs []string
- if s.groups != nil {
- gs = *s.groups
- }
- // Resolve before calling ReplaceAttr, so the user doesn't have to.
- a.Value = a.Value.Resolve()
- a = rep(gs, a)
- }
- a.Value = a.Value.Resolve()
- // Elide empty Attrs.
- if a.isEmpty() {
- return
- }
- // Special case: Source.
- if v := a.Value; v.Kind() == KindAny {
- if src, ok := v.Any().(*Source); ok {
- if s.h.json {
- a.Value = src.group()
- } else {
- a.Value = StringValue(fmt.Sprintf("%s:%d", src.File, src.Line))
- }
- }
- }
- if a.Value.Kind() == KindGroup {
- attrs := a.Value.Group()
- // Output only non-empty groups.
- if len(attrs) > 0 {
- // Inline a group with an empty key.
- if a.Key != "" {
- s.openGroup(a.Key)
- }
- for _, aa := range attrs {
- s.appendAttr(aa)
- }
- if a.Key != "" {
- s.closeGroup(a.Key)
- }
- }
- } else {
- s.appendKey(a.Key)
- s.appendValue(a.Value)
- }
-}
-
-func (s *handleState) appendError(err error) {
- s.appendString(fmt.Sprintf("!ERROR:%v", err))
-}
-
-func (s *handleState) appendKey(key string) {
- s.buf.WriteString(s.sep)
- if s.prefix != nil {
- // TODO: optimize by avoiding allocation.
- s.appendString(string(*s.prefix) + key)
- } else {
- s.appendString(key)
- }
- if s.h.json {
- s.buf.WriteByte(':')
- } else {
- s.buf.WriteByte('=')
- }
- s.sep = s.h.attrSep()
-}
-
-func (s *handleState) appendString(str string) {
- if s.h.json {
- s.buf.WriteByte('"')
- *s.buf = appendEscapedJSONString(*s.buf, str)
- s.buf.WriteByte('"')
- } else {
- // text
- if needsQuoting(str) {
- *s.buf = strconv.AppendQuote(*s.buf, str)
- } else {
- s.buf.WriteString(str)
- }
- }
-}
-
-func (s *handleState) appendValue(v Value) {
- defer func() {
- if r := recover(); r != nil {
- // If it panics with a nil pointer, the most likely cases are
- // an encoding.TextMarshaler or error fails to guard against nil,
- // in which case "" seems to be the feasible choice.
- //
- // Adapted from the code in fmt/print.go.
- if v := reflect.ValueOf(v.any); v.Kind() == reflect.Pointer && v.IsNil() {
- s.appendString("")
- return
- }
-
- // Otherwise just print the original panic message.
- s.appendString(fmt.Sprintf("!PANIC: %v", r))
- }
- }()
-
- var err error
- if s.h.json {
- err = appendJSONValue(s, v)
- } else {
- err = appendTextValue(s, v)
- }
- if err != nil {
- s.appendError(err)
- }
-}
-
-func (s *handleState) appendTime(t time.Time) {
- if s.h.json {
- appendJSONTime(s, t)
- } else {
- writeTimeRFC3339Millis(s.buf, t)
- }
-}
-
-// This takes half the time of Time.AppendFormat.
-func writeTimeRFC3339Millis(buf *buffer.Buffer, t time.Time) {
- year, month, day := t.Date()
- buf.WritePosIntWidth(year, 4)
- buf.WriteByte('-')
- buf.WritePosIntWidth(int(month), 2)
- buf.WriteByte('-')
- buf.WritePosIntWidth(day, 2)
- buf.WriteByte('T')
- hour, min, sec := t.Clock()
- buf.WritePosIntWidth(hour, 2)
- buf.WriteByte(':')
- buf.WritePosIntWidth(min, 2)
- buf.WriteByte(':')
- buf.WritePosIntWidth(sec, 2)
- ns := t.Nanosecond()
- buf.WriteByte('.')
- buf.WritePosIntWidth(ns/1e6, 3)
- _, offsetSeconds := t.Zone()
- if offsetSeconds == 0 {
- buf.WriteByte('Z')
- } else {
- offsetMinutes := offsetSeconds / 60
- if offsetMinutes < 0 {
- buf.WriteByte('-')
- offsetMinutes = -offsetMinutes
- } else {
- buf.WriteByte('+')
- }
- buf.WritePosIntWidth(offsetMinutes/60, 2)
- buf.WriteByte(':')
- buf.WritePosIntWidth(offsetMinutes%60, 2)
- }
-}
diff --git a/vendor/golang.org/x/exp/slog/internal/buffer/buffer.go b/vendor/golang.org/x/exp/slog/internal/buffer/buffer.go
deleted file mode 100644
index 7786c166e..000000000
--- a/vendor/golang.org/x/exp/slog/internal/buffer/buffer.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2022 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 buffer provides a pool-allocated byte buffer.
-package buffer
-
-import (
- "sync"
-)
-
-// Buffer adapted from go/src/fmt/print.go
-type Buffer []byte
-
-// Having an initial size gives a dramatic speedup.
-var bufPool = sync.Pool{
- New: func() any {
- b := make([]byte, 0, 1024)
- return (*Buffer)(&b)
- },
-}
-
-func New() *Buffer {
- return bufPool.Get().(*Buffer)
-}
-
-func (b *Buffer) Free() {
- // To reduce peak allocation, return only smaller buffers to the pool.
- const maxBufferSize = 16 << 10
- if cap(*b) <= maxBufferSize {
- *b = (*b)[:0]
- bufPool.Put(b)
- }
-}
-
-func (b *Buffer) Reset() {
- *b = (*b)[:0]
-}
-
-func (b *Buffer) Write(p []byte) (int, error) {
- *b = append(*b, p...)
- return len(p), nil
-}
-
-func (b *Buffer) WriteString(s string) {
- *b = append(*b, s...)
-}
-
-func (b *Buffer) WriteByte(c byte) {
- *b = append(*b, c)
-}
-
-func (b *Buffer) WritePosInt(i int) {
- b.WritePosIntWidth(i, 0)
-}
-
-// WritePosIntWidth writes non-negative integer i to the buffer, padded on the left
-// by zeroes to the given width. Use a width of 0 to omit padding.
-func (b *Buffer) WritePosIntWidth(i, width int) {
- // Cheap integer to fixed-width decimal ASCII.
- // Copied from log/log.go.
-
- if i < 0 {
- panic("negative int")
- }
-
- // Assemble decimal in reverse order.
- var bb [20]byte
- bp := len(bb) - 1
- for i >= 10 || width > 1 {
- width--
- q := i / 10
- bb[bp] = byte('0' + i - q*10)
- bp--
- i = q
- }
- // i < 10
- bb[bp] = byte('0' + i)
- b.Write(bb[bp:])
-}
-
-func (b *Buffer) String() string {
- return string(*b)
-}
diff --git a/vendor/golang.org/x/exp/slog/internal/ignorepc.go b/vendor/golang.org/x/exp/slog/internal/ignorepc.go
deleted file mode 100644
index d1256426f..000000000
--- a/vendor/golang.org/x/exp/slog/internal/ignorepc.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2023 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 internal
-
-// If IgnorePC is true, do not invoke runtime.Callers to get the pc.
-// This is solely for benchmarking the slowdown from runtime.Callers.
-var IgnorePC = false
diff --git a/vendor/golang.org/x/exp/slog/json_handler.go b/vendor/golang.org/x/exp/slog/json_handler.go
deleted file mode 100644
index 157ada869..000000000
--- a/vendor/golang.org/x/exp/slog/json_handler.go
+++ /dev/null
@@ -1,336 +0,0 @@
-// Copyright 2022 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 slog
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "strconv"
- "time"
- "unicode/utf8"
-
- "golang.org/x/exp/slog/internal/buffer"
-)
-
-// JSONHandler is a Handler that writes Records to an io.Writer as
-// line-delimited JSON objects.
-type JSONHandler struct {
- *commonHandler
-}
-
-// NewJSONHandler creates a JSONHandler that writes to w,
-// using the given options.
-// If opts is nil, the default options are used.
-func NewJSONHandler(w io.Writer, opts *HandlerOptions) *JSONHandler {
- if opts == nil {
- opts = &HandlerOptions{}
- }
- return &JSONHandler{
- &commonHandler{
- json: true,
- w: w,
- opts: *opts,
- },
- }
-}
-
-// Enabled reports whether the handler handles records at the given level.
-// The handler ignores records whose level is lower.
-func (h *JSONHandler) Enabled(_ context.Context, level Level) bool {
- return h.commonHandler.enabled(level)
-}
-
-// WithAttrs returns a new JSONHandler whose attributes consists
-// of h's attributes followed by attrs.
-func (h *JSONHandler) WithAttrs(attrs []Attr) Handler {
- return &JSONHandler{commonHandler: h.commonHandler.withAttrs(attrs)}
-}
-
-func (h *JSONHandler) WithGroup(name string) Handler {
- return &JSONHandler{commonHandler: h.commonHandler.withGroup(name)}
-}
-
-// Handle formats its argument Record as a JSON object on a single line.
-//
-// If the Record's time is zero, the time is omitted.
-// Otherwise, the key is "time"
-// and the value is output as with json.Marshal.
-//
-// If the Record's level is zero, the level is omitted.
-// Otherwise, the key is "level"
-// and the value of [Level.String] is output.
-//
-// If the AddSource option is set and source information is available,
-// the key is "source"
-// and the value is output as "FILE:LINE".
-//
-// The message's key is "msg".
-//
-// To modify these or other attributes, or remove them from the output, use
-// [HandlerOptions.ReplaceAttr].
-//
-// Values are formatted as with an [encoding/json.Encoder] with SetEscapeHTML(false),
-// with two exceptions.
-//
-// First, an Attr whose Value is of type error is formatted as a string, by
-// calling its Error method. Only errors in Attrs receive this special treatment,
-// not errors embedded in structs, slices, maps or other data structures that
-// are processed by the encoding/json package.
-//
-// Second, an encoding failure does not cause Handle to return an error.
-// Instead, the error message is formatted as a string.
-//
-// Each call to Handle results in a single serialized call to io.Writer.Write.
-func (h *JSONHandler) Handle(_ context.Context, r Record) error {
- return h.commonHandler.handle(r)
-}
-
-// Adapted from time.Time.MarshalJSON to avoid allocation.
-func appendJSONTime(s *handleState, t time.Time) {
- if y := t.Year(); y < 0 || y >= 10000 {
- // RFC 3339 is clear that years are 4 digits exactly.
- // See golang.org/issue/4556#c15 for more discussion.
- s.appendError(errors.New("time.Time year outside of range [0,9999]"))
- }
- s.buf.WriteByte('"')
- *s.buf = t.AppendFormat(*s.buf, time.RFC3339Nano)
- s.buf.WriteByte('"')
-}
-
-func appendJSONValue(s *handleState, v Value) error {
- switch v.Kind() {
- case KindString:
- s.appendString(v.str())
- case KindInt64:
- *s.buf = strconv.AppendInt(*s.buf, v.Int64(), 10)
- case KindUint64:
- *s.buf = strconv.AppendUint(*s.buf, v.Uint64(), 10)
- case KindFloat64:
- // json.Marshal is funny about floats; it doesn't
- // always match strconv.AppendFloat. So just call it.
- // That's expensive, but floats are rare.
- if err := appendJSONMarshal(s.buf, v.Float64()); err != nil {
- return err
- }
- case KindBool:
- *s.buf = strconv.AppendBool(*s.buf, v.Bool())
- case KindDuration:
- // Do what json.Marshal does.
- *s.buf = strconv.AppendInt(*s.buf, int64(v.Duration()), 10)
- case KindTime:
- s.appendTime(v.Time())
- case KindAny:
- a := v.Any()
- _, jm := a.(json.Marshaler)
- if err, ok := a.(error); ok && !jm {
- s.appendString(err.Error())
- } else {
- return appendJSONMarshal(s.buf, a)
- }
- default:
- panic(fmt.Sprintf("bad kind: %s", v.Kind()))
- }
- return nil
-}
-
-func appendJSONMarshal(buf *buffer.Buffer, v any) error {
- // Use a json.Encoder to avoid escaping HTML.
- var bb bytes.Buffer
- enc := json.NewEncoder(&bb)
- enc.SetEscapeHTML(false)
- if err := enc.Encode(v); err != nil {
- return err
- }
- bs := bb.Bytes()
- buf.Write(bs[:len(bs)-1]) // remove final newline
- return nil
-}
-
-// appendEscapedJSONString escapes s for JSON and appends it to buf.
-// It does not surround the string in quotation marks.
-//
-// Modified from encoding/json/encode.go:encodeState.string,
-// with escapeHTML set to false.
-func appendEscapedJSONString(buf []byte, s string) []byte {
- char := func(b byte) { buf = append(buf, b) }
- str := func(s string) { buf = append(buf, s...) }
-
- start := 0
- for i := 0; i < len(s); {
- if b := s[i]; b < utf8.RuneSelf {
- if safeSet[b] {
- i++
- continue
- }
- if start < i {
- str(s[start:i])
- }
- char('\\')
- switch b {
- case '\\', '"':
- char(b)
- case '\n':
- char('n')
- case '\r':
- char('r')
- case '\t':
- char('t')
- default:
- // This encodes bytes < 0x20 except for \t, \n and \r.
- str(`u00`)
- char(hex[b>>4])
- char(hex[b&0xF])
- }
- i++
- start = i
- continue
- }
- c, size := utf8.DecodeRuneInString(s[i:])
- if c == utf8.RuneError && size == 1 {
- if start < i {
- str(s[start:i])
- }
- str(`\ufffd`)
- i += size
- start = i
- continue
- }
- // U+2028 is LINE SEPARATOR.
- // U+2029 is PARAGRAPH SEPARATOR.
- // They are both technically valid characters in JSON strings,
- // but don't work in JSONP, which has to be evaluated as JavaScript,
- // and can lead to security holes there. It is valid JSON to
- // escape them, so we do so unconditionally.
- // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.
- if c == '\u2028' || c == '\u2029' {
- if start < i {
- str(s[start:i])
- }
- str(`\u202`)
- char(hex[c&0xF])
- i += size
- start = i
- continue
- }
- i += size
- }
- if start < len(s) {
- str(s[start:])
- }
- return buf
-}
-
-var hex = "0123456789abcdef"
-
-// Copied from encoding/json/tables.go.
-//
-// safeSet holds the value true if the ASCII character with the given array
-// position can be represented inside a JSON string without any further
-// escaping.
-//
-// All values are true except for the ASCII control characters (0-31), the
-// double quote ("), and the backslash character ("\").
-var safeSet = [utf8.RuneSelf]bool{
- ' ': true,
- '!': true,
- '"': false,
- '#': true,
- '$': true,
- '%': true,
- '&': true,
- '\'': true,
- '(': true,
- ')': true,
- '*': true,
- '+': true,
- ',': true,
- '-': true,
- '.': true,
- '/': true,
- '0': true,
- '1': true,
- '2': true,
- '3': true,
- '4': true,
- '5': true,
- '6': true,
- '7': true,
- '8': true,
- '9': true,
- ':': true,
- ';': true,
- '<': true,
- '=': true,
- '>': true,
- '?': true,
- '@': true,
- 'A': true,
- 'B': true,
- 'C': true,
- 'D': true,
- 'E': true,
- 'F': true,
- 'G': true,
- 'H': true,
- 'I': true,
- 'J': true,
- 'K': true,
- 'L': true,
- 'M': true,
- 'N': true,
- 'O': true,
- 'P': true,
- 'Q': true,
- 'R': true,
- 'S': true,
- 'T': true,
- 'U': true,
- 'V': true,
- 'W': true,
- 'X': true,
- 'Y': true,
- 'Z': true,
- '[': true,
- '\\': false,
- ']': true,
- '^': true,
- '_': true,
- '`': true,
- 'a': true,
- 'b': true,
- 'c': true,
- 'd': true,
- 'e': true,
- 'f': true,
- 'g': true,
- 'h': true,
- 'i': true,
- 'j': true,
- 'k': true,
- 'l': true,
- 'm': true,
- 'n': true,
- 'o': true,
- 'p': true,
- 'q': true,
- 'r': true,
- 's': true,
- 't': true,
- 'u': true,
- 'v': true,
- 'w': true,
- 'x': true,
- 'y': true,
- 'z': true,
- '{': true,
- '|': true,
- '}': true,
- '~': true,
- '\u007f': true,
-}
diff --git a/vendor/golang.org/x/exp/slog/level.go b/vendor/golang.org/x/exp/slog/level.go
deleted file mode 100644
index b2365f0aa..000000000
--- a/vendor/golang.org/x/exp/slog/level.go
+++ /dev/null
@@ -1,201 +0,0 @@
-// Copyright 2022 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 slog
-
-import (
- "errors"
- "fmt"
- "strconv"
- "strings"
- "sync/atomic"
-)
-
-// A Level is the importance or severity of a log event.
-// The higher the level, the more important or severe the event.
-type Level int
-
-// Level numbers are inherently arbitrary,
-// but we picked them to satisfy three constraints.
-// Any system can map them to another numbering scheme if it wishes.
-//
-// First, we wanted the default level to be Info, Since Levels are ints, Info is
-// the default value for int, zero.
-//
-
-// Second, we wanted to make it easy to use levels to specify logger verbosity.
-// Since a larger level means a more severe event, a logger that accepts events
-// with smaller (or more negative) level means a more verbose logger. Logger
-// verbosity is thus the negation of event severity, and the default verbosity
-// of 0 accepts all events at least as severe as INFO.
-//
-// Third, we wanted some room between levels to accommodate schemes with named
-// levels between ours. For example, Google Cloud Logging defines a Notice level
-// between Info and Warn. Since there are only a few of these intermediate
-// levels, the gap between the numbers need not be large. Our gap of 4 matches
-// OpenTelemetry's mapping. Subtracting 9 from an OpenTelemetry level in the
-// DEBUG, INFO, WARN and ERROR ranges converts it to the corresponding slog
-// Level range. OpenTelemetry also has the names TRACE and FATAL, which slog
-// does not. But those OpenTelemetry levels can still be represented as slog
-// Levels by using the appropriate integers.
-//
-// Names for common levels.
-const (
- LevelDebug Level = -4
- LevelInfo Level = 0
- LevelWarn Level = 4
- LevelError Level = 8
-)
-
-// String returns a name for the level.
-// If the level has a name, then that name
-// in uppercase is returned.
-// If the level is between named values, then
-// an integer is appended to the uppercased name.
-// Examples:
-//
-// LevelWarn.String() => "WARN"
-// (LevelInfo+2).String() => "INFO+2"
-func (l Level) String() string {
- str := func(base string, val Level) string {
- if val == 0 {
- return base
- }
- return fmt.Sprintf("%s%+d", base, val)
- }
-
- switch {
- case l < LevelInfo:
- return str("DEBUG", l-LevelDebug)
- case l < LevelWarn:
- return str("INFO", l-LevelInfo)
- case l < LevelError:
- return str("WARN", l-LevelWarn)
- default:
- return str("ERROR", l-LevelError)
- }
-}
-
-// MarshalJSON implements [encoding/json.Marshaler]
-// by quoting the output of [Level.String].
-func (l Level) MarshalJSON() ([]byte, error) {
- // AppendQuote is sufficient for JSON-encoding all Level strings.
- // They don't contain any runes that would produce invalid JSON
- // when escaped.
- return strconv.AppendQuote(nil, l.String()), nil
-}
-
-// UnmarshalJSON implements [encoding/json.Unmarshaler]
-// It accepts any string produced by [Level.MarshalJSON],
-// ignoring case.
-// It also accepts numeric offsets that would result in a different string on
-// output. For example, "Error-8" would marshal as "INFO".
-func (l *Level) UnmarshalJSON(data []byte) error {
- s, err := strconv.Unquote(string(data))
- if err != nil {
- return err
- }
- return l.parse(s)
-}
-
-// MarshalText implements [encoding.TextMarshaler]
-// by calling [Level.String].
-func (l Level) MarshalText() ([]byte, error) {
- return []byte(l.String()), nil
-}
-
-// UnmarshalText implements [encoding.TextUnmarshaler].
-// It accepts any string produced by [Level.MarshalText],
-// ignoring case.
-// It also accepts numeric offsets that would result in a different string on
-// output. For example, "Error-8" would marshal as "INFO".
-func (l *Level) UnmarshalText(data []byte) error {
- return l.parse(string(data))
-}
-
-func (l *Level) parse(s string) (err error) {
- defer func() {
- if err != nil {
- err = fmt.Errorf("slog: level string %q: %w", s, err)
- }
- }()
-
- name := s
- offset := 0
- if i := strings.IndexAny(s, "+-"); i >= 0 {
- name = s[:i]
- offset, err = strconv.Atoi(s[i:])
- if err != nil {
- return err
- }
- }
- switch strings.ToUpper(name) {
- case "DEBUG":
- *l = LevelDebug
- case "INFO":
- *l = LevelInfo
- case "WARN":
- *l = LevelWarn
- case "ERROR":
- *l = LevelError
- default:
- return errors.New("unknown name")
- }
- *l += Level(offset)
- return nil
-}
-
-// Level returns the receiver.
-// It implements Leveler.
-func (l Level) Level() Level { return l }
-
-// A LevelVar is a Level variable, to allow a Handler level to change
-// dynamically.
-// It implements Leveler as well as a Set method,
-// and it is safe for use by multiple goroutines.
-// The zero LevelVar corresponds to LevelInfo.
-type LevelVar struct {
- val atomic.Int64
-}
-
-// Level returns v's level.
-func (v *LevelVar) Level() Level {
- return Level(int(v.val.Load()))
-}
-
-// Set sets v's level to l.
-func (v *LevelVar) Set(l Level) {
- v.val.Store(int64(l))
-}
-
-func (v *LevelVar) String() string {
- return fmt.Sprintf("LevelVar(%s)", v.Level())
-}
-
-// MarshalText implements [encoding.TextMarshaler]
-// by calling [Level.MarshalText].
-func (v *LevelVar) MarshalText() ([]byte, error) {
- return v.Level().MarshalText()
-}
-
-// UnmarshalText implements [encoding.TextUnmarshaler]
-// by calling [Level.UnmarshalText].
-func (v *LevelVar) UnmarshalText(data []byte) error {
- var l Level
- if err := l.UnmarshalText(data); err != nil {
- return err
- }
- v.Set(l)
- return nil
-}
-
-// A Leveler provides a Level value.
-//
-// As Level itself implements Leveler, clients typically supply
-// a Level value wherever a Leveler is needed, such as in HandlerOptions.
-// Clients who need to vary the level dynamically can provide a more complex
-// Leveler implementation such as *LevelVar.
-type Leveler interface {
- Level() Level
-}
diff --git a/vendor/golang.org/x/exp/slog/logger.go b/vendor/golang.org/x/exp/slog/logger.go
deleted file mode 100644
index e87ec9936..000000000
--- a/vendor/golang.org/x/exp/slog/logger.go
+++ /dev/null
@@ -1,343 +0,0 @@
-// Copyright 2022 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 slog
-
-import (
- "context"
- "log"
- "runtime"
- "sync/atomic"
- "time"
-
- "golang.org/x/exp/slog/internal"
-)
-
-var defaultLogger atomic.Value
-
-func init() {
- defaultLogger.Store(New(newDefaultHandler(log.Output)))
-}
-
-// Default returns the default Logger.
-func Default() *Logger { return defaultLogger.Load().(*Logger) }
-
-// SetDefault makes l the default Logger.
-// After this call, output from the log package's default Logger
-// (as with [log.Print], etc.) will be logged at LevelInfo using l's Handler.
-func SetDefault(l *Logger) {
- defaultLogger.Store(l)
- // If the default's handler is a defaultHandler, then don't use a handleWriter,
- // or we'll deadlock as they both try to acquire the log default mutex.
- // The defaultHandler will use whatever the log default writer is currently
- // set to, which is correct.
- // This can occur with SetDefault(Default()).
- // See TestSetDefault.
- if _, ok := l.Handler().(*defaultHandler); !ok {
- capturePC := log.Flags()&(log.Lshortfile|log.Llongfile) != 0
- log.SetOutput(&handlerWriter{l.Handler(), LevelInfo, capturePC})
- log.SetFlags(0) // we want just the log message, no time or location
- }
-}
-
-// handlerWriter is an io.Writer that calls a Handler.
-// It is used to link the default log.Logger to the default slog.Logger.
-type handlerWriter struct {
- h Handler
- level Level
- capturePC bool
-}
-
-func (w *handlerWriter) Write(buf []byte) (int, error) {
- if !w.h.Enabled(context.Background(), w.level) {
- return 0, nil
- }
- var pc uintptr
- if !internal.IgnorePC && w.capturePC {
- // skip [runtime.Callers, w.Write, Logger.Output, log.Print]
- var pcs [1]uintptr
- runtime.Callers(4, pcs[:])
- pc = pcs[0]
- }
-
- // Remove final newline.
- origLen := len(buf) // Report that the entire buf was written.
- if len(buf) > 0 && buf[len(buf)-1] == '\n' {
- buf = buf[:len(buf)-1]
- }
- r := NewRecord(time.Now(), w.level, string(buf), pc)
- return origLen, w.h.Handle(context.Background(), r)
-}
-
-// A Logger records structured information about each call to its
-// Log, Debug, Info, Warn, and Error methods.
-// For each call, it creates a Record and passes it to a Handler.
-//
-// To create a new Logger, call [New] or a Logger method
-// that begins "With".
-type Logger struct {
- handler Handler // for structured logging
-}
-
-func (l *Logger) clone() *Logger {
- c := *l
- return &c
-}
-
-// Handler returns l's Handler.
-func (l *Logger) Handler() Handler { return l.handler }
-
-// With returns a new Logger that includes the given arguments, converted to
-// Attrs as in [Logger.Log].
-// The Attrs will be added to each output from the Logger.
-// The new Logger shares the old Logger's context.
-// The new Logger's handler is the result of calling WithAttrs on the receiver's
-// handler.
-func (l *Logger) With(args ...any) *Logger {
- c := l.clone()
- c.handler = l.handler.WithAttrs(argsToAttrSlice(args))
- return c
-}
-
-// WithGroup returns a new Logger that starts a group. The keys of all
-// attributes added to the Logger will be qualified by the given name.
-// (How that qualification happens depends on the [Handler.WithGroup]
-// method of the Logger's Handler.)
-// The new Logger shares the old Logger's context.
-//
-// The new Logger's handler is the result of calling WithGroup on the receiver's
-// handler.
-func (l *Logger) WithGroup(name string) *Logger {
- c := l.clone()
- c.handler = l.handler.WithGroup(name)
- return c
-
-}
-
-// New creates a new Logger with the given non-nil Handler and a nil context.
-func New(h Handler) *Logger {
- if h == nil {
- panic("nil Handler")
- }
- return &Logger{handler: h}
-}
-
-// With calls Logger.With on the default logger.
-func With(args ...any) *Logger {
- return Default().With(args...)
-}
-
-// Enabled reports whether l emits log records at the given context and level.
-func (l *Logger) Enabled(ctx context.Context, level Level) bool {
- if ctx == nil {
- ctx = context.Background()
- }
- return l.Handler().Enabled(ctx, level)
-}
-
-// NewLogLogger returns a new log.Logger such that each call to its Output method
-// dispatches a Record to the specified handler. The logger acts as a bridge from
-// the older log API to newer structured logging handlers.
-func NewLogLogger(h Handler, level Level) *log.Logger {
- return log.New(&handlerWriter{h, level, true}, "", 0)
-}
-
-// Log emits a log record with the current time and the given level and message.
-// The Record's Attrs consist of the Logger's attributes followed by
-// the Attrs specified by args.
-//
-// The attribute arguments are processed as follows:
-// - If an argument is an Attr, it is used as is.
-// - If an argument is a string and this is not the last argument,
-// the following argument is treated as the value and the two are combined
-// into an Attr.
-// - Otherwise, the argument is treated as a value with key "!BADKEY".
-func (l *Logger) Log(ctx context.Context, level Level, msg string, args ...any) {
- l.log(ctx, level, msg, args...)
-}
-
-// LogAttrs is a more efficient version of [Logger.Log] that accepts only Attrs.
-func (l *Logger) LogAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
- l.logAttrs(ctx, level, msg, attrs...)
-}
-
-// Debug logs at LevelDebug.
-func (l *Logger) Debug(msg string, args ...any) {
- l.log(nil, LevelDebug, msg, args...)
-}
-
-// DebugContext logs at LevelDebug with the given context.
-func (l *Logger) DebugContext(ctx context.Context, msg string, args ...any) {
- l.log(ctx, LevelDebug, msg, args...)
-}
-
-// DebugCtx logs at LevelDebug with the given context.
-// Deprecated: Use Logger.DebugContext.
-func (l *Logger) DebugCtx(ctx context.Context, msg string, args ...any) {
- l.log(ctx, LevelDebug, msg, args...)
-}
-
-// Info logs at LevelInfo.
-func (l *Logger) Info(msg string, args ...any) {
- l.log(nil, LevelInfo, msg, args...)
-}
-
-// InfoContext logs at LevelInfo with the given context.
-func (l *Logger) InfoContext(ctx context.Context, msg string, args ...any) {
- l.log(ctx, LevelInfo, msg, args...)
-}
-
-// InfoCtx logs at LevelInfo with the given context.
-// Deprecated: Use Logger.InfoContext.
-func (l *Logger) InfoCtx(ctx context.Context, msg string, args ...any) {
- l.log(ctx, LevelInfo, msg, args...)
-}
-
-// Warn logs at LevelWarn.
-func (l *Logger) Warn(msg string, args ...any) {
- l.log(nil, LevelWarn, msg, args...)
-}
-
-// WarnContext logs at LevelWarn with the given context.
-func (l *Logger) WarnContext(ctx context.Context, msg string, args ...any) {
- l.log(ctx, LevelWarn, msg, args...)
-}
-
-// WarnCtx logs at LevelWarn with the given context.
-// Deprecated: Use Logger.WarnContext.
-func (l *Logger) WarnCtx(ctx context.Context, msg string, args ...any) {
- l.log(ctx, LevelWarn, msg, args...)
-}
-
-// Error logs at LevelError.
-func (l *Logger) Error(msg string, args ...any) {
- l.log(nil, LevelError, msg, args...)
-}
-
-// ErrorContext logs at LevelError with the given context.
-func (l *Logger) ErrorContext(ctx context.Context, msg string, args ...any) {
- l.log(ctx, LevelError, msg, args...)
-}
-
-// ErrorCtx logs at LevelError with the given context.
-// Deprecated: Use Logger.ErrorContext.
-func (l *Logger) ErrorCtx(ctx context.Context, msg string, args ...any) {
- l.log(ctx, LevelError, msg, args...)
-}
-
-// log is the low-level logging method for methods that take ...any.
-// It must always be called directly by an exported logging method
-// or function, because it uses a fixed call depth to obtain the pc.
-func (l *Logger) log(ctx context.Context, level Level, msg string, args ...any) {
- if !l.Enabled(ctx, level) {
- return
- }
- var pc uintptr
- if !internal.IgnorePC {
- var pcs [1]uintptr
- // skip [runtime.Callers, this function, this function's caller]
- runtime.Callers(3, pcs[:])
- pc = pcs[0]
- }
- r := NewRecord(time.Now(), level, msg, pc)
- r.Add(args...)
- if ctx == nil {
- ctx = context.Background()
- }
- _ = l.Handler().Handle(ctx, r)
-}
-
-// logAttrs is like [Logger.log], but for methods that take ...Attr.
-func (l *Logger) logAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
- if !l.Enabled(ctx, level) {
- return
- }
- var pc uintptr
- if !internal.IgnorePC {
- var pcs [1]uintptr
- // skip [runtime.Callers, this function, this function's caller]
- runtime.Callers(3, pcs[:])
- pc = pcs[0]
- }
- r := NewRecord(time.Now(), level, msg, pc)
- r.AddAttrs(attrs...)
- if ctx == nil {
- ctx = context.Background()
- }
- _ = l.Handler().Handle(ctx, r)
-}
-
-// Debug calls Logger.Debug on the default logger.
-func Debug(msg string, args ...any) {
- Default().log(nil, LevelDebug, msg, args...)
-}
-
-// DebugContext calls Logger.DebugContext on the default logger.
-func DebugContext(ctx context.Context, msg string, args ...any) {
- Default().log(ctx, LevelDebug, msg, args...)
-}
-
-// Info calls Logger.Info on the default logger.
-func Info(msg string, args ...any) {
- Default().log(nil, LevelInfo, msg, args...)
-}
-
-// InfoContext calls Logger.InfoContext on the default logger.
-func InfoContext(ctx context.Context, msg string, args ...any) {
- Default().log(ctx, LevelInfo, msg, args...)
-}
-
-// Warn calls Logger.Warn on the default logger.
-func Warn(msg string, args ...any) {
- Default().log(nil, LevelWarn, msg, args...)
-}
-
-// WarnContext calls Logger.WarnContext on the default logger.
-func WarnContext(ctx context.Context, msg string, args ...any) {
- Default().log(ctx, LevelWarn, msg, args...)
-}
-
-// Error calls Logger.Error on the default logger.
-func Error(msg string, args ...any) {
- Default().log(nil, LevelError, msg, args...)
-}
-
-// ErrorContext calls Logger.ErrorContext on the default logger.
-func ErrorContext(ctx context.Context, msg string, args ...any) {
- Default().log(ctx, LevelError, msg, args...)
-}
-
-// DebugCtx calls Logger.DebugContext on the default logger.
-// Deprecated: call DebugContext.
-func DebugCtx(ctx context.Context, msg string, args ...any) {
- Default().log(ctx, LevelDebug, msg, args...)
-}
-
-// InfoCtx calls Logger.InfoContext on the default logger.
-// Deprecated: call InfoContext.
-func InfoCtx(ctx context.Context, msg string, args ...any) {
- Default().log(ctx, LevelInfo, msg, args...)
-}
-
-// WarnCtx calls Logger.WarnContext on the default logger.
-// Deprecated: call WarnContext.
-func WarnCtx(ctx context.Context, msg string, args ...any) {
- Default().log(ctx, LevelWarn, msg, args...)
-}
-
-// ErrorCtx calls Logger.ErrorContext on the default logger.
-// Deprecated: call ErrorContext.
-func ErrorCtx(ctx context.Context, msg string, args ...any) {
- Default().log(ctx, LevelError, msg, args...)
-}
-
-// Log calls Logger.Log on the default logger.
-func Log(ctx context.Context, level Level, msg string, args ...any) {
- Default().log(ctx, level, msg, args...)
-}
-
-// LogAttrs calls Logger.LogAttrs on the default logger.
-func LogAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
- Default().logAttrs(ctx, level, msg, attrs...)
-}
diff --git a/vendor/golang.org/x/exp/slog/noplog.bench b/vendor/golang.org/x/exp/slog/noplog.bench
deleted file mode 100644
index ed9296ff6..000000000
--- a/vendor/golang.org/x/exp/slog/noplog.bench
+++ /dev/null
@@ -1,36 +0,0 @@
-goos: linux
-goarch: amd64
-pkg: golang.org/x/exp/slog
-cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
-BenchmarkNopLog/attrs-8 1000000 1090 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-8 1000000 1097 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-8 1000000 1078 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-8 1000000 1095 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-8 1000000 1096 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 4007268 308.2 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 4016138 299.7 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 4020529 305.9 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 3977829 303.4 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/attrs-parallel-8 3225438 318.5 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1179256 994.2 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1000000 1002 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1216710 993.2 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1000000 1013 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/keys-values-8 1000000 1016 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 989066 1163 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 994116 1163 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 1000000 1152 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 991675 1165 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-8 965268 1166 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 3955503 303.3 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 3861188 307.8 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 3967752 303.9 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 3955203 302.7 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/WithContext-parallel-8 3948278 301.1 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/Ctx-8 940622 1247 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/Ctx-8 936381 1257 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/Ctx-8 959730 1266 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/Ctx-8 943473 1290 ns/op 0 B/op 0 allocs/op
-BenchmarkNopLog/Ctx-8 919414 1259 ns/op 0 B/op 0 allocs/op
-PASS
-ok golang.org/x/exp/slog 40.566s
diff --git a/vendor/golang.org/x/exp/slog/record.go b/vendor/golang.org/x/exp/slog/record.go
deleted file mode 100644
index 38b3440f7..000000000
--- a/vendor/golang.org/x/exp/slog/record.go
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright 2022 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 slog
-
-import (
- "runtime"
- "time"
-
- "golang.org/x/exp/slices"
-)
-
-const nAttrsInline = 5
-
-// A Record holds information about a log event.
-// Copies of a Record share state.
-// Do not modify a Record after handing out a copy to it.
-// Use [Record.Clone] to create a copy with no shared state.
-type Record struct {
- // The time at which the output method (Log, Info, etc.) was called.
- Time time.Time
-
- // The log message.
- Message string
-
- // The level of the event.
- Level Level
-
- // The program counter at the time the record was constructed, as determined
- // by runtime.Callers. If zero, no program counter is available.
- //
- // The only valid use for this value is as an argument to
- // [runtime.CallersFrames]. In particular, it must not be passed to
- // [runtime.FuncForPC].
- PC uintptr
-
- // Allocation optimization: an inline array sized to hold
- // the majority of log calls (based on examination of open-source
- // code). It holds the start of the list of Attrs.
- front [nAttrsInline]Attr
-
- // The number of Attrs in front.
- nFront int
-
- // The list of Attrs except for those in front.
- // Invariants:
- // - len(back) > 0 iff nFront == len(front)
- // - Unused array elements are zero. Used to detect mistakes.
- back []Attr
-}
-
-// NewRecord creates a Record from the given arguments.
-// Use [Record.AddAttrs] to add attributes to the Record.
-//
-// NewRecord is intended for logging APIs that want to support a [Handler] as
-// a backend.
-func NewRecord(t time.Time, level Level, msg string, pc uintptr) Record {
- return Record{
- Time: t,
- Message: msg,
- Level: level,
- PC: pc,
- }
-}
-
-// Clone returns a copy of the record with no shared state.
-// The original record and the clone can both be modified
-// without interfering with each other.
-func (r Record) Clone() Record {
- r.back = slices.Clip(r.back) // prevent append from mutating shared array
- return r
-}
-
-// NumAttrs returns the number of attributes in the Record.
-func (r Record) NumAttrs() int {
- return r.nFront + len(r.back)
-}
-
-// Attrs calls f on each Attr in the Record.
-// Iteration stops if f returns false.
-func (r Record) Attrs(f func(Attr) bool) {
- for i := 0; i < r.nFront; i++ {
- if !f(r.front[i]) {
- return
- }
- }
- for _, a := range r.back {
- if !f(a) {
- return
- }
- }
-}
-
-// AddAttrs appends the given Attrs to the Record's list of Attrs.
-func (r *Record) AddAttrs(attrs ...Attr) {
- n := copy(r.front[r.nFront:], attrs)
- r.nFront += n
- // Check if a copy was modified by slicing past the end
- // and seeing if the Attr there is non-zero.
- if cap(r.back) > len(r.back) {
- end := r.back[:len(r.back)+1][len(r.back)]
- if !end.isEmpty() {
- panic("copies of a slog.Record were both modified")
- }
- }
- r.back = append(r.back, attrs[n:]...)
-}
-
-// Add converts the args to Attrs as described in [Logger.Log],
-// then appends the Attrs to the Record's list of Attrs.
-func (r *Record) Add(args ...any) {
- var a Attr
- for len(args) > 0 {
- a, args = argsToAttr(args)
- if r.nFront < len(r.front) {
- r.front[r.nFront] = a
- r.nFront++
- } else {
- if r.back == nil {
- r.back = make([]Attr, 0, countAttrs(args))
- }
- r.back = append(r.back, a)
- }
- }
-
-}
-
-// countAttrs returns the number of Attrs that would be created from args.
-func countAttrs(args []any) int {
- n := 0
- for i := 0; i < len(args); i++ {
- n++
- if _, ok := args[i].(string); ok {
- i++
- }
- }
- return n
-}
-
-const badKey = "!BADKEY"
-
-// argsToAttr turns a prefix of the nonempty args slice into an Attr
-// and returns the unconsumed portion of the slice.
-// If args[0] is an Attr, it returns it.
-// If args[0] is a string, it treats the first two elements as
-// a key-value pair.
-// Otherwise, it treats args[0] as a value with a missing key.
-func argsToAttr(args []any) (Attr, []any) {
- switch x := args[0].(type) {
- case string:
- if len(args) == 1 {
- return String(badKey, x), nil
- }
- return Any(x, args[1]), args[2:]
-
- case Attr:
- return x, args[1:]
-
- default:
- return Any(badKey, x), args[1:]
- }
-}
-
-// Source describes the location of a line of source code.
-type Source struct {
- // Function is the package path-qualified function name containing the
- // source line. If non-empty, this string uniquely identifies a single
- // function in the program. This may be the empty string if not known.
- Function string `json:"function"`
- // File and Line are the file name and line number (1-based) of the source
- // line. These may be the empty string and zero, respectively, if not known.
- File string `json:"file"`
- Line int `json:"line"`
-}
-
-// attrs returns the non-zero fields of s as a slice of attrs.
-// It is similar to a LogValue method, but we don't want Source
-// to implement LogValuer because it would be resolved before
-// the ReplaceAttr function was called.
-func (s *Source) group() Value {
- var as []Attr
- if s.Function != "" {
- as = append(as, String("function", s.Function))
- }
- if s.File != "" {
- as = append(as, String("file", s.File))
- }
- if s.Line != 0 {
- as = append(as, Int("line", s.Line))
- }
- return GroupValue(as...)
-}
-
-// source returns a Source for the log event.
-// If the Record was created without the necessary information,
-// or if the location is unavailable, it returns a non-nil *Source
-// with zero fields.
-func (r Record) source() *Source {
- fs := runtime.CallersFrames([]uintptr{r.PC})
- f, _ := fs.Next()
- return &Source{
- Function: f.Function,
- File: f.File,
- Line: f.Line,
- }
-}
diff --git a/vendor/golang.org/x/exp/slog/text_handler.go b/vendor/golang.org/x/exp/slog/text_handler.go
deleted file mode 100644
index 75b66b716..000000000
--- a/vendor/golang.org/x/exp/slog/text_handler.go
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright 2022 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 slog
-
-import (
- "context"
- "encoding"
- "fmt"
- "io"
- "reflect"
- "strconv"
- "unicode"
- "unicode/utf8"
-)
-
-// TextHandler is a Handler that writes Records to an io.Writer as a
-// sequence of key=value pairs separated by spaces and followed by a newline.
-type TextHandler struct {
- *commonHandler
-}
-
-// NewTextHandler creates a TextHandler that writes to w,
-// using the given options.
-// If opts is nil, the default options are used.
-func NewTextHandler(w io.Writer, opts *HandlerOptions) *TextHandler {
- if opts == nil {
- opts = &HandlerOptions{}
- }
- return &TextHandler{
- &commonHandler{
- json: false,
- w: w,
- opts: *opts,
- },
- }
-}
-
-// Enabled reports whether the handler handles records at the given level.
-// The handler ignores records whose level is lower.
-func (h *TextHandler) Enabled(_ context.Context, level Level) bool {
- return h.commonHandler.enabled(level)
-}
-
-// WithAttrs returns a new TextHandler whose attributes consists
-// of h's attributes followed by attrs.
-func (h *TextHandler) WithAttrs(attrs []Attr) Handler {
- return &TextHandler{commonHandler: h.commonHandler.withAttrs(attrs)}
-}
-
-func (h *TextHandler) WithGroup(name string) Handler {
- return &TextHandler{commonHandler: h.commonHandler.withGroup(name)}
-}
-
-// Handle formats its argument Record as a single line of space-separated
-// key=value items.
-//
-// If the Record's time is zero, the time is omitted.
-// Otherwise, the key is "time"
-// and the value is output in RFC3339 format with millisecond precision.
-//
-// If the Record's level is zero, the level is omitted.
-// Otherwise, the key is "level"
-// and the value of [Level.String] is output.
-//
-// If the AddSource option is set and source information is available,
-// the key is "source" and the value is output as FILE:LINE.
-//
-// The message's key is "msg".
-//
-// To modify these or other attributes, or remove them from the output, use
-// [HandlerOptions.ReplaceAttr].
-//
-// If a value implements [encoding.TextMarshaler], the result of MarshalText is
-// written. Otherwise, the result of fmt.Sprint is written.
-//
-// Keys and values are quoted with [strconv.Quote] if they contain Unicode space
-// characters, non-printing characters, '"' or '='.
-//
-// Keys inside groups consist of components (keys or group names) separated by
-// dots. No further escaping is performed.
-// Thus there is no way to determine from the key "a.b.c" whether there
-// are two groups "a" and "b" and a key "c", or a single group "a.b" and a key "c",
-// or single group "a" and a key "b.c".
-// If it is necessary to reconstruct the group structure of a key
-// even in the presence of dots inside components, use
-// [HandlerOptions.ReplaceAttr] to encode that information in the key.
-//
-// Each call to Handle results in a single serialized call to
-// io.Writer.Write.
-func (h *TextHandler) Handle(_ context.Context, r Record) error {
- return h.commonHandler.handle(r)
-}
-
-func appendTextValue(s *handleState, v Value) error {
- switch v.Kind() {
- case KindString:
- s.appendString(v.str())
- case KindTime:
- s.appendTime(v.time())
- case KindAny:
- if tm, ok := v.any.(encoding.TextMarshaler); ok {
- data, err := tm.MarshalText()
- if err != nil {
- return err
- }
- // TODO: avoid the conversion to string.
- s.appendString(string(data))
- return nil
- }
- if bs, ok := byteSlice(v.any); ok {
- // As of Go 1.19, this only allocates for strings longer than 32 bytes.
- s.buf.WriteString(strconv.Quote(string(bs)))
- return nil
- }
- s.appendString(fmt.Sprintf("%+v", v.Any()))
- default:
- *s.buf = v.append(*s.buf)
- }
- return nil
-}
-
-// byteSlice returns its argument as a []byte if the argument's
-// underlying type is []byte, along with a second return value of true.
-// Otherwise it returns nil, false.
-func byteSlice(a any) ([]byte, bool) {
- if bs, ok := a.([]byte); ok {
- return bs, true
- }
- // Like Printf's %s, we allow both the slice type and the byte element type to be named.
- t := reflect.TypeOf(a)
- if t != nil && t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8 {
- return reflect.ValueOf(a).Bytes(), true
- }
- return nil, false
-}
-
-func needsQuoting(s string) bool {
- if len(s) == 0 {
- return true
- }
- for i := 0; i < len(s); {
- b := s[i]
- if b < utf8.RuneSelf {
- // Quote anything except a backslash that would need quoting in a
- // JSON string, as well as space and '='
- if b != '\\' && (b == ' ' || b == '=' || !safeSet[b]) {
- return true
- }
- i++
- continue
- }
- r, size := utf8.DecodeRuneInString(s[i:])
- if r == utf8.RuneError || unicode.IsSpace(r) || !unicode.IsPrint(r) {
- return true
- }
- i += size
- }
- return false
-}
diff --git a/vendor/golang.org/x/exp/slog/value.go b/vendor/golang.org/x/exp/slog/value.go
deleted file mode 100644
index 3550c46fc..000000000
--- a/vendor/golang.org/x/exp/slog/value.go
+++ /dev/null
@@ -1,456 +0,0 @@
-// Copyright 2022 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 slog
-
-import (
- "fmt"
- "math"
- "runtime"
- "strconv"
- "strings"
- "time"
- "unsafe"
-
- "golang.org/x/exp/slices"
-)
-
-// A Value can represent any Go value, but unlike type any,
-// it can represent most small values without an allocation.
-// The zero Value corresponds to nil.
-type Value struct {
- _ [0]func() // disallow ==
- // num holds the value for Kinds Int64, Uint64, Float64, Bool and Duration,
- // the string length for KindString, and nanoseconds since the epoch for KindTime.
- num uint64
- // If any is of type Kind, then the value is in num as described above.
- // If any is of type *time.Location, then the Kind is Time and time.Time value
- // can be constructed from the Unix nanos in num and the location (monotonic time
- // is not preserved).
- // If any is of type stringptr, then the Kind is String and the string value
- // consists of the length in num and the pointer in any.
- // Otherwise, the Kind is Any and any is the value.
- // (This implies that Attrs cannot store values of type Kind, *time.Location
- // or stringptr.)
- any any
-}
-
-// Kind is the kind of a Value.
-type Kind int
-
-// The following list is sorted alphabetically, but it's also important that
-// KindAny is 0 so that a zero Value represents nil.
-
-const (
- KindAny Kind = iota
- KindBool
- KindDuration
- KindFloat64
- KindInt64
- KindString
- KindTime
- KindUint64
- KindGroup
- KindLogValuer
-)
-
-var kindStrings = []string{
- "Any",
- "Bool",
- "Duration",
- "Float64",
- "Int64",
- "String",
- "Time",
- "Uint64",
- "Group",
- "LogValuer",
-}
-
-func (k Kind) String() string {
- if k >= 0 && int(k) < len(kindStrings) {
- return kindStrings[k]
- }
- return ""
-}
-
-// Unexported version of Kind, just so we can store Kinds in Values.
-// (No user-provided value has this type.)
-type kind Kind
-
-// Kind returns v's Kind.
-func (v Value) Kind() Kind {
- switch x := v.any.(type) {
- case Kind:
- return x
- case stringptr:
- return KindString
- case timeLocation:
- return KindTime
- case groupptr:
- return KindGroup
- case LogValuer:
- return KindLogValuer
- case kind: // a kind is just a wrapper for a Kind
- return KindAny
- default:
- return KindAny
- }
-}
-
-//////////////// Constructors
-
-// IntValue returns a Value for an int.
-func IntValue(v int) Value {
- return Int64Value(int64(v))
-}
-
-// Int64Value returns a Value for an int64.
-func Int64Value(v int64) Value {
- return Value{num: uint64(v), any: KindInt64}
-}
-
-// Uint64Value returns a Value for a uint64.
-func Uint64Value(v uint64) Value {
- return Value{num: v, any: KindUint64}
-}
-
-// Float64Value returns a Value for a floating-point number.
-func Float64Value(v float64) Value {
- return Value{num: math.Float64bits(v), any: KindFloat64}
-}
-
-// BoolValue returns a Value for a bool.
-func BoolValue(v bool) Value {
- u := uint64(0)
- if v {
- u = 1
- }
- return Value{num: u, any: KindBool}
-}
-
-// Unexported version of *time.Location, just so we can store *time.Locations in
-// Values. (No user-provided value has this type.)
-type timeLocation *time.Location
-
-// TimeValue returns a Value for a time.Time.
-// It discards the monotonic portion.
-func TimeValue(v time.Time) Value {
- if v.IsZero() {
- // UnixNano on the zero time is undefined, so represent the zero time
- // with a nil *time.Location instead. time.Time.Location method never
- // returns nil, so a Value with any == timeLocation(nil) cannot be
- // mistaken for any other Value, time.Time or otherwise.
- return Value{any: timeLocation(nil)}
- }
- return Value{num: uint64(v.UnixNano()), any: timeLocation(v.Location())}
-}
-
-// DurationValue returns a Value for a time.Duration.
-func DurationValue(v time.Duration) Value {
- return Value{num: uint64(v.Nanoseconds()), any: KindDuration}
-}
-
-// AnyValue returns a Value for the supplied value.
-//
-// If the supplied value is of type Value, it is returned
-// unmodified.
-//
-// Given a value of one of Go's predeclared string, bool, or
-// (non-complex) numeric types, AnyValue returns a Value of kind
-// String, Bool, Uint64, Int64, or Float64. The width of the
-// original numeric type is not preserved.
-//
-// Given a time.Time or time.Duration value, AnyValue returns a Value of kind
-// KindTime or KindDuration. The monotonic time is not preserved.
-//
-// For nil, or values of all other types, including named types whose
-// underlying type is numeric, AnyValue returns a value of kind KindAny.
-func AnyValue(v any) Value {
- switch v := v.(type) {
- case string:
- return StringValue(v)
- case int:
- return Int64Value(int64(v))
- case uint:
- return Uint64Value(uint64(v))
- case int64:
- return Int64Value(v)
- case uint64:
- return Uint64Value(v)
- case bool:
- return BoolValue(v)
- case time.Duration:
- return DurationValue(v)
- case time.Time:
- return TimeValue(v)
- case uint8:
- return Uint64Value(uint64(v))
- case uint16:
- return Uint64Value(uint64(v))
- case uint32:
- return Uint64Value(uint64(v))
- case uintptr:
- return Uint64Value(uint64(v))
- case int8:
- return Int64Value(int64(v))
- case int16:
- return Int64Value(int64(v))
- case int32:
- return Int64Value(int64(v))
- case float64:
- return Float64Value(v)
- case float32:
- return Float64Value(float64(v))
- case []Attr:
- return GroupValue(v...)
- case Kind:
- return Value{any: kind(v)}
- case Value:
- return v
- default:
- return Value{any: v}
- }
-}
-
-//////////////// Accessors
-
-// Any returns v's value as an any.
-func (v Value) Any() any {
- switch v.Kind() {
- case KindAny:
- if k, ok := v.any.(kind); ok {
- return Kind(k)
- }
- return v.any
- case KindLogValuer:
- return v.any
- case KindGroup:
- return v.group()
- case KindInt64:
- return int64(v.num)
- case KindUint64:
- return v.num
- case KindFloat64:
- return v.float()
- case KindString:
- return v.str()
- case KindBool:
- return v.bool()
- case KindDuration:
- return v.duration()
- case KindTime:
- return v.time()
- default:
- panic(fmt.Sprintf("bad kind: %s", v.Kind()))
- }
-}
-
-// Int64 returns v's value as an int64. It panics
-// if v is not a signed integer.
-func (v Value) Int64() int64 {
- if g, w := v.Kind(), KindInt64; g != w {
- panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
- }
- return int64(v.num)
-}
-
-// Uint64 returns v's value as a uint64. It panics
-// if v is not an unsigned integer.
-func (v Value) Uint64() uint64 {
- if g, w := v.Kind(), KindUint64; g != w {
- panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
- }
- return v.num
-}
-
-// Bool returns v's value as a bool. It panics
-// if v is not a bool.
-func (v Value) Bool() bool {
- if g, w := v.Kind(), KindBool; g != w {
- panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
- }
- return v.bool()
-}
-
-func (v Value) bool() bool {
- return v.num == 1
-}
-
-// Duration returns v's value as a time.Duration. It panics
-// if v is not a time.Duration.
-func (v Value) Duration() time.Duration {
- if g, w := v.Kind(), KindDuration; g != w {
- panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
- }
-
- return v.duration()
-}
-
-func (v Value) duration() time.Duration {
- return time.Duration(int64(v.num))
-}
-
-// Float64 returns v's value as a float64. It panics
-// if v is not a float64.
-func (v Value) Float64() float64 {
- if g, w := v.Kind(), KindFloat64; g != w {
- panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
- }
-
- return v.float()
-}
-
-func (v Value) float() float64 {
- return math.Float64frombits(v.num)
-}
-
-// Time returns v's value as a time.Time. It panics
-// if v is not a time.Time.
-func (v Value) Time() time.Time {
- if g, w := v.Kind(), KindTime; g != w {
- panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
- }
- return v.time()
-}
-
-func (v Value) time() time.Time {
- loc := v.any.(timeLocation)
- if loc == nil {
- return time.Time{}
- }
- return time.Unix(0, int64(v.num)).In(loc)
-}
-
-// LogValuer returns v's value as a LogValuer. It panics
-// if v is not a LogValuer.
-func (v Value) LogValuer() LogValuer {
- return v.any.(LogValuer)
-}
-
-// Group returns v's value as a []Attr.
-// It panics if v's Kind is not KindGroup.
-func (v Value) Group() []Attr {
- if sp, ok := v.any.(groupptr); ok {
- return unsafe.Slice((*Attr)(sp), v.num)
- }
- panic("Group: bad kind")
-}
-
-func (v Value) group() []Attr {
- return unsafe.Slice((*Attr)(v.any.(groupptr)), v.num)
-}
-
-//////////////// Other
-
-// Equal reports whether v and w represent the same Go value.
-func (v Value) Equal(w Value) bool {
- k1 := v.Kind()
- k2 := w.Kind()
- if k1 != k2 {
- return false
- }
- switch k1 {
- case KindInt64, KindUint64, KindBool, KindDuration:
- return v.num == w.num
- case KindString:
- return v.str() == w.str()
- case KindFloat64:
- return v.float() == w.float()
- case KindTime:
- return v.time().Equal(w.time())
- case KindAny, KindLogValuer:
- return v.any == w.any // may panic if non-comparable
- case KindGroup:
- return slices.EqualFunc(v.group(), w.group(), Attr.Equal)
- default:
- panic(fmt.Sprintf("bad kind: %s", k1))
- }
-}
-
-// append appends a text representation of v to dst.
-// v is formatted as with fmt.Sprint.
-func (v Value) append(dst []byte) []byte {
- switch v.Kind() {
- case KindString:
- return append(dst, v.str()...)
- case KindInt64:
- return strconv.AppendInt(dst, int64(v.num), 10)
- case KindUint64:
- return strconv.AppendUint(dst, v.num, 10)
- case KindFloat64:
- return strconv.AppendFloat(dst, v.float(), 'g', -1, 64)
- case KindBool:
- return strconv.AppendBool(dst, v.bool())
- case KindDuration:
- return append(dst, v.duration().String()...)
- case KindTime:
- return append(dst, v.time().String()...)
- case KindGroup:
- return fmt.Append(dst, v.group())
- case KindAny, KindLogValuer:
- return fmt.Append(dst, v.any)
- default:
- panic(fmt.Sprintf("bad kind: %s", v.Kind()))
- }
-}
-
-// A LogValuer is any Go value that can convert itself into a Value for logging.
-//
-// This mechanism may be used to defer expensive operations until they are
-// needed, or to expand a single value into a sequence of components.
-type LogValuer interface {
- LogValue() Value
-}
-
-const maxLogValues = 100
-
-// Resolve repeatedly calls LogValue on v while it implements LogValuer,
-// and returns the result.
-// If v resolves to a group, the group's attributes' values are not recursively
-// resolved.
-// If the number of LogValue calls exceeds a threshold, a Value containing an
-// error is returned.
-// Resolve's return value is guaranteed not to be of Kind KindLogValuer.
-func (v Value) Resolve() (rv Value) {
- orig := v
- defer func() {
- if r := recover(); r != nil {
- rv = AnyValue(fmt.Errorf("LogValue panicked\n%s", stack(3, 5)))
- }
- }()
-
- for i := 0; i < maxLogValues; i++ {
- if v.Kind() != KindLogValuer {
- return v
- }
- v = v.LogValuer().LogValue()
- }
- err := fmt.Errorf("LogValue called too many times on Value of type %T", orig.Any())
- return AnyValue(err)
-}
-
-func stack(skip, nFrames int) string {
- pcs := make([]uintptr, nFrames+1)
- n := runtime.Callers(skip+1, pcs)
- if n == 0 {
- return "(no stack)"
- }
- frames := runtime.CallersFrames(pcs[:n])
- var b strings.Builder
- i := 0
- for {
- frame, more := frames.Next()
- fmt.Fprintf(&b, "called from %s (%s:%d)\n", frame.Function, frame.File, frame.Line)
- if !more {
- break
- }
- i++
- if i >= nFrames {
- fmt.Fprintf(&b, "(rest of stack elided)\n")
- break
- }
- }
- return b.String()
-}
diff --git a/vendor/golang.org/x/exp/slog/value_119.go b/vendor/golang.org/x/exp/slog/value_119.go
deleted file mode 100644
index 29b0d7329..000000000
--- a/vendor/golang.org/x/exp/slog/value_119.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.19 && !go1.20
-
-package slog
-
-import (
- "reflect"
- "unsafe"
-)
-
-type (
- stringptr unsafe.Pointer // used in Value.any when the Value is a string
- groupptr unsafe.Pointer // used in Value.any when the Value is a []Attr
-)
-
-// StringValue returns a new Value for a string.
-func StringValue(value string) Value {
- hdr := (*reflect.StringHeader)(unsafe.Pointer(&value))
- return Value{num: uint64(hdr.Len), any: stringptr(hdr.Data)}
-}
-
-func (v Value) str() string {
- var s string
- hdr := (*reflect.StringHeader)(unsafe.Pointer(&s))
- hdr.Data = uintptr(v.any.(stringptr))
- hdr.Len = int(v.num)
- return s
-}
-
-// String returns Value's value as a string, formatted like fmt.Sprint. Unlike
-// the methods Int64, Float64, and so on, which panic if v is of the
-// wrong kind, String never panics.
-func (v Value) String() string {
- if sp, ok := v.any.(stringptr); ok {
- // Inlining this code makes a huge difference.
- var s string
- hdr := (*reflect.StringHeader)(unsafe.Pointer(&s))
- hdr.Data = uintptr(sp)
- hdr.Len = int(v.num)
- return s
- }
- return string(v.append(nil))
-}
-
-// GroupValue returns a new Value for a list of Attrs.
-// The caller must not subsequently mutate the argument slice.
-func GroupValue(as ...Attr) Value {
- hdr := (*reflect.SliceHeader)(unsafe.Pointer(&as))
- return Value{num: uint64(hdr.Len), any: groupptr(hdr.Data)}
-}
diff --git a/vendor/golang.org/x/exp/slog/value_120.go b/vendor/golang.org/x/exp/slog/value_120.go
deleted file mode 100644
index f7d4c0932..000000000
--- a/vendor/golang.org/x/exp/slog/value_120.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2022 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.
-
-//go:build go1.20
-
-package slog
-
-import "unsafe"
-
-type (
- stringptr *byte // used in Value.any when the Value is a string
- groupptr *Attr // used in Value.any when the Value is a []Attr
-)
-
-// StringValue returns a new Value for a string.
-func StringValue(value string) Value {
- return Value{num: uint64(len(value)), any: stringptr(unsafe.StringData(value))}
-}
-
-// GroupValue returns a new Value for a list of Attrs.
-// The caller must not subsequently mutate the argument slice.
-func GroupValue(as ...Attr) Value {
- return Value{num: uint64(len(as)), any: groupptr(unsafe.SliceData(as))}
-}
-
-// String returns Value's value as a string, formatted like fmt.Sprint. Unlike
-// the methods Int64, Float64, and so on, which panic if v is of the
-// wrong kind, String never panics.
-func (v Value) String() string {
- if sp, ok := v.any.(stringptr); ok {
- return unsafe.String(sp, v.num)
- }
- return string(v.append(nil))
-}
-
-func (v Value) str() string {
- return unsafe.String(v.any.(stringptr), v.num)
-}
diff --git a/vendor/golang.org/x/mod/LICENSE b/vendor/golang.org/x/mod/LICENSE
deleted file mode 100644
index 2a7cf70da..000000000
--- a/vendor/golang.org/x/mod/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright 2009 The Go Authors.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google LLC nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/mod/PATENTS b/vendor/golang.org/x/mod/PATENTS
deleted file mode 100644
index 733099041..000000000
--- a/vendor/golang.org/x/mod/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/mod/semver/semver.go b/vendor/golang.org/x/mod/semver/semver.go
deleted file mode 100644
index 9a2dfd33a..000000000
--- a/vendor/golang.org/x/mod/semver/semver.go
+++ /dev/null
@@ -1,401 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package semver implements comparison of semantic version strings.
-// In this package, semantic version strings must begin with a leading "v",
-// as in "v1.0.0".
-//
-// The general form of a semantic version string accepted by this package is
-//
-// vMAJOR[.MINOR[.PATCH[-PRERELEASE][+BUILD]]]
-//
-// where square brackets indicate optional parts of the syntax;
-// MAJOR, MINOR, and PATCH are decimal integers without extra leading zeros;
-// PRERELEASE and BUILD are each a series of non-empty dot-separated identifiers
-// using only alphanumeric characters and hyphens; and
-// all-numeric PRERELEASE identifiers must not have leading zeros.
-//
-// This package follows Semantic Versioning 2.0.0 (see semver.org)
-// with two exceptions. First, it requires the "v" prefix. Second, it recognizes
-// vMAJOR and vMAJOR.MINOR (with no prerelease or build suffixes)
-// as shorthands for vMAJOR.0.0 and vMAJOR.MINOR.0.
-package semver
-
-import "sort"
-
-// parsed returns the parsed form of a semantic version string.
-type parsed struct {
- major string
- minor string
- patch string
- short string
- prerelease string
- build string
-}
-
-// IsValid reports whether v is a valid semantic version string.
-func IsValid(v string) bool {
- _, ok := parse(v)
- return ok
-}
-
-// Canonical returns the canonical formatting of the semantic version v.
-// It fills in any missing .MINOR or .PATCH and discards build metadata.
-// Two semantic versions compare equal only if their canonical formattings
-// are identical strings.
-// The canonical invalid semantic version is the empty string.
-func Canonical(v string) string {
- p, ok := parse(v)
- if !ok {
- return ""
- }
- if p.build != "" {
- return v[:len(v)-len(p.build)]
- }
- if p.short != "" {
- return v + p.short
- }
- return v
-}
-
-// Major returns the major version prefix of the semantic version v.
-// For example, Major("v2.1.0") == "v2".
-// If v is an invalid semantic version string, Major returns the empty string.
-func Major(v string) string {
- pv, ok := parse(v)
- if !ok {
- return ""
- }
- return v[:1+len(pv.major)]
-}
-
-// MajorMinor returns the major.minor version prefix of the semantic version v.
-// For example, MajorMinor("v2.1.0") == "v2.1".
-// If v is an invalid semantic version string, MajorMinor returns the empty string.
-func MajorMinor(v string) string {
- pv, ok := parse(v)
- if !ok {
- return ""
- }
- i := 1 + len(pv.major)
- if j := i + 1 + len(pv.minor); j <= len(v) && v[i] == '.' && v[i+1:j] == pv.minor {
- return v[:j]
- }
- return v[:i] + "." + pv.minor
-}
-
-// Prerelease returns the prerelease suffix of the semantic version v.
-// For example, Prerelease("v2.1.0-pre+meta") == "-pre".
-// If v is an invalid semantic version string, Prerelease returns the empty string.
-func Prerelease(v string) string {
- pv, ok := parse(v)
- if !ok {
- return ""
- }
- return pv.prerelease
-}
-
-// Build returns the build suffix of the semantic version v.
-// For example, Build("v2.1.0+meta") == "+meta".
-// If v is an invalid semantic version string, Build returns the empty string.
-func Build(v string) string {
- pv, ok := parse(v)
- if !ok {
- return ""
- }
- return pv.build
-}
-
-// Compare returns an integer comparing two versions according to
-// semantic version precedence.
-// The result will be 0 if v == w, -1 if v < w, or +1 if v > w.
-//
-// An invalid semantic version string is considered less than a valid one.
-// All invalid semantic version strings compare equal to each other.
-func Compare(v, w string) int {
- pv, ok1 := parse(v)
- pw, ok2 := parse(w)
- if !ok1 && !ok2 {
- return 0
- }
- if !ok1 {
- return -1
- }
- if !ok2 {
- return +1
- }
- if c := compareInt(pv.major, pw.major); c != 0 {
- return c
- }
- if c := compareInt(pv.minor, pw.minor); c != 0 {
- return c
- }
- if c := compareInt(pv.patch, pw.patch); c != 0 {
- return c
- }
- return comparePrerelease(pv.prerelease, pw.prerelease)
-}
-
-// Max canonicalizes its arguments and then returns the version string
-// that compares greater.
-//
-// Deprecated: use [Compare] instead. In most cases, returning a canonicalized
-// version is not expected or desired.
-func Max(v, w string) string {
- v = Canonical(v)
- w = Canonical(w)
- if Compare(v, w) > 0 {
- return v
- }
- return w
-}
-
-// ByVersion implements [sort.Interface] for sorting semantic version strings.
-type ByVersion []string
-
-func (vs ByVersion) Len() int { return len(vs) }
-func (vs ByVersion) Swap(i, j int) { vs[i], vs[j] = vs[j], vs[i] }
-func (vs ByVersion) Less(i, j int) bool {
- cmp := Compare(vs[i], vs[j])
- if cmp != 0 {
- return cmp < 0
- }
- return vs[i] < vs[j]
-}
-
-// Sort sorts a list of semantic version strings using [ByVersion].
-func Sort(list []string) {
- sort.Sort(ByVersion(list))
-}
-
-func parse(v string) (p parsed, ok bool) {
- if v == "" || v[0] != 'v' {
- return
- }
- p.major, v, ok = parseInt(v[1:])
- if !ok {
- return
- }
- if v == "" {
- p.minor = "0"
- p.patch = "0"
- p.short = ".0.0"
- return
- }
- if v[0] != '.' {
- ok = false
- return
- }
- p.minor, v, ok = parseInt(v[1:])
- if !ok {
- return
- }
- if v == "" {
- p.patch = "0"
- p.short = ".0"
- return
- }
- if v[0] != '.' {
- ok = false
- return
- }
- p.patch, v, ok = parseInt(v[1:])
- if !ok {
- return
- }
- if len(v) > 0 && v[0] == '-' {
- p.prerelease, v, ok = parsePrerelease(v)
- if !ok {
- return
- }
- }
- if len(v) > 0 && v[0] == '+' {
- p.build, v, ok = parseBuild(v)
- if !ok {
- return
- }
- }
- if v != "" {
- ok = false
- return
- }
- ok = true
- return
-}
-
-func parseInt(v string) (t, rest string, ok bool) {
- if v == "" {
- return
- }
- if v[0] < '0' || '9' < v[0] {
- return
- }
- i := 1
- for i < len(v) && '0' <= v[i] && v[i] <= '9' {
- i++
- }
- if v[0] == '0' && i != 1 {
- return
- }
- return v[:i], v[i:], true
-}
-
-func parsePrerelease(v string) (t, rest string, ok bool) {
- // "A pre-release version MAY be denoted by appending a hyphen and
- // a series of dot separated identifiers immediately following the patch version.
- // Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-].
- // Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes."
- if v == "" || v[0] != '-' {
- return
- }
- i := 1
- start := 1
- for i < len(v) && v[i] != '+' {
- if !isIdentChar(v[i]) && v[i] != '.' {
- return
- }
- if v[i] == '.' {
- if start == i || isBadNum(v[start:i]) {
- return
- }
- start = i + 1
- }
- i++
- }
- if start == i || isBadNum(v[start:i]) {
- return
- }
- return v[:i], v[i:], true
-}
-
-func parseBuild(v string) (t, rest string, ok bool) {
- if v == "" || v[0] != '+' {
- return
- }
- i := 1
- start := 1
- for i < len(v) {
- if !isIdentChar(v[i]) && v[i] != '.' {
- return
- }
- if v[i] == '.' {
- if start == i {
- return
- }
- start = i + 1
- }
- i++
- }
- if start == i {
- return
- }
- return v[:i], v[i:], true
-}
-
-func isIdentChar(c byte) bool {
- return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '-'
-}
-
-func isBadNum(v string) bool {
- i := 0
- for i < len(v) && '0' <= v[i] && v[i] <= '9' {
- i++
- }
- return i == len(v) && i > 1 && v[0] == '0'
-}
-
-func isNum(v string) bool {
- i := 0
- for i < len(v) && '0' <= v[i] && v[i] <= '9' {
- i++
- }
- return i == len(v)
-}
-
-func compareInt(x, y string) int {
- if x == y {
- return 0
- }
- if len(x) < len(y) {
- return -1
- }
- if len(x) > len(y) {
- return +1
- }
- if x < y {
- return -1
- } else {
- return +1
- }
-}
-
-func comparePrerelease(x, y string) int {
- // "When major, minor, and patch are equal, a pre-release version has
- // lower precedence than a normal version.
- // Example: 1.0.0-alpha < 1.0.0.
- // Precedence for two pre-release versions with the same major, minor,
- // and patch version MUST be determined by comparing each dot separated
- // identifier from left to right until a difference is found as follows:
- // identifiers consisting of only digits are compared numerically and
- // identifiers with letters or hyphens are compared lexically in ASCII
- // sort order. Numeric identifiers always have lower precedence than
- // non-numeric identifiers. A larger set of pre-release fields has a
- // higher precedence than a smaller set, if all of the preceding
- // identifiers are equal.
- // Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta <
- // 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0."
- if x == y {
- return 0
- }
- if x == "" {
- return +1
- }
- if y == "" {
- return -1
- }
- for x != "" && y != "" {
- x = x[1:] // skip - or .
- y = y[1:] // skip - or .
- var dx, dy string
- dx, x = nextIdent(x)
- dy, y = nextIdent(y)
- if dx != dy {
- ix := isNum(dx)
- iy := isNum(dy)
- if ix != iy {
- if ix {
- return -1
- } else {
- return +1
- }
- }
- if ix {
- if len(dx) < len(dy) {
- return -1
- }
- if len(dx) > len(dy) {
- return +1
- }
- }
- if dx < dy {
- return -1
- } else {
- return +1
- }
- }
- }
- if x == "" {
- return -1
- } else {
- return +1
- }
-}
-
-func nextIdent(x string) (dx, rest string) {
- i := 0
- for i < len(x) && x[i] != '.' {
- i++
- }
- return x[:i], x[i:]
-}
diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE
deleted file mode 100644
index 2a7cf70da..000000000
--- a/vendor/golang.org/x/net/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright 2009 The Go Authors.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google LLC nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/net/PATENTS b/vendor/golang.org/x/net/PATENTS
deleted file mode 100644
index 733099041..000000000
--- a/vendor/golang.org/x/net/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go
deleted file mode 100644
index cf66309c4..000000000
--- a/vendor/golang.org/x/net/context/context.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package context defines the Context type, which carries deadlines,
-// cancelation signals, and other request-scoped values across API boundaries
-// and between processes.
-// As of Go 1.7 this package is available in the standard library under the
-// name context. https://golang.org/pkg/context.
-//
-// Incoming requests to a server should create a Context, and outgoing calls to
-// servers should accept a Context. The chain of function calls between must
-// propagate the Context, optionally replacing it with a modified copy created
-// using WithDeadline, WithTimeout, WithCancel, or WithValue.
-//
-// Programs that use Contexts should follow these rules to keep interfaces
-// consistent across packages and enable static analysis tools to check context
-// propagation:
-//
-// Do not store Contexts inside a struct type; instead, pass a Context
-// explicitly to each function that needs it. The Context should be the first
-// parameter, typically named ctx:
-//
-// func DoSomething(ctx context.Context, arg Arg) error {
-// // ... use ctx ...
-// }
-//
-// Do not pass a nil Context, even if a function permits it. Pass context.TODO
-// if you are unsure about which Context to use.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-//
-// The same Context may be passed to functions running in different goroutines;
-// Contexts are safe for simultaneous use by multiple goroutines.
-//
-// See http://blog.golang.org/context for example code for a server that uses
-// Contexts.
-package context // import "golang.org/x/net/context"
-
-// Background returns a non-nil, empty Context. It is never canceled, has no
-// values, and has no deadline. It is typically used by the main function,
-// initialization, and tests, and as the top-level Context for incoming
-// requests.
-func Background() Context {
- return background
-}
-
-// TODO returns a non-nil, empty Context. Code should use context.TODO when
-// it's unclear which Context to use or it is not yet available (because the
-// surrounding function has not yet been extended to accept a Context
-// parameter). TODO is recognized by static analysis tools that determine
-// whether Contexts are propagated correctly in a program.
-func TODO() Context {
- return todo
-}
diff --git a/vendor/golang.org/x/net/context/go17.go b/vendor/golang.org/x/net/context/go17.go
deleted file mode 100644
index 0c1b86793..000000000
--- a/vendor/golang.org/x/net/context/go17.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.7
-
-package context
-
-import (
- "context" // standard library's context, as of Go 1.7
- "time"
-)
-
-var (
- todo = context.TODO()
- background = context.Background()
-)
-
-// Canceled is the error returned by Context.Err when the context is canceled.
-var Canceled = context.Canceled
-
-// DeadlineExceeded is the error returned by Context.Err when the context's
-// deadline passes.
-var DeadlineExceeded = context.DeadlineExceeded
-
-// WithCancel returns a copy of parent with a new Done channel. The returned
-// context's Done channel is closed when the returned cancel function is called
-// or when the parent context's Done channel is closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
- ctx, f := context.WithCancel(parent)
- return ctx, f
-}
-
-// WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d. If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent. The returned
-// context's Done channel is closed when the deadline expires, when the returned
-// cancel function is called, or when the parent context's Done channel is
-// closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
- ctx, f := context.WithDeadline(parent, deadline)
- return ctx, f
-}
-
-// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete:
-//
-// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
-// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
-// defer cancel() // releases resources if slowOperation completes before timeout elapses
-// return slowOperation(ctx)
-// }
-func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
- return WithDeadline(parent, time.Now().Add(timeout))
-}
-
-// WithValue returns a copy of parent in which the value associated with key is
-// val.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-func WithValue(parent Context, key interface{}, val interface{}) Context {
- return context.WithValue(parent, key, val)
-}
diff --git a/vendor/golang.org/x/net/context/go19.go b/vendor/golang.org/x/net/context/go19.go
deleted file mode 100644
index e31e35a90..000000000
--- a/vendor/golang.org/x/net/context/go19.go
+++ /dev/null
@@ -1,20 +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.
-
-//go:build go1.9
-
-package context
-
-import "context" // standard library's context, as of Go 1.7
-
-// A Context carries a deadline, a cancelation signal, and other values across
-// API boundaries.
-//
-// Context's methods may be called by multiple goroutines simultaneously.
-type Context = context.Context
-
-// A CancelFunc tells an operation to abandon its work.
-// A CancelFunc does not wait for the work to stop.
-// After the first call, subsequent calls to a CancelFunc do nothing.
-type CancelFunc = context.CancelFunc
diff --git a/vendor/golang.org/x/net/context/pre_go17.go b/vendor/golang.org/x/net/context/pre_go17.go
deleted file mode 100644
index 065ff3dfa..000000000
--- a/vendor/golang.org/x/net/context/pre_go17.go
+++ /dev/null
@@ -1,300 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.7
-
-package context
-
-import (
- "errors"
- "fmt"
- "sync"
- "time"
-)
-
-// An emptyCtx is never canceled, has no values, and has no deadline. It is not
-// struct{}, since vars of this type must have distinct addresses.
-type emptyCtx int
-
-func (*emptyCtx) Deadline() (deadline time.Time, ok bool) {
- return
-}
-
-func (*emptyCtx) Done() <-chan struct{} {
- return nil
-}
-
-func (*emptyCtx) Err() error {
- return nil
-}
-
-func (*emptyCtx) Value(key interface{}) interface{} {
- return nil
-}
-
-func (e *emptyCtx) String() string {
- switch e {
- case background:
- return "context.Background"
- case todo:
- return "context.TODO"
- }
- return "unknown empty Context"
-}
-
-var (
- background = new(emptyCtx)
- todo = new(emptyCtx)
-)
-
-// Canceled is the error returned by Context.Err when the context is canceled.
-var Canceled = errors.New("context canceled")
-
-// DeadlineExceeded is the error returned by Context.Err when the context's
-// deadline passes.
-var DeadlineExceeded = errors.New("context deadline exceeded")
-
-// WithCancel returns a copy of parent with a new Done channel. The returned
-// context's Done channel is closed when the returned cancel function is called
-// or when the parent context's Done channel is closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
- c := newCancelCtx(parent)
- propagateCancel(parent, c)
- return c, func() { c.cancel(true, Canceled) }
-}
-
-// newCancelCtx returns an initialized cancelCtx.
-func newCancelCtx(parent Context) *cancelCtx {
- return &cancelCtx{
- Context: parent,
- done: make(chan struct{}),
- }
-}
-
-// propagateCancel arranges for child to be canceled when parent is.
-func propagateCancel(parent Context, child canceler) {
- if parent.Done() == nil {
- return // parent is never canceled
- }
- if p, ok := parentCancelCtx(parent); ok {
- p.mu.Lock()
- if p.err != nil {
- // parent has already been canceled
- child.cancel(false, p.err)
- } else {
- if p.children == nil {
- p.children = make(map[canceler]bool)
- }
- p.children[child] = true
- }
- p.mu.Unlock()
- } else {
- go func() {
- select {
- case <-parent.Done():
- child.cancel(false, parent.Err())
- case <-child.Done():
- }
- }()
- }
-}
-
-// parentCancelCtx follows a chain of parent references until it finds a
-// *cancelCtx. This function understands how each of the concrete types in this
-// package represents its parent.
-func parentCancelCtx(parent Context) (*cancelCtx, bool) {
- for {
- switch c := parent.(type) {
- case *cancelCtx:
- return c, true
- case *timerCtx:
- return c.cancelCtx, true
- case *valueCtx:
- parent = c.Context
- default:
- return nil, false
- }
- }
-}
-
-// removeChild removes a context from its parent.
-func removeChild(parent Context, child canceler) {
- p, ok := parentCancelCtx(parent)
- if !ok {
- return
- }
- p.mu.Lock()
- if p.children != nil {
- delete(p.children, child)
- }
- p.mu.Unlock()
-}
-
-// A canceler is a context type that can be canceled directly. The
-// implementations are *cancelCtx and *timerCtx.
-type canceler interface {
- cancel(removeFromParent bool, err error)
- Done() <-chan struct{}
-}
-
-// A cancelCtx can be canceled. When canceled, it also cancels any children
-// that implement canceler.
-type cancelCtx struct {
- Context
-
- done chan struct{} // closed by the first cancel call.
-
- mu sync.Mutex
- children map[canceler]bool // set to nil by the first cancel call
- err error // set to non-nil by the first cancel call
-}
-
-func (c *cancelCtx) Done() <-chan struct{} {
- return c.done
-}
-
-func (c *cancelCtx) Err() error {
- c.mu.Lock()
- defer c.mu.Unlock()
- return c.err
-}
-
-func (c *cancelCtx) String() string {
- return fmt.Sprintf("%v.WithCancel", c.Context)
-}
-
-// cancel closes c.done, cancels each of c's children, and, if
-// removeFromParent is true, removes c from its parent's children.
-func (c *cancelCtx) cancel(removeFromParent bool, err error) {
- if err == nil {
- panic("context: internal error: missing cancel error")
- }
- c.mu.Lock()
- if c.err != nil {
- c.mu.Unlock()
- return // already canceled
- }
- c.err = err
- close(c.done)
- for child := range c.children {
- // NOTE: acquiring the child's lock while holding parent's lock.
- child.cancel(false, err)
- }
- c.children = nil
- c.mu.Unlock()
-
- if removeFromParent {
- removeChild(c.Context, c)
- }
-}
-
-// WithDeadline returns a copy of the parent context with the deadline adjusted
-// to be no later than d. If the parent's deadline is already earlier than d,
-// WithDeadline(parent, d) is semantically equivalent to parent. The returned
-// context's Done channel is closed when the deadline expires, when the returned
-// cancel function is called, or when the parent context's Done channel is
-// closed, whichever happens first.
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete.
-func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
- if cur, ok := parent.Deadline(); ok && cur.Before(deadline) {
- // The current deadline is already sooner than the new one.
- return WithCancel(parent)
- }
- c := &timerCtx{
- cancelCtx: newCancelCtx(parent),
- deadline: deadline,
- }
- propagateCancel(parent, c)
- d := deadline.Sub(time.Now())
- if d <= 0 {
- c.cancel(true, DeadlineExceeded) // deadline has already passed
- return c, func() { c.cancel(true, Canceled) }
- }
- c.mu.Lock()
- defer c.mu.Unlock()
- if c.err == nil {
- c.timer = time.AfterFunc(d, func() {
- c.cancel(true, DeadlineExceeded)
- })
- }
- return c, func() { c.cancel(true, Canceled) }
-}
-
-// A timerCtx carries a timer and a deadline. It embeds a cancelCtx to
-// implement Done and Err. It implements cancel by stopping its timer then
-// delegating to cancelCtx.cancel.
-type timerCtx struct {
- *cancelCtx
- timer *time.Timer // Under cancelCtx.mu.
-
- deadline time.Time
-}
-
-func (c *timerCtx) Deadline() (deadline time.Time, ok bool) {
- return c.deadline, true
-}
-
-func (c *timerCtx) String() string {
- return fmt.Sprintf("%v.WithDeadline(%s [%s])", c.cancelCtx.Context, c.deadline, c.deadline.Sub(time.Now()))
-}
-
-func (c *timerCtx) cancel(removeFromParent bool, err error) {
- c.cancelCtx.cancel(false, err)
- if removeFromParent {
- // Remove this timerCtx from its parent cancelCtx's children.
- removeChild(c.cancelCtx.Context, c)
- }
- c.mu.Lock()
- if c.timer != nil {
- c.timer.Stop()
- c.timer = nil
- }
- c.mu.Unlock()
-}
-
-// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
-//
-// Canceling this context releases resources associated with it, so code should
-// call cancel as soon as the operations running in this Context complete:
-//
-// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
-// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
-// defer cancel() // releases resources if slowOperation completes before timeout elapses
-// return slowOperation(ctx)
-// }
-func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
- return WithDeadline(parent, time.Now().Add(timeout))
-}
-
-// WithValue returns a copy of parent in which the value associated with key is
-// val.
-//
-// Use context Values only for request-scoped data that transits processes and
-// APIs, not for passing optional parameters to functions.
-func WithValue(parent Context, key interface{}, val interface{}) Context {
- return &valueCtx{parent, key, val}
-}
-
-// A valueCtx carries a key-value pair. It implements Value for that key and
-// delegates all other calls to the embedded Context.
-type valueCtx struct {
- Context
- key, val interface{}
-}
-
-func (c *valueCtx) String() string {
- return fmt.Sprintf("%v.WithValue(%#v, %#v)", c.Context, c.key, c.val)
-}
-
-func (c *valueCtx) Value(key interface{}) interface{} {
- if c.key == key {
- return c.val
- }
- return c.Context.Value(key)
-}
diff --git a/vendor/golang.org/x/net/context/pre_go19.go b/vendor/golang.org/x/net/context/pre_go19.go
deleted file mode 100644
index ec5a63803..000000000
--- a/vendor/golang.org/x/net/context/pre_go19.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.9
-
-package context
-
-import "time"
-
-// A Context carries a deadline, a cancelation signal, and other values across
-// API boundaries.
-//
-// Context's methods may be called by multiple goroutines simultaneously.
-type Context interface {
- // Deadline returns the time when work done on behalf of this context
- // should be canceled. Deadline returns ok==false when no deadline is
- // set. Successive calls to Deadline return the same results.
- Deadline() (deadline time.Time, ok bool)
-
- // Done returns a channel that's closed when work done on behalf of this
- // context should be canceled. Done may return nil if this context can
- // never be canceled. Successive calls to Done return the same value.
- //
- // WithCancel arranges for Done to be closed when cancel is called;
- // WithDeadline arranges for Done to be closed when the deadline
- // expires; WithTimeout arranges for Done to be closed when the timeout
- // elapses.
- //
- // Done is provided for use in select statements:
- //
- // // Stream generates values with DoSomething and sends them to out
- // // until DoSomething returns an error or ctx.Done is closed.
- // func Stream(ctx context.Context, out chan<- Value) error {
- // for {
- // v, err := DoSomething(ctx)
- // if err != nil {
- // return err
- // }
- // select {
- // case <-ctx.Done():
- // return ctx.Err()
- // case out <- v:
- // }
- // }
- // }
- //
- // See http://blog.golang.org/pipelines for more examples of how to use
- // a Done channel for cancelation.
- Done() <-chan struct{}
-
- // Err returns a non-nil error value after Done is closed. Err returns
- // Canceled if the context was canceled or DeadlineExceeded if the
- // context's deadline passed. No other values for Err are defined.
- // After Done is closed, successive calls to Err return the same value.
- Err() error
-
- // Value returns the value associated with this context for key, or nil
- // if no value is associated with key. Successive calls to Value with
- // the same key returns the same result.
- //
- // Use context values only for request-scoped data that transits
- // processes and API boundaries, not for passing optional parameters to
- // functions.
- //
- // A key identifies a specific value in a Context. Functions that wish
- // to store values in Context typically allocate a key in a global
- // variable then use that key as the argument to context.WithValue and
- // Context.Value. A key can be any type that supports equality;
- // packages should define keys as an unexported type to avoid
- // collisions.
- //
- // Packages that define a Context key should provide type-safe accessors
- // for the values stores using that key:
- //
- // // Package user defines a User type that's stored in Contexts.
- // package user
- //
- // import "golang.org/x/net/context"
- //
- // // User is the type of value stored in the Contexts.
- // type User struct {...}
- //
- // // key is an unexported type for keys defined in this package.
- // // This prevents collisions with keys defined in other packages.
- // type key int
- //
- // // userKey is the key for user.User values in Contexts. It is
- // // unexported; clients use user.NewContext and user.FromContext
- // // instead of using this key directly.
- // var userKey key = 0
- //
- // // NewContext returns a new Context that carries value u.
- // func NewContext(ctx context.Context, u *User) context.Context {
- // return context.WithValue(ctx, userKey, u)
- // }
- //
- // // FromContext returns the User value stored in ctx, if any.
- // func FromContext(ctx context.Context) (*User, bool) {
- // u, ok := ctx.Value(userKey).(*User)
- // return u, ok
- // }
- Value(key interface{}) interface{}
-}
-
-// A CancelFunc tells an operation to abandon its work.
-// A CancelFunc does not wait for the work to stop.
-// After the first call, subsequent calls to a CancelFunc do nothing.
-type CancelFunc func()
diff --git a/vendor/golang.org/x/net/internal/socks/client.go b/vendor/golang.org/x/net/internal/socks/client.go
deleted file mode 100644
index 3d6f516a5..000000000
--- a/vendor/golang.org/x/net/internal/socks/client.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package socks
-
-import (
- "context"
- "errors"
- "io"
- "net"
- "strconv"
- "time"
-)
-
-var (
- noDeadline = time.Time{}
- aLongTimeAgo = time.Unix(1, 0)
-)
-
-func (d *Dialer) connect(ctx context.Context, c net.Conn, address string) (_ net.Addr, ctxErr error) {
- host, port, err := splitHostPort(address)
- if err != nil {
- return nil, err
- }
- if deadline, ok := ctx.Deadline(); ok && !deadline.IsZero() {
- c.SetDeadline(deadline)
- defer c.SetDeadline(noDeadline)
- }
- if ctx != context.Background() {
- errCh := make(chan error, 1)
- done := make(chan struct{})
- defer func() {
- close(done)
- if ctxErr == nil {
- ctxErr = <-errCh
- }
- }()
- go func() {
- select {
- case <-ctx.Done():
- c.SetDeadline(aLongTimeAgo)
- errCh <- ctx.Err()
- case <-done:
- errCh <- nil
- }
- }()
- }
-
- b := make([]byte, 0, 6+len(host)) // the size here is just an estimate
- b = append(b, Version5)
- if len(d.AuthMethods) == 0 || d.Authenticate == nil {
- b = append(b, 1, byte(AuthMethodNotRequired))
- } else {
- ams := d.AuthMethods
- if len(ams) > 255 {
- return nil, errors.New("too many authentication methods")
- }
- b = append(b, byte(len(ams)))
- for _, am := range ams {
- b = append(b, byte(am))
- }
- }
- if _, ctxErr = c.Write(b); ctxErr != nil {
- return
- }
-
- if _, ctxErr = io.ReadFull(c, b[:2]); ctxErr != nil {
- return
- }
- if b[0] != Version5 {
- return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0])))
- }
- am := AuthMethod(b[1])
- if am == AuthMethodNoAcceptableMethods {
- return nil, errors.New("no acceptable authentication methods")
- }
- if d.Authenticate != nil {
- if ctxErr = d.Authenticate(ctx, c, am); ctxErr != nil {
- return
- }
- }
-
- b = b[:0]
- b = append(b, Version5, byte(d.cmd), 0)
- if ip := net.ParseIP(host); ip != nil {
- if ip4 := ip.To4(); ip4 != nil {
- b = append(b, AddrTypeIPv4)
- b = append(b, ip4...)
- } else if ip6 := ip.To16(); ip6 != nil {
- b = append(b, AddrTypeIPv6)
- b = append(b, ip6...)
- } else {
- return nil, errors.New("unknown address type")
- }
- } else {
- if len(host) > 255 {
- return nil, errors.New("FQDN too long")
- }
- b = append(b, AddrTypeFQDN)
- b = append(b, byte(len(host)))
- b = append(b, host...)
- }
- b = append(b, byte(port>>8), byte(port))
- if _, ctxErr = c.Write(b); ctxErr != nil {
- return
- }
-
- if _, ctxErr = io.ReadFull(c, b[:4]); ctxErr != nil {
- return
- }
- if b[0] != Version5 {
- return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0])))
- }
- if cmdErr := Reply(b[1]); cmdErr != StatusSucceeded {
- return nil, errors.New("unknown error " + cmdErr.String())
- }
- if b[2] != 0 {
- return nil, errors.New("non-zero reserved field")
- }
- l := 2
- var a Addr
- switch b[3] {
- case AddrTypeIPv4:
- l += net.IPv4len
- a.IP = make(net.IP, net.IPv4len)
- case AddrTypeIPv6:
- l += net.IPv6len
- a.IP = make(net.IP, net.IPv6len)
- case AddrTypeFQDN:
- if _, err := io.ReadFull(c, b[:1]); err != nil {
- return nil, err
- }
- l += int(b[0])
- default:
- return nil, errors.New("unknown address type " + strconv.Itoa(int(b[3])))
- }
- if cap(b) < l {
- b = make([]byte, l)
- } else {
- b = b[:l]
- }
- if _, ctxErr = io.ReadFull(c, b); ctxErr != nil {
- return
- }
- if a.IP != nil {
- copy(a.IP, b)
- } else {
- a.Name = string(b[:len(b)-2])
- }
- a.Port = int(b[len(b)-2])<<8 | int(b[len(b)-1])
- return &a, nil
-}
-
-func splitHostPort(address string) (string, int, error) {
- host, port, err := net.SplitHostPort(address)
- if err != nil {
- return "", 0, err
- }
- portnum, err := strconv.Atoi(port)
- if err != nil {
- return "", 0, err
- }
- if 1 > portnum || portnum > 0xffff {
- return "", 0, errors.New("port number out of range " + port)
- }
- return host, portnum, nil
-}
diff --git a/vendor/golang.org/x/net/internal/socks/socks.go b/vendor/golang.org/x/net/internal/socks/socks.go
deleted file mode 100644
index 84fcc32b6..000000000
--- a/vendor/golang.org/x/net/internal/socks/socks.go
+++ /dev/null
@@ -1,317 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package socks provides a SOCKS version 5 client implementation.
-//
-// SOCKS protocol version 5 is defined in RFC 1928.
-// Username/Password authentication for SOCKS version 5 is defined in
-// RFC 1929.
-package socks
-
-import (
- "context"
- "errors"
- "io"
- "net"
- "strconv"
-)
-
-// A Command represents a SOCKS command.
-type Command int
-
-func (cmd Command) String() string {
- switch cmd {
- case CmdConnect:
- return "socks connect"
- case cmdBind:
- return "socks bind"
- default:
- return "socks " + strconv.Itoa(int(cmd))
- }
-}
-
-// An AuthMethod represents a SOCKS authentication method.
-type AuthMethod int
-
-// A Reply represents a SOCKS command reply code.
-type Reply int
-
-func (code Reply) String() string {
- switch code {
- case StatusSucceeded:
- return "succeeded"
- case 0x01:
- return "general SOCKS server failure"
- case 0x02:
- return "connection not allowed by ruleset"
- case 0x03:
- return "network unreachable"
- case 0x04:
- return "host unreachable"
- case 0x05:
- return "connection refused"
- case 0x06:
- return "TTL expired"
- case 0x07:
- return "command not supported"
- case 0x08:
- return "address type not supported"
- default:
- return "unknown code: " + strconv.Itoa(int(code))
- }
-}
-
-// Wire protocol constants.
-const (
- Version5 = 0x05
-
- AddrTypeIPv4 = 0x01
- AddrTypeFQDN = 0x03
- AddrTypeIPv6 = 0x04
-
- CmdConnect Command = 0x01 // establishes an active-open forward proxy connection
- cmdBind Command = 0x02 // establishes a passive-open forward proxy connection
-
- AuthMethodNotRequired AuthMethod = 0x00 // no authentication required
- AuthMethodUsernamePassword AuthMethod = 0x02 // use username/password
- AuthMethodNoAcceptableMethods AuthMethod = 0xff // no acceptable authentication methods
-
- StatusSucceeded Reply = 0x00
-)
-
-// An Addr represents a SOCKS-specific address.
-// Either Name or IP is used exclusively.
-type Addr struct {
- Name string // fully-qualified domain name
- IP net.IP
- Port int
-}
-
-func (a *Addr) Network() string { return "socks" }
-
-func (a *Addr) String() string {
- if a == nil {
- return ""
- }
- port := strconv.Itoa(a.Port)
- if a.IP == nil {
- return net.JoinHostPort(a.Name, port)
- }
- return net.JoinHostPort(a.IP.String(), port)
-}
-
-// A Conn represents a forward proxy connection.
-type Conn struct {
- net.Conn
-
- boundAddr net.Addr
-}
-
-// BoundAddr returns the address assigned by the proxy server for
-// connecting to the command target address from the proxy server.
-func (c *Conn) BoundAddr() net.Addr {
- if c == nil {
- return nil
- }
- return c.boundAddr
-}
-
-// A Dialer holds SOCKS-specific options.
-type Dialer struct {
- cmd Command // either CmdConnect or cmdBind
- proxyNetwork string // network between a proxy server and a client
- proxyAddress string // proxy server address
-
- // ProxyDial specifies the optional dial function for
- // establishing the transport connection.
- ProxyDial func(context.Context, string, string) (net.Conn, error)
-
- // AuthMethods specifies the list of request authentication
- // methods.
- // If empty, SOCKS client requests only AuthMethodNotRequired.
- AuthMethods []AuthMethod
-
- // Authenticate specifies the optional authentication
- // function. It must be non-nil when AuthMethods is not empty.
- // It must return an error when the authentication is failed.
- Authenticate func(context.Context, io.ReadWriter, AuthMethod) error
-}
-
-// DialContext connects to the provided address on the provided
-// network.
-//
-// The returned error value may be a net.OpError. When the Op field of
-// net.OpError contains "socks", the Source field contains a proxy
-// server address and the Addr field contains a command target
-// address.
-//
-// See func Dial of the net package of standard library for a
-// description of the network and address parameters.
-func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
- if err := d.validateTarget(network, address); err != nil {
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
- }
- if ctx == nil {
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")}
- }
- var err error
- var c net.Conn
- if d.ProxyDial != nil {
- c, err = d.ProxyDial(ctx, d.proxyNetwork, d.proxyAddress)
- } else {
- var dd net.Dialer
- c, err = dd.DialContext(ctx, d.proxyNetwork, d.proxyAddress)
- }
- if err != nil {
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
- }
- a, err := d.connect(ctx, c, address)
- if err != nil {
- c.Close()
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
- }
- return &Conn{Conn: c, boundAddr: a}, nil
-}
-
-// DialWithConn initiates a connection from SOCKS server to the target
-// network and address using the connection c that is already
-// connected to the SOCKS server.
-//
-// It returns the connection's local address assigned by the SOCKS
-// server.
-func (d *Dialer) DialWithConn(ctx context.Context, c net.Conn, network, address string) (net.Addr, error) {
- if err := d.validateTarget(network, address); err != nil {
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
- }
- if ctx == nil {
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")}
- }
- a, err := d.connect(ctx, c, address)
- if err != nil {
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
- }
- return a, nil
-}
-
-// Dial connects to the provided address on the provided network.
-//
-// Unlike DialContext, it returns a raw transport connection instead
-// of a forward proxy connection.
-//
-// Deprecated: Use DialContext or DialWithConn instead.
-func (d *Dialer) Dial(network, address string) (net.Conn, error) {
- if err := d.validateTarget(network, address); err != nil {
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
- }
- var err error
- var c net.Conn
- if d.ProxyDial != nil {
- c, err = d.ProxyDial(context.Background(), d.proxyNetwork, d.proxyAddress)
- } else {
- c, err = net.Dial(d.proxyNetwork, d.proxyAddress)
- }
- if err != nil {
- proxy, dst, _ := d.pathAddrs(address)
- return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
- }
- if _, err := d.DialWithConn(context.Background(), c, network, address); err != nil {
- c.Close()
- return nil, err
- }
- return c, nil
-}
-
-func (d *Dialer) validateTarget(network, address string) error {
- switch network {
- case "tcp", "tcp6", "tcp4":
- default:
- return errors.New("network not implemented")
- }
- switch d.cmd {
- case CmdConnect, cmdBind:
- default:
- return errors.New("command not implemented")
- }
- return nil
-}
-
-func (d *Dialer) pathAddrs(address string) (proxy, dst net.Addr, err error) {
- for i, s := range []string{d.proxyAddress, address} {
- host, port, err := splitHostPort(s)
- if err != nil {
- return nil, nil, err
- }
- a := &Addr{Port: port}
- a.IP = net.ParseIP(host)
- if a.IP == nil {
- a.Name = host
- }
- if i == 0 {
- proxy = a
- } else {
- dst = a
- }
- }
- return
-}
-
-// NewDialer returns a new Dialer that dials through the provided
-// proxy server's network and address.
-func NewDialer(network, address string) *Dialer {
- return &Dialer{proxyNetwork: network, proxyAddress: address, cmd: CmdConnect}
-}
-
-const (
- authUsernamePasswordVersion = 0x01
- authStatusSucceeded = 0x00
-)
-
-// UsernamePassword are the credentials for the username/password
-// authentication method.
-type UsernamePassword struct {
- Username string
- Password string
-}
-
-// Authenticate authenticates a pair of username and password with the
-// proxy server.
-func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter, auth AuthMethod) error {
- switch auth {
- case AuthMethodNotRequired:
- return nil
- case AuthMethodUsernamePassword:
- if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) > 255 {
- return errors.New("invalid username/password")
- }
- b := []byte{authUsernamePasswordVersion}
- b = append(b, byte(len(up.Username)))
- b = append(b, up.Username...)
- b = append(b, byte(len(up.Password)))
- b = append(b, up.Password...)
- // TODO(mikio): handle IO deadlines and cancelation if
- // necessary
- if _, err := rw.Write(b); err != nil {
- return err
- }
- if _, err := io.ReadFull(rw, b[:2]); err != nil {
- return err
- }
- if b[0] != authUsernamePasswordVersion {
- return errors.New("invalid username/password version")
- }
- if b[1] != authStatusSucceeded {
- return errors.New("username/password authentication failed")
- }
- return nil
- }
- return errors.New("unsupported authentication method " + strconv.Itoa(int(auth)))
-}
diff --git a/vendor/golang.org/x/net/proxy/dial.go b/vendor/golang.org/x/net/proxy/dial.go
deleted file mode 100644
index 811c2e4e9..000000000
--- a/vendor/golang.org/x/net/proxy/dial.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2019 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 proxy
-
-import (
- "context"
- "net"
-)
-
-// A ContextDialer dials using a context.
-type ContextDialer interface {
- DialContext(ctx context.Context, network, address string) (net.Conn, error)
-}
-
-// Dial works like DialContext on net.Dialer but using a dialer returned by FromEnvironment.
-//
-// The passed ctx is only used for returning the Conn, not the lifetime of the Conn.
-//
-// Custom dialers (registered via RegisterDialerType) that do not implement ContextDialer
-// can leak a goroutine for as long as it takes the underlying Dialer implementation to timeout.
-//
-// A Conn returned from a successful Dial after the context has been cancelled will be immediately closed.
-func Dial(ctx context.Context, network, address string) (net.Conn, error) {
- d := FromEnvironment()
- if xd, ok := d.(ContextDialer); ok {
- return xd.DialContext(ctx, network, address)
- }
- return dialContext(ctx, d, network, address)
-}
-
-// WARNING: this can leak a goroutine for as long as the underlying Dialer implementation takes to timeout
-// A Conn returned from a successful Dial after the context has been cancelled will be immediately closed.
-func dialContext(ctx context.Context, d Dialer, network, address string) (net.Conn, error) {
- var (
- conn net.Conn
- done = make(chan struct{}, 1)
- err error
- )
- go func() {
- conn, err = d.Dial(network, address)
- close(done)
- if conn != nil && ctx.Err() != nil {
- conn.Close()
- }
- }()
- select {
- case <-ctx.Done():
- err = ctx.Err()
- case <-done:
- }
- return conn, err
-}
diff --git a/vendor/golang.org/x/net/proxy/direct.go b/vendor/golang.org/x/net/proxy/direct.go
deleted file mode 100644
index 3d66bdef9..000000000
--- a/vendor/golang.org/x/net/proxy/direct.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package proxy
-
-import (
- "context"
- "net"
-)
-
-type direct struct{}
-
-// Direct implements Dialer by making network connections directly using net.Dial or net.DialContext.
-var Direct = direct{}
-
-var (
- _ Dialer = Direct
- _ ContextDialer = Direct
-)
-
-// Dial directly invokes net.Dial with the supplied parameters.
-func (direct) Dial(network, addr string) (net.Conn, error) {
- return net.Dial(network, addr)
-}
-
-// DialContext instantiates a net.Dialer and invokes its DialContext receiver with the supplied parameters.
-func (direct) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
- var d net.Dialer
- return d.DialContext(ctx, network, addr)
-}
diff --git a/vendor/golang.org/x/net/proxy/per_host.go b/vendor/golang.org/x/net/proxy/per_host.go
deleted file mode 100644
index d7d4b8b6e..000000000
--- a/vendor/golang.org/x/net/proxy/per_host.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package proxy
-
-import (
- "context"
- "net"
- "strings"
-)
-
-// A PerHost directs connections to a default Dialer unless the host name
-// requested matches one of a number of exceptions.
-type PerHost struct {
- def, bypass Dialer
-
- bypassNetworks []*net.IPNet
- bypassIPs []net.IP
- bypassZones []string
- bypassHosts []string
-}
-
-// NewPerHost returns a PerHost Dialer that directs connections to either
-// defaultDialer or bypass, depending on whether the connection matches one of
-// the configured rules.
-func NewPerHost(defaultDialer, bypass Dialer) *PerHost {
- return &PerHost{
- def: defaultDialer,
- bypass: bypass,
- }
-}
-
-// Dial connects to the address addr on the given network through either
-// defaultDialer or bypass.
-func (p *PerHost) Dial(network, addr string) (c net.Conn, err error) {
- host, _, err := net.SplitHostPort(addr)
- if err != nil {
- return nil, err
- }
-
- return p.dialerForRequest(host).Dial(network, addr)
-}
-
-// DialContext connects to the address addr on the given network through either
-// defaultDialer or bypass.
-func (p *PerHost) DialContext(ctx context.Context, network, addr string) (c net.Conn, err error) {
- host, _, err := net.SplitHostPort(addr)
- if err != nil {
- return nil, err
- }
- d := p.dialerForRequest(host)
- if x, ok := d.(ContextDialer); ok {
- return x.DialContext(ctx, network, addr)
- }
- return dialContext(ctx, d, network, addr)
-}
-
-func (p *PerHost) dialerForRequest(host string) Dialer {
- if ip := net.ParseIP(host); ip != nil {
- for _, net := range p.bypassNetworks {
- if net.Contains(ip) {
- return p.bypass
- }
- }
- for _, bypassIP := range p.bypassIPs {
- if bypassIP.Equal(ip) {
- return p.bypass
- }
- }
- return p.def
- }
-
- for _, zone := range p.bypassZones {
- if strings.HasSuffix(host, zone) {
- return p.bypass
- }
- if host == zone[1:] {
- // For a zone ".example.com", we match "example.com"
- // too.
- return p.bypass
- }
- }
- for _, bypassHost := range p.bypassHosts {
- if bypassHost == host {
- return p.bypass
- }
- }
- return p.def
-}
-
-// AddFromString parses a string that contains comma-separated values
-// specifying hosts that should use the bypass proxy. Each value is either an
-// IP address, a CIDR range, a zone (*.example.com) or a host name
-// (localhost). A best effort is made to parse the string and errors are
-// ignored.
-func (p *PerHost) AddFromString(s string) {
- hosts := strings.Split(s, ",")
- for _, host := range hosts {
- host = strings.TrimSpace(host)
- if len(host) == 0 {
- continue
- }
- if strings.Contains(host, "/") {
- // We assume that it's a CIDR address like 127.0.0.0/8
- if _, net, err := net.ParseCIDR(host); err == nil {
- p.AddNetwork(net)
- }
- continue
- }
- if ip := net.ParseIP(host); ip != nil {
- p.AddIP(ip)
- continue
- }
- if strings.HasPrefix(host, "*.") {
- p.AddZone(host[1:])
- continue
- }
- p.AddHost(host)
- }
-}
-
-// AddIP specifies an IP address that will use the bypass proxy. Note that
-// this will only take effect if a literal IP address is dialed. A connection
-// to a named host will never match an IP.
-func (p *PerHost) AddIP(ip net.IP) {
- p.bypassIPs = append(p.bypassIPs, ip)
-}
-
-// AddNetwork specifies an IP range that will use the bypass proxy. Note that
-// this will only take effect if a literal IP address is dialed. A connection
-// to a named host will never match.
-func (p *PerHost) AddNetwork(net *net.IPNet) {
- p.bypassNetworks = append(p.bypassNetworks, net)
-}
-
-// AddZone specifies a DNS suffix that will use the bypass proxy. A zone of
-// "example.com" matches "example.com" and all of its subdomains.
-func (p *PerHost) AddZone(zone string) {
- zone = strings.TrimSuffix(zone, ".")
- if !strings.HasPrefix(zone, ".") {
- zone = "." + zone
- }
- p.bypassZones = append(p.bypassZones, zone)
-}
-
-// AddHost specifies a host name that will use the bypass proxy.
-func (p *PerHost) AddHost(host string) {
- host = strings.TrimSuffix(host, ".")
- p.bypassHosts = append(p.bypassHosts, host)
-}
diff --git a/vendor/golang.org/x/net/proxy/proxy.go b/vendor/golang.org/x/net/proxy/proxy.go
deleted file mode 100644
index 9ff4b9a77..000000000
--- a/vendor/golang.org/x/net/proxy/proxy.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package proxy provides support for a variety of protocols to proxy network
-// data.
-package proxy // import "golang.org/x/net/proxy"
-
-import (
- "errors"
- "net"
- "net/url"
- "os"
- "sync"
-)
-
-// A Dialer is a means to establish a connection.
-// Custom dialers should also implement ContextDialer.
-type Dialer interface {
- // Dial connects to the given address via the proxy.
- Dial(network, addr string) (c net.Conn, err error)
-}
-
-// Auth contains authentication parameters that specific Dialers may require.
-type Auth struct {
- User, Password string
-}
-
-// FromEnvironment returns the dialer specified by the proxy-related
-// variables in the environment and makes underlying connections
-// directly.
-func FromEnvironment() Dialer {
- return FromEnvironmentUsing(Direct)
-}
-
-// FromEnvironmentUsing returns the dialer specify by the proxy-related
-// variables in the environment and makes underlying connections
-// using the provided forwarding Dialer (for instance, a *net.Dialer
-// with desired configuration).
-func FromEnvironmentUsing(forward Dialer) Dialer {
- allProxy := allProxyEnv.Get()
- if len(allProxy) == 0 {
- return forward
- }
-
- proxyURL, err := url.Parse(allProxy)
- if err != nil {
- return forward
- }
- proxy, err := FromURL(proxyURL, forward)
- if err != nil {
- return forward
- }
-
- noProxy := noProxyEnv.Get()
- if len(noProxy) == 0 {
- return proxy
- }
-
- perHost := NewPerHost(proxy, forward)
- perHost.AddFromString(noProxy)
- return perHost
-}
-
-// proxySchemes is a map from URL schemes to a function that creates a Dialer
-// from a URL with such a scheme.
-var proxySchemes map[string]func(*url.URL, Dialer) (Dialer, error)
-
-// RegisterDialerType takes a URL scheme and a function to generate Dialers from
-// a URL with that scheme and a forwarding Dialer. Registered schemes are used
-// by FromURL.
-func RegisterDialerType(scheme string, f func(*url.URL, Dialer) (Dialer, error)) {
- if proxySchemes == nil {
- proxySchemes = make(map[string]func(*url.URL, Dialer) (Dialer, error))
- }
- proxySchemes[scheme] = f
-}
-
-// FromURL returns a Dialer given a URL specification and an underlying
-// Dialer for it to make network requests.
-func FromURL(u *url.URL, forward Dialer) (Dialer, error) {
- var auth *Auth
- if u.User != nil {
- auth = new(Auth)
- auth.User = u.User.Username()
- if p, ok := u.User.Password(); ok {
- auth.Password = p
- }
- }
-
- switch u.Scheme {
- case "socks5", "socks5h":
- addr := u.Hostname()
- port := u.Port()
- if port == "" {
- port = "1080"
- }
- return SOCKS5("tcp", net.JoinHostPort(addr, port), auth, forward)
- }
-
- // If the scheme doesn't match any of the built-in schemes, see if it
- // was registered by another package.
- if proxySchemes != nil {
- if f, ok := proxySchemes[u.Scheme]; ok {
- return f(u, forward)
- }
- }
-
- return nil, errors.New("proxy: unknown scheme: " + u.Scheme)
-}
-
-var (
- allProxyEnv = &envOnce{
- names: []string{"ALL_PROXY", "all_proxy"},
- }
- noProxyEnv = &envOnce{
- names: []string{"NO_PROXY", "no_proxy"},
- }
-)
-
-// envOnce looks up an environment variable (optionally by multiple
-// names) once. It mitigates expensive lookups on some platforms
-// (e.g. Windows).
-// (Borrowed from net/http/transport.go)
-type envOnce struct {
- names []string
- once sync.Once
- val string
-}
-
-func (e *envOnce) Get() string {
- e.once.Do(e.init)
- return e.val
-}
-
-func (e *envOnce) init() {
- for _, n := range e.names {
- e.val = os.Getenv(n)
- if e.val != "" {
- return
- }
- }
-}
-
-// reset is used by tests
-func (e *envOnce) reset() {
- e.once = sync.Once{}
- e.val = ""
-}
diff --git a/vendor/golang.org/x/net/proxy/socks5.go b/vendor/golang.org/x/net/proxy/socks5.go
deleted file mode 100644
index c91651f96..000000000
--- a/vendor/golang.org/x/net/proxy/socks5.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package proxy
-
-import (
- "context"
- "net"
-
- "golang.org/x/net/internal/socks"
-)
-
-// SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given
-// address with an optional username and password.
-// See RFC 1928 and RFC 1929.
-func SOCKS5(network, address string, auth *Auth, forward Dialer) (Dialer, error) {
- d := socks.NewDialer(network, address)
- if forward != nil {
- if f, ok := forward.(ContextDialer); ok {
- d.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) {
- return f.DialContext(ctx, network, address)
- }
- } else {
- d.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) {
- return dialContext(ctx, forward, network, address)
- }
- }
- }
- if auth != nil {
- up := socks.UsernamePassword{
- Username: auth.User,
- Password: auth.Password,
- }
- d.AuthMethods = []socks.AuthMethod{
- socks.AuthMethodNotRequired,
- socks.AuthMethodUsernamePassword,
- }
- d.Authenticate = up.Authenticate
- }
- return d, nil
-}
diff --git a/vendor/golang.org/x/oauth2/.travis.yml b/vendor/golang.org/x/oauth2/.travis.yml
deleted file mode 100644
index fa139db22..000000000
--- a/vendor/golang.org/x/oauth2/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: go
-
-go:
- - tip
-
-install:
- - export GOPATH="$HOME/gopath"
- - mkdir -p "$GOPATH/src/golang.org/x"
- - mv "$TRAVIS_BUILD_DIR" "$GOPATH/src/golang.org/x/oauth2"
- - go get -v -t -d golang.org/x/oauth2/...
-
-script:
- - go test -v golang.org/x/oauth2/...
diff --git a/vendor/golang.org/x/oauth2/CONTRIBUTING.md b/vendor/golang.org/x/oauth2/CONTRIBUTING.md
deleted file mode 100644
index dfbed62cf..000000000
--- a/vendor/golang.org/x/oauth2/CONTRIBUTING.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Contributing to Go
-
-Go is an open source project.
-
-It is the work of hundreds of contributors. We appreciate your help!
-
-## Filing issues
-
-When [filing an issue](https://github.com/golang/oauth2/issues), make sure to answer these five questions:
-
-1. What version of Go are you using (`go version`)?
-2. What operating system and processor architecture are you using?
-3. What did you do?
-4. What did you expect to see?
-5. What did you see instead?
-
-General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker.
-The gophers there will answer or ask you to file an issue if you've tripped over a bug.
-
-## Contributing code
-
-Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html)
-before sending patches.
-
-Unless otherwise noted, the Go source files are distributed under
-the BSD-style license found in the LICENSE file.
diff --git a/vendor/golang.org/x/oauth2/LICENSE b/vendor/golang.org/x/oauth2/LICENSE
deleted file mode 100644
index 6a66aea5e..000000000
--- a/vendor/golang.org/x/oauth2/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/oauth2/README.md b/vendor/golang.org/x/oauth2/README.md
deleted file mode 100644
index 781770c20..000000000
--- a/vendor/golang.org/x/oauth2/README.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# OAuth2 for Go
-
-[](https://pkg.go.dev/golang.org/x/oauth2)
-[](https://travis-ci.org/golang/oauth2)
-
-oauth2 package contains a client implementation for OAuth 2.0 spec.
-
-## Installation
-
-~~~~
-go get golang.org/x/oauth2
-~~~~
-
-Or you can manually git clone the repository to
-`$(go env GOPATH)/src/golang.org/x/oauth2`.
-
-See pkg.go.dev for further documentation and examples.
-
-* [pkg.go.dev/golang.org/x/oauth2](https://pkg.go.dev/golang.org/x/oauth2)
-* [pkg.go.dev/golang.org/x/oauth2/google](https://pkg.go.dev/golang.org/x/oauth2/google)
-
-## Policy for new endpoints
-
-We no longer accept new provider-specific packages in this repo if all
-they do is add a single endpoint variable. If you just want to add a
-single endpoint, add it to the
-[pkg.go.dev/golang.org/x/oauth2/endpoints](https://pkg.go.dev/golang.org/x/oauth2/endpoints)
-package.
-
-## Report Issues / Send Patches
-
-The main issue tracker for the oauth2 repository is located at
-https://github.com/golang/oauth2/issues.
-
-This repository uses Gerrit for code changes. To learn how to submit changes to
-this repository, see https://golang.org/doc/contribute.html. In particular:
-
-* Excluding trivial changes, all contributions should be connected to an existing issue.
-* API changes must go through the [change proposal process](https://go.dev/s/proposal-process) before they can be accepted.
-* The code owners are listed at [dev.golang.org/owners](https://dev.golang.org/owners#:~:text=x/oauth2).
diff --git a/vendor/golang.org/x/oauth2/deviceauth.go b/vendor/golang.org/x/oauth2/deviceauth.go
deleted file mode 100644
index e99c92f39..000000000
--- a/vendor/golang.org/x/oauth2/deviceauth.go
+++ /dev/null
@@ -1,198 +0,0 @@
-package oauth2
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "strings"
- "time"
-
- "golang.org/x/oauth2/internal"
-)
-
-// https://datatracker.ietf.org/doc/html/rfc8628#section-3.5
-const (
- errAuthorizationPending = "authorization_pending"
- errSlowDown = "slow_down"
- errAccessDenied = "access_denied"
- errExpiredToken = "expired_token"
-)
-
-// DeviceAuthResponse describes a successful RFC 8628 Device Authorization Response
-// https://datatracker.ietf.org/doc/html/rfc8628#section-3.2
-type DeviceAuthResponse struct {
- // DeviceCode
- DeviceCode string `json:"device_code"`
- // UserCode is the code the user should enter at the verification uri
- UserCode string `json:"user_code"`
- // VerificationURI is where user should enter the user code
- VerificationURI string `json:"verification_uri"`
- // VerificationURIComplete (if populated) includes the user code in the verification URI. This is typically shown to the user in non-textual form, such as a QR code.
- VerificationURIComplete string `json:"verification_uri_complete,omitempty"`
- // Expiry is when the device code and user code expire
- Expiry time.Time `json:"expires_in,omitempty"`
- // Interval is the duration in seconds that Poll should wait between requests
- Interval int64 `json:"interval,omitempty"`
-}
-
-func (d DeviceAuthResponse) MarshalJSON() ([]byte, error) {
- type Alias DeviceAuthResponse
- var expiresIn int64
- if !d.Expiry.IsZero() {
- expiresIn = int64(time.Until(d.Expiry).Seconds())
- }
- return json.Marshal(&struct {
- ExpiresIn int64 `json:"expires_in,omitempty"`
- *Alias
- }{
- ExpiresIn: expiresIn,
- Alias: (*Alias)(&d),
- })
-
-}
-
-func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
- type Alias DeviceAuthResponse
- aux := &struct {
- ExpiresIn int64 `json:"expires_in"`
- // workaround misspelling of verification_uri
- VerificationURL string `json:"verification_url"`
- *Alias
- }{
- Alias: (*Alias)(c),
- }
- if err := json.Unmarshal(data, &aux); err != nil {
- return err
- }
- if aux.ExpiresIn != 0 {
- c.Expiry = time.Now().UTC().Add(time.Second * time.Duration(aux.ExpiresIn))
- }
- if c.VerificationURI == "" {
- c.VerificationURI = aux.VerificationURL
- }
- return nil
-}
-
-// DeviceAuth returns a device auth struct which contains a device code
-// and authorization information provided for users to enter on another device.
-func (c *Config) DeviceAuth(ctx context.Context, opts ...AuthCodeOption) (*DeviceAuthResponse, error) {
- // https://datatracker.ietf.org/doc/html/rfc8628#section-3.1
- v := url.Values{
- "client_id": {c.ClientID},
- }
- if len(c.Scopes) > 0 {
- v.Set("scope", strings.Join(c.Scopes, " "))
- }
- for _, opt := range opts {
- opt.setValue(v)
- }
- return retrieveDeviceAuth(ctx, c, v)
-}
-
-func retrieveDeviceAuth(ctx context.Context, c *Config, v url.Values) (*DeviceAuthResponse, error) {
- if c.Endpoint.DeviceAuthURL == "" {
- return nil, errors.New("endpoint missing DeviceAuthURL")
- }
-
- req, err := http.NewRequest("POST", c.Endpoint.DeviceAuthURL, strings.NewReader(v.Encode()))
- if err != nil {
- return nil, err
- }
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- req.Header.Set("Accept", "application/json")
-
- t := time.Now()
- r, err := internal.ContextClient(ctx).Do(req)
- if err != nil {
- return nil, err
- }
-
- body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))
- if err != nil {
- return nil, fmt.Errorf("oauth2: cannot auth device: %v", err)
- }
- if code := r.StatusCode; code < 200 || code > 299 {
- return nil, &RetrieveError{
- Response: r,
- Body: body,
- }
- }
-
- da := &DeviceAuthResponse{}
- err = json.Unmarshal(body, &da)
- if err != nil {
- return nil, fmt.Errorf("unmarshal %s", err)
- }
-
- if !da.Expiry.IsZero() {
- // Make a small adjustment to account for time taken by the request
- da.Expiry = da.Expiry.Add(-time.Since(t))
- }
-
- return da, nil
-}
-
-// DeviceAccessToken polls the server to exchange a device code for a token.
-func (c *Config) DeviceAccessToken(ctx context.Context, da *DeviceAuthResponse, opts ...AuthCodeOption) (*Token, error) {
- if !da.Expiry.IsZero() {
- var cancel context.CancelFunc
- ctx, cancel = context.WithDeadline(ctx, da.Expiry)
- defer cancel()
- }
-
- // https://datatracker.ietf.org/doc/html/rfc8628#section-3.4
- v := url.Values{
- "client_id": {c.ClientID},
- "grant_type": {"urn:ietf:params:oauth:grant-type:device_code"},
- "device_code": {da.DeviceCode},
- }
- if len(c.Scopes) > 0 {
- v.Set("scope", strings.Join(c.Scopes, " "))
- }
- for _, opt := range opts {
- opt.setValue(v)
- }
-
- // "If no value is provided, clients MUST use 5 as the default."
- // https://datatracker.ietf.org/doc/html/rfc8628#section-3.2
- interval := da.Interval
- if interval == 0 {
- interval = 5
- }
-
- ticker := time.NewTicker(time.Duration(interval) * time.Second)
- defer ticker.Stop()
- for {
- select {
- case <-ctx.Done():
- return nil, ctx.Err()
- case <-ticker.C:
- tok, err := retrieveToken(ctx, c, v)
- if err == nil {
- return tok, nil
- }
-
- e, ok := err.(*RetrieveError)
- if !ok {
- return nil, err
- }
- switch e.ErrorCode {
- case errSlowDown:
- // https://datatracker.ietf.org/doc/html/rfc8628#section-3.5
- // "the interval MUST be increased by 5 seconds for this and all subsequent requests"
- interval += 5
- ticker.Reset(time.Duration(interval) * time.Second)
- case errAuthorizationPending:
- // Do nothing.
- case errAccessDenied, errExpiredToken:
- fallthrough
- default:
- return tok, err
- }
- }
- }
-}
diff --git a/vendor/golang.org/x/oauth2/internal/client_appengine.go b/vendor/golang.org/x/oauth2/internal/client_appengine.go
deleted file mode 100644
index d28140f78..000000000
--- a/vendor/golang.org/x/oauth2/internal/client_appengine.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build appengine
-
-package internal
-
-import "google.golang.org/appengine/urlfetch"
-
-func init() {
- appengineClientHook = urlfetch.Client
-}
diff --git a/vendor/golang.org/x/oauth2/internal/doc.go b/vendor/golang.org/x/oauth2/internal/doc.go
deleted file mode 100644
index 03265e888..000000000
--- a/vendor/golang.org/x/oauth2/internal/doc.go
+++ /dev/null
@@ -1,6 +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 internal contains support packages for oauth2 package.
-package internal
diff --git a/vendor/golang.org/x/oauth2/internal/oauth2.go b/vendor/golang.org/x/oauth2/internal/oauth2.go
deleted file mode 100644
index 14989beaf..000000000
--- a/vendor/golang.org/x/oauth2/internal/oauth2.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "crypto/rsa"
- "crypto/x509"
- "encoding/pem"
- "errors"
- "fmt"
-)
-
-// ParseKey converts the binary contents of a private key file
-// to an *rsa.PrivateKey. It detects whether the private key is in a
-// PEM container or not. If so, it extracts the private key
-// from PEM container before conversion. It only supports PEM
-// containers with no passphrase.
-func ParseKey(key []byte) (*rsa.PrivateKey, error) {
- block, _ := pem.Decode(key)
- if block != nil {
- key = block.Bytes
- }
- parsedKey, err := x509.ParsePKCS8PrivateKey(key)
- if err != nil {
- parsedKey, err = x509.ParsePKCS1PrivateKey(key)
- if err != nil {
- return nil, fmt.Errorf("private key should be a PEM or plain PKCS1 or PKCS8; parse error: %v", err)
- }
- }
- parsed, ok := parsedKey.(*rsa.PrivateKey)
- if !ok {
- return nil, errors.New("private key is invalid")
- }
- return parsed, nil
-}
diff --git a/vendor/golang.org/x/oauth2/internal/token.go b/vendor/golang.org/x/oauth2/internal/token.go
deleted file mode 100644
index e83ddeef0..000000000
--- a/vendor/golang.org/x/oauth2/internal/token.go
+++ /dev/null
@@ -1,352 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "math"
- "mime"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "time"
-)
-
-// Token represents the credentials used to authorize
-// the requests to access protected resources on the OAuth 2.0
-// provider's backend.
-//
-// This type is a mirror of oauth2.Token and exists to break
-// an otherwise-circular dependency. Other internal packages
-// should convert this Token into an oauth2.Token before use.
-type Token struct {
- // AccessToken is the token that authorizes and authenticates
- // the requests.
- AccessToken string
-
- // TokenType is the type of token.
- // The Type method returns either this or "Bearer", the default.
- TokenType string
-
- // RefreshToken is a token that's used by the application
- // (as opposed to the user) to refresh the access token
- // if it expires.
- RefreshToken string
-
- // Expiry is the optional expiration time of the access token.
- //
- // If zero, TokenSource implementations will reuse the same
- // token forever and RefreshToken or equivalent
- // mechanisms for that TokenSource will not be used.
- Expiry time.Time
-
- // Raw optionally contains extra metadata from the server
- // when updating a token.
- Raw interface{}
-}
-
-// tokenJSON is the struct representing the HTTP response from OAuth2
-// providers returning a token or error in JSON form.
-// https://datatracker.ietf.org/doc/html/rfc6749#section-5.1
-type tokenJSON struct {
- AccessToken string `json:"access_token"`
- TokenType string `json:"token_type"`
- RefreshToken string `json:"refresh_token"`
- ExpiresIn expirationTime `json:"expires_in"` // at least PayPal returns string, while most return number
- // error fields
- // https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
- ErrorCode string `json:"error"`
- ErrorDescription string `json:"error_description"`
- ErrorURI string `json:"error_uri"`
-}
-
-func (e *tokenJSON) expiry() (t time.Time) {
- if v := e.ExpiresIn; v != 0 {
- return time.Now().Add(time.Duration(v) * time.Second)
- }
- return
-}
-
-type expirationTime int32
-
-func (e *expirationTime) UnmarshalJSON(b []byte) error {
- if len(b) == 0 || string(b) == "null" {
- return nil
- }
- var n json.Number
- err := json.Unmarshal(b, &n)
- if err != nil {
- return err
- }
- i, err := n.Int64()
- if err != nil {
- return err
- }
- if i > math.MaxInt32 {
- i = math.MaxInt32
- }
- *e = expirationTime(i)
- return nil
-}
-
-// RegisterBrokenAuthHeaderProvider previously did something. It is now a no-op.
-//
-// Deprecated: this function no longer does anything. Caller code that
-// wants to avoid potential extra HTTP requests made during
-// auto-probing of the provider's auth style should set
-// Endpoint.AuthStyle.
-func RegisterBrokenAuthHeaderProvider(tokenURL string) {}
-
-// AuthStyle is a copy of the golang.org/x/oauth2 package's AuthStyle type.
-type AuthStyle int
-
-const (
- AuthStyleUnknown AuthStyle = 0
- AuthStyleInParams AuthStyle = 1
- AuthStyleInHeader AuthStyle = 2
-)
-
-// LazyAuthStyleCache is a backwards compatibility compromise to let Configs
-// have a lazily-initialized AuthStyleCache.
-//
-// The two users of this, oauth2.Config and oauth2/clientcredentials.Config,
-// both would ideally just embed an unexported AuthStyleCache but because both
-// were historically allowed to be copied by value we can't retroactively add an
-// uncopyable Mutex to them.
-//
-// We could use an atomic.Pointer, but that was added recently enough (in Go
-// 1.18) that we'd break Go 1.17 users where the tests as of 2023-08-03
-// still pass. By using an atomic.Value, it supports both Go 1.17 and
-// copying by value, even if that's not ideal.
-type LazyAuthStyleCache struct {
- v atomic.Value // of *AuthStyleCache
-}
-
-func (lc *LazyAuthStyleCache) Get() *AuthStyleCache {
- if c, ok := lc.v.Load().(*AuthStyleCache); ok {
- return c
- }
- c := new(AuthStyleCache)
- if !lc.v.CompareAndSwap(nil, c) {
- c = lc.v.Load().(*AuthStyleCache)
- }
- return c
-}
-
-// AuthStyleCache is the set of tokenURLs we've successfully used via
-// RetrieveToken and which style auth we ended up using.
-// It's called a cache, but it doesn't (yet?) shrink. It's expected that
-// the set of OAuth2 servers a program contacts over time is fixed and
-// small.
-type AuthStyleCache struct {
- mu sync.Mutex
- m map[string]AuthStyle // keyed by tokenURL
-}
-
-// lookupAuthStyle reports which auth style we last used with tokenURL
-// when calling RetrieveToken and whether we have ever done so.
-func (c *AuthStyleCache) lookupAuthStyle(tokenURL string) (style AuthStyle, ok bool) {
- c.mu.Lock()
- defer c.mu.Unlock()
- style, ok = c.m[tokenURL]
- return
-}
-
-// setAuthStyle adds an entry to authStyleCache, documented above.
-func (c *AuthStyleCache) setAuthStyle(tokenURL string, v AuthStyle) {
- c.mu.Lock()
- defer c.mu.Unlock()
- if c.m == nil {
- c.m = make(map[string]AuthStyle)
- }
- c.m[tokenURL] = v
-}
-
-// newTokenRequest returns a new *http.Request to retrieve a new token
-// from tokenURL using the provided clientID, clientSecret, and POST
-// body parameters.
-//
-// inParams is whether the clientID & clientSecret should be encoded
-// as the POST body. An 'inParams' value of true means to send it in
-// the POST body (along with any values in v); false means to send it
-// in the Authorization header.
-func newTokenRequest(tokenURL, clientID, clientSecret string, v url.Values, authStyle AuthStyle) (*http.Request, error) {
- if authStyle == AuthStyleInParams {
- v = cloneURLValues(v)
- if clientID != "" {
- v.Set("client_id", clientID)
- }
- if clientSecret != "" {
- v.Set("client_secret", clientSecret)
- }
- }
- req, err := http.NewRequest("POST", tokenURL, strings.NewReader(v.Encode()))
- if err != nil {
- return nil, err
- }
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- if authStyle == AuthStyleInHeader {
- req.SetBasicAuth(url.QueryEscape(clientID), url.QueryEscape(clientSecret))
- }
- return req, nil
-}
-
-func cloneURLValues(v url.Values) url.Values {
- v2 := make(url.Values, len(v))
- for k, vv := range v {
- v2[k] = append([]string(nil), vv...)
- }
- return v2
-}
-
-func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string, v url.Values, authStyle AuthStyle, styleCache *AuthStyleCache) (*Token, error) {
- needsAuthStyleProbe := authStyle == 0
- if needsAuthStyleProbe {
- if style, ok := styleCache.lookupAuthStyle(tokenURL); ok {
- authStyle = style
- needsAuthStyleProbe = false
- } else {
- authStyle = AuthStyleInHeader // the first way we'll try
- }
- }
- req, err := newTokenRequest(tokenURL, clientID, clientSecret, v, authStyle)
- if err != nil {
- return nil, err
- }
- token, err := doTokenRoundTrip(ctx, req)
- if err != nil && needsAuthStyleProbe {
- // If we get an error, assume the server wants the
- // clientID & clientSecret in a different form.
- // See https://code.google.com/p/goauth2/issues/detail?id=31 for background.
- // In summary:
- // - Reddit only accepts client secret in the Authorization header
- // - Dropbox accepts either it in URL param or Auth header, but not both.
- // - Google only accepts URL param (not spec compliant?), not Auth header
- // - Stripe only accepts client secret in Auth header with Bearer method, not Basic
- //
- // We used to maintain a big table in this code of all the sites and which way
- // they went, but maintaining it didn't scale & got annoying.
- // So just try both ways.
- authStyle = AuthStyleInParams // the second way we'll try
- req, _ = newTokenRequest(tokenURL, clientID, clientSecret, v, authStyle)
- token, err = doTokenRoundTrip(ctx, req)
- }
- if needsAuthStyleProbe && err == nil {
- styleCache.setAuthStyle(tokenURL, authStyle)
- }
- // Don't overwrite `RefreshToken` with an empty value
- // if this was a token refreshing request.
- if token != nil && token.RefreshToken == "" {
- token.RefreshToken = v.Get("refresh_token")
- }
- return token, err
-}
-
-func doTokenRoundTrip(ctx context.Context, req *http.Request) (*Token, error) {
- r, err := ContextClient(ctx).Do(req.WithContext(ctx))
- if err != nil {
- return nil, err
- }
- body, err := ioutil.ReadAll(io.LimitReader(r.Body, 1<<20))
- r.Body.Close()
- if err != nil {
- return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
- }
-
- failureStatus := r.StatusCode < 200 || r.StatusCode > 299
- retrieveError := &RetrieveError{
- Response: r,
- Body: body,
- // attempt to populate error detail below
- }
-
- var token *Token
- content, _, _ := mime.ParseMediaType(r.Header.Get("Content-Type"))
- switch content {
- case "application/x-www-form-urlencoded", "text/plain":
- // some endpoints return a query string
- vals, err := url.ParseQuery(string(body))
- if err != nil {
- if failureStatus {
- return nil, retrieveError
- }
- return nil, fmt.Errorf("oauth2: cannot parse response: %v", err)
- }
- retrieveError.ErrorCode = vals.Get("error")
- retrieveError.ErrorDescription = vals.Get("error_description")
- retrieveError.ErrorURI = vals.Get("error_uri")
- token = &Token{
- AccessToken: vals.Get("access_token"),
- TokenType: vals.Get("token_type"),
- RefreshToken: vals.Get("refresh_token"),
- Raw: vals,
- }
- e := vals.Get("expires_in")
- expires, _ := strconv.Atoi(e)
- if expires != 0 {
- token.Expiry = time.Now().Add(time.Duration(expires) * time.Second)
- }
- default:
- var tj tokenJSON
- if err = json.Unmarshal(body, &tj); err != nil {
- if failureStatus {
- return nil, retrieveError
- }
- return nil, fmt.Errorf("oauth2: cannot parse json: %v", err)
- }
- retrieveError.ErrorCode = tj.ErrorCode
- retrieveError.ErrorDescription = tj.ErrorDescription
- retrieveError.ErrorURI = tj.ErrorURI
- token = &Token{
- AccessToken: tj.AccessToken,
- TokenType: tj.TokenType,
- RefreshToken: tj.RefreshToken,
- Expiry: tj.expiry(),
- Raw: make(map[string]interface{}),
- }
- json.Unmarshal(body, &token.Raw) // no error checks for optional fields
- }
- // according to spec, servers should respond status 400 in error case
- // https://www.rfc-editor.org/rfc/rfc6749#section-5.2
- // but some unorthodox servers respond 200 in error case
- if failureStatus || retrieveError.ErrorCode != "" {
- return nil, retrieveError
- }
- if token.AccessToken == "" {
- return nil, errors.New("oauth2: server response missing access_token")
- }
- return token, nil
-}
-
-// mirrors oauth2.RetrieveError
-type RetrieveError struct {
- Response *http.Response
- Body []byte
- ErrorCode string
- ErrorDescription string
- ErrorURI string
-}
-
-func (r *RetrieveError) Error() string {
- if r.ErrorCode != "" {
- s := fmt.Sprintf("oauth2: %q", r.ErrorCode)
- if r.ErrorDescription != "" {
- s += fmt.Sprintf(" %q", r.ErrorDescription)
- }
- if r.ErrorURI != "" {
- s += fmt.Sprintf(" %q", r.ErrorURI)
- }
- return s
- }
- return fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", r.Response.Status, r.Body)
-}
diff --git a/vendor/golang.org/x/oauth2/internal/transport.go b/vendor/golang.org/x/oauth2/internal/transport.go
deleted file mode 100644
index 572074a63..000000000
--- a/vendor/golang.org/x/oauth2/internal/transport.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package internal
-
-import (
- "context"
- "net/http"
-)
-
-// HTTPClient is the context key to use with golang.org/x/net/context's
-// WithValue function to associate an *http.Client value with a context.
-var HTTPClient ContextKey
-
-// ContextKey is just an empty struct. It exists so HTTPClient can be
-// an immutable public variable with a unique type. It's immutable
-// because nobody else can create a ContextKey, being unexported.
-type ContextKey struct{}
-
-var appengineClientHook func(context.Context) *http.Client
-
-func ContextClient(ctx context.Context) *http.Client {
- if ctx != nil {
- if hc, ok := ctx.Value(HTTPClient).(*http.Client); ok {
- return hc
- }
- }
- if appengineClientHook != nil {
- return appengineClientHook(ctx)
- }
- return http.DefaultClient
-}
diff --git a/vendor/golang.org/x/oauth2/oauth2.go b/vendor/golang.org/x/oauth2/oauth2.go
deleted file mode 100644
index 90a2c3d6d..000000000
--- a/vendor/golang.org/x/oauth2/oauth2.go
+++ /dev/null
@@ -1,421 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package oauth2 provides support for making
-// OAuth2 authorized and authenticated HTTP requests,
-// as specified in RFC 6749.
-// It can additionally grant authorization with Bearer JWT.
-package oauth2 // import "golang.org/x/oauth2"
-
-import (
- "bytes"
- "context"
- "errors"
- "net/http"
- "net/url"
- "strings"
- "sync"
- "time"
-
- "golang.org/x/oauth2/internal"
-)
-
-// NoContext is the default context you should supply if not using
-// your own context.Context (see https://golang.org/x/net/context).
-//
-// Deprecated: Use context.Background() or context.TODO() instead.
-var NoContext = context.TODO()
-
-// RegisterBrokenAuthHeaderProvider previously did something. It is now a no-op.
-//
-// Deprecated: this function no longer does anything. Caller code that
-// wants to avoid potential extra HTTP requests made during
-// auto-probing of the provider's auth style should set
-// Endpoint.AuthStyle.
-func RegisterBrokenAuthHeaderProvider(tokenURL string) {}
-
-// Config describes a typical 3-legged OAuth2 flow, with both the
-// client application information and the server's endpoint URLs.
-// For the client credentials 2-legged OAuth2 flow, see the clientcredentials
-// package (https://golang.org/x/oauth2/clientcredentials).
-type Config struct {
- // ClientID is the application's ID.
- ClientID string
-
- // ClientSecret is the application's secret.
- ClientSecret string
-
- // Endpoint contains the resource server's token endpoint
- // URLs. These are constants specific to each server and are
- // often available via site-specific packages, such as
- // google.Endpoint or github.Endpoint.
- Endpoint Endpoint
-
- // RedirectURL is the URL to redirect users going through
- // the OAuth flow, after the resource owner's URLs.
- RedirectURL string
-
- // Scope specifies optional requested permissions.
- Scopes []string
-
- // authStyleCache caches which auth style to use when Endpoint.AuthStyle is
- // the zero value (AuthStyleAutoDetect).
- authStyleCache internal.LazyAuthStyleCache
-}
-
-// A TokenSource is anything that can return a token.
-type TokenSource interface {
- // Token returns a token or an error.
- // Token must be safe for concurrent use by multiple goroutines.
- // The returned Token must not be modified.
- Token() (*Token, error)
-}
-
-// Endpoint represents an OAuth 2.0 provider's authorization and token
-// endpoint URLs.
-type Endpoint struct {
- AuthURL string
- DeviceAuthURL string
- TokenURL string
-
- // AuthStyle optionally specifies how the endpoint wants the
- // client ID & client secret sent. The zero value means to
- // auto-detect.
- AuthStyle AuthStyle
-}
-
-// AuthStyle represents how requests for tokens are authenticated
-// to the server.
-type AuthStyle int
-
-const (
- // AuthStyleAutoDetect means to auto-detect which authentication
- // style the provider wants by trying both ways and caching
- // the successful way for the future.
- AuthStyleAutoDetect AuthStyle = 0
-
- // AuthStyleInParams sends the "client_id" and "client_secret"
- // in the POST body as application/x-www-form-urlencoded parameters.
- AuthStyleInParams AuthStyle = 1
-
- // AuthStyleInHeader sends the client_id and client_password
- // using HTTP Basic Authorization. This is an optional style
- // described in the OAuth2 RFC 6749 section 2.3.1.
- AuthStyleInHeader AuthStyle = 2
-)
-
-var (
- // AccessTypeOnline and AccessTypeOffline are options passed
- // to the Options.AuthCodeURL method. They modify the
- // "access_type" field that gets sent in the URL returned by
- // AuthCodeURL.
- //
- // Online is the default if neither is specified. If your
- // application needs to refresh access tokens when the user
- // is not present at the browser, then use offline. This will
- // result in your application obtaining a refresh token the
- // first time your application exchanges an authorization
- // code for a user.
- AccessTypeOnline AuthCodeOption = SetAuthURLParam("access_type", "online")
- AccessTypeOffline AuthCodeOption = SetAuthURLParam("access_type", "offline")
-
- // ApprovalForce forces the users to view the consent dialog
- // and confirm the permissions request at the URL returned
- // from AuthCodeURL, even if they've already done so.
- ApprovalForce AuthCodeOption = SetAuthURLParam("prompt", "consent")
-)
-
-// An AuthCodeOption is passed to Config.AuthCodeURL.
-type AuthCodeOption interface {
- setValue(url.Values)
-}
-
-type setParam struct{ k, v string }
-
-func (p setParam) setValue(m url.Values) { m.Set(p.k, p.v) }
-
-// SetAuthURLParam builds an AuthCodeOption which passes key/value parameters
-// to a provider's authorization endpoint.
-func SetAuthURLParam(key, value string) AuthCodeOption {
- return setParam{key, value}
-}
-
-// AuthCodeURL returns a URL to OAuth 2.0 provider's consent page
-// that asks for permissions for the required scopes explicitly.
-//
-// State is an opaque value used by the client to maintain state between the
-// request and callback. The authorization server includes this value when
-// redirecting the user agent back to the client.
-//
-// Opts may include AccessTypeOnline or AccessTypeOffline, as well
-// as ApprovalForce.
-//
-// To protect against CSRF attacks, opts should include a PKCE challenge
-// (S256ChallengeOption). Not all servers support PKCE. An alternative is to
-// generate a random state parameter and verify it after exchange.
-// See https://datatracker.ietf.org/doc/html/rfc6749#section-10.12 (predating
-// PKCE), https://www.oauth.com/oauth2-servers/pkce/ and
-// https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-09.html#name-cross-site-request-forgery (describing both approaches)
-func (c *Config) AuthCodeURL(state string, opts ...AuthCodeOption) string {
- var buf bytes.Buffer
- buf.WriteString(c.Endpoint.AuthURL)
- v := url.Values{
- "response_type": {"code"},
- "client_id": {c.ClientID},
- }
- if c.RedirectURL != "" {
- v.Set("redirect_uri", c.RedirectURL)
- }
- if len(c.Scopes) > 0 {
- v.Set("scope", strings.Join(c.Scopes, " "))
- }
- if state != "" {
- v.Set("state", state)
- }
- for _, opt := range opts {
- opt.setValue(v)
- }
- if strings.Contains(c.Endpoint.AuthURL, "?") {
- buf.WriteByte('&')
- } else {
- buf.WriteByte('?')
- }
- buf.WriteString(v.Encode())
- return buf.String()
-}
-
-// PasswordCredentialsToken converts a resource owner username and password
-// pair into a token.
-//
-// Per the RFC, this grant type should only be used "when there is a high
-// degree of trust between the resource owner and the client (e.g., the client
-// is part of the device operating system or a highly privileged application),
-// and when other authorization grant types are not available."
-// See https://tools.ietf.org/html/rfc6749#section-4.3 for more info.
-//
-// The provided context optionally controls which HTTP client is used. See the HTTPClient variable.
-func (c *Config) PasswordCredentialsToken(ctx context.Context, username, password string) (*Token, error) {
- v := url.Values{
- "grant_type": {"password"},
- "username": {username},
- "password": {password},
- }
- if len(c.Scopes) > 0 {
- v.Set("scope", strings.Join(c.Scopes, " "))
- }
- return retrieveToken(ctx, c, v)
-}
-
-// Exchange converts an authorization code into a token.
-//
-// It is used after a resource provider redirects the user back
-// to the Redirect URI (the URL obtained from AuthCodeURL).
-//
-// The provided context optionally controls which HTTP client is used. See the HTTPClient variable.
-//
-// The code will be in the *http.Request.FormValue("code"). Before
-// calling Exchange, be sure to validate FormValue("state") if you are
-// using it to protect against CSRF attacks.
-//
-// If using PKCE to protect against CSRF attacks, opts should include a
-// VerifierOption.
-func (c *Config) Exchange(ctx context.Context, code string, opts ...AuthCodeOption) (*Token, error) {
- v := url.Values{
- "grant_type": {"authorization_code"},
- "code": {code},
- }
- if c.RedirectURL != "" {
- v.Set("redirect_uri", c.RedirectURL)
- }
- for _, opt := range opts {
- opt.setValue(v)
- }
- return retrieveToken(ctx, c, v)
-}
-
-// Client returns an HTTP client using the provided token.
-// The token will auto-refresh as necessary. The underlying
-// HTTP transport will be obtained using the provided context.
-// The returned client and its Transport should not be modified.
-func (c *Config) Client(ctx context.Context, t *Token) *http.Client {
- return NewClient(ctx, c.TokenSource(ctx, t))
-}
-
-// TokenSource returns a TokenSource that returns t until t expires,
-// automatically refreshing it as necessary using the provided context.
-//
-// Most users will use Config.Client instead.
-func (c *Config) TokenSource(ctx context.Context, t *Token) TokenSource {
- tkr := &tokenRefresher{
- ctx: ctx,
- conf: c,
- }
- if t != nil {
- tkr.refreshToken = t.RefreshToken
- }
- return &reuseTokenSource{
- t: t,
- new: tkr,
- }
-}
-
-// tokenRefresher is a TokenSource that makes "grant_type"=="refresh_token"
-// HTTP requests to renew a token using a RefreshToken.
-type tokenRefresher struct {
- ctx context.Context // used to get HTTP requests
- conf *Config
- refreshToken string
-}
-
-// WARNING: Token is not safe for concurrent access, as it
-// updates the tokenRefresher's refreshToken field.
-// Within this package, it is used by reuseTokenSource which
-// synchronizes calls to this method with its own mutex.
-func (tf *tokenRefresher) Token() (*Token, error) {
- if tf.refreshToken == "" {
- return nil, errors.New("oauth2: token expired and refresh token is not set")
- }
-
- tk, err := retrieveToken(tf.ctx, tf.conf, url.Values{
- "grant_type": {"refresh_token"},
- "refresh_token": {tf.refreshToken},
- })
-
- if err != nil {
- return nil, err
- }
- if tf.refreshToken != tk.RefreshToken {
- tf.refreshToken = tk.RefreshToken
- }
- return tk, err
-}
-
-// reuseTokenSource is a TokenSource that holds a single token in memory
-// and validates its expiry before each call to retrieve it with
-// Token. If it's expired, it will be auto-refreshed using the
-// new TokenSource.
-type reuseTokenSource struct {
- new TokenSource // called when t is expired.
-
- mu sync.Mutex // guards t
- t *Token
-
- expiryDelta time.Duration
-}
-
-// Token returns the current token if it's still valid, else will
-// refresh the current token (using r.Context for HTTP client
-// information) and return the new one.
-func (s *reuseTokenSource) Token() (*Token, error) {
- s.mu.Lock()
- defer s.mu.Unlock()
- if s.t.Valid() {
- return s.t, nil
- }
- t, err := s.new.Token()
- if err != nil {
- return nil, err
- }
- t.expiryDelta = s.expiryDelta
- s.t = t
- return t, nil
-}
-
-// StaticTokenSource returns a TokenSource that always returns the same token.
-// Because the provided token t is never refreshed, StaticTokenSource is only
-// useful for tokens that never expire.
-func StaticTokenSource(t *Token) TokenSource {
- return staticTokenSource{t}
-}
-
-// staticTokenSource is a TokenSource that always returns the same Token.
-type staticTokenSource struct {
- t *Token
-}
-
-func (s staticTokenSource) Token() (*Token, error) {
- return s.t, nil
-}
-
-// HTTPClient is the context key to use with golang.org/x/net/context's
-// WithValue function to associate an *http.Client value with a context.
-var HTTPClient internal.ContextKey
-
-// NewClient creates an *http.Client from a Context and TokenSource.
-// The returned client is not valid beyond the lifetime of the context.
-//
-// Note that if a custom *http.Client is provided via the Context it
-// is used only for token acquisition and is not used to configure the
-// *http.Client returned from NewClient.
-//
-// As a special case, if src is nil, a non-OAuth2 client is returned
-// using the provided context. This exists to support related OAuth2
-// packages.
-func NewClient(ctx context.Context, src TokenSource) *http.Client {
- if src == nil {
- return internal.ContextClient(ctx)
- }
- return &http.Client{
- Transport: &Transport{
- Base: internal.ContextClient(ctx).Transport,
- Source: ReuseTokenSource(nil, src),
- },
- }
-}
-
-// ReuseTokenSource returns a TokenSource which repeatedly returns the
-// same token as long as it's valid, starting with t.
-// When its cached token is invalid, a new token is obtained from src.
-//
-// ReuseTokenSource is typically used to reuse tokens from a cache
-// (such as a file on disk) between runs of a program, rather than
-// obtaining new tokens unnecessarily.
-//
-// The initial token t may be nil, in which case the TokenSource is
-// wrapped in a caching version if it isn't one already. This also
-// means it's always safe to wrap ReuseTokenSource around any other
-// TokenSource without adverse effects.
-func ReuseTokenSource(t *Token, src TokenSource) TokenSource {
- // Don't wrap a reuseTokenSource in itself. That would work,
- // but cause an unnecessary number of mutex operations.
- // Just build the equivalent one.
- if rt, ok := src.(*reuseTokenSource); ok {
- if t == nil {
- // Just use it directly.
- return rt
- }
- src = rt.new
- }
- return &reuseTokenSource{
- t: t,
- new: src,
- }
-}
-
-// ReuseTokenSource returns a TokenSource that acts in the same manner as the
-// TokenSource returned by ReuseTokenSource, except the expiry buffer is
-// configurable. The expiration time of a token is calculated as
-// t.Expiry.Add(-earlyExpiry).
-func ReuseTokenSourceWithExpiry(t *Token, src TokenSource, earlyExpiry time.Duration) TokenSource {
- // Don't wrap a reuseTokenSource in itself. That would work,
- // but cause an unnecessary number of mutex operations.
- // Just build the equivalent one.
- if rt, ok := src.(*reuseTokenSource); ok {
- if t == nil {
- // Just use it directly, but set the expiryDelta to earlyExpiry,
- // so the behavior matches what the user expects.
- rt.expiryDelta = earlyExpiry
- return rt
- }
- src = rt.new
- }
- if t != nil {
- t.expiryDelta = earlyExpiry
- }
- return &reuseTokenSource{
- t: t,
- new: src,
- expiryDelta: earlyExpiry,
- }
-}
diff --git a/vendor/golang.org/x/oauth2/pkce.go b/vendor/golang.org/x/oauth2/pkce.go
deleted file mode 100644
index 50593b6df..000000000
--- a/vendor/golang.org/x/oauth2/pkce.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2023 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 oauth2
-
-import (
- "crypto/rand"
- "crypto/sha256"
- "encoding/base64"
- "net/url"
-)
-
-const (
- codeChallengeKey = "code_challenge"
- codeChallengeMethodKey = "code_challenge_method"
- codeVerifierKey = "code_verifier"
-)
-
-// GenerateVerifier generates a PKCE code verifier with 32 octets of randomness.
-// This follows recommendations in RFC 7636.
-//
-// A fresh verifier should be generated for each authorization.
-// S256ChallengeOption(verifier) should then be passed to Config.AuthCodeURL
-// (or Config.DeviceAccess) and VerifierOption(verifier) to Config.Exchange
-// (or Config.DeviceAccessToken).
-func GenerateVerifier() string {
- // "RECOMMENDED that the output of a suitable random number generator be
- // used to create a 32-octet sequence. The octet sequence is then
- // base64url-encoded to produce a 43-octet URL-safe string to use as the
- // code verifier."
- // https://datatracker.ietf.org/doc/html/rfc7636#section-4.1
- data := make([]byte, 32)
- if _, err := rand.Read(data); err != nil {
- panic(err)
- }
- return base64.RawURLEncoding.EncodeToString(data)
-}
-
-// VerifierOption returns a PKCE code verifier AuthCodeOption. It should be
-// passed to Config.Exchange or Config.DeviceAccessToken only.
-func VerifierOption(verifier string) AuthCodeOption {
- return setParam{k: codeVerifierKey, v: verifier}
-}
-
-// S256ChallengeFromVerifier returns a PKCE code challenge derived from verifier with method S256.
-//
-// Prefer to use S256ChallengeOption where possible.
-func S256ChallengeFromVerifier(verifier string) string {
- sha := sha256.Sum256([]byte(verifier))
- return base64.RawURLEncoding.EncodeToString(sha[:])
-}
-
-// S256ChallengeOption derives a PKCE code challenge derived from verifier with
-// method S256. It should be passed to Config.AuthCodeURL or Config.DeviceAccess
-// only.
-func S256ChallengeOption(verifier string) AuthCodeOption {
- return challengeOption{
- challenge_method: "S256",
- challenge: S256ChallengeFromVerifier(verifier),
- }
-}
-
-type challengeOption struct{ challenge_method, challenge string }
-
-func (p challengeOption) setValue(m url.Values) {
- m.Set(codeChallengeMethodKey, p.challenge_method)
- m.Set(codeChallengeKey, p.challenge)
-}
diff --git a/vendor/golang.org/x/oauth2/token.go b/vendor/golang.org/x/oauth2/token.go
deleted file mode 100644
index 5bbb33217..000000000
--- a/vendor/golang.org/x/oauth2/token.go
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package oauth2
-
-import (
- "context"
- "fmt"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "golang.org/x/oauth2/internal"
-)
-
-// defaultExpiryDelta determines how earlier a token should be considered
-// expired than its actual expiration time. It is used to avoid late
-// expirations due to client-server time mismatches.
-const defaultExpiryDelta = 10 * time.Second
-
-// Token represents the credentials used to authorize
-// the requests to access protected resources on the OAuth 2.0
-// provider's backend.
-//
-// Most users of this package should not access fields of Token
-// directly. They're exported mostly for use by related packages
-// implementing derivative OAuth2 flows.
-type Token struct {
- // AccessToken is the token that authorizes and authenticates
- // the requests.
- AccessToken string `json:"access_token"`
-
- // TokenType is the type of token.
- // The Type method returns either this or "Bearer", the default.
- TokenType string `json:"token_type,omitempty"`
-
- // RefreshToken is a token that's used by the application
- // (as opposed to the user) to refresh the access token
- // if it expires.
- RefreshToken string `json:"refresh_token,omitempty"`
-
- // Expiry is the optional expiration time of the access token.
- //
- // If zero, TokenSource implementations will reuse the same
- // token forever and RefreshToken or equivalent
- // mechanisms for that TokenSource will not be used.
- Expiry time.Time `json:"expiry,omitempty"`
-
- // raw optionally contains extra metadata from the server
- // when updating a token.
- raw interface{}
-
- // expiryDelta is used to calculate when a token is considered
- // expired, by subtracting from Expiry. If zero, defaultExpiryDelta
- // is used.
- expiryDelta time.Duration
-}
-
-// Type returns t.TokenType if non-empty, else "Bearer".
-func (t *Token) Type() string {
- if strings.EqualFold(t.TokenType, "bearer") {
- return "Bearer"
- }
- if strings.EqualFold(t.TokenType, "mac") {
- return "MAC"
- }
- if strings.EqualFold(t.TokenType, "basic") {
- return "Basic"
- }
- if t.TokenType != "" {
- return t.TokenType
- }
- return "Bearer"
-}
-
-// SetAuthHeader sets the Authorization header to r using the access
-// token in t.
-//
-// This method is unnecessary when using Transport or an HTTP Client
-// returned by this package.
-func (t *Token) SetAuthHeader(r *http.Request) {
- r.Header.Set("Authorization", t.Type()+" "+t.AccessToken)
-}
-
-// WithExtra returns a new Token that's a clone of t, but using the
-// provided raw extra map. This is only intended for use by packages
-// implementing derivative OAuth2 flows.
-func (t *Token) WithExtra(extra interface{}) *Token {
- t2 := new(Token)
- *t2 = *t
- t2.raw = extra
- return t2
-}
-
-// Extra returns an extra field.
-// Extra fields are key-value pairs returned by the server as a
-// part of the token retrieval response.
-func (t *Token) Extra(key string) interface{} {
- if raw, ok := t.raw.(map[string]interface{}); ok {
- return raw[key]
- }
-
- vals, ok := t.raw.(url.Values)
- if !ok {
- return nil
- }
-
- v := vals.Get(key)
- switch s := strings.TrimSpace(v); strings.Count(s, ".") {
- case 0: // Contains no "."; try to parse as int
- if i, err := strconv.ParseInt(s, 10, 64); err == nil {
- return i
- }
- case 1: // Contains a single "."; try to parse as float
- if f, err := strconv.ParseFloat(s, 64); err == nil {
- return f
- }
- }
-
- return v
-}
-
-// timeNow is time.Now but pulled out as a variable for tests.
-var timeNow = time.Now
-
-// expired reports whether the token is expired.
-// t must be non-nil.
-func (t *Token) expired() bool {
- if t.Expiry.IsZero() {
- return false
- }
-
- expiryDelta := defaultExpiryDelta
- if t.expiryDelta != 0 {
- expiryDelta = t.expiryDelta
- }
- return t.Expiry.Round(0).Add(-expiryDelta).Before(timeNow())
-}
-
-// Valid reports whether t is non-nil, has an AccessToken, and is not expired.
-func (t *Token) Valid() bool {
- return t != nil && t.AccessToken != "" && !t.expired()
-}
-
-// tokenFromInternal maps an *internal.Token struct into
-// a *Token struct.
-func tokenFromInternal(t *internal.Token) *Token {
- if t == nil {
- return nil
- }
- return &Token{
- AccessToken: t.AccessToken,
- TokenType: t.TokenType,
- RefreshToken: t.RefreshToken,
- Expiry: t.Expiry,
- raw: t.Raw,
- }
-}
-
-// retrieveToken takes a *Config and uses that to retrieve an *internal.Token.
-// This token is then mapped from *internal.Token into an *oauth2.Token which is returned along
-// with an error..
-func retrieveToken(ctx context.Context, c *Config, v url.Values) (*Token, error) {
- tk, err := internal.RetrieveToken(ctx, c.ClientID, c.ClientSecret, c.Endpoint.TokenURL, v, internal.AuthStyle(c.Endpoint.AuthStyle), c.authStyleCache.Get())
- if err != nil {
- if rErr, ok := err.(*internal.RetrieveError); ok {
- return nil, (*RetrieveError)(rErr)
- }
- return nil, err
- }
- return tokenFromInternal(tk), nil
-}
-
-// RetrieveError is the error returned when the token endpoint returns a
-// non-2XX HTTP status code or populates RFC 6749's 'error' parameter.
-// https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
-type RetrieveError struct {
- Response *http.Response
- // Body is the body that was consumed by reading Response.Body.
- // It may be truncated.
- Body []byte
- // ErrorCode is RFC 6749's 'error' parameter.
- ErrorCode string
- // ErrorDescription is RFC 6749's 'error_description' parameter.
- ErrorDescription string
- // ErrorURI is RFC 6749's 'error_uri' parameter.
- ErrorURI string
-}
-
-func (r *RetrieveError) Error() string {
- if r.ErrorCode != "" {
- s := fmt.Sprintf("oauth2: %q", r.ErrorCode)
- if r.ErrorDescription != "" {
- s += fmt.Sprintf(" %q", r.ErrorDescription)
- }
- if r.ErrorURI != "" {
- s += fmt.Sprintf(" %q", r.ErrorURI)
- }
- return s
- }
- return fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", r.Response.Status, r.Body)
-}
diff --git a/vendor/golang.org/x/oauth2/transport.go b/vendor/golang.org/x/oauth2/transport.go
deleted file mode 100644
index 90657915f..000000000
--- a/vendor/golang.org/x/oauth2/transport.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package oauth2
-
-import (
- "errors"
- "log"
- "net/http"
- "sync"
-)
-
-// Transport is an http.RoundTripper that makes OAuth 2.0 HTTP requests,
-// wrapping a base RoundTripper and adding an Authorization header
-// with a token from the supplied Sources.
-//
-// Transport is a low-level mechanism. Most code will use the
-// higher-level Config.Client method instead.
-type Transport struct {
- // Source supplies the token to add to outgoing requests'
- // Authorization headers.
- Source TokenSource
-
- // Base is the base RoundTripper used to make HTTP requests.
- // If nil, http.DefaultTransport is used.
- Base http.RoundTripper
-}
-
-// RoundTrip authorizes and authenticates the request with an
-// access token from Transport's Source.
-func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
- reqBodyClosed := false
- if req.Body != nil {
- defer func() {
- if !reqBodyClosed {
- req.Body.Close()
- }
- }()
- }
-
- if t.Source == nil {
- return nil, errors.New("oauth2: Transport's Source is nil")
- }
- token, err := t.Source.Token()
- if err != nil {
- return nil, err
- }
-
- req2 := cloneRequest(req) // per RoundTripper contract
- token.SetAuthHeader(req2)
-
- // req.Body is assumed to be closed by the base RoundTripper.
- reqBodyClosed = true
- return t.base().RoundTrip(req2)
-}
-
-var cancelOnce sync.Once
-
-// CancelRequest does nothing. It used to be a legacy cancellation mechanism
-// but now only it only logs on first use to warn that it's deprecated.
-//
-// Deprecated: use contexts for cancellation instead.
-func (t *Transport) CancelRequest(req *http.Request) {
- cancelOnce.Do(func() {
- log.Printf("deprecated: golang.org/x/oauth2: Transport.CancelRequest no longer does anything; use contexts")
- })
-}
-
-func (t *Transport) base() http.RoundTripper {
- if t.Base != nil {
- return t.Base
- }
- return http.DefaultTransport
-}
-
-// cloneRequest returns a clone of the provided *http.Request.
-// The clone is a shallow copy of the struct and its Header map.
-func cloneRequest(r *http.Request) *http.Request {
- // shallow copy of the struct
- r2 := new(http.Request)
- *r2 = *r
- // deep copy of the Header
- r2.Header = make(http.Header, len(r.Header))
- for k, s := range r.Header {
- r2.Header[k] = append([]string(nil), s...)
- }
- return r2
-}
diff --git a/vendor/golang.org/x/sync/LICENSE b/vendor/golang.org/x/sync/LICENSE
deleted file mode 100644
index 2a7cf70da..000000000
--- a/vendor/golang.org/x/sync/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright 2009 The Go Authors.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google LLC nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/sync/PATENTS b/vendor/golang.org/x/sync/PATENTS
deleted file mode 100644
index 733099041..000000000
--- a/vendor/golang.org/x/sync/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/sync/errgroup/errgroup.go b/vendor/golang.org/x/sync/errgroup/errgroup.go
deleted file mode 100644
index 948a3ee63..000000000
--- a/vendor/golang.org/x/sync/errgroup/errgroup.go
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package errgroup provides synchronization, error propagation, and Context
-// cancelation for groups of goroutines working on subtasks of a common task.
-//
-// [errgroup.Group] is related to [sync.WaitGroup] but adds handling of tasks
-// returning errors.
-package errgroup
-
-import (
- "context"
- "fmt"
- "sync"
-)
-
-type token struct{}
-
-// A Group is a collection of goroutines working on subtasks that are part of
-// the same overall task.
-//
-// A zero Group is valid, has no limit on the number of active goroutines,
-// and does not cancel on error.
-type Group struct {
- cancel func(error)
-
- wg sync.WaitGroup
-
- sem chan token
-
- errOnce sync.Once
- err error
-}
-
-func (g *Group) done() {
- if g.sem != nil {
- <-g.sem
- }
- g.wg.Done()
-}
-
-// WithContext returns a new Group and an associated Context derived from ctx.
-//
-// The derived Context is canceled the first time a function passed to Go
-// returns a non-nil error or the first time Wait returns, whichever occurs
-// first.
-func WithContext(ctx context.Context) (*Group, context.Context) {
- ctx, cancel := withCancelCause(ctx)
- return &Group{cancel: cancel}, ctx
-}
-
-// Wait blocks until all function calls from the Go method have returned, then
-// returns the first non-nil error (if any) from them.
-func (g *Group) Wait() error {
- g.wg.Wait()
- if g.cancel != nil {
- g.cancel(g.err)
- }
- return g.err
-}
-
-// Go calls the given function in a new goroutine.
-// It blocks until the new goroutine can be added without the number of
-// active goroutines in the group exceeding the configured limit.
-//
-// The first call to return a non-nil error cancels the group's context, if the
-// group was created by calling WithContext. The error will be returned by Wait.
-func (g *Group) Go(f func() error) {
- if g.sem != nil {
- g.sem <- token{}
- }
-
- g.wg.Add(1)
- go func() {
- defer g.done()
-
- if err := f(); err != nil {
- g.errOnce.Do(func() {
- g.err = err
- if g.cancel != nil {
- g.cancel(g.err)
- }
- })
- }
- }()
-}
-
-// TryGo calls the given function in a new goroutine only if the number of
-// active goroutines in the group is currently below the configured limit.
-//
-// The return value reports whether the goroutine was started.
-func (g *Group) TryGo(f func() error) bool {
- if g.sem != nil {
- select {
- case g.sem <- token{}:
- // Note: this allows barging iff channels in general allow barging.
- default:
- return false
- }
- }
-
- g.wg.Add(1)
- go func() {
- defer g.done()
-
- if err := f(); err != nil {
- g.errOnce.Do(func() {
- g.err = err
- if g.cancel != nil {
- g.cancel(g.err)
- }
- })
- }
- }()
- return true
-}
-
-// SetLimit limits the number of active goroutines in this group to at most n.
-// A negative value indicates no limit.
-//
-// Any subsequent call to the Go method will block until it can add an active
-// goroutine without exceeding the configured limit.
-//
-// The limit must not be modified while any goroutines in the group are active.
-func (g *Group) SetLimit(n int) {
- if n < 0 {
- g.sem = nil
- return
- }
- if len(g.sem) != 0 {
- panic(fmt.Errorf("errgroup: modify limit while %v goroutines in the group are still active", len(g.sem)))
- }
- g.sem = make(chan token, n)
-}
diff --git a/vendor/golang.org/x/sync/errgroup/go120.go b/vendor/golang.org/x/sync/errgroup/go120.go
deleted file mode 100644
index f93c740b6..000000000
--- a/vendor/golang.org/x/sync/errgroup/go120.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2023 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.
-
-//go:build go1.20
-
-package errgroup
-
-import "context"
-
-func withCancelCause(parent context.Context) (context.Context, func(error)) {
- return context.WithCancelCause(parent)
-}
diff --git a/vendor/golang.org/x/sync/errgroup/pre_go120.go b/vendor/golang.org/x/sync/errgroup/pre_go120.go
deleted file mode 100644
index 88ce33434..000000000
--- a/vendor/golang.org/x/sync/errgroup/pre_go120.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2023 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.
-
-//go:build !go1.20
-
-package errgroup
-
-import "context"
-
-func withCancelCause(parent context.Context) (context.Context, func(error)) {
- ctx, cancel := context.WithCancel(parent)
- return ctx, func(error) { cancel() }
-}
diff --git a/vendor/golang.org/x/sys/LICENSE b/vendor/golang.org/x/sys/LICENSE
deleted file mode 100644
index 2a7cf70da..000000000
--- a/vendor/golang.org/x/sys/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright 2009 The Go Authors.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google LLC nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/sys/PATENTS b/vendor/golang.org/x/sys/PATENTS
deleted file mode 100644
index 733099041..000000000
--- a/vendor/golang.org/x/sys/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
deleted file mode 100644
index 269e173ca..000000000
--- a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build gc
-
-#include "textflag.h"
-
-//
-// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go
-//
-
-TEXT ·syscall6(SB),NOSPLIT,$0-88
- JMP syscall·syscall6(SB)
-
-TEXT ·rawSyscall6(SB),NOSPLIT,$0-88
- JMP syscall·rawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/cpu/asm_darwin_x86_gc.s b/vendor/golang.org/x/sys/cpu/asm_darwin_x86_gc.s
deleted file mode 100644
index ec2acfe54..000000000
--- a/vendor/golang.org/x/sys/cpu/asm_darwin_x86_gc.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2024 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.
-
-//go:build darwin && amd64 && gc
-
-#include "textflag.h"
-
-TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
- JMP libc_sysctl(SB)
-GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
-DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
-
-TEXT libc_sysctlbyname_trampoline<>(SB),NOSPLIT,$0-0
- JMP libc_sysctlbyname(SB)
-GLOBL ·libc_sysctlbyname_trampoline_addr(SB), RODATA, $8
-DATA ·libc_sysctlbyname_trampoline_addr(SB)/8, $libc_sysctlbyname_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/cpu/byteorder.go b/vendor/golang.org/x/sys/cpu/byteorder.go
deleted file mode 100644
index 271055be0..000000000
--- a/vendor/golang.org/x/sys/cpu/byteorder.go
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2019 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 cpu
-
-import (
- "runtime"
-)
-
-// byteOrder is a subset of encoding/binary.ByteOrder.
-type byteOrder interface {
- Uint32([]byte) uint32
- Uint64([]byte) uint64
-}
-
-type littleEndian struct{}
-type bigEndian struct{}
-
-func (littleEndian) Uint32(b []byte) uint32 {
- _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
- return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
-}
-
-func (littleEndian) Uint64(b []byte) uint64 {
- _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
- return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
- uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
-}
-
-func (bigEndian) Uint32(b []byte) uint32 {
- _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
- return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24
-}
-
-func (bigEndian) Uint64(b []byte) uint64 {
- _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
- return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
- uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
-}
-
-// hostByteOrder returns littleEndian on little-endian machines and
-// bigEndian on big-endian machines.
-func hostByteOrder() byteOrder {
- switch runtime.GOARCH {
- case "386", "amd64", "amd64p32",
- "alpha",
- "arm", "arm64",
- "loong64",
- "mipsle", "mips64le", "mips64p32le",
- "nios2",
- "ppc64le",
- "riscv", "riscv64",
- "sh":
- return littleEndian{}
- case "armbe", "arm64be",
- "m68k",
- "mips", "mips64", "mips64p32",
- "ppc", "ppc64",
- "s390", "s390x",
- "shbe",
- "sparc", "sparc64":
- return bigEndian{}
- }
- panic("unknown architecture")
-}
diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go
deleted file mode 100644
index 02609d5b2..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu.go
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package cpu implements processor feature detection for
-// various CPU architectures.
-package cpu
-
-import (
- "os"
- "strings"
-)
-
-// Initialized reports whether the CPU features were initialized.
-//
-// For some GOOS/GOARCH combinations initialization of the CPU features depends
-// on reading an operating specific file, e.g. /proc/self/auxv on linux/arm
-// Initialized will report false if reading the file fails.
-var Initialized bool
-
-// CacheLinePad is used to pad structs to avoid false sharing.
-type CacheLinePad struct{ _ [cacheLineSize]byte }
-
-// X86 contains the supported CPU features of the
-// current X86/AMD64 platform. If the current platform
-// is not X86/AMD64 then all feature flags are false.
-//
-// X86 is padded to avoid false sharing. Further the HasAVX
-// and HasAVX2 are only set if the OS supports XMM and YMM
-// registers in addition to the CPUID feature bit being set.
-var X86 struct {
- _ CacheLinePad
- HasAES bool // AES hardware implementation (AES NI)
- HasADX bool // Multi-precision add-carry instruction extensions
- HasAVX bool // Advanced vector extension
- HasAVX2 bool // Advanced vector extension 2
- HasAVX512 bool // Advanced vector extension 512
- HasAVX512F bool // Advanced vector extension 512 Foundation Instructions
- HasAVX512CD bool // Advanced vector extension 512 Conflict Detection Instructions
- HasAVX512ER bool // Advanced vector extension 512 Exponential and Reciprocal Instructions
- HasAVX512PF bool // Advanced vector extension 512 Prefetch Instructions
- HasAVX512VL bool // Advanced vector extension 512 Vector Length Extensions
- HasAVX512BW bool // Advanced vector extension 512 Byte and Word Instructions
- HasAVX512DQ bool // Advanced vector extension 512 Doubleword and Quadword Instructions
- HasAVX512IFMA bool // Advanced vector extension 512 Integer Fused Multiply Add
- HasAVX512VBMI bool // Advanced vector extension 512 Vector Byte Manipulation Instructions
- HasAVX5124VNNIW bool // Advanced vector extension 512 Vector Neural Network Instructions Word variable precision
- HasAVX5124FMAPS bool // Advanced vector extension 512 Fused Multiply Accumulation Packed Single precision
- HasAVX512VPOPCNTDQ bool // Advanced vector extension 512 Double and quad word population count instructions
- HasAVX512VPCLMULQDQ bool // Advanced vector extension 512 Vector carry-less multiply operations
- HasAVX512VNNI bool // Advanced vector extension 512 Vector Neural Network Instructions
- HasAVX512GFNI bool // Advanced vector extension 512 Galois field New Instructions
- HasAVX512VAES bool // Advanced vector extension 512 Vector AES instructions
- HasAVX512VBMI2 bool // Advanced vector extension 512 Vector Byte Manipulation Instructions 2
- HasAVX512BITALG bool // Advanced vector extension 512 Bit Algorithms
- HasAVX512BF16 bool // Advanced vector extension 512 BFloat16 Instructions
- HasAMXTile bool // Advanced Matrix Extension Tile instructions
- HasAMXInt8 bool // Advanced Matrix Extension Int8 instructions
- HasAMXBF16 bool // Advanced Matrix Extension BFloat16 instructions
- HasBMI1 bool // Bit manipulation instruction set 1
- HasBMI2 bool // Bit manipulation instruction set 2
- HasCX16 bool // Compare and exchange 16 Bytes
- HasERMS bool // Enhanced REP for MOVSB and STOSB
- HasFMA bool // Fused-multiply-add instructions
- HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
- HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM
- HasPOPCNT bool // Hamming weight instruction POPCNT.
- HasRDRAND bool // RDRAND instruction (on-chip random number generator)
- HasRDSEED bool // RDSEED instruction (on-chip random number generator)
- HasSSE2 bool // Streaming SIMD extension 2 (always available on amd64)
- HasSSE3 bool // Streaming SIMD extension 3
- HasSSSE3 bool // Supplemental streaming SIMD extension 3
- HasSSE41 bool // Streaming SIMD extension 4 and 4.1
- HasSSE42 bool // Streaming SIMD extension 4 and 4.2
- _ CacheLinePad
-}
-
-// ARM64 contains the supported CPU features of the
-// current ARMv8(aarch64) platform. If the current platform
-// is not arm64 then all feature flags are false.
-var ARM64 struct {
- _ CacheLinePad
- HasFP bool // Floating-point instruction set (always available)
- HasASIMD bool // Advanced SIMD (always available)
- HasEVTSTRM bool // Event stream support
- HasAES bool // AES hardware implementation
- HasPMULL bool // Polynomial multiplication instruction set
- HasSHA1 bool // SHA1 hardware implementation
- HasSHA2 bool // SHA2 hardware implementation
- HasCRC32 bool // CRC32 hardware implementation
- HasATOMICS bool // Atomic memory operation instruction set
- HasFPHP bool // Half precision floating-point instruction set
- HasASIMDHP bool // Advanced SIMD half precision instruction set
- HasCPUID bool // CPUID identification scheme registers
- HasASIMDRDM bool // Rounding double multiply add/subtract instruction set
- HasJSCVT bool // Javascript conversion from floating-point to integer
- HasFCMA bool // Floating-point multiplication and addition of complex numbers
- HasLRCPC bool // Release Consistent processor consistent support
- HasDCPOP bool // Persistent memory support
- HasSHA3 bool // SHA3 hardware implementation
- HasSM3 bool // SM3 hardware implementation
- HasSM4 bool // SM4 hardware implementation
- HasASIMDDP bool // Advanced SIMD double precision instruction set
- HasSHA512 bool // SHA512 hardware implementation
- HasSVE bool // Scalable Vector Extensions
- HasSVE2 bool // Scalable Vector Extensions 2
- HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32
- HasDIT bool // Data Independent Timing support
- HasI8MM bool // Advanced SIMD Int8 matrix multiplication instructions
- _ CacheLinePad
-}
-
-// ARM contains the supported CPU features of the current ARM (32-bit) platform.
-// All feature flags are false if:
-// 1. the current platform is not arm, or
-// 2. the current operating system is not Linux.
-var ARM struct {
- _ CacheLinePad
- HasSWP bool // SWP instruction support
- HasHALF bool // Half-word load and store support
- HasTHUMB bool // ARM Thumb instruction set
- Has26BIT bool // Address space limited to 26-bits
- HasFASTMUL bool // 32-bit operand, 64-bit result multiplication support
- HasFPA bool // Floating point arithmetic support
- HasVFP bool // Vector floating point support
- HasEDSP bool // DSP Extensions support
- HasJAVA bool // Java instruction set
- HasIWMMXT bool // Intel Wireless MMX technology support
- HasCRUNCH bool // MaverickCrunch context switching and handling
- HasTHUMBEE bool // Thumb EE instruction set
- HasNEON bool // NEON instruction set
- HasVFPv3 bool // Vector floating point version 3 support
- HasVFPv3D16 bool // Vector floating point version 3 D8-D15
- HasTLS bool // Thread local storage support
- HasVFPv4 bool // Vector floating point version 4 support
- HasIDIVA bool // Integer divide instruction support in ARM mode
- HasIDIVT bool // Integer divide instruction support in Thumb mode
- HasVFPD32 bool // Vector floating point version 3 D15-D31
- HasLPAE bool // Large Physical Address Extensions
- HasEVTSTRM bool // Event stream support
- HasAES bool // AES hardware implementation
- HasPMULL bool // Polynomial multiplication instruction set
- HasSHA1 bool // SHA1 hardware implementation
- HasSHA2 bool // SHA2 hardware implementation
- HasCRC32 bool // CRC32 hardware implementation
- _ CacheLinePad
-}
-
-// MIPS64X contains the supported CPU features of the current mips64/mips64le
-// platforms. If the current platform is not mips64/mips64le or the current
-// operating system is not Linux then all feature flags are false.
-var MIPS64X struct {
- _ CacheLinePad
- HasMSA bool // MIPS SIMD architecture
- _ CacheLinePad
-}
-
-// PPC64 contains the supported CPU features of the current ppc64/ppc64le platforms.
-// If the current platform is not ppc64/ppc64le then all feature flags are false.
-//
-// For ppc64/ppc64le, it is safe to check only for ISA level starting on ISA v3.00,
-// since there are no optional categories. There are some exceptions that also
-// require kernel support to work (DARN, SCV), so there are feature bits for
-// those as well. The struct is padded to avoid false sharing.
-var PPC64 struct {
- _ CacheLinePad
- HasDARN bool // Hardware random number generator (requires kernel enablement)
- HasSCV bool // Syscall vectored (requires kernel enablement)
- IsPOWER8 bool // ISA v2.07 (POWER8)
- IsPOWER9 bool // ISA v3.00 (POWER9), implies IsPOWER8
- _ CacheLinePad
-}
-
-// S390X contains the supported CPU features of the current IBM Z
-// (s390x) platform. If the current platform is not IBM Z then all
-// feature flags are false.
-//
-// S390X is padded to avoid false sharing. Further HasVX is only set
-// if the OS supports vector registers in addition to the STFLE
-// feature bit being set.
-var S390X struct {
- _ CacheLinePad
- HasZARCH bool // z/Architecture mode is active [mandatory]
- HasSTFLE bool // store facility list extended
- HasLDISP bool // long (20-bit) displacements
- HasEIMM bool // 32-bit immediates
- HasDFP bool // decimal floating point
- HasETF3EH bool // ETF-3 enhanced
- HasMSA bool // message security assist (CPACF)
- HasAES bool // KM-AES{128,192,256} functions
- HasAESCBC bool // KMC-AES{128,192,256} functions
- HasAESCTR bool // KMCTR-AES{128,192,256} functions
- HasAESGCM bool // KMA-GCM-AES{128,192,256} functions
- HasGHASH bool // KIMD-GHASH function
- HasSHA1 bool // K{I,L}MD-SHA-1 functions
- HasSHA256 bool // K{I,L}MD-SHA-256 functions
- HasSHA512 bool // K{I,L}MD-SHA-512 functions
- HasSHA3 bool // K{I,L}MD-SHA3-{224,256,384,512} and K{I,L}MD-SHAKE-{128,256} functions
- HasVX bool // vector facility
- HasVXE bool // vector-enhancements facility 1
- _ CacheLinePad
-}
-
-// RISCV64 contains the supported CPU features and performance characteristics for riscv64
-// platforms. The booleans in RISCV64, with the exception of HasFastMisaligned, indicate
-// the presence of RISC-V extensions.
-//
-// It is safe to assume that all the RV64G extensions are supported and so they are omitted from
-// this structure. As riscv64 Go programs require at least RV64G, the code that populates
-// this structure cannot run successfully if some of the RV64G extensions are missing.
-// The struct is padded to avoid false sharing.
-var RISCV64 struct {
- _ CacheLinePad
- HasFastMisaligned bool // Fast misaligned accesses
- HasC bool // Compressed instruction-set extension
- HasV bool // Vector extension compatible with RVV 1.0
- HasZba bool // Address generation instructions extension
- HasZbb bool // Basic bit-manipulation extension
- HasZbs bool // Single-bit instructions extension
- _ CacheLinePad
-}
-
-func init() {
- archInit()
- initOptions()
- processOptions()
-}
-
-// options contains the cpu debug options that can be used in GODEBUG.
-// Options are arch dependent and are added by the arch specific initOptions functions.
-// Features that are mandatory for the specific GOARCH should have the Required field set
-// (e.g. SSE2 on amd64).
-var options []option
-
-// Option names should be lower case. e.g. avx instead of AVX.
-type option struct {
- Name string
- Feature *bool
- Specified bool // whether feature value was specified in GODEBUG
- Enable bool // whether feature should be enabled
- Required bool // whether feature is mandatory and can not be disabled
-}
-
-func processOptions() {
- env := os.Getenv("GODEBUG")
-field:
- for env != "" {
- field := ""
- i := strings.IndexByte(env, ',')
- if i < 0 {
- field, env = env, ""
- } else {
- field, env = env[:i], env[i+1:]
- }
- if len(field) < 4 || field[:4] != "cpu." {
- continue
- }
- i = strings.IndexByte(field, '=')
- if i < 0 {
- print("GODEBUG sys/cpu: no value specified for \"", field, "\"\n")
- continue
- }
- key, value := field[4:i], field[i+1:] // e.g. "SSE2", "on"
-
- var enable bool
- switch value {
- case "on":
- enable = true
- case "off":
- enable = false
- default:
- print("GODEBUG sys/cpu: value \"", value, "\" not supported for cpu option \"", key, "\"\n")
- continue field
- }
-
- if key == "all" {
- for i := range options {
- options[i].Specified = true
- options[i].Enable = enable || options[i].Required
- }
- continue field
- }
-
- for i := range options {
- if options[i].Name == key {
- options[i].Specified = true
- options[i].Enable = enable
- continue field
- }
- }
-
- print("GODEBUG sys/cpu: unknown cpu feature \"", key, "\"\n")
- }
-
- for _, o := range options {
- if !o.Specified {
- continue
- }
-
- if o.Enable && !*o.Feature {
- print("GODEBUG sys/cpu: can not enable \"", o.Name, "\", missing CPU support\n")
- continue
- }
-
- if !o.Enable && o.Required {
- print("GODEBUG sys/cpu: can not disable \"", o.Name, "\", required CPU feature\n")
- continue
- }
-
- *o.Feature = o.Enable
- }
-}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_aix.go b/vendor/golang.org/x/sys/cpu/cpu_aix.go
deleted file mode 100644
index 9bf0c32eb..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_aix.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2019 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.
-
-//go:build aix
-
-package cpu
-
-const (
- // getsystemcfg constants
- _SC_IMPL = 2
- _IMPL_POWER8 = 0x10000
- _IMPL_POWER9 = 0x20000
-)
-
-func archInit() {
- impl := getsystemcfg(_SC_IMPL)
- if impl&_IMPL_POWER8 != 0 {
- PPC64.IsPOWER8 = true
- }
- if impl&_IMPL_POWER9 != 0 {
- PPC64.IsPOWER8 = true
- PPC64.IsPOWER9 = true
- }
-
- Initialized = true
-}
-
-func getsystemcfg(label int) (n uint64) {
- r0, _ := callgetsystemcfg(label)
- n = uint64(r0)
- return
-}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm.go b/vendor/golang.org/x/sys/cpu/cpu_arm.go
deleted file mode 100644
index 301b752e9..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_arm.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package cpu
-
-const cacheLineSize = 32
-
-// HWCAP/HWCAP2 bits.
-// These are specific to Linux.
-const (
- hwcap_SWP = 1 << 0
- hwcap_HALF = 1 << 1
- hwcap_THUMB = 1 << 2
- hwcap_26BIT = 1 << 3
- hwcap_FAST_MULT = 1 << 4
- hwcap_FPA = 1 << 5
- hwcap_VFP = 1 << 6
- hwcap_EDSP = 1 << 7
- hwcap_JAVA = 1 << 8
- hwcap_IWMMXT = 1 << 9
- hwcap_CRUNCH = 1 << 10
- hwcap_THUMBEE = 1 << 11
- hwcap_NEON = 1 << 12
- hwcap_VFPv3 = 1 << 13
- hwcap_VFPv3D16 = 1 << 14
- hwcap_TLS = 1 << 15
- hwcap_VFPv4 = 1 << 16
- hwcap_IDIVA = 1 << 17
- hwcap_IDIVT = 1 << 18
- hwcap_VFPD32 = 1 << 19
- hwcap_LPAE = 1 << 20
- hwcap_EVTSTRM = 1 << 21
-
- hwcap2_AES = 1 << 0
- hwcap2_PMULL = 1 << 1
- hwcap2_SHA1 = 1 << 2
- hwcap2_SHA2 = 1 << 3
- hwcap2_CRC32 = 1 << 4
-)
-
-func initOptions() {
- options = []option{
- {Name: "pmull", Feature: &ARM.HasPMULL},
- {Name: "sha1", Feature: &ARM.HasSHA1},
- {Name: "sha2", Feature: &ARM.HasSHA2},
- {Name: "swp", Feature: &ARM.HasSWP},
- {Name: "thumb", Feature: &ARM.HasTHUMB},
- {Name: "thumbee", Feature: &ARM.HasTHUMBEE},
- {Name: "tls", Feature: &ARM.HasTLS},
- {Name: "vfp", Feature: &ARM.HasVFP},
- {Name: "vfpd32", Feature: &ARM.HasVFPD32},
- {Name: "vfpv3", Feature: &ARM.HasVFPv3},
- {Name: "vfpv3d16", Feature: &ARM.HasVFPv3D16},
- {Name: "vfpv4", Feature: &ARM.HasVFPv4},
- {Name: "half", Feature: &ARM.HasHALF},
- {Name: "26bit", Feature: &ARM.Has26BIT},
- {Name: "fastmul", Feature: &ARM.HasFASTMUL},
- {Name: "fpa", Feature: &ARM.HasFPA},
- {Name: "edsp", Feature: &ARM.HasEDSP},
- {Name: "java", Feature: &ARM.HasJAVA},
- {Name: "iwmmxt", Feature: &ARM.HasIWMMXT},
- {Name: "crunch", Feature: &ARM.HasCRUNCH},
- {Name: "neon", Feature: &ARM.HasNEON},
- {Name: "idivt", Feature: &ARM.HasIDIVT},
- {Name: "idiva", Feature: &ARM.HasIDIVA},
- {Name: "lpae", Feature: &ARM.HasLPAE},
- {Name: "evtstrm", Feature: &ARM.HasEVTSTRM},
- {Name: "aes", Feature: &ARM.HasAES},
- {Name: "crc32", Feature: &ARM.HasCRC32},
- }
-
-}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go
deleted file mode 100644
index af2aa99f9..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_arm64.go
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright 2019 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 cpu
-
-import "runtime"
-
-// cacheLineSize is used to prevent false sharing of cache lines.
-// We choose 128 because Apple Silicon, a.k.a. M1, has 128-byte cache line size.
-// It doesn't cost much and is much more future-proof.
-const cacheLineSize = 128
-
-func initOptions() {
- options = []option{
- {Name: "fp", Feature: &ARM64.HasFP},
- {Name: "asimd", Feature: &ARM64.HasASIMD},
- {Name: "evstrm", Feature: &ARM64.HasEVTSTRM},
- {Name: "aes", Feature: &ARM64.HasAES},
- {Name: "fphp", Feature: &ARM64.HasFPHP},
- {Name: "jscvt", Feature: &ARM64.HasJSCVT},
- {Name: "lrcpc", Feature: &ARM64.HasLRCPC},
- {Name: "pmull", Feature: &ARM64.HasPMULL},
- {Name: "sha1", Feature: &ARM64.HasSHA1},
- {Name: "sha2", Feature: &ARM64.HasSHA2},
- {Name: "sha3", Feature: &ARM64.HasSHA3},
- {Name: "sha512", Feature: &ARM64.HasSHA512},
- {Name: "sm3", Feature: &ARM64.HasSM3},
- {Name: "sm4", Feature: &ARM64.HasSM4},
- {Name: "sve", Feature: &ARM64.HasSVE},
- {Name: "sve2", Feature: &ARM64.HasSVE2},
- {Name: "crc32", Feature: &ARM64.HasCRC32},
- {Name: "atomics", Feature: &ARM64.HasATOMICS},
- {Name: "asimdhp", Feature: &ARM64.HasASIMDHP},
- {Name: "cpuid", Feature: &ARM64.HasCPUID},
- {Name: "asimrdm", Feature: &ARM64.HasASIMDRDM},
- {Name: "fcma", Feature: &ARM64.HasFCMA},
- {Name: "dcpop", Feature: &ARM64.HasDCPOP},
- {Name: "asimddp", Feature: &ARM64.HasASIMDDP},
- {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM},
- {Name: "dit", Feature: &ARM64.HasDIT},
- {Name: "i8mm", Feature: &ARM64.HasI8MM},
- }
-}
-
-func archInit() {
- switch runtime.GOOS {
- case "freebsd":
- readARM64Registers()
- case "linux", "netbsd", "openbsd":
- doinit()
- default:
- // Many platforms don't seem to allow reading these registers.
- setMinimalFeatures()
- }
-}
-
-// setMinimalFeatures fakes the minimal ARM64 features expected by
-// TestARM64minimalFeatures.
-func setMinimalFeatures() {
- ARM64.HasASIMD = true
- ARM64.HasFP = true
-}
-
-func readARM64Registers() {
- Initialized = true
-
- parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0())
-}
-
-func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) {
- // ID_AA64ISAR0_EL1
- switch extractBits(isar0, 4, 7) {
- case 1:
- ARM64.HasAES = true
- case 2:
- ARM64.HasAES = true
- ARM64.HasPMULL = true
- }
-
- switch extractBits(isar0, 8, 11) {
- case 1:
- ARM64.HasSHA1 = true
- }
-
- switch extractBits(isar0, 12, 15) {
- case 1:
- ARM64.HasSHA2 = true
- case 2:
- ARM64.HasSHA2 = true
- ARM64.HasSHA512 = true
- }
-
- switch extractBits(isar0, 16, 19) {
- case 1:
- ARM64.HasCRC32 = true
- }
-
- switch extractBits(isar0, 20, 23) {
- case 2:
- ARM64.HasATOMICS = true
- }
-
- switch extractBits(isar0, 28, 31) {
- case 1:
- ARM64.HasASIMDRDM = true
- }
-
- switch extractBits(isar0, 32, 35) {
- case 1:
- ARM64.HasSHA3 = true
- }
-
- switch extractBits(isar0, 36, 39) {
- case 1:
- ARM64.HasSM3 = true
- }
-
- switch extractBits(isar0, 40, 43) {
- case 1:
- ARM64.HasSM4 = true
- }
-
- switch extractBits(isar0, 44, 47) {
- case 1:
- ARM64.HasASIMDDP = true
- }
-
- // ID_AA64ISAR1_EL1
- switch extractBits(isar1, 0, 3) {
- case 1:
- ARM64.HasDCPOP = true
- }
-
- switch extractBits(isar1, 12, 15) {
- case 1:
- ARM64.HasJSCVT = true
- }
-
- switch extractBits(isar1, 16, 19) {
- case 1:
- ARM64.HasFCMA = true
- }
-
- switch extractBits(isar1, 20, 23) {
- case 1:
- ARM64.HasLRCPC = true
- }
-
- switch extractBits(isar1, 52, 55) {
- case 1:
- ARM64.HasI8MM = true
- }
-
- // ID_AA64PFR0_EL1
- switch extractBits(pfr0, 16, 19) {
- case 0:
- ARM64.HasFP = true
- case 1:
- ARM64.HasFP = true
- ARM64.HasFPHP = true
- }
-
- switch extractBits(pfr0, 20, 23) {
- case 0:
- ARM64.HasASIMD = true
- case 1:
- ARM64.HasASIMD = true
- ARM64.HasASIMDHP = true
- }
-
- switch extractBits(pfr0, 32, 35) {
- case 1:
- ARM64.HasSVE = true
-
- parseARM64SVERegister(getzfr0())
- }
-
- switch extractBits(pfr0, 48, 51) {
- case 1:
- ARM64.HasDIT = true
- }
-}
-
-func parseARM64SVERegister(zfr0 uint64) {
- switch extractBits(zfr0, 0, 3) {
- case 1:
- ARM64.HasSVE2 = true
- }
-}
-
-func extractBits(data uint64, start, end uint) uint {
- return (uint)(data>>start) & ((1 << (end - start + 1)) - 1)
-}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.s
deleted file mode 100644
index 22cc99844..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_arm64.s
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2019 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.
-
-//go:build gc
-
-#include "textflag.h"
-
-// func getisar0() uint64
-TEXT ·getisar0(SB),NOSPLIT,$0-8
- // get Instruction Set Attributes 0 into x0
- // mrs x0, ID_AA64ISAR0_EL1 = d5380600
- WORD $0xd5380600
- MOVD R0, ret+0(FP)
- RET
-
-// func getisar1() uint64
-TEXT ·getisar1(SB),NOSPLIT,$0-8
- // get Instruction Set Attributes 1 into x0
- // mrs x0, ID_AA64ISAR1_EL1 = d5380620
- WORD $0xd5380620
- MOVD R0, ret+0(FP)
- RET
-
-// func getpfr0() uint64
-TEXT ·getpfr0(SB),NOSPLIT,$0-8
- // get Processor Feature Register 0 into x0
- // mrs x0, ID_AA64PFR0_EL1 = d5380400
- WORD $0xd5380400
- MOVD R0, ret+0(FP)
- RET
-
-// func getzfr0() uint64
-TEXT ·getzfr0(SB),NOSPLIT,$0-8
- // get SVE Feature Register 0 into x0
- // mrs x0, ID_AA64ZFR0_EL1 = d5380480
- WORD $0xd5380480
- MOVD R0, ret+0(FP)
- RET
diff --git a/vendor/golang.org/x/sys/cpu/cpu_darwin_x86.go b/vendor/golang.org/x/sys/cpu/cpu_darwin_x86.go
deleted file mode 100644
index b838cb9e9..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_darwin_x86.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2024 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.
-
-//go:build darwin && amd64 && gc
-
-package cpu
-
-// darwinSupportsAVX512 checks Darwin kernel for AVX512 support via sysctl
-// call (see issue 43089). It also restricts AVX512 support for Darwin to
-// kernel version 21.3.0 (MacOS 12.2.0) or later (see issue 49233).
-//
-// Background:
-// Darwin implements a special mechanism to economize on thread state when
-// AVX512 specific registers are not in use. This scheme minimizes state when
-// preempting threads that haven't yet used any AVX512 instructions, but adds
-// special requirements to check for AVX512 hardware support at runtime (e.g.
-// via sysctl call or commpage inspection). See issue 43089 and link below for
-// full background:
-// https://github.com/apple-oss-distributions/xnu/blob/xnu-11215.1.10/osfmk/i386/fpu.c#L214-L240
-//
-// Additionally, all versions of the Darwin kernel from 19.6.0 through 21.2.0
-// (corresponding to MacOS 10.15.6 - 12.1) have a bug that can cause corruption
-// of the AVX512 mask registers (K0-K7) upon signal return. For this reason
-// AVX512 is considered unsafe to use on Darwin for kernel versions prior to
-// 21.3.0, where a fix has been confirmed. See issue 49233 for full background.
-func darwinSupportsAVX512() bool {
- return darwinSysctlEnabled([]byte("hw.optional.avx512f\x00")) && darwinKernelVersionCheck(21, 3, 0)
-}
-
-// Ensure Darwin kernel version is at least major.minor.patch, avoiding dependencies
-func darwinKernelVersionCheck(major, minor, patch int) bool {
- var release [256]byte
- err := darwinOSRelease(&release)
- if err != nil {
- return false
- }
-
- var mmp [3]int
- c := 0
-Loop:
- for _, b := range release[:] {
- switch {
- case b >= '0' && b <= '9':
- mmp[c] = 10*mmp[c] + int(b-'0')
- case b == '.':
- c++
- if c > 2 {
- return false
- }
- case b == 0:
- break Loop
- default:
- return false
- }
- }
- if c != 2 {
- return false
- }
- return mmp[0] > major || mmp[0] == major && (mmp[1] > minor || mmp[1] == minor && mmp[2] >= patch)
-}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
deleted file mode 100644
index 6ac6e1efb..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2019 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.
-
-//go:build gc
-
-package cpu
-
-func getisar0() uint64
-func getisar1() uint64
-func getpfr0() uint64
-func getzfr0() uint64
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go
deleted file mode 100644
index c8ae6ddc1..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2019 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.
-
-//go:build gc
-
-package cpu
-
-// haveAsmFunctions reports whether the other functions in this file can
-// be safely called.
-func haveAsmFunctions() bool { return true }
-
-// The following feature detection functions are defined in cpu_s390x.s.
-// They are likely to be expensive to call so the results should be cached.
-func stfle() facilityList
-func kmQuery() queryResult
-func kmcQuery() queryResult
-func kmctrQuery() queryResult
-func kmaQuery() queryResult
-func kimdQuery() queryResult
-func klmdQuery() queryResult
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
deleted file mode 100644
index 32a44514e..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build (386 || amd64 || amd64p32) && gc
-
-package cpu
-
-// cpuid is implemented in cpu_gc_x86.s for gc compiler
-// and in cpu_gccgo.c for gccgo.
-func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
-
-// xgetbv with ecx = 0 is implemented in cpu_gc_x86.s for gc compiler
-// and in cpu_gccgo.c for gccgo.
-func xgetbv() (eax, edx uint32)
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.s b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.s
deleted file mode 100644
index ce208ce6d..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.s
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build (386 || amd64 || amd64p32) && gc
-
-#include "textflag.h"
-
-// func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
-TEXT ·cpuid(SB), NOSPLIT, $0-24
- MOVL eaxArg+0(FP), AX
- MOVL ecxArg+4(FP), CX
- CPUID
- MOVL AX, eax+8(FP)
- MOVL BX, ebx+12(FP)
- MOVL CX, ecx+16(FP)
- MOVL DX, edx+20(FP)
- RET
-
-// func xgetbv() (eax, edx uint32)
-TEXT ·xgetbv(SB), NOSPLIT, $0-8
- MOVL $0, CX
- XGETBV
- MOVL AX, eax+0(FP)
- MOVL DX, edx+4(FP)
- RET
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go
deleted file mode 100644
index 7f1946780..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2019 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.
-
-//go:build gccgo
-
-package cpu
-
-func getisar0() uint64 { return 0 }
-func getisar1() uint64 { return 0 }
-func getpfr0() uint64 { return 0 }
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go
deleted file mode 100644
index 9526d2ce3..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2019 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.
-
-//go:build gccgo
-
-package cpu
-
-// haveAsmFunctions reports whether the other functions in this file can
-// be safely called.
-func haveAsmFunctions() bool { return false }
-
-// TODO(mundaym): the following feature detection functions are currently
-// stubs. See https://golang.org/cl/162887 for how to fix this.
-// They are likely to be expensive to call so the results should be cached.
-func stfle() facilityList { panic("not implemented for gccgo") }
-func kmQuery() queryResult { panic("not implemented for gccgo") }
-func kmcQuery() queryResult { panic("not implemented for gccgo") }
-func kmctrQuery() queryResult { panic("not implemented for gccgo") }
-func kmaQuery() queryResult { panic("not implemented for gccgo") }
-func kimdQuery() queryResult { panic("not implemented for gccgo") }
-func klmdQuery() queryResult { panic("not implemented for gccgo") }
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c
deleted file mode 100644
index 3f73a05dc..000000000
--- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build (386 || amd64 || amd64p32) && gccgo
-
-#include