mirror of
https://github.com/fatedier/frp.git
synced 2026-01-11 22:23:12 +00:00
update vendor, fix #788
This commit is contained in:
4
vendor/github.com/fatedier/golib/msg/json/process.go
generated
vendored
4
vendor/github.com/fatedier/golib/msg/json/process.go
generated
vendored
@@ -23,6 +23,7 @@ import (
|
||||
var (
|
||||
ErrMsgType = errors.New("message type error")
|
||||
ErrMaxMsgLength = errors.New("message length exceed the limit")
|
||||
ErrMsgLength = errors.New("message length error")
|
||||
ErrMsgFormat = errors.New("message format error")
|
||||
)
|
||||
|
||||
@@ -46,6 +47,9 @@ func (msgCtl *MsgCtl) readMsg(c io.Reader) (typeByte byte, buffer []byte, err er
|
||||
if length > msgCtl.maxMsgLength {
|
||||
err = ErrMaxMsgLength
|
||||
return
|
||||
} else if length < 0 {
|
||||
err = ErrMsgLength
|
||||
return
|
||||
}
|
||||
|
||||
buffer = make([]byte, length)
|
||||
|
||||
29
vendor/github.com/spf13/cobra/bash_completions.go
generated
vendored
29
vendor/github.com/spf13/cobra/bash_completions.go
generated
vendored
@@ -251,6 +251,14 @@ __%[1]s_handle_word()
|
||||
__%[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
|
||||
@@ -266,6 +274,7 @@ func writePostscript(buf *bytes.Buffer, name string) {
|
||||
buf.WriteString(fmt.Sprintf(`{
|
||||
local cur prev words cword
|
||||
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
|
||||
@@ -305,6 +314,7 @@ func writeCommands(buf *bytes.Buffer, cmd *Command) {
|
||||
continue
|
||||
}
|
||||
buf.WriteString(fmt.Sprintf(" commands+=(%q)\n", c.Name()))
|
||||
writeCmdAliases(buf, c)
|
||||
}
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
@@ -443,6 +453,21 @@ func writeRequiredNouns(buf *bytes.Buffer, cmd *Command) {
|
||||
}
|
||||
}
|
||||
|
||||
func writeCmdAliases(buf *bytes.Buffer, cmd *Command) {
|
||||
if len(cmd.Aliases) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
sort.Sort(sort.StringSlice(cmd.Aliases))
|
||||
|
||||
buf.WriteString(fmt.Sprint(` if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then`, "\n"))
|
||||
for _, value := range cmd.Aliases {
|
||||
buf.WriteString(fmt.Sprintf(" command_aliases+=(%q)\n", value))
|
||||
buf.WriteString(fmt.Sprintf(" aliashash[%q]=%q\n", value, cmd.Name()))
|
||||
}
|
||||
buf.WriteString(` fi`)
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
func writeArgAliases(buf *bytes.Buffer, cmd *Command) {
|
||||
buf.WriteString(" noun_aliases=()\n")
|
||||
sort.Sort(sort.StringSlice(cmd.ArgAliases))
|
||||
@@ -469,6 +494,10 @@ func gen(buf *bytes.Buffer, cmd *Command) {
|
||||
}
|
||||
|
||||
buf.WriteString(fmt.Sprintf(" last_command=%q\n", commandName))
|
||||
buf.WriteString("\n")
|
||||
buf.WriteString(" command_aliases=()\n")
|
||||
buf.WriteString("\n")
|
||||
|
||||
writeCommands(buf, cmd)
|
||||
writeFlags(buf, cmd)
|
||||
writeRequiredFlag(buf, cmd)
|
||||
|
||||
2
vendor/github.com/spf13/cobra/bash_completions.md
generated
vendored
2
vendor/github.com/spf13/cobra/bash_completions.md
generated
vendored
@@ -181,7 +181,7 @@ a custom flag completion function with cobra.BashCompCustom:
|
||||
|
||||
```go
|
||||
annotation := make(map[string][]string)
|
||||
annotation[cobra.BashCompFilenameExt] = []string{"__kubectl_get_namespaces"}
|
||||
annotation[cobra.BashCompCustom] = []string{"__kubectl_get_namespaces"}
|
||||
|
||||
flag := &pflag.Flag{
|
||||
Name: "namespace",
|
||||
|
||||
10
vendor/github.com/spf13/cobra/command.go
generated
vendored
10
vendor/github.com/spf13/cobra/command.go
generated
vendored
@@ -27,6 +27,9 @@ import (
|
||||
flag "github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
// FParseErrWhitelist configures Flag parse errors to be ignored
|
||||
type FParseErrWhitelist flag.ParseErrorsWhitelist
|
||||
|
||||
// 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
|
||||
@@ -137,6 +140,9 @@ type Command struct {
|
||||
// TraverseChildren parses flags on all parents before executing child command.
|
||||
TraverseChildren bool
|
||||
|
||||
//FParseErrWhitelist flag parse errors to be ignored
|
||||
FParseErrWhitelist FParseErrWhitelist
|
||||
|
||||
// commands is the list of commands supported by this program.
|
||||
commands []*Command
|
||||
// parent is a parent command for this command.
|
||||
@@ -1463,6 +1469,10 @@ func (c *Command) ParseFlags(args []string) error {
|
||||
}
|
||||
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 {
|
||||
|
||||
2
vendor/golang.org/x/net/ipv4/header.go
generated
vendored
2
vendor/golang.org/x/net/ipv4/header.go
generated
vendored
@@ -98,7 +98,7 @@ func (h *Header) Marshal() ([]byte, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// Parse parses b as an IPv4 header and sotres the result in h.
|
||||
// Parse parses b as an IPv4 header and stores the result in h.
|
||||
func (h *Header) Parse(b []byte) error {
|
||||
if h == nil || len(b) < HeaderLen {
|
||||
return errHeaderTooShort
|
||||
|
||||
Reference in New Issue
Block a user