mirror of https://github.com/status-im/consul.git
agent: don't let left nodes hold onto their node-id (#7747)
This commit is contained in:
parent
daec810e34
commit
c4093c87cc
|
@ -27,6 +27,10 @@ func (md *lanMergeDelegate) NotifyMerge(members []*serf.Member) error {
|
|||
nodeMap := make(map[types.NodeID]string)
|
||||
for _, m := range members {
|
||||
if rawID, ok := m.Tags["id"]; ok && rawID != "" {
|
||||
if m.Status == serf.StatusLeft {
|
||||
continue
|
||||
}
|
||||
|
||||
nodeID := types.NodeID(rawID)
|
||||
|
||||
// See if there's another node that conflicts with us.
|
||||
|
|
8
go.mod
8
go.mod
|
@ -39,7 +39,7 @@ require (
|
|||
github.com/hashicorp/go-hclog v0.12.0
|
||||
github.com/hashicorp/go-memdb v1.0.3
|
||||
github.com/hashicorp/go-msgpack v0.5.5
|
||||
github.com/hashicorp/go-multierror v1.0.0
|
||||
github.com/hashicorp/go-multierror v1.1.0
|
||||
github.com/hashicorp/go-raftchunking v0.6.1
|
||||
github.com/hashicorp/go-sockaddr v1.0.2
|
||||
github.com/hashicorp/go-syslog v1.0.0
|
||||
|
@ -48,11 +48,11 @@ require (
|
|||
github.com/hashicorp/golang-lru v0.5.1
|
||||
github.com/hashicorp/hcl v1.0.0
|
||||
github.com/hashicorp/hil v0.0.0-20160711231837-1e86c6b523c5
|
||||
github.com/hashicorp/memberlist v0.2.0
|
||||
github.com/hashicorp/memberlist v0.2.2
|
||||
github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69
|
||||
github.com/hashicorp/raft v1.1.2
|
||||
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea
|
||||
github.com/hashicorp/serf v0.9.0
|
||||
github.com/hashicorp/serf v0.9.1
|
||||
github.com/hashicorp/vault/api v1.0.4
|
||||
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
|
||||
github.com/imdario/mergo v0.3.6
|
||||
|
@ -79,7 +79,7 @@ require (
|
|||
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975
|
||||
golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
|
||||
google.golang.org/api v0.7.0 // indirect
|
||||
google.golang.org/appengine v1.6.0 // indirect
|
||||
|
|
13
go.sum
13
go.sum
|
@ -211,6 +211,8 @@ github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9
|
|||
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
|
||||
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
||||
github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=
|
||||
github.com/hashicorp/go-raftchunking v0.6.1 h1:moEnaG3gcwsWNyIBJoD5PCByE+Ewkqxh6N05CT+MbwA=
|
||||
github.com/hashicorp/go-raftchunking v0.6.1/go.mod h1:cGlg3JtDy7qy6c/3Bu660Mic1JF+7lWqIwCFSb08fX0=
|
||||
|
@ -243,6 +245,8 @@ github.com/hashicorp/mdns v1.0.1 h1:XFSOubp8KWB+Jd2PDyaX5xUd5bhSP/+pTDZVDMzZJM8=
|
|||
github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY=
|
||||
github.com/hashicorp/memberlist v0.2.0 h1:WeeNspppWi5s1OFefTviPQueC/Bq8dONfvNjPhiEQKE=
|
||||
github.com/hashicorp/memberlist v0.2.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
||||
github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g=
|
||||
github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
|
||||
github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69 h1:lc3c72qGlIMDqQpQH82Y4vaglRMMFdJbziYWriR4UcE=
|
||||
github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69/go.mod h1:/z+jUGRBlwVpUZfjute9jWaF6/HuhjuFQuL1YXzVD1Q=
|
||||
github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
|
||||
|
@ -252,6 +256,8 @@ github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea h1:xykPFhrBA
|
|||
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
|
||||
github.com/hashicorp/serf v0.9.0 h1:+Zd/16AJ9lxk9RzfTDyv/TLhZ8UerqYS0/+JGCIDaa0=
|
||||
github.com/hashicorp/serf v0.9.0/go.mod h1:YL0HO+FifKOW2u1ke99DGVu1zhcpZzNwrLIqBC7vbYU=
|
||||
github.com/hashicorp/serf v0.9.1 h1:YG/tpCm4cHZPmGQ9+XQIRSOYnWcRnyTbYKFmwzjmmg0=
|
||||
github.com/hashicorp/serf v0.9.1/go.mod h1:9O54gmUahS6cDUNpIQFouJdluzAIfBOp4mSLSvf5ZAE=
|
||||
github.com/hashicorp/vault/api v1.0.4 h1:j08Or/wryXT4AcHj1oCbMd7IijXcKzYUGw59LGu9onU=
|
||||
github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q=
|
||||
github.com/hashicorp/vault/sdk v0.1.13 h1:mOEPeOhT7jl0J4AMl1E705+BcmeRs1VmKNb9F0sMLy8=
|
||||
|
@ -304,6 +310,8 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN
|
|||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
||||
|
@ -376,6 +384,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
|
||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
||||
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
||||
|
@ -538,6 +548,9 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 h1:1/DFK4b7JH8DmkqhUk48onnSfrPzImPoVxuomtbT2nk=
|
||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d h1:nc5K6ox/4lTFbMVSL9WRR81ixkcwXThoiF6yf+R9scA=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
|
@ -9,4 +9,4 @@ branches:
|
|||
only:
|
||||
- master
|
||||
|
||||
script: make test testrace
|
||||
script: env GO111MODULE=on make test testrace
|
||||
|
|
|
@ -14,9 +14,10 @@ be a list of errors. If the caller knows this, they can unwrap the
|
|||
list and access the errors. If the caller doesn't know, the error
|
||||
formats to a nice human-readable format.
|
||||
|
||||
`go-multierror` implements the
|
||||
[errwrap](https://github.com/hashicorp/errwrap) interface so that it can
|
||||
be used with that library, as well.
|
||||
`go-multierror` is fully compatible with the Go standard library
|
||||
[errors](https://golang.org/pkg/errors/) package, including the
|
||||
functions `As`, `Is`, and `Unwrap`. This provides a standardized approach
|
||||
for introspecting on error values.
|
||||
|
||||
## Installation and Docs
|
||||
|
||||
|
@ -81,6 +82,39 @@ if err := something(); err != nil {
|
|||
}
|
||||
```
|
||||
|
||||
You can also use the standard [`errors.Unwrap`](https://golang.org/pkg/errors/#Unwrap)
|
||||
function. This will continue to unwrap into subsequent errors until none exist.
|
||||
|
||||
**Extracting an error**
|
||||
|
||||
The standard library [`errors.As`](https://golang.org/pkg/errors/#As)
|
||||
function can be used directly with a multierror to extract a specific error:
|
||||
|
||||
```go
|
||||
// Assume err is a multierror value
|
||||
err := somefunc()
|
||||
|
||||
// We want to know if "err" has a "RichErrorType" in it and extract it.
|
||||
var errRich RichErrorType
|
||||
if errors.As(err, &errRich) {
|
||||
// It has it, and now errRich is populated.
|
||||
}
|
||||
```
|
||||
|
||||
**Checking for an exact error value**
|
||||
|
||||
Some errors are returned as exact errors such as the [`ErrNotExist`](https://golang.org/pkg/os/#pkg-variables)
|
||||
error in the `os` package. You can check if this error is present by using
|
||||
the standard [`errors.Is`](https://golang.org/pkg/errors/#Is) function.
|
||||
|
||||
```go
|
||||
// Assume err is a multierror value
|
||||
err := somefunc()
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
// err contains os.ErrNotExist
|
||||
}
|
||||
```
|
||||
|
||||
**Returning a multierror only if there are errors**
|
||||
|
||||
If you build a `multierror.Error`, you can use the `ErrorOrNil` function
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
module github.com/hashicorp/go-multierror
|
||||
|
||||
go 1.14
|
||||
|
||||
require github.com/hashicorp/errwrap v1.0.0
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce h1:prjrVgOk2Yg6w+PflHoszQNLTUh4kaByUcEWM/9uin4=
|
||||
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package multierror
|
||||
|
||||
import "sync"
|
||||
|
||||
// Group is a collection of goroutines which return errors that need to be
|
||||
// coalesced.
|
||||
type Group struct {
|
||||
mutex sync.Mutex
|
||||
err *Error
|
||||
wg sync.WaitGroup
|
||||
}
|
||||
|
||||
// Go calls the given function in a new goroutine.
|
||||
//
|
||||
// If the function returns an error it is added to the group multierror which
|
||||
// is returned by Wait.
|
||||
func (g *Group) Go(f func() error) {
|
||||
g.wg.Add(1)
|
||||
|
||||
go func() {
|
||||
defer g.wg.Done()
|
||||
|
||||
if err := f(); err != nil {
|
||||
g.mutex.Lock()
|
||||
g.err = Append(g.err, err)
|
||||
g.mutex.Unlock()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Wait blocks until all function calls from the Go method have returned, then
|
||||
// returns the multierror.
|
||||
func (g *Group) Wait() *Error {
|
||||
g.wg.Wait()
|
||||
g.mutex.Lock()
|
||||
defer g.mutex.Unlock()
|
||||
return g.err
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package multierror
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
|
@ -49,3 +50,69 @@ func (e *Error) GoString() string {
|
|||
func (e *Error) WrappedErrors() []error {
|
||||
return e.Errors
|
||||
}
|
||||
|
||||
// Unwrap returns an error from Error (or nil if there are no errors).
|
||||
// This error returned will further support Unwrap to get the next error,
|
||||
// etc. The order will match the order of Errors in the multierror.Error
|
||||
// at the time of calling.
|
||||
//
|
||||
// The resulting error supports errors.As/Is/Unwrap so you can continue
|
||||
// to use the stdlib errors package to introspect further.
|
||||
//
|
||||
// This will perform a shallow copy of the errors slice. Any errors appended
|
||||
// to this error after calling Unwrap will not be available until a new
|
||||
// Unwrap is called on the multierror.Error.
|
||||
func (e *Error) Unwrap() error {
|
||||
// If we have no errors then we do nothing
|
||||
if e == nil || len(e.Errors) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If we have exactly one error, we can just return that directly.
|
||||
if len(e.Errors) == 1 {
|
||||
return e.Errors[0]
|
||||
}
|
||||
|
||||
// Shallow copy the slice
|
||||
errs := make([]error, len(e.Errors))
|
||||
copy(errs, e.Errors)
|
||||
return chain(errs)
|
||||
}
|
||||
|
||||
// chain implements the interfaces necessary for errors.Is/As/Unwrap to
|
||||
// work in a deterministic way with multierror. A chain tracks a list of
|
||||
// errors while accounting for the current represented error. This lets
|
||||
// Is/As be meaningful.
|
||||
//
|
||||
// Unwrap returns the next error. In the cleanest form, Unwrap would return
|
||||
// the wrapped error here but we can't do that if we want to properly
|
||||
// get access to all the errors. Instead, users are recommended to use
|
||||
// Is/As to get the correct error type out.
|
||||
//
|
||||
// Precondition: []error is non-empty (len > 0)
|
||||
type chain []error
|
||||
|
||||
// Error implements the error interface
|
||||
func (e chain) Error() string {
|
||||
return e[0].Error()
|
||||
}
|
||||
|
||||
// Unwrap implements errors.Unwrap by returning the next error in the
|
||||
// chain or nil if there are no more errors.
|
||||
func (e chain) Unwrap() error {
|
||||
if len(e) == 1 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return e[1:]
|
||||
}
|
||||
|
||||
// As implements errors.As by attempting to map to the current value.
|
||||
func (e chain) As(target interface{}) bool {
|
||||
return errors.As(e[0], target)
|
||||
}
|
||||
|
||||
// Is implements errors.Is by comparing the current value directly.
|
||||
func (e chain) Is(target error) bool {
|
||||
return errors.Is(e[0], target)
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package memberlist
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
multierror "github.com/hashicorp/go-multierror"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
@ -228,6 +233,35 @@ type Config struct {
|
|||
// RequireNodeNames controls if the name of a node is required when sending
|
||||
// a message to that node.
|
||||
RequireNodeNames bool
|
||||
// CIDRsAllowed If nil, allow any connection (default), otherwise specify all networks
|
||||
// allowed to connect (you must specify IPv6/IPv4 separately)
|
||||
// Using [] will block all connections.
|
||||
CIDRsAllowed []net.IPNet
|
||||
}
|
||||
|
||||
// ParseCIDRs return a possible empty list of all Network that have been parsed
|
||||
// In case of error, it returns succesfully parsed CIDRs and the last error found
|
||||
func ParseCIDRs(v []string) ([]net.IPNet, error) {
|
||||
nets := make([]net.IPNet, 0)
|
||||
if v == nil {
|
||||
return nets, nil
|
||||
}
|
||||
var errs error
|
||||
hasErrors := false
|
||||
for _, p := range v {
|
||||
_, net, err := net.ParseCIDR(strings.TrimSpace(p))
|
||||
if err != nil {
|
||||
err = fmt.Errorf("invalid cidr: %s", p)
|
||||
errs = multierror.Append(errs, err)
|
||||
hasErrors = true
|
||||
} else {
|
||||
nets = append(nets, *net)
|
||||
}
|
||||
}
|
||||
if !hasErrors {
|
||||
errs = nil
|
||||
}
|
||||
return nets, errs
|
||||
}
|
||||
|
||||
// DefaultLANConfig returns a sane set of configurations for Memberlist.
|
||||
|
@ -271,6 +305,7 @@ func DefaultLANConfig() *Config {
|
|||
|
||||
HandoffQueueDepth: 1024,
|
||||
UDPBufferSize: 1400,
|
||||
CIDRsAllowed: nil, // same as allow all
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,6 +325,24 @@ func DefaultWANConfig() *Config {
|
|||
return conf
|
||||
}
|
||||
|
||||
// IPMustBeChecked return true if IPAllowed must be called
|
||||
func (c *Config) IPMustBeChecked() bool {
|
||||
return len(c.CIDRsAllowed) > 0
|
||||
}
|
||||
|
||||
// IPAllowed return an error if access to memberlist is denied
|
||||
func (c *Config) IPAllowed(ip net.IP) error {
|
||||
if !c.IPMustBeChecked() {
|
||||
return nil
|
||||
}
|
||||
for _, n := range c.CIDRsAllowed {
|
||||
if n.Contains(ip) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("%s is not allowed", ip)
|
||||
}
|
||||
|
||||
// DefaultLocalConfig works like DefaultConfig, however it returns a configuration
|
||||
// that is optimized for a local loopback environments. The default configuration is
|
||||
// still very conservative and errs on the side of caution.
|
||||
|
|
|
@ -568,7 +568,7 @@ func (m *Memberlist) SendBestEffort(to *Node, msg []byte) error {
|
|||
buf = append(buf, msg...)
|
||||
|
||||
// Send the message
|
||||
a := Address{Addr: to.String(), Name: to.Name}
|
||||
a := Address{Addr: to.Address(), Name: to.Name}
|
||||
return m.rawSendMsgPacket(a, to, buf)
|
||||
}
|
||||
|
||||
|
@ -736,7 +736,7 @@ func (m *Memberlist) hasLeft() bool {
|
|||
return atomic.LoadInt32(&m.leave) == 1
|
||||
}
|
||||
|
||||
func (m *Memberlist) getNodeState(addr string) nodeStateType {
|
||||
func (m *Memberlist) getNodeState(addr string) NodeStateType {
|
||||
m.nodeLock.RLock()
|
||||
defer m.nodeLock.RUnlock()
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ type pushNodeState struct {
|
|||
Port uint16
|
||||
Meta []byte
|
||||
Incarnation uint32
|
||||
State nodeStateType
|
||||
State NodeStateType
|
||||
Vsn []uint8 // Protocol versions
|
||||
}
|
||||
|
||||
|
@ -220,9 +220,9 @@ func (m *Memberlist) streamListen() {
|
|||
|
||||
// handleConn handles a single incoming stream connection from the transport.
|
||||
func (m *Memberlist) handleConn(conn net.Conn) {
|
||||
defer conn.Close()
|
||||
m.logger.Printf("[DEBUG] memberlist: Stream connection %s", LogConn(conn))
|
||||
|
||||
defer conn.Close()
|
||||
metrics.IncrCounter([]string{"memberlist", "tcp", "accept"}, 1)
|
||||
|
||||
conn.SetDeadline(time.Now().Add(m.config.TCPTimeout))
|
||||
|
@ -622,12 +622,47 @@ func (m *Memberlist) handleSuspect(buf []byte, from net.Addr) {
|
|||
m.suspectNode(&sus)
|
||||
}
|
||||
|
||||
// ensureCanConnect return the IP from a RemoteAddress
|
||||
// return error if this client must not connect
|
||||
func (m *Memberlist) ensureCanConnect(from net.Addr) error {
|
||||
if !m.config.IPMustBeChecked() {
|
||||
return nil
|
||||
}
|
||||
source := from.String()
|
||||
if source == "pipe" {
|
||||
return nil
|
||||
}
|
||||
host, _, err := net.SplitHostPort(source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ip := net.ParseIP(host)
|
||||
if ip == nil {
|
||||
return fmt.Errorf("Cannot parse IP from %s", host)
|
||||
}
|
||||
return m.config.IPAllowed(ip)
|
||||
}
|
||||
|
||||
func (m *Memberlist) handleAlive(buf []byte, from net.Addr) {
|
||||
if err := m.ensureCanConnect(from); err != nil {
|
||||
m.logger.Printf("[DEBUG] memberlist: Blocked alive message: %s %s", err, LogAddress(from))
|
||||
return
|
||||
}
|
||||
var live alive
|
||||
if err := decode(buf, &live); err != nil {
|
||||
m.logger.Printf("[ERR] memberlist: Failed to decode alive message: %s %s", err, LogAddress(from))
|
||||
return
|
||||
}
|
||||
if m.config.IPMustBeChecked() {
|
||||
innerIP := net.IP(live.Addr)
|
||||
if innerIP != nil {
|
||||
if err := m.config.IPAllowed(innerIP); err != nil {
|
||||
m.logger.Printf("[DEBUG] memberlist: Blocked alive.Addr=%s message from: %s %s", innerIP.String(), err, LogAddress(from))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For proto versions < 2, there is no port provided. Mask old
|
||||
// behavior by using the configured port
|
||||
|
@ -1113,16 +1148,17 @@ func (m *Memberlist) mergeRemoteState(join bool, remoteNodes []pushNodeState, us
|
|||
nodes := make([]*Node, len(remoteNodes))
|
||||
for idx, n := range remoteNodes {
|
||||
nodes[idx] = &Node{
|
||||
Name: n.Name,
|
||||
Addr: n.Addr,
|
||||
Port: n.Port,
|
||||
Meta: n.Meta,
|
||||
PMin: n.Vsn[0],
|
||||
PMax: n.Vsn[1],
|
||||
PCur: n.Vsn[2],
|
||||
DMin: n.Vsn[3],
|
||||
DMax: n.Vsn[4],
|
||||
DCur: n.Vsn[5],
|
||||
Name: n.Name,
|
||||
Addr: n.Addr,
|
||||
Port: n.Port,
|
||||
Meta: n.Meta,
|
||||
State: n.State,
|
||||
PMin: n.Vsn[0],
|
||||
PMax: n.Vsn[1],
|
||||
PCur: n.Vsn[2],
|
||||
DMin: n.Vsn[3],
|
||||
DMax: n.Vsn[4],
|
||||
DCur: n.Vsn[5],
|
||||
}
|
||||
}
|
||||
if err := m.config.Merge.NotifyMerge(nodes); err != nil {
|
||||
|
|
|
@ -106,7 +106,10 @@ func encryptPayload(vsn encryptionVersion, key []byte, msg []byte, data []byte,
|
|||
dst.WriteByte(byte(vsn))
|
||||
|
||||
// Add a random nonce
|
||||
io.CopyN(dst, rand.Reader, nonceSize)
|
||||
_, err = io.CopyN(dst, rand.Reader, nonceSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
afterNonce := dst.Len()
|
||||
|
||||
// Ensure we are correctly padded (only version 0)
|
||||
|
|
|
@ -13,27 +13,28 @@ import (
|
|||
metrics "github.com/armon/go-metrics"
|
||||
)
|
||||
|
||||
type nodeStateType int
|
||||
type NodeStateType int
|
||||
|
||||
const (
|
||||
stateAlive nodeStateType = iota
|
||||
stateSuspect
|
||||
stateDead
|
||||
stateLeft
|
||||
StateAlive NodeStateType = iota
|
||||
StateSuspect
|
||||
StateDead
|
||||
StateLeft
|
||||
)
|
||||
|
||||
// Node represents a node in the cluster.
|
||||
type Node struct {
|
||||
Name string
|
||||
Addr net.IP
|
||||
Port uint16
|
||||
Meta []byte // Metadata from the delegate for this node.
|
||||
PMin uint8 // Minimum protocol version this understands
|
||||
PMax uint8 // Maximum protocol version this understands
|
||||
PCur uint8 // Current version node is speaking
|
||||
DMin uint8 // Min protocol version for the delegate to understand
|
||||
DMax uint8 // Max protocol version for the delegate to understand
|
||||
DCur uint8 // Current version delegate is speaking
|
||||
Name string
|
||||
Addr net.IP
|
||||
Port uint16
|
||||
Meta []byte // Metadata from the delegate for this node.
|
||||
State NodeStateType // State of the node.
|
||||
PMin uint8 // Minimum protocol version this understands
|
||||
PMax uint8 // Maximum protocol version this understands
|
||||
PCur uint8 // Current version node is speaking
|
||||
DMin uint8 // Min protocol version for the delegate to understand
|
||||
DMax uint8 // Max protocol version for the delegate to understand
|
||||
DCur uint8 // Current version delegate is speaking
|
||||
}
|
||||
|
||||
// Address returns the host:port form of a node's address, suitable for use
|
||||
|
@ -60,7 +61,7 @@ func (n *Node) String() string {
|
|||
type nodeState struct {
|
||||
Node
|
||||
Incarnation uint32 // Last known incarnation number
|
||||
State nodeStateType // Current state
|
||||
State NodeStateType // Current state
|
||||
StateChange time.Time // Time last state change happened
|
||||
}
|
||||
|
||||
|
@ -77,7 +78,7 @@ func (n *nodeState) FullAddress() Address {
|
|||
}
|
||||
|
||||
func (n *nodeState) DeadOrLeft() bool {
|
||||
return n.State == stateDead || n.State == stateLeft
|
||||
return n.State == StateDead || n.State == StateLeft
|
||||
}
|
||||
|
||||
// ackHandler is used to register handlers for incoming acks and nacks.
|
||||
|
@ -321,7 +322,7 @@ func (m *Memberlist) probeNode(node *nodeState) {
|
|||
defer func() {
|
||||
m.awareness.ApplyDelta(awarenessDelta)
|
||||
}()
|
||||
if node.State == stateAlive {
|
||||
if node.State == StateAlive {
|
||||
if err := m.encodeAndSendMsg(node.FullAddress(), pingMsg, &ping); err != nil {
|
||||
m.logger.Printf("[ERR] memberlist: Failed to send ping: %s", err)
|
||||
if failedRemote(err) {
|
||||
|
@ -396,7 +397,7 @@ HANDLE_REMOTE_FAILURE:
|
|||
kNodes := kRandomNodes(m.config.IndirectChecks, m.nodes, func(n *nodeState) bool {
|
||||
return n.Name == m.config.Name ||
|
||||
n.Name == node.Name ||
|
||||
n.State != stateAlive
|
||||
n.State != StateAlive
|
||||
})
|
||||
m.nodeLock.RUnlock()
|
||||
|
||||
|
@ -573,10 +574,10 @@ func (m *Memberlist) gossip() {
|
|||
}
|
||||
|
||||
switch n.State {
|
||||
case stateAlive, stateSuspect:
|
||||
case StateAlive, StateSuspect:
|
||||
return false
|
||||
|
||||
case stateDead:
|
||||
case StateDead:
|
||||
return time.Since(n.StateChange) > m.config.GossipToTheDeadTime
|
||||
|
||||
default:
|
||||
|
@ -623,7 +624,7 @@ func (m *Memberlist) pushPull() {
|
|||
m.nodeLock.RLock()
|
||||
nodes := kRandomNodes(1, m.nodes, func(n *nodeState) bool {
|
||||
return n.Name == m.config.Name ||
|
||||
n.State != stateAlive
|
||||
n.State != StateAlive
|
||||
})
|
||||
m.nodeLock.RUnlock()
|
||||
|
||||
|
@ -681,7 +682,7 @@ func (m *Memberlist) verifyProtocol(remote []pushNodeState) error {
|
|||
|
||||
for _, rn := range remote {
|
||||
// If the node isn't alive, then skip it
|
||||
if rn.State != stateAlive {
|
||||
if rn.State != StateAlive {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -710,7 +711,7 @@ func (m *Memberlist) verifyProtocol(remote []pushNodeState) error {
|
|||
|
||||
for _, n := range m.nodes {
|
||||
// Ignore non-alive nodes
|
||||
if n.State != stateAlive {
|
||||
if n.State != StateAlive {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -969,6 +970,11 @@ func (m *Memberlist) aliveNode(a *alive, notify chan struct{}, bootstrap bool) {
|
|||
// store this node in our node map.
|
||||
var updatesNode bool
|
||||
if !ok {
|
||||
errCon := m.config.IPAllowed(a.Addr)
|
||||
if errCon != nil {
|
||||
m.logger.Printf("[WARN] memberlist: Rejected node %s (%v): %s", a.Node, net.IP(a.Addr), errCon)
|
||||
return
|
||||
}
|
||||
state = &nodeState{
|
||||
Node: Node{
|
||||
Name: a.Node,
|
||||
|
@ -976,7 +982,7 @@ func (m *Memberlist) aliveNode(a *alive, notify chan struct{}, bootstrap bool) {
|
|||
Port: a.Port,
|
||||
Meta: a.Meta,
|
||||
},
|
||||
State: stateDead,
|
||||
State: StateDead,
|
||||
}
|
||||
if len(a.Vsn) > 5 {
|
||||
state.PMin = a.Vsn[0]
|
||||
|
@ -1006,12 +1012,17 @@ func (m *Memberlist) aliveNode(a *alive, notify chan struct{}, bootstrap bool) {
|
|||
} else {
|
||||
// Check if this address is different than the existing node unless the old node is dead.
|
||||
if !bytes.Equal([]byte(state.Addr), a.Addr) || state.Port != a.Port {
|
||||
errCon := m.config.IPAllowed(a.Addr)
|
||||
if errCon != nil {
|
||||
m.logger.Printf("[WARN] memberlist: Rejected IP update from %v to %v for node %s: %s", a.Node, state.Addr, net.IP(a.Addr), errCon)
|
||||
return
|
||||
}
|
||||
// If DeadNodeReclaimTime is configured, check if enough time has elapsed since the node died.
|
||||
canReclaim := (m.config.DeadNodeReclaimTime > 0 &&
|
||||
time.Since(state.StateChange) > m.config.DeadNodeReclaimTime)
|
||||
|
||||
// Allow the address to be updated if a dead node is being replaced.
|
||||
if state.State == stateLeft || (state.State == stateDead && canReclaim) {
|
||||
if state.State == StateLeft || (state.State == StateDead && canReclaim) {
|
||||
m.logger.Printf("[INFO] memberlist: Updating address for left or failed node %s from %v:%d to %v:%d",
|
||||
state.Name, state.Addr, state.Port, net.IP(a.Addr), a.Port)
|
||||
updatesNode = true
|
||||
|
@ -1096,8 +1107,8 @@ func (m *Memberlist) aliveNode(a *alive, notify chan struct{}, bootstrap bool) {
|
|||
state.Meta = a.Meta
|
||||
state.Addr = a.Addr
|
||||
state.Port = a.Port
|
||||
if state.State != stateAlive {
|
||||
state.State = stateAlive
|
||||
if state.State != StateAlive {
|
||||
state.State = StateAlive
|
||||
state.StateChange = time.Now()
|
||||
}
|
||||
}
|
||||
|
@ -1107,7 +1118,7 @@ func (m *Memberlist) aliveNode(a *alive, notify chan struct{}, bootstrap bool) {
|
|||
|
||||
// Notify the delegate of any relevant updates
|
||||
if m.config.Events != nil {
|
||||
if oldState == stateDead || oldState == stateLeft {
|
||||
if oldState == StateDead || oldState == StateLeft {
|
||||
// if Dead/Left -> Alive, notify of join
|
||||
m.config.Events.NotifyJoin(&state.Node)
|
||||
|
||||
|
@ -1147,7 +1158,7 @@ func (m *Memberlist) suspectNode(s *suspect) {
|
|||
}
|
||||
|
||||
// Ignore non-alive nodes
|
||||
if state.State != stateAlive {
|
||||
if state.State != StateAlive {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1165,7 +1176,7 @@ func (m *Memberlist) suspectNode(s *suspect) {
|
|||
|
||||
// Update the state
|
||||
state.Incarnation = s.Incarnation
|
||||
state.State = stateSuspect
|
||||
state.State = StateSuspect
|
||||
changeTime := time.Now()
|
||||
state.StateChange = changeTime
|
||||
|
||||
|
@ -1189,7 +1200,7 @@ func (m *Memberlist) suspectNode(s *suspect) {
|
|||
fn := func(numConfirmations int) {
|
||||
m.nodeLock.Lock()
|
||||
state, ok := m.nodeMap[s.Node]
|
||||
timeout := ok && state.State == stateSuspect && state.StateChange == changeTime
|
||||
timeout := ok && state.State == StateSuspect && state.StateChange == changeTime
|
||||
m.nodeLock.Unlock()
|
||||
|
||||
if timeout {
|
||||
|
@ -1255,9 +1266,9 @@ func (m *Memberlist) deadNode(d *dead) {
|
|||
// If the dead message was send by the node itself, mark it is left
|
||||
// instead of dead.
|
||||
if d.Node == d.From {
|
||||
state.State = stateLeft
|
||||
state.State = StateLeft
|
||||
} else {
|
||||
state.State = stateDead
|
||||
state.State = StateDead
|
||||
}
|
||||
state.StateChange = time.Now()
|
||||
|
||||
|
@ -1272,7 +1283,7 @@ func (m *Memberlist) deadNode(d *dead) {
|
|||
func (m *Memberlist) mergeState(remote []pushNodeState) {
|
||||
for _, r := range remote {
|
||||
switch r.State {
|
||||
case stateAlive:
|
||||
case StateAlive:
|
||||
a := alive{
|
||||
Incarnation: r.Incarnation,
|
||||
Node: r.Name,
|
||||
|
@ -1283,14 +1294,14 @@ func (m *Memberlist) mergeState(remote []pushNodeState) {
|
|||
}
|
||||
m.aliveNode(&a, nil, false)
|
||||
|
||||
case stateLeft:
|
||||
case StateLeft:
|
||||
d := dead{Incarnation: r.Incarnation, Node: r.Name, From: r.Name}
|
||||
m.deadNode(&d)
|
||||
case stateDead:
|
||||
case StateDead:
|
||||
// If the remote node believes a node is dead, we prefer to
|
||||
// suspect that node instead of declaring it dead instantly
|
||||
fallthrough
|
||||
case stateSuspect:
|
||||
case StateSuspect:
|
||||
s := suspect{Incarnation: r.Incarnation, Node: r.Name, From: m.config.Name}
|
||||
m.suspectNode(&s)
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ func moveDeadNodes(nodes []*nodeState, gossipToTheDeadTime time.Duration) int {
|
|||
numDead := 0
|
||||
n := len(nodes)
|
||||
for i := 0; i < n-numDead; i++ {
|
||||
if nodes[i].State != stateDead {
|
||||
if nodes[i].State != StateDead {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -28,12 +28,17 @@ func (m *mergeDelegate) NotifyAlive(peer *memberlist.Node) error {
|
|||
}
|
||||
|
||||
func (m *mergeDelegate) nodeToMember(n *memberlist.Node) *Member {
|
||||
status := StatusNone
|
||||
if n.State == memberlist.StateLeft {
|
||||
status = StatusLeft
|
||||
}
|
||||
|
||||
return &Member{
|
||||
Name: n.Name,
|
||||
Addr: net.IP(n.Addr),
|
||||
Port: n.Port,
|
||||
Tags: m.serf.decodeTags(n.Meta),
|
||||
Status: StatusNone,
|
||||
Status: status,
|
||||
ProtocolMin: n.PMin,
|
||||
ProtocolMax: n.PMax,
|
||||
ProtocolCur: n.PCur,
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
language: go
|
||||
sudo: false
|
||||
go:
|
||||
- 1.13.x
|
||||
- tip
|
||||
|
||||
before_install:
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
- go get -t -v ./...
|
||||
|
||||
script:
|
||||
- $HOME/gopath/bin/goveralls -repotoken xnXqRGwgW3SXIguzxf90ZSK1GPYZPaGrw
|
||||
- ./go.test.sh
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# go-colorable
|
||||
|
||||
[![Godoc Reference](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable)
|
||||
[![Build Status](https://travis-ci.org/mattn/go-colorable.svg?branch=master)](https://travis-ci.org/mattn/go-colorable)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/mattn/go-colorable/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-colorable?branch=master)
|
||||
[![Codecov](https://codecov.io/gh/mattn/go-colorable/branch/master/graph/badge.svg)](https://codecov.io/gh/mattn/go-colorable)
|
||||
[![GoDoc](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable)
|
||||
[![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable)
|
||||
|
||||
Colorable writer for windows.
|
||||
|
|
|
@ -27,3 +27,11 @@ func NewColorableStdout() io.Writer {
|
|||
func NewColorableStderr() io.Writer {
|
||||
return os.Stderr
|
||||
}
|
||||
|
||||
// EnableColorsStdout enable colors if possible.
|
||||
func EnableColorsStdout(enabled *bool) func() {
|
||||
if enabled != nil {
|
||||
*enabled = true
|
||||
}
|
||||
return func() {}
|
||||
}
|
||||
|
|
|
@ -28,3 +28,11 @@ func NewColorableStdout() io.Writer {
|
|||
func NewColorableStderr() io.Writer {
|
||||
return os.Stderr
|
||||
}
|
||||
|
||||
// EnableColorsStdout enable colors if possible.
|
||||
func EnableColorsStdout(enabled *bool) func() {
|
||||
if enabled != nil {
|
||||
*enabled = true
|
||||
}
|
||||
return func() {}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ const (
|
|||
backgroundRed = 0x40
|
||||
backgroundIntensity = 0x80
|
||||
backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
|
||||
|
||||
cENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -78,6 +80,8 @@ var (
|
|||
procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo")
|
||||
procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo")
|
||||
procSetConsoleTitle = kernel32.NewProc("SetConsoleTitleW")
|
||||
procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
|
||||
procSetConsoleMode = kernel32.NewProc("SetConsoleMode")
|
||||
procCreateConsoleScreenBuffer = kernel32.NewProc("CreateConsoleScreenBuffer")
|
||||
)
|
||||
|
||||
|
@ -98,6 +102,10 @@ func NewColorable(file *os.File) io.Writer {
|
|||
}
|
||||
|
||||
if isatty.IsTerminal(file.Fd()) {
|
||||
var mode uint32
|
||||
if r, _, _ := procGetConsoleMode.Call(file.Fd(), uintptr(unsafe.Pointer(&mode))); r != 0 && mode&cENABLE_VIRTUAL_TERMINAL_PROCESSING != 0 {
|
||||
return file
|
||||
}
|
||||
var csbi consoleScreenBufferInfo
|
||||
handle := syscall.Handle(file.Fd())
|
||||
procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
|
||||
|
@ -1003,3 +1011,23 @@ func n256setup() {
|
|||
n256backAttr[i] = c.backgroundAttr()
|
||||
}
|
||||
}
|
||||
|
||||
// EnableColorsStdout enable colors if possible.
|
||||
func EnableColorsStdout(enabled *bool) func() {
|
||||
var mode uint32
|
||||
h := os.Stdout.Fd()
|
||||
if r, _, _ := procGetConsoleMode.Call(h, uintptr(unsafe.Pointer(&mode))); r != 0 {
|
||||
if r, _, _ = procSetConsoleMode.Call(h, uintptr(mode|cENABLE_VIRTUAL_TERMINAL_PROCESSING)); r != 0 {
|
||||
if enabled != nil {
|
||||
*enabled = true
|
||||
}
|
||||
return func() {
|
||||
procSetConsoleMode.Call(h, uintptr(mode))
|
||||
}
|
||||
}
|
||||
}
|
||||
if enabled != nil {
|
||||
*enabled = true
|
||||
}
|
||||
return func() {}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
module github.com/mattn/go-colorable
|
||||
|
||||
require github.com/mattn/go-isatty v0.0.8
|
||||
require (
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect
|
||||
)
|
||||
|
||||
go 1.13
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw=
|
||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
|
|
@ -4,9 +4,9 @@ set -e
|
|||
echo "" > coverage.txt
|
||||
|
||||
for d in $(go list ./... | grep -v vendor); do
|
||||
go test -v -race -coverprofile=profile.out -covermode=atomic $d
|
||||
go test -race -coverprofile=profile.out -covermode=atomic "$d"
|
||||
if [ -f profile.out ]; then
|
||||
cat profile.out >> coverage.txt
|
||||
rm profile.out
|
||||
fi
|
||||
done
|
||||
done
|
|
@ -1,2 +1,4 @@
|
|||
.idea
|
||||
coverage.txt
|
||||
gocomplete/gocomplete
|
||||
example/self/self
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
language: go
|
||||
sudo: false
|
||||
go:
|
||||
- 1.9
|
||||
- 1.8
|
||||
|
||||
before_install:
|
||||
- go get -u -t ./...
|
||||
- go get -u gopkg.in/alecthomas/gometalinter.v1
|
||||
- gometalinter.v1 --install
|
||||
- tip
|
||||
- 1.12.x
|
||||
- 1.11.x
|
||||
- 1.10.x
|
||||
|
||||
script:
|
||||
- gometalinter.v1 --config metalinter.json ./...
|
||||
- ./test.sh
|
||||
- go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
|
@ -28,6 +28,8 @@ type Args struct {
|
|||
// Directory gives the directory of the current written
|
||||
// last argument if it represents a file name being written.
|
||||
// in case that it is not, we fall back to the current directory.
|
||||
//
|
||||
// Deprecated.
|
||||
func (a Args) Directory() string {
|
||||
if info, err := os.Stat(a.Last); err == nil && info.IsDir() {
|
||||
return fixPathForm(a.Last, a.Last)
|
||||
|
@ -57,11 +59,20 @@ func newArgs(line string) Args {
|
|||
}
|
||||
}
|
||||
|
||||
// splitFields returns a list of fields from the given command line.
|
||||
// If the last character is space, it appends an empty field in the end
|
||||
// indicating that the field before it was completed.
|
||||
// If the last field is of the form "a=b", it splits it to two fields: "a", "b",
|
||||
// So it can be completed.
|
||||
func splitFields(line string) []string {
|
||||
parts := strings.Fields(line)
|
||||
|
||||
// Add empty field if the last field was completed.
|
||||
if len(line) > 0 && unicode.IsSpace(rune(line[len(line)-1])) {
|
||||
parts = append(parts, "")
|
||||
}
|
||||
|
||||
// Treat the last field if it is of the form "a=b"
|
||||
parts = splitLastEqual(parts)
|
||||
return parts
|
||||
}
|
||||
|
@ -74,16 +85,17 @@ func splitLastEqual(line []string) []string {
|
|||
return append(line[:len(line)-1], parts...)
|
||||
}
|
||||
|
||||
// from returns a copy of Args of all arguments after the i'th argument.
|
||||
func (a Args) from(i int) Args {
|
||||
if i > len(a.All) {
|
||||
i = len(a.All)
|
||||
if i >= len(a.All) {
|
||||
i = len(a.All) - 1
|
||||
}
|
||||
a.All = a.All[i:]
|
||||
a.All = a.All[i+1:]
|
||||
|
||||
if i > len(a.Completed) {
|
||||
i = len(a.Completed)
|
||||
if i >= len(a.Completed) {
|
||||
i = len(a.Completed) - 1
|
||||
}
|
||||
a.Completed = a.Completed[i:]
|
||||
a.Completed = a.Completed[i+1:]
|
||||
return a
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ func (f *CLI) AddFlags(flags *flag.FlagSet) {
|
|||
fmt.Sprintf("Uninstall completion for %s command", f.Name))
|
||||
}
|
||||
if flags.Lookup("y") == nil {
|
||||
flags.BoolVar(&f.yes, "y", false, "Don't prompt user for typing 'yes'")
|
||||
flags.BoolVar(&f.yes, "y", false, "Don't prompt user for typing 'yes' when installing completion")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,20 +10,25 @@ type bash struct {
|
|||
rc string
|
||||
}
|
||||
|
||||
func (b bash) Install(cmd, bin string) error {
|
||||
func (b bash) IsInstalled(cmd, bin string) bool {
|
||||
completeCmd := b.cmd(cmd, bin)
|
||||
if lineInFile(b.rc, completeCmd) {
|
||||
return lineInFile(b.rc, completeCmd)
|
||||
}
|
||||
|
||||
func (b bash) Install(cmd, bin string) error {
|
||||
if b.IsInstalled(cmd, bin) {
|
||||
return fmt.Errorf("already installed in %s", b.rc)
|
||||
}
|
||||
completeCmd := b.cmd(cmd, bin)
|
||||
return appendToFile(b.rc, completeCmd)
|
||||
}
|
||||
|
||||
func (b bash) Uninstall(cmd, bin string) error {
|
||||
completeCmd := b.cmd(cmd, bin)
|
||||
if !lineInFile(b.rc, completeCmd) {
|
||||
if !b.IsInstalled(cmd, bin) {
|
||||
return fmt.Errorf("does not installed in %s", b.rc)
|
||||
}
|
||||
|
||||
completeCmd := b.cmd(cmd, bin)
|
||||
return removeFromFile(b.rc, completeCmd)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,37 +14,56 @@ type fish struct {
|
|||
configDir string
|
||||
}
|
||||
|
||||
func (f fish) Install(cmd, bin string) error {
|
||||
completionFile := filepath.Join(f.configDir, "completions", fmt.Sprintf("%s.fish", cmd))
|
||||
completeCmd := f.cmd(cmd, bin)
|
||||
func (f fish) IsInstalled(cmd, bin string) bool {
|
||||
completionFile := f.getCompletionFilePath(cmd)
|
||||
if _, err := os.Stat(completionFile); err == nil {
|
||||
return fmt.Errorf("already installed at %s", completionFile)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (f fish) Install(cmd, bin string) error {
|
||||
if f.IsInstalled(cmd, bin) {
|
||||
return fmt.Errorf("already installed at %s", f.getCompletionFilePath(cmd))
|
||||
}
|
||||
|
||||
completionFile := f.getCompletionFilePath(cmd)
|
||||
completeCmd, err := f.cmd(cmd, bin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return createFile(completionFile, completeCmd)
|
||||
}
|
||||
|
||||
func (f fish) Uninstall(cmd, bin string) error {
|
||||
completionFile := filepath.Join(f.configDir, "completions", fmt.Sprintf("%s.fish", cmd))
|
||||
if _, err := os.Stat(completionFile); err != nil {
|
||||
if !f.IsInstalled(cmd, bin) {
|
||||
return fmt.Errorf("does not installed in %s", f.configDir)
|
||||
}
|
||||
|
||||
completionFile := f.getCompletionFilePath(cmd)
|
||||
return os.Remove(completionFile)
|
||||
}
|
||||
|
||||
func (f fish) cmd(cmd, bin string) string {
|
||||
func (f fish) getCompletionFilePath(cmd string) string {
|
||||
return filepath.Join(f.configDir, "completions", fmt.Sprintf("%s.fish", cmd))
|
||||
}
|
||||
|
||||
func (f fish) cmd(cmd, bin string) (string, error) {
|
||||
var buf bytes.Buffer
|
||||
params := struct{ Cmd, Bin string }{cmd, bin}
|
||||
template.Must(template.New("cmd").Parse(`
|
||||
tmpl := template.Must(template.New("cmd").Parse(`
|
||||
function __complete_{{.Cmd}}
|
||||
set -lx COMP_LINE (string join ' ' (commandline -o))
|
||||
test (commandline -ct) = ""
|
||||
set -lx COMP_LINE (commandline -cp)
|
||||
test -z (commandline -ct)
|
||||
and set COMP_LINE "$COMP_LINE "
|
||||
{{.Bin}}
|
||||
end
|
||||
complete -c {{.Cmd}} -a "(__complete_{{.Cmd}})"
|
||||
`)).Execute(&buf, params)
|
||||
|
||||
return string(buf.Bytes())
|
||||
complete -f -c {{.Cmd}} -a "(__complete_{{.Cmd}})"
|
||||
`))
|
||||
err := tmpl.Execute(&buf, params)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
|
|
@ -5,11 +5,13 @@ import (
|
|||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/hashicorp/go-multierror"
|
||||
)
|
||||
|
||||
type installer interface {
|
||||
IsInstalled(cmd, bin string) bool
|
||||
Install(cmd, bin string) error
|
||||
Uninstall(cmd, bin string) error
|
||||
}
|
||||
|
@ -36,6 +38,24 @@ func Install(cmd string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// IsInstalled returns true if the completion
|
||||
// for the given cmd is installed.
|
||||
func IsInstalled(cmd string) bool {
|
||||
bin, err := getBinaryPath()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, i := range installers() {
|
||||
installed := i.IsInstalled(cmd, bin)
|
||||
if installed {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Uninstall complete command given:
|
||||
// cmd: is the command name
|
||||
func Uninstall(cmd string) error {
|
||||
|
@ -51,7 +71,7 @@ func Uninstall(cmd string) error {
|
|||
for _, i := range is {
|
||||
errI := i.Uninstall(cmd, bin)
|
||||
if errI != nil {
|
||||
multierror.Append(err, errI)
|
||||
err = multierror.Append(err, errI)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +79,16 @@ func Uninstall(cmd string) error {
|
|||
}
|
||||
|
||||
func installers() (i []installer) {
|
||||
for _, rc := range [...]string{".bashrc", ".bash_profile", ".bash_login", ".profile"} {
|
||||
// The list of bash config files candidates where it is
|
||||
// possible to install the completion command.
|
||||
var bashConfFiles []string
|
||||
switch runtime.GOOS {
|
||||
case "darwin":
|
||||
bashConfFiles = []string{".bash_profile"}
|
||||
default:
|
||||
bashConfFiles = []string{".bashrc", ".bash_profile", ".bash_login", ".profile"}
|
||||
}
|
||||
for _, rc := range bashConfFiles {
|
||||
if f := rcFile(rc); f != "" {
|
||||
i = append(i, bash{f})
|
||||
break
|
||||
|
|
|
@ -115,7 +115,10 @@ func removeContentToTempFile(name, content string) (string, error) {
|
|||
if str == content {
|
||||
continue
|
||||
}
|
||||
wf.WriteString(str + "\n")
|
||||
_, err = wf.WriteString(str + "\n")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
prefix = prefix[:0]
|
||||
}
|
||||
return wf.Name(), nil
|
||||
|
|
|
@ -11,12 +11,17 @@ type zsh struct {
|
|||
rc string
|
||||
}
|
||||
|
||||
func (z zsh) Install(cmd, bin string) error {
|
||||
func (z zsh) IsInstalled(cmd, bin string) bool {
|
||||
completeCmd := z.cmd(cmd, bin)
|
||||
if lineInFile(z.rc, completeCmd) {
|
||||
return lineInFile(z.rc, completeCmd)
|
||||
}
|
||||
|
||||
func (z zsh) Install(cmd, bin string) error {
|
||||
if z.IsInstalled(cmd, bin) {
|
||||
return fmt.Errorf("already installed in %s", z.rc)
|
||||
}
|
||||
|
||||
completeCmd := z.cmd(cmd, bin)
|
||||
bashCompInit := "autoload -U +X bashcompinit && bashcompinit"
|
||||
if !lineInFile(z.rc, bashCompInit) {
|
||||
completeCmd = bashCompInit + "\n" + completeCmd
|
||||
|
@ -26,11 +31,11 @@ func (z zsh) Install(cmd, bin string) error {
|
|||
}
|
||||
|
||||
func (z zsh) Uninstall(cmd, bin string) error {
|
||||
completeCmd := z.cmd(cmd, bin)
|
||||
if !lineInFile(z.rc, completeCmd) {
|
||||
if !z.IsInstalled(cmd, bin) {
|
||||
return fmt.Errorf("does not installed in %s", z.rc)
|
||||
}
|
||||
|
||||
completeCmd := z.cmd(cmd, bin)
|
||||
return removeFromFile(z.rc, completeCmd)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
// Package complete provides a tool for bash writing bash completion in go.
|
||||
//
|
||||
// Writing bash completion scripts is a hard work. This package provides an easy way
|
||||
// to create bash completion scripts for any command, and also an easy way to install/uninstall
|
||||
// the completion of the command.
|
||||
package complete
|
||||
|
||||
import (
|
||||
|
@ -10,14 +5,16 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/posener/complete/cmd"
|
||||
"github.com/posener/complete/match"
|
||||
)
|
||||
|
||||
const (
|
||||
envComplete = "COMP_LINE"
|
||||
envDebug = "COMP_DEBUG"
|
||||
envLine = "COMP_LINE"
|
||||
envPoint = "COMP_POINT"
|
||||
envDebug = "COMP_DEBUG"
|
||||
)
|
||||
|
||||
// Complete structs define completion for a command with CLI options
|
||||
|
@ -55,13 +52,18 @@ func (c *Complete) Run() bool {
|
|||
// For installation: it assumes that flags were added and parsed before
|
||||
// it was called.
|
||||
func (c *Complete) Complete() bool {
|
||||
line, ok := getLine()
|
||||
line, point, ok := getEnv()
|
||||
if !ok {
|
||||
// make sure flags parsed,
|
||||
// in case they were not added in the main program
|
||||
return c.CLI.Run()
|
||||
}
|
||||
Log("Completing line: %s", line)
|
||||
|
||||
if point >= 0 && point < len(line) {
|
||||
line = line[:point]
|
||||
}
|
||||
|
||||
Log("Completing phrase: %s", line)
|
||||
a := newArgs(line)
|
||||
Log("Completing last field: %s", a.Last)
|
||||
options := c.Command.Predict(a)
|
||||
|
@ -70,7 +72,7 @@ func (c *Complete) Complete() bool {
|
|||
// filter only options that match the last argument
|
||||
matches := []string{}
|
||||
for _, option := range options {
|
||||
if match.Prefix(option, a.Last) {
|
||||
if strings.HasPrefix(option, a.Last) {
|
||||
matches = append(matches, option)
|
||||
}
|
||||
}
|
||||
|
@ -79,12 +81,19 @@ func (c *Complete) Complete() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func getLine() (string, bool) {
|
||||
line := os.Getenv(envComplete)
|
||||
func getEnv() (line string, point int, ok bool) {
|
||||
line = os.Getenv(envLine)
|
||||
if line == "" {
|
||||
return "", false
|
||||
return
|
||||
}
|
||||
return line, true
|
||||
point, err := strconv.Atoi(os.Getenv(envPoint))
|
||||
if err != nil {
|
||||
// If failed parsing point for some reason, set it to point
|
||||
// on the end of the line.
|
||||
Log("Failed parsing point %s: %v", os.Getenv(envPoint), err)
|
||||
point = len(line)
|
||||
}
|
||||
return line, point, true
|
||||
}
|
||||
|
||||
func (c *Complete) output(options []string) {
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
Package complete provides a tool for bash writing bash completion in go, and bash completion for the go command line.
|
||||
|
||||
Writing bash completion scripts is a hard work. This package provides an easy way
|
||||
to create bash completion scripts for any command, and also an easy way to install/uninstall
|
||||
the completion of the command.
|
||||
|
||||
Go Command Bash Completion
|
||||
|
||||
In ./cmd/gocomplete there is an example for bash completion for the `go` command line.
|
||||
|
||||
This is an example that uses the `complete` package on the `go` command - the `complete` package
|
||||
can also be used to implement any completions, see #usage.
|
||||
|
||||
Install
|
||||
|
||||
1. Type in your shell:
|
||||
|
||||
go get -u github.com/posener/complete/gocomplete
|
||||
gocomplete -install
|
||||
|
||||
2. Restart your shell
|
||||
|
||||
Uninstall by `gocomplete -uninstall`
|
||||
|
||||
Features
|
||||
|
||||
- Complete `go` command, including sub commands and all flags.
|
||||
- Complete packages names or `.go` files when necessary.
|
||||
- Complete test names after `-run` flag.
|
||||
|
||||
Complete package
|
||||
|
||||
Supported shells:
|
||||
|
||||
- [x] bash
|
||||
- [x] zsh
|
||||
- [x] fish
|
||||
|
||||
Usage
|
||||
|
||||
Assuming you have program called `run` and you want to have bash completion
|
||||
for it, meaning, if you type `run` then space, then press the `Tab` key,
|
||||
the shell will suggest relevant complete options.
|
||||
|
||||
In that case, we will create a program called `runcomplete`, a go program,
|
||||
with a `func main()` and so, that will make the completion of the `run`
|
||||
program. Once the `runcomplete` will be in a binary form, we could
|
||||
`runcomplete -install` and that will add to our shell all the bash completion
|
||||
options for `run`.
|
||||
|
||||
So here it is:
|
||||
|
||||
import "github.com/posener/complete"
|
||||
|
||||
func main() {
|
||||
|
||||
// create a Command object, that represents the command we want
|
||||
// to complete.
|
||||
run := complete.Command{
|
||||
|
||||
// Sub defines a list of sub commands of the program,
|
||||
// this is recursive, since every command is of type command also.
|
||||
Sub: complete.Commands{
|
||||
|
||||
// add a build sub command
|
||||
"build": complete.Command {
|
||||
|
||||
// define flags of the build sub command
|
||||
Flags: complete.Flags{
|
||||
// build sub command has a flag '-cpus', which
|
||||
// expects number of cpus after it. in that case
|
||||
// anything could complete this flag.
|
||||
"-cpus": complete.PredictAnything,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// define flags of the 'run' main command
|
||||
Flags: complete.Flags{
|
||||
// a flag -o, which expects a file ending with .out after
|
||||
// it, the tab completion will auto complete for files matching
|
||||
// the given pattern.
|
||||
"-o": complete.PredictFiles("*.out"),
|
||||
},
|
||||
|
||||
// define global flags of the 'run' main command
|
||||
// those will show up also when a sub command was entered in the
|
||||
// command line
|
||||
GlobalFlags: complete.Flags{
|
||||
|
||||
// a flag '-h' which does not expects anything after it
|
||||
"-h": complete.PredictNothing,
|
||||
},
|
||||
}
|
||||
|
||||
// run the command completion, as part of the main() function.
|
||||
// this triggers the autocompletion when needed.
|
||||
// name must be exactly as the binary that we want to complete.
|
||||
complete.New("run", run).Run()
|
||||
}
|
||||
|
||||
Self completing program
|
||||
|
||||
In case that the program that we want to complete is written in go we
|
||||
can make it self completing.
|
||||
Here is an example: ./example/self/main.go .
|
||||
|
||||
*/
|
||||
package complete
|
|
@ -0,0 +1,8 @@
|
|||
module github.com/posener/complete
|
||||
|
||||
require (
|
||||
github.com/hashicorp/go-multierror v1.0.0
|
||||
github.com/stretchr/testify v1.4.0
|
||||
)
|
||||
|
||||
go 1.13
|
|
@ -0,0 +1,15 @@
|
|||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"badges": {
|
||||
"travis_ci": true,
|
||||
"code_cov": true,
|
||||
"golang_ci": true,
|
||||
"go_doc": true,
|
||||
"goreadme": true
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package complete
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
@ -15,7 +14,7 @@ import (
|
|||
var Log = getLogger()
|
||||
|
||||
func getLogger() func(format string, args ...interface{}) {
|
||||
var logfile io.Writer = ioutil.Discard
|
||||
var logfile = ioutil.Discard
|
||||
if os.Getenv(envDebug) != "" {
|
||||
logfile = os.Stderr
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package match
|
||||
|
||||
import "strings"
|
||||
|
||||
// File returns true if prefix can match the file
|
||||
func File(file, prefix string) bool {
|
||||
// special case for current directory completion
|
||||
if file == "./" && (prefix == "." || prefix == "") {
|
||||
return true
|
||||
}
|
||||
if prefix == "." && strings.HasPrefix(file, ".") {
|
||||
return true
|
||||
}
|
||||
|
||||
file = strings.TrimPrefix(file, "./")
|
||||
prefix = strings.TrimPrefix(prefix, "./")
|
||||
|
||||
return strings.HasPrefix(file, prefix)
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package match
|
||||
|
||||
// Match matches two strings
|
||||
// it is used for comparing a term to the last typed
|
||||
// word, the prefix, and see if it is a possible auto complete option.
|
||||
type Match func(term, prefix string) bool
|
|
@ -1,9 +0,0 @@
|
|||
package match
|
||||
|
||||
import "strings"
|
||||
|
||||
// Prefix is a simple Matcher, if the word is it's prefix, there is a match
|
||||
// Match returns true if a has the prefix as prefix
|
||||
func Prefix(long, prefix string) bool {
|
||||
return strings.HasPrefix(long, prefix)
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
"Vendor": true,
|
||||
"DisableAll": true,
|
||||
"Enable": [
|
||||
"gofmt",
|
||||
"goimports",
|
||||
"interfacer",
|
||||
"goconst",
|
||||
"misspell",
|
||||
"unconvert",
|
||||
"gosimple",
|
||||
"golint",
|
||||
"structcheck",
|
||||
"deadcode",
|
||||
"vet"
|
||||
],
|
||||
"Exclude": [
|
||||
"initTests is unused"
|
||||
],
|
||||
"Deadline": "2m"
|
||||
}
|
|
@ -5,8 +5,6 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/posener/complete/match"
|
||||
)
|
||||
|
||||
// PredictDirs will search for directories in the given started to be typed
|
||||
|
@ -53,7 +51,7 @@ func predictFiles(a Args, pattern string, allowFiles bool) []string {
|
|||
return nil
|
||||
}
|
||||
|
||||
dir := a.Directory()
|
||||
dir := directory(a.Last)
|
||||
files := listFiles(dir, pattern, allowFiles)
|
||||
|
||||
// add dir if match
|
||||
|
@ -62,6 +60,19 @@ func predictFiles(a Args, pattern string, allowFiles bool) []string {
|
|||
return PredictFilesSet(files).Predict(a)
|
||||
}
|
||||
|
||||
// directory gives the directory of the given partial path
|
||||
// in case that it is not, we fall back to the current directory.
|
||||
func directory(path string) string {
|
||||
if info, err := os.Stat(path); err == nil && info.IsDir() {
|
||||
return fixPathForm(path, path)
|
||||
}
|
||||
dir := filepath.Dir(path)
|
||||
if info, err := os.Stat(dir); err == nil && info.IsDir() {
|
||||
return fixPathForm(path, dir)
|
||||
}
|
||||
return "./"
|
||||
}
|
||||
|
||||
// PredictFilesSet predict according to file rules to a given set of file names
|
||||
func PredictFilesSet(files []string) PredictFunc {
|
||||
return func(a Args) (prediction []string) {
|
||||
|
@ -70,7 +81,7 @@ func PredictFilesSet(files []string) PredictFunc {
|
|||
f = fixPathForm(a.Last, f)
|
||||
|
||||
// test matching of file to the argument
|
||||
if match.File(f, a.Last) {
|
||||
if matchFile(f, a.Last) {
|
||||
prediction = append(prediction, f)
|
||||
}
|
||||
}
|
||||
|
@ -106,3 +117,58 @@ func listFiles(dir, pattern string, allowFiles bool) []string {
|
|||
}
|
||||
return list
|
||||
}
|
||||
|
||||
// MatchFile returns true if prefix can match the file
|
||||
func matchFile(file, prefix string) bool {
|
||||
// special case for current directory completion
|
||||
if file == "./" && (prefix == "." || prefix == "") {
|
||||
return true
|
||||
}
|
||||
if prefix == "." && strings.HasPrefix(file, ".") {
|
||||
return true
|
||||
}
|
||||
|
||||
file = strings.TrimPrefix(file, "./")
|
||||
prefix = strings.TrimPrefix(prefix, "./")
|
||||
|
||||
return strings.HasPrefix(file, prefix)
|
||||
}
|
||||
|
||||
// fixPathForm changes a file name to a relative name
|
||||
func fixPathForm(last string, file string) string {
|
||||
// get wording directory for relative name
|
||||
workDir, err := os.Getwd()
|
||||
if err != nil {
|
||||
return file
|
||||
}
|
||||
|
||||
abs, err := filepath.Abs(file)
|
||||
if err != nil {
|
||||
return file
|
||||
}
|
||||
|
||||
// if last is absolute, return path as absolute
|
||||
if filepath.IsAbs(last) {
|
||||
return fixDirPath(abs)
|
||||
}
|
||||
|
||||
rel, err := filepath.Rel(workDir, abs)
|
||||
if err != nil {
|
||||
return file
|
||||
}
|
||||
|
||||
// fix ./ prefix of path
|
||||
if rel != "." && strings.HasPrefix(last, ".") {
|
||||
rel = "./" + rel
|
||||
}
|
||||
|
||||
return fixDirPath(rel)
|
||||
}
|
||||
|
||||
func fixDirPath(path string) string {
|
||||
info, err := os.Stat(path)
|
||||
if err == nil && info.IsDir() && !strings.HasSuffix(path, "/") {
|
||||
path += "/"
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
|
|
@ -1,27 +1,29 @@
|
|||
# complete
|
||||
|
||||
A tool for bash writing bash completion in go, and bash completion for the go command line.
|
||||
|
||||
[![Build Status](https://travis-ci.org/posener/complete.svg?branch=master)](https://travis-ci.org/posener/complete)
|
||||
[![codecov](https://codecov.io/gh/posener/complete/branch/master/graph/badge.svg)](https://codecov.io/gh/posener/complete)
|
||||
[![golangci](https://golangci.com/badges/github.com/posener/complete.svg)](https://golangci.com/r/github.com/posener/complete)
|
||||
[![GoDoc](https://godoc.org/github.com/posener/complete?status.svg)](http://godoc.org/github.com/posener/complete)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/posener/complete)](https://goreportcard.com/report/github.com/posener/complete)
|
||||
[![goreadme](https://goreadme.herokuapp.com/badge/posener/complete.svg)](https://goreadme.herokuapp.com)
|
||||
|
||||
Package complete provides a tool for bash writing bash completion in go, and bash completion for the go command line.
|
||||
|
||||
Writing bash completion scripts is a hard work. This package provides an easy way
|
||||
to create bash completion scripts for any command, and also an easy way to install/uninstall
|
||||
the completion of the command.
|
||||
|
||||
## go command bash completion
|
||||
#### Go Command Bash Completion
|
||||
|
||||
In [gocomplete](./gocomplete) there is an example for bash completion for the `go` command line.
|
||||
In [./cmd/gocomplete](./cmd/gocomplete) there is an example for bash completion for the `go` command line.
|
||||
|
||||
This is an example that uses the `complete` package on the `go` command - the `complete` package
|
||||
can also be used to implement any completions, see [Usage](#usage).
|
||||
can also be used to implement any completions, see #usage.
|
||||
|
||||
### Install
|
||||
#### Install
|
||||
|
||||
1. Type in your shell:
|
||||
```
|
||||
|
||||
```go
|
||||
go get -u github.com/posener/complete/gocomplete
|
||||
gocomplete -install
|
||||
```
|
||||
|
@ -30,13 +32,13 @@ gocomplete -install
|
|||
|
||||
Uninstall by `gocomplete -uninstall`
|
||||
|
||||
### Features
|
||||
#### Features
|
||||
|
||||
- Complete `go` command, including sub commands and all flags.
|
||||
- Complete packages names or `.go` files when necessary.
|
||||
- Complete test names after `-run` flag.
|
||||
|
||||
## complete package
|
||||
#### Complete package
|
||||
|
||||
Supported shells:
|
||||
|
||||
|
@ -44,7 +46,7 @@ Supported shells:
|
|||
- [x] zsh
|
||||
- [x] fish
|
||||
|
||||
### Usage
|
||||
#### Usage
|
||||
|
||||
Assuming you have program called `run` and you want to have bash completion
|
||||
for it, meaning, if you type `run` then space, then press the `Tab` key,
|
||||
|
@ -52,7 +54,7 @@ the shell will suggest relevant complete options.
|
|||
|
||||
In that case, we will create a program called `runcomplete`, a go program,
|
||||
with a `func main()` and so, that will make the completion of the `run`
|
||||
program. Once the `runcomplete` will be in a binary form, we could
|
||||
program. Once the `runcomplete` will be in a binary form, we could
|
||||
`runcomplete -install` and that will add to our shell all the bash completion
|
||||
options for `run`.
|
||||
|
||||
|
@ -109,9 +111,21 @@ func main() {
|
|||
}
|
||||
```
|
||||
|
||||
### Self completing program
|
||||
#### Self completing program
|
||||
|
||||
In case that the program that we want to complete is written in go we
|
||||
can make it self completing.
|
||||
Here is an example: [./example/self/main.go](./example/self/main.go) .
|
||||
|
||||
Here is an [example](./example/self/main.go)
|
||||
## Sub Packages
|
||||
|
||||
* [cmd](./cmd): Package cmd used for command line options for the complete tool
|
||||
|
||||
* [gocomplete](./gocomplete): Package main is complete tool for the go command line
|
||||
|
||||
* [match](./match): Package match contains matchers that decide if to apply completion.
|
||||
|
||||
|
||||
---
|
||||
|
||||
Created by [goreadme](https://github.com/apps/goreadme)
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package complete
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// fixPathForm changes a file name to a relative name
|
||||
func fixPathForm(last string, file string) string {
|
||||
// get wording directory for relative name
|
||||
workDir, err := os.Getwd()
|
||||
if err != nil {
|
||||
return file
|
||||
}
|
||||
|
||||
abs, err := filepath.Abs(file)
|
||||
if err != nil {
|
||||
return file
|
||||
}
|
||||
|
||||
// if last is absolute, return path as absolute
|
||||
if filepath.IsAbs(last) {
|
||||
return fixDirPath(abs)
|
||||
}
|
||||
|
||||
rel, err := filepath.Rel(workDir, abs)
|
||||
if err != nil {
|
||||
return file
|
||||
}
|
||||
|
||||
// fix ./ prefix of path
|
||||
if rel != "." && strings.HasPrefix(last, ".") {
|
||||
rel = "./" + rel
|
||||
}
|
||||
|
||||
return fixDirPath(rel)
|
||||
}
|
||||
|
||||
func fixDirPath(path string) string {
|
||||
info, err := os.Stat(path)
|
||||
if err == nil && info.IsDir() && !strings.HasSuffix(path, "/") {
|
||||
path += "/"
|
||||
}
|
||||
return path
|
||||
}
|
|
@ -114,6 +114,15 @@ var ARM struct {
|
|||
_ 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.
|
||||
//
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2020 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build mips64 mips64le
|
||||
|
||||
package cpu
|
||||
|
||||
// HWCAP bits. These are exposed by the Linux kernel 5.4.
|
||||
const (
|
||||
// CPU features
|
||||
hwcap_MIPS_MSA = 1 << 1
|
||||
)
|
||||
|
||||
func doinit() {
|
||||
// HWCAP feature bits
|
||||
MIPS64X.HasMSA = isSet(hwCap, hwcap_MIPS_MSA)
|
||||
}
|
||||
|
||||
func isSet(hwc uint, value uint) bool {
|
||||
return hwc&value != 0
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,!arm,!arm64,!ppc64,!ppc64le,!s390x
|
||||
// +build linux,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le,!s390x
|
||||
|
||||
package cpu
|
||||
|
||||
|
|
|
@ -149,6 +149,17 @@ To add a constant, add the header that includes it to the appropriate variable.
|
|||
Then, edit the regex (if necessary) to match the desired constant. Avoid making
|
||||
the regex too broad to avoid matching unintended constants.
|
||||
|
||||
### mkmerge.go
|
||||
|
||||
This program is used to extract duplicate const, func, and type declarations
|
||||
from the generated architecture-specific files listed below, and merge these
|
||||
into a common file for each OS.
|
||||
|
||||
The merge is performed in the following steps:
|
||||
1. Construct the set of common code that is idential in all architecture-specific files.
|
||||
2. Write this common code to the merged file.
|
||||
3. Remove the common code from all architecture-specific files.
|
||||
|
||||
|
||||
## Generated files
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package unix
|
||||
|
||||
const (
|
||||
DLT_HHDLC = 0x79
|
||||
IFF_SMART = 0x20
|
||||
IFT_1822 = 0x2
|
||||
IFT_A12MPPSWITCH = 0x82
|
||||
|
@ -210,13 +211,18 @@ const (
|
|||
IFT_XETHER = 0x1a
|
||||
IPPROTO_MAXID = 0x34
|
||||
IPV6_FAITH = 0x1d
|
||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||
IP_FAITH = 0x16
|
||||
IP_MAX_SOURCE_FILTER = 0x400
|
||||
IP_MIN_MEMBERSHIPS = 0x1f
|
||||
MAP_NORESERVE = 0x40
|
||||
MAP_RENAME = 0x20
|
||||
NET_RT_MAXID = 0x6
|
||||
RTF_PRCLONING = 0x10000
|
||||
RTM_OLDADD = 0x9
|
||||
RTM_OLDDEL = 0xa
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_NORTREF = 0x2
|
||||
SIOCADDRT = 0x8030720a
|
||||
SIOCALIFADDR = 0x8118691b
|
||||
SIOCDELRT = 0x8030720b
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
package unix
|
||||
|
||||
const (
|
||||
DLT_HHDLC = 0x79
|
||||
IFF_SMART = 0x20
|
||||
IFT_1822 = 0x2
|
||||
IFT_A12MPPSWITCH = 0x82
|
||||
|
@ -210,13 +211,18 @@ const (
|
|||
IFT_XETHER = 0x1a
|
||||
IPPROTO_MAXID = 0x34
|
||||
IPV6_FAITH = 0x1d
|
||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||
IP_FAITH = 0x16
|
||||
IP_MAX_SOURCE_FILTER = 0x400
|
||||
IP_MIN_MEMBERSHIPS = 0x1f
|
||||
MAP_NORESERVE = 0x40
|
||||
MAP_RENAME = 0x20
|
||||
NET_RT_MAXID = 0x6
|
||||
RTF_PRCLONING = 0x10000
|
||||
RTM_OLDADD = 0x9
|
||||
RTM_OLDDEL = 0xa
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_NORTREF = 0x2
|
||||
SIOCADDRT = 0x8040720a
|
||||
SIOCALIFADDR = 0x8118691b
|
||||
SIOCDELRT = 0x8040720b
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2020 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
|
||||
// them here for backwards compatibility.
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
DLT_HHDLC = 0x79
|
||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||
IP_MAX_SOURCE_FILTER = 0x400
|
||||
IP_MIN_MEMBERSHIPS = 0x1f
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_NORTREF = 0x2
|
||||
)
|
|
@ -124,7 +124,7 @@ freebsd_arm)
|
|||
freebsd_arm64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
netbsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
|
@ -190,6 +190,12 @@ solaris_amd64)
|
|||
mksysnum=
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
illumos_amd64)
|
||||
mksyscall="go run mksyscall_solaris.go"
|
||||
mkerrors=
|
||||
mksysnum=
|
||||
mktypes=
|
||||
;;
|
||||
*)
|
||||
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
|
||||
exit 1
|
||||
|
@ -217,6 +223,11 @@ esac
|
|||
echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
||||
# 1.13 and later, syscalls via libSystem (including syscallPtr)
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH,go1.13 syscall_darwin.1_13.go |gofmt >zsyscall_$GOOSARCH.1_13.go";
|
||||
elif [ "$GOOS" == "illumos" ]; then
|
||||
# illumos code generation requires a --illumos switch
|
||||
echo "$mksyscall -illumos -tags illumos,$GOARCH syscall_illumos.go |gofmt > zsyscall_illumos_$GOARCH.go";
|
||||
# illumos implies solaris, so solaris code generation is also required
|
||||
echo "$mksyscall -tags solaris,$GOARCH syscall_solaris.go syscall_solaris_$GOARCH.go |gofmt >zsyscall_solaris_$GOARCH.go";
|
||||
else
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
||||
fi
|
||||
|
|
|
@ -105,6 +105,7 @@ includes_FreeBSD='
|
|||
#include <sys/capsicum.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -199,6 +200,7 @@ struct ltchars {
|
|||
#include <linux/filter.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/fscrypt.h>
|
||||
#include <linux/fsverity.h>
|
||||
#include <linux/genetlink.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/icmpv6.h>
|
||||
|
@ -280,6 +282,11 @@ struct ltchars {
|
|||
// for the tipc_subscr timeout __u32 field.
|
||||
#undef TIPC_WAIT_FOREVER
|
||||
#define TIPC_WAIT_FOREVER 0xffffffff
|
||||
|
||||
// Copied from linux/l2tp.h
|
||||
// Including linux/l2tp.h here causes conflicts between linux/in.h
|
||||
// and netinet/in.h included via net/route.h above.
|
||||
#define IPPROTO_L2TP 115
|
||||
'
|
||||
|
||||
includes_NetBSD='
|
||||
|
@ -479,6 +486,7 @@ ccflags="$@"
|
|||
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
|
||||
$2 ~ /^MODULE_INIT_/ ||
|
||||
$2 !~ "NLA_TYPE_MASK" &&
|
||||
$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
|
||||
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
||||
$2 ~ /^SIOC/ ||
|
||||
$2 ~ /^TIOC/ ||
|
||||
|
@ -486,8 +494,9 @@ ccflags="$@"
|
|||
$2 ~ /^TCSET/ ||
|
||||
$2 ~ /^TC(FLSH|SBRKP?|XONC)$/ ||
|
||||
$2 !~ "RTF_BITS" &&
|
||||
$2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
|
||||
$2 ~ /^(IFF|IFT|NET_RT|RTM(GRP)?|RTF|RTV|RTA|RTAX)_/ ||
|
||||
$2 ~ /^BIOC/ ||
|
||||
$2 ~ /^DIOC/ ||
|
||||
$2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ ||
|
||||
$2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
|
||||
$2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
|
||||
|
@ -499,7 +508,8 @@ ccflags="$@"
|
|||
$2 ~ /^CAP_/ ||
|
||||
$2 ~ /^ALG_/ ||
|
||||
$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE)/ ||
|
||||
$2 ~ /^FS_IOC_.*ENCRYPTION/ ||
|
||||
$2 ~ /^FS_IOC_.*(ENCRYPTION|VERITY|GETFLAGS)/ ||
|
||||
$2 ~ /^FS_VERITY_/ ||
|
||||
$2 ~ /^FSCRYPT_/ ||
|
||||
$2 ~ /^GRND_/ ||
|
||||
$2 ~ /^RND/ ||
|
||||
|
|
|
@ -521,10 +521,6 @@ func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) {
|
|||
return ptrace(PTRACE_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0)
|
||||
}
|
||||
|
||||
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
|
||||
return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
||||
}
|
||||
|
||||
func PtraceGetRegs(pid int, regsout *Reg) (err error) {
|
||||
return ptrace(PTRACE_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0)
|
||||
}
|
||||
|
|
|
@ -55,6 +55,10 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
|
||||
return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
||||
}
|
||||
|
||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
||||
ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint32(countin)}
|
||||
err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
||||
|
|
|
@ -55,6 +55,10 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
|
||||
return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
||||
}
|
||||
|
||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
||||
ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint64(countin)}
|
||||
err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
// 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.
|
||||
|
||||
// illumos system calls not present on Solaris.
|
||||
|
||||
// +build amd64,illumos
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func bytes2iovec(bs [][]byte) []Iovec {
|
||||
iovecs := make([]Iovec, len(bs))
|
||||
for i, b := range bs {
|
||||
iovecs[i].SetLen(len(b))
|
||||
if len(b) > 0 {
|
||||
// somehow Iovec.Base on illumos is (*int8), not (*byte)
|
||||
iovecs[i].Base = (*int8)(unsafe.Pointer(&b[0]))
|
||||
} else {
|
||||
iovecs[i].Base = (*int8)(unsafe.Pointer(&_zero))
|
||||
}
|
||||
}
|
||||
return iovecs
|
||||
}
|
||||
|
||||
//sys readv(fd int, iovs []Iovec) (n int, err error)
|
||||
|
||||
func Readv(fd int, iovs [][]byte) (n int, err error) {
|
||||
iovecs := bytes2iovec(iovs)
|
||||
n, err = readv(fd, iovecs)
|
||||
return n, err
|
||||
}
|
||||
|
||||
//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error)
|
||||
|
||||
func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) {
|
||||
iovecs := bytes2iovec(iovs)
|
||||
n, err = preadv(fd, iovecs, off)
|
||||
return n, err
|
||||
}
|
||||
|
||||
//sys writev(fd int, iovs []Iovec) (n int, err error)
|
||||
|
||||
func Writev(fd int, iovs [][]byte) (n int, err error) {
|
||||
iovecs := bytes2iovec(iovs)
|
||||
n, err = writev(fd, iovecs)
|
||||
return n, err
|
||||
}
|
||||
|
||||
//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error)
|
||||
|
||||
func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) {
|
||||
iovecs := bytes2iovec(iovs)
|
||||
n, err = pwritev(fd, iovecs, off)
|
||||
return n, err
|
||||
}
|
|
@ -839,6 +839,40 @@ func (sa *SockaddrTIPC) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
|||
return unsafe.Pointer(&sa.raw), SizeofSockaddrTIPC, nil
|
||||
}
|
||||
|
||||
// SockaddrL2TPIP implements the Sockaddr interface for IPPROTO_L2TP/AF_INET sockets.
|
||||
type SockaddrL2TPIP struct {
|
||||
Addr [4]byte
|
||||
ConnId uint32
|
||||
raw RawSockaddrL2TPIP
|
||||
}
|
||||
|
||||
func (sa *SockaddrL2TPIP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Family = AF_INET
|
||||
sa.raw.Conn_id = sa.ConnId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP, nil
|
||||
}
|
||||
|
||||
// SockaddrL2TPIP6 implements the Sockaddr interface for IPPROTO_L2TP/AF_INET6 sockets.
|
||||
type SockaddrL2TPIP6 struct {
|
||||
Addr [16]byte
|
||||
ZoneId uint32
|
||||
ConnId uint32
|
||||
raw RawSockaddrL2TPIP6
|
||||
}
|
||||
|
||||
func (sa *SockaddrL2TPIP6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Family = AF_INET6
|
||||
sa.raw.Conn_id = sa.ConnId
|
||||
sa.raw.Scope_id = sa.ZoneId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP6, nil
|
||||
}
|
||||
|
||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_NETLINK:
|
||||
|
@ -889,25 +923,58 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
|||
return sa, nil
|
||||
|
||||
case AF_INET:
|
||||
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch proto {
|
||||
case IPPROTO_L2TP:
|
||||
pp := (*RawSockaddrL2TPIP)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrL2TPIP)
|
||||
sa.ConnId = pp.Conn_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
return sa, nil
|
||||
default:
|
||||
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
return sa, nil
|
||||
}
|
||||
return sa, nil
|
||||
|
||||
case AF_INET6:
|
||||
pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrInet6)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch proto {
|
||||
case IPPROTO_L2TP:
|
||||
pp := (*RawSockaddrL2TPIP6)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrL2TPIP6)
|
||||
sa.ConnId = pp.Conn_id
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
return sa, nil
|
||||
default:
|
||||
pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrInet6)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
return sa, nil
|
||||
}
|
||||
return sa, nil
|
||||
|
||||
case AF_VSOCK:
|
||||
pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
|
||||
|
@ -1555,8 +1622,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
|||
//sys Acct(path string) (err error)
|
||||
//sys AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error)
|
||||
//sys Adjtimex(buf *Timex) (state int, err error)
|
||||
//sys Capget(hdr *CapUserHeader, data *CapUserData) (err error)
|
||||
//sys Capset(hdr *CapUserHeader, data *CapUserData) (err error)
|
||||
//sysnb Capget(hdr *CapUserHeader, data *CapUserData) (err error)
|
||||
//sysnb Capset(hdr *CapUserHeader, data *CapUserData) (err error)
|
||||
//sys Chdir(path string) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
||||
|
|
|
@ -216,6 +216,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
|||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
func InotifyInit() (fd int, err error) {
|
||||
return InotifyInit1(0)
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
|
|
|
@ -76,7 +76,7 @@ func SignalName(s syscall.Signal) string {
|
|||
// The signal name should start with "SIG".
|
||||
func SignalNum(s string) syscall.Signal {
|
||||
signalNameMapOnce.Do(func() {
|
||||
signalNameMap = make(map[string]syscall.Signal)
|
||||
signalNameMap = make(map[string]syscall.Signal, len(signalList))
|
||||
for _, signal := range signalList {
|
||||
signalNameMap[signal.name] = signal.num
|
||||
}
|
||||
|
|
|
@ -355,6 +355,22 @@ const (
|
|||
CTL_KERN = 0x1
|
||||
CTL_MAXNAME = 0x18
|
||||
CTL_NET = 0x4
|
||||
DIOCGATTR = 0xc144648e
|
||||
DIOCGDELETE = 0x80106488
|
||||
DIOCGFLUSH = 0x20006487
|
||||
DIOCGFRONTSTUFF = 0x40086486
|
||||
DIOCGFWHEADS = 0x40046483
|
||||
DIOCGFWSECTORS = 0x40046482
|
||||
DIOCGIDENT = 0x41006489
|
||||
DIOCGMEDIASIZE = 0x40086481
|
||||
DIOCGPHYSPATH = 0x4400648d
|
||||
DIOCGPROVIDERNAME = 0x4400648a
|
||||
DIOCGSECTORSIZE = 0x40046480
|
||||
DIOCGSTRIPEOFFSET = 0x4008648c
|
||||
DIOCGSTRIPESIZE = 0x4008648b
|
||||
DIOCSKERNELDUMP = 0x804c6490
|
||||
DIOCSKERNELDUMP_FREEBSD11 = 0x80046485
|
||||
DIOCZONECMD = 0xc06c648f
|
||||
DLT_A429 = 0xb8
|
||||
DLT_A653_ICM = 0xb9
|
||||
DLT_AIRONET_HEADER = 0x78
|
||||
|
@ -379,11 +395,14 @@ const (
|
|||
DLT_CHAOS = 0x5
|
||||
DLT_CHDLC = 0x68
|
||||
DLT_CISCO_IOS = 0x76
|
||||
DLT_CLASS_NETBSD_RAWAF = 0x2240000
|
||||
DLT_C_HDLC = 0x68
|
||||
DLT_C_HDLC_WITH_DIR = 0xcd
|
||||
DLT_DBUS = 0xe7
|
||||
DLT_DECT = 0xdd
|
||||
DLT_DISPLAYPORT_AUX = 0x113
|
||||
DLT_DOCSIS = 0x8f
|
||||
DLT_DOCSIS31_XRA31 = 0x111
|
||||
DLT_DVB_CI = 0xeb
|
||||
DLT_ECONET = 0x73
|
||||
DLT_EN10MB = 0x1
|
||||
|
@ -393,6 +412,7 @@ const (
|
|||
DLT_ERF = 0xc5
|
||||
DLT_ERF_ETH = 0xaf
|
||||
DLT_ERF_POS = 0xb0
|
||||
DLT_ETHERNET_MPACKET = 0x112
|
||||
DLT_FC_2 = 0xe0
|
||||
DLT_FC_2_WITH_FRAME_DELIMS = 0xe1
|
||||
DLT_FDDI = 0xa
|
||||
|
@ -406,7 +426,6 @@ const (
|
|||
DLT_GPRS_LLC = 0xa9
|
||||
DLT_GSMTAP_ABIS = 0xda
|
||||
DLT_GSMTAP_UM = 0xd9
|
||||
DLT_HHDLC = 0x79
|
||||
DLT_IBM_SN = 0x92
|
||||
DLT_IBM_SP = 0x91
|
||||
DLT_IEEE802 = 0x6
|
||||
|
@ -429,6 +448,7 @@ const (
|
|||
DLT_IPV4 = 0xe4
|
||||
DLT_IPV6 = 0xe5
|
||||
DLT_IP_OVER_FC = 0x7a
|
||||
DLT_ISO_14443 = 0x108
|
||||
DLT_JUNIPER_ATM1 = 0x89
|
||||
DLT_JUNIPER_ATM2 = 0x87
|
||||
DLT_JUNIPER_ATM_CEMIC = 0xee
|
||||
|
@ -461,8 +481,9 @@ const (
|
|||
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
||||
DLT_LINUX_SLL = 0x71
|
||||
DLT_LOOP = 0x6c
|
||||
DLT_LORATAP = 0x10e
|
||||
DLT_LTALK = 0x72
|
||||
DLT_MATCHING_MAX = 0x104
|
||||
DLT_MATCHING_MAX = 0x113
|
||||
DLT_MATCHING_MIN = 0x68
|
||||
DLT_MFR = 0xb6
|
||||
DLT_MOST = 0xd3
|
||||
|
@ -478,14 +499,16 @@ const (
|
|||
DLT_NFC_LLCP = 0xf5
|
||||
DLT_NFLOG = 0xef
|
||||
DLT_NG40 = 0xf4
|
||||
DLT_NORDIC_BLE = 0x110
|
||||
DLT_NULL = 0x0
|
||||
DLT_OPENFLOW = 0x10b
|
||||
DLT_PCI_EXP = 0x7d
|
||||
DLT_PFLOG = 0x75
|
||||
DLT_PFSYNC = 0x79
|
||||
DLT_PKTAP = 0x102
|
||||
DLT_PPI = 0xc0
|
||||
DLT_PPP = 0x9
|
||||
DLT_PPP_BSDOS = 0x10
|
||||
DLT_PPP_BSDOS = 0xe
|
||||
DLT_PPP_ETHER = 0x33
|
||||
DLT_PPP_PPPD = 0xa6
|
||||
DLT_PPP_SERIAL = 0x32
|
||||
|
@ -496,19 +519,25 @@ const (
|
|||
DLT_PRONET = 0x4
|
||||
DLT_RAIF1 = 0xc6
|
||||
DLT_RAW = 0xc
|
||||
DLT_RDS = 0x109
|
||||
DLT_REDBACK_SMARTEDGE = 0x20
|
||||
DLT_RIO = 0x7c
|
||||
DLT_RTAC_SERIAL = 0xfa
|
||||
DLT_SCCP = 0x8e
|
||||
DLT_SCTP = 0xf8
|
||||
DLT_SDLC = 0x10c
|
||||
DLT_SITA = 0xc4
|
||||
DLT_SLIP = 0x8
|
||||
DLT_SLIP_BSDOS = 0xf
|
||||
DLT_SLIP_BSDOS = 0xd
|
||||
DLT_STANAG_5066_D_PDU = 0xed
|
||||
DLT_SUNATM = 0x7b
|
||||
DLT_SYMANTEC_FIREWALL = 0x63
|
||||
DLT_TI_LLN_SNIFFER = 0x10d
|
||||
DLT_TZSP = 0x80
|
||||
DLT_USB = 0xba
|
||||
DLT_USBPCAP = 0xf9
|
||||
DLT_USB_DARWIN = 0x10a
|
||||
DLT_USB_FREEBSD = 0xba
|
||||
DLT_USB_LINUX = 0xbd
|
||||
DLT_USB_LINUX_MMAPPED = 0xdc
|
||||
DLT_USER0 = 0x93
|
||||
|
@ -527,10 +556,14 @@ const (
|
|||
DLT_USER7 = 0x9a
|
||||
DLT_USER8 = 0x9b
|
||||
DLT_USER9 = 0x9c
|
||||
DLT_VSOCK = 0x10f
|
||||
DLT_WATTSTOPPER_DLM = 0x107
|
||||
DLT_WIHART = 0xdf
|
||||
DLT_WIRESHARK_UPPER_PDU = 0xfc
|
||||
DLT_X2E_SERIAL = 0xd5
|
||||
DLT_X2E_XORAYA = 0xd6
|
||||
DLT_ZWAVE_R1_R2 = 0x105
|
||||
DLT_ZWAVE_R3 = 0x106
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
|
@ -548,6 +581,7 @@ const (
|
|||
ECHONL = 0x10
|
||||
ECHOPRT = 0x20
|
||||
EVFILT_AIO = -0x3
|
||||
EVFILT_EMPTY = -0xd
|
||||
EVFILT_FS = -0x9
|
||||
EVFILT_LIO = -0xa
|
||||
EVFILT_PROC = -0x5
|
||||
|
@ -555,11 +589,12 @@ const (
|
|||
EVFILT_READ = -0x1
|
||||
EVFILT_SENDFILE = -0xc
|
||||
EVFILT_SIGNAL = -0x6
|
||||
EVFILT_SYSCOUNT = 0xc
|
||||
EVFILT_SYSCOUNT = 0xd
|
||||
EVFILT_TIMER = -0x7
|
||||
EVFILT_USER = -0xb
|
||||
EVFILT_VNODE = -0x4
|
||||
EVFILT_WRITE = -0x2
|
||||
EVNAMEMAP_NAME_SIZE = 0x40
|
||||
EV_ADD = 0x1
|
||||
EV_CLEAR = 0x20
|
||||
EV_DELETE = 0x2
|
||||
|
@ -576,6 +611,7 @@ const (
|
|||
EV_RECEIPT = 0x40
|
||||
EV_SYSFLAGS = 0xf000
|
||||
EXTA = 0x4b00
|
||||
EXTATTR_MAXNAMELEN = 0xff
|
||||
EXTATTR_NAMESPACE_EMPTY = 0x0
|
||||
EXTATTR_NAMESPACE_SYSTEM = 0x2
|
||||
EXTATTR_NAMESPACE_USER = 0x1
|
||||
|
@ -617,6 +653,7 @@ const (
|
|||
IEXTEN = 0x400
|
||||
IFAN_ARRIVAL = 0x0
|
||||
IFAN_DEPARTURE = 0x1
|
||||
IFCAP_WOL_MAGIC = 0x2000
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ALTPHYS = 0x4000
|
||||
IFF_BROADCAST = 0x2
|
||||
|
@ -633,6 +670,7 @@ const (
|
|||
IFF_MONITOR = 0x40000
|
||||
IFF_MULTICAST = 0x8000
|
||||
IFF_NOARP = 0x80
|
||||
IFF_NOGROUP = 0x800000
|
||||
IFF_OACTIVE = 0x400
|
||||
IFF_POINTOPOINT = 0x10
|
||||
IFF_PPROMISC = 0x20000
|
||||
|
@ -807,6 +845,7 @@ const (
|
|||
IPV6_DSTOPTS = 0x32
|
||||
IPV6_FLOWID = 0x43
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_LEN = 0x14
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
IPV6_FLOWTYPE = 0x44
|
||||
IPV6_FRAGTTL = 0x78
|
||||
|
@ -827,13 +866,13 @@ const (
|
|||
IPV6_MAX_GROUP_SRC_FILTER = 0x200
|
||||
IPV6_MAX_MEMBERSHIPS = 0xfff
|
||||
IPV6_MAX_SOCK_SRC_FILTER = 0x80
|
||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||
IPV6_MMTU = 0x500
|
||||
IPV6_MSFILTER = 0x4a
|
||||
IPV6_MULTICAST_HOPS = 0xa
|
||||
IPV6_MULTICAST_IF = 0x9
|
||||
IPV6_MULTICAST_LOOP = 0xb
|
||||
IPV6_NEXTHOP = 0x30
|
||||
IPV6_ORIGDSTADDR = 0x48
|
||||
IPV6_PATHMTU = 0x2c
|
||||
IPV6_PKTINFO = 0x2e
|
||||
IPV6_PORTRANGE = 0xe
|
||||
|
@ -845,6 +884,7 @@ const (
|
|||
IPV6_RECVFLOWID = 0x46
|
||||
IPV6_RECVHOPLIMIT = 0x25
|
||||
IPV6_RECVHOPOPTS = 0x27
|
||||
IPV6_RECVORIGDSTADDR = 0x48
|
||||
IPV6_RECVPATHMTU = 0x2b
|
||||
IPV6_RECVPKTINFO = 0x24
|
||||
IPV6_RECVRSSBUCKETID = 0x47
|
||||
|
@ -905,10 +945,8 @@ const (
|
|||
IP_MAX_MEMBERSHIPS = 0xfff
|
||||
IP_MAX_SOCK_MUTE_FILTER = 0x80
|
||||
IP_MAX_SOCK_SRC_FILTER = 0x80
|
||||
IP_MAX_SOURCE_FILTER = 0x400
|
||||
IP_MF = 0x2000
|
||||
IP_MINTTL = 0x42
|
||||
IP_MIN_MEMBERSHIPS = 0x1f
|
||||
IP_MSFILTER = 0x4a
|
||||
IP_MSS = 0x240
|
||||
IP_MULTICAST_IF = 0x9
|
||||
|
@ -918,6 +956,7 @@ const (
|
|||
IP_OFFMASK = 0x1fff
|
||||
IP_ONESBCAST = 0x17
|
||||
IP_OPTIONS = 0x1
|
||||
IP_ORIGDSTADDR = 0x1b
|
||||
IP_PORTRANGE = 0x13
|
||||
IP_PORTRANGE_DEFAULT = 0x0
|
||||
IP_PORTRANGE_HIGH = 0x1
|
||||
|
@ -926,6 +965,7 @@ const (
|
|||
IP_RECVFLOWID = 0x5d
|
||||
IP_RECVIF = 0x14
|
||||
IP_RECVOPTS = 0x5
|
||||
IP_RECVORIGDSTADDR = 0x1b
|
||||
IP_RECVRETOPTS = 0x6
|
||||
IP_RECVRSSBUCKETID = 0x5e
|
||||
IP_RECVTOS = 0x44
|
||||
|
@ -975,6 +1015,7 @@ const (
|
|||
MAP_EXCL = 0x4000
|
||||
MAP_FILE = 0x0
|
||||
MAP_FIXED = 0x10
|
||||
MAP_GUARD = 0x2000
|
||||
MAP_HASSEMAPHORE = 0x200
|
||||
MAP_NOCORE = 0x20000
|
||||
MAP_NOSYNC = 0x800
|
||||
|
@ -986,6 +1027,15 @@ const (
|
|||
MAP_RESERVED0100 = 0x100
|
||||
MAP_SHARED = 0x1
|
||||
MAP_STACK = 0x400
|
||||
MCAST_BLOCK_SOURCE = 0x54
|
||||
MCAST_EXCLUDE = 0x2
|
||||
MCAST_INCLUDE = 0x1
|
||||
MCAST_JOIN_GROUP = 0x50
|
||||
MCAST_JOIN_SOURCE_GROUP = 0x52
|
||||
MCAST_LEAVE_GROUP = 0x51
|
||||
MCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||
MCAST_UNBLOCK_SOURCE = 0x55
|
||||
MCAST_UNDEFINED = 0x0
|
||||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MNT_ACLS = 0x8000000
|
||||
|
@ -1026,10 +1076,12 @@ const (
|
|||
MNT_SUSPEND = 0x4
|
||||
MNT_SYNCHRONOUS = 0x2
|
||||
MNT_UNION = 0x20
|
||||
MNT_UNTRUSTED = 0x800000000
|
||||
MNT_UPDATE = 0x10000
|
||||
MNT_UPDATEMASK = 0x2d8d0807e
|
||||
MNT_UPDATEMASK = 0xad8d0807e
|
||||
MNT_USER = 0x8000
|
||||
MNT_VISFLAGMASK = 0x3fef0ffff
|
||||
MNT_VERIFIED = 0x400000000
|
||||
MNT_VISFLAGMASK = 0xffef0ffff
|
||||
MNT_WAIT = 0x1
|
||||
MSG_CMSG_CLOEXEC = 0x40000
|
||||
MSG_COMPAT = 0x8000
|
||||
|
@ -1058,6 +1110,7 @@ const (
|
|||
NFDBITS = 0x20
|
||||
NOFLSH = 0x80000000
|
||||
NOKERNINFO = 0x2000000
|
||||
NOTE_ABSTIME = 0x10
|
||||
NOTE_ATTRIB = 0x8
|
||||
NOTE_CHILD = 0x4
|
||||
NOTE_CLOSE = 0x100
|
||||
|
@ -1212,7 +1265,6 @@ const (
|
|||
RTV_WEIGHT = 0x100
|
||||
RT_ALL_FIBS = -0x1
|
||||
RT_BLACKHOLE = 0x40
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_DEFAULT_FIB = 0x0
|
||||
RT_HAS_GW = 0x80
|
||||
RT_HAS_HEADER = 0x10
|
||||
|
@ -1222,15 +1274,17 @@ const (
|
|||
RT_LLE_CACHE = 0x100
|
||||
RT_MAY_LOOP = 0x8
|
||||
RT_MAY_LOOP_BIT = 0x3
|
||||
RT_NORTREF = 0x2
|
||||
RT_REJECT = 0x20
|
||||
RUSAGE_CHILDREN = -0x1
|
||||
RUSAGE_SELF = 0x0
|
||||
RUSAGE_THREAD = 0x1
|
||||
SCM_BINTIME = 0x4
|
||||
SCM_CREDS = 0x3
|
||||
SCM_MONOTONIC = 0x6
|
||||
SCM_REALTIME = 0x5
|
||||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SCM_TIME_INFO = 0x7
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1246,6 +1300,7 @@ const (
|
|||
SIOCGETSGCNT = 0xc0147210
|
||||
SIOCGETVIFCNT = 0xc014720f
|
||||
SIOCGHIWAT = 0x40047301
|
||||
SIOCGHWADDR = 0xc020693e
|
||||
SIOCGI2C = 0xc020693d
|
||||
SIOCGIFADDR = 0xc0206921
|
||||
SIOCGIFBRDADDR = 0xc0206923
|
||||
|
@ -1267,8 +1322,11 @@ const (
|
|||
SIOCGIFPDSTADDR = 0xc0206948
|
||||
SIOCGIFPHYS = 0xc0206935
|
||||
SIOCGIFPSRCADDR = 0xc0206947
|
||||
SIOCGIFRSSHASH = 0xc0186997
|
||||
SIOCGIFRSSKEY = 0xc0946996
|
||||
SIOCGIFSTATUS = 0xc331693b
|
||||
SIOCGIFXMEDIA = 0xc028698b
|
||||
SIOCGLANPCP = 0xc0206998
|
||||
SIOCGLOWAT = 0x40047303
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCGPRIVATE_0 = 0xc0206950
|
||||
|
@ -1299,6 +1357,7 @@ const (
|
|||
SIOCSIFPHYS = 0x80206936
|
||||
SIOCSIFRVNET = 0xc020695b
|
||||
SIOCSIFVNET = 0xc020695a
|
||||
SIOCSLANPCP = 0x80206999
|
||||
SIOCSLOWAT = 0x80047302
|
||||
SIOCSPGRP = 0x80047308
|
||||
SIOCSTUNFIB = 0x8020695f
|
||||
|
@ -1317,6 +1376,7 @@ const (
|
|||
SO_BINTIME = 0x2000
|
||||
SO_BROADCAST = 0x20
|
||||
SO_DEBUG = 0x1
|
||||
SO_DOMAIN = 0x1019
|
||||
SO_DONTROUTE = 0x10
|
||||
SO_ERROR = 0x1007
|
||||
SO_KEEPALIVE = 0x8
|
||||
|
@ -1325,6 +1385,7 @@ const (
|
|||
SO_LISTENINCQLEN = 0x1013
|
||||
SO_LISTENQLEN = 0x1012
|
||||
SO_LISTENQLIMIT = 0x1011
|
||||
SO_MAX_PACING_RATE = 0x1018
|
||||
SO_NOSIGPIPE = 0x800
|
||||
SO_NO_DDP = 0x8000
|
||||
SO_NO_OFFLOAD = 0x4000
|
||||
|
@ -1337,11 +1398,19 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_REUSEPORT_LB = 0x10000
|
||||
SO_SETFIB = 0x1014
|
||||
SO_SNDBUF = 0x1001
|
||||
SO_SNDLOWAT = 0x1003
|
||||
SO_SNDTIMEO = 0x1005
|
||||
SO_TIMESTAMP = 0x400
|
||||
SO_TS_BINTIME = 0x1
|
||||
SO_TS_CLOCK = 0x1017
|
||||
SO_TS_CLOCK_MAX = 0x3
|
||||
SO_TS_DEFAULT = 0x0
|
||||
SO_TS_MONOTONIC = 0x3
|
||||
SO_TS_REALTIME = 0x2
|
||||
SO_TS_REALTIME_MICRO = 0x0
|
||||
SO_TYPE = 0x1008
|
||||
SO_USELOOPBACK = 0x40
|
||||
SO_USER_COOKIE = 0x1015
|
||||
|
@ -1385,10 +1454,45 @@ const (
|
|||
TCOFLUSH = 0x2
|
||||
TCOOFF = 0x1
|
||||
TCOON = 0x2
|
||||
TCP_BBR_ACK_COMP_ALG = 0x448
|
||||
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
||||
TCP_BBR_DRAIN_PG = 0x42e
|
||||
TCP_BBR_EXTRA_GAIN = 0x449
|
||||
TCP_BBR_IWINTSO = 0x42b
|
||||
TCP_BBR_LOWGAIN_FD = 0x436
|
||||
TCP_BBR_LOWGAIN_HALF = 0x435
|
||||
TCP_BBR_LOWGAIN_THRESH = 0x434
|
||||
TCP_BBR_MAX_RTO = 0x439
|
||||
TCP_BBR_MIN_RTO = 0x438
|
||||
TCP_BBR_ONE_RETRAN = 0x431
|
||||
TCP_BBR_PACE_CROSS = 0x442
|
||||
TCP_BBR_PACE_DEL_TAR = 0x43f
|
||||
TCP_BBR_PACE_PER_SEC = 0x43e
|
||||
TCP_BBR_PACE_SEG_MAX = 0x440
|
||||
TCP_BBR_PACE_SEG_MIN = 0x441
|
||||
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
||||
TCP_BBR_PROBE_RTT_INT = 0x430
|
||||
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
||||
TCP_BBR_RACK_RTT_USE = 0x44a
|
||||
TCP_BBR_RECFORCE = 0x42c
|
||||
TCP_BBR_REC_OVER_HPTS = 0x43a
|
||||
TCP_BBR_RETRAN_WTSO = 0x44b
|
||||
TCP_BBR_RWND_IS_APP = 0x42f
|
||||
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
||||
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
||||
TCP_BBR_STARTUP_PG = 0x42d
|
||||
TCP_BBR_UNLIMITED = 0x43b
|
||||
TCP_BBR_USEDEL_RATE = 0x437
|
||||
TCP_BBR_USE_LOWGAIN = 0x433
|
||||
TCP_CA_NAME_MAX = 0x10
|
||||
TCP_CCALGOOPT = 0x41
|
||||
TCP_CONGESTION = 0x40
|
||||
TCP_DATA_AFTER_CLOSE = 0x44c
|
||||
TCP_DELACK = 0x48
|
||||
TCP_FASTOPEN = 0x401
|
||||
TCP_FASTOPEN_MAX_COOKIE_LEN = 0x10
|
||||
TCP_FASTOPEN_MIN_COOKIE_LEN = 0x4
|
||||
TCP_FASTOPEN_PSK_LEN = 0x10
|
||||
TCP_FUNCTION_BLK = 0x2000
|
||||
TCP_FUNCTION_NAME_LEN_MAX = 0x20
|
||||
TCP_INFO = 0x20
|
||||
|
@ -1396,6 +1500,12 @@ const (
|
|||
TCP_KEEPIDLE = 0x100
|
||||
TCP_KEEPINIT = 0x80
|
||||
TCP_KEEPINTVL = 0x200
|
||||
TCP_LOG = 0x22
|
||||
TCP_LOGBUF = 0x23
|
||||
TCP_LOGDUMP = 0x25
|
||||
TCP_LOGDUMPID = 0x26
|
||||
TCP_LOGID = 0x24
|
||||
TCP_LOG_ID_LEN = 0x40
|
||||
TCP_MAXBURST = 0x4
|
||||
TCP_MAXHLEN = 0x3c
|
||||
TCP_MAXOLEN = 0x28
|
||||
|
@ -1411,8 +1521,30 @@ const (
|
|||
TCP_NOPUSH = 0x4
|
||||
TCP_PCAP_IN = 0x1000
|
||||
TCP_PCAP_OUT = 0x800
|
||||
TCP_RACK_EARLY_RECOV = 0x423
|
||||
TCP_RACK_EARLY_SEG = 0x424
|
||||
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
||||
TCP_RACK_MIN_PACE = 0x445
|
||||
TCP_RACK_MIN_PACE_SEG = 0x446
|
||||
TCP_RACK_MIN_TO = 0x422
|
||||
TCP_RACK_PACE_ALWAYS = 0x41f
|
||||
TCP_RACK_PACE_MAX_SEG = 0x41e
|
||||
TCP_RACK_PACE_REDUCE = 0x41d
|
||||
TCP_RACK_PKT_DELAY = 0x428
|
||||
TCP_RACK_PROP = 0x41b
|
||||
TCP_RACK_PROP_RATE = 0x420
|
||||
TCP_RACK_PRR_SENDALOT = 0x421
|
||||
TCP_RACK_REORD_FADE = 0x426
|
||||
TCP_RACK_REORD_THRESH = 0x425
|
||||
TCP_RACK_SESS_CWV = 0x42a
|
||||
TCP_RACK_TLP_INC_VAR = 0x429
|
||||
TCP_RACK_TLP_REDUCE = 0x41c
|
||||
TCP_RACK_TLP_THRESH = 0x427
|
||||
TCP_RACK_TLP_USE = 0x447
|
||||
TCP_VENDOR = 0x80000000
|
||||
TCSAFLUSH = 0x2
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIMER_RELTIME = 0x0
|
||||
TIOCCBRK = 0x2000747a
|
||||
TIOCCDTR = 0x20007478
|
||||
TIOCCONS = 0x80047462
|
||||
|
@ -1476,6 +1608,8 @@ const (
|
|||
TIOCTIMESTAMP = 0x40087459
|
||||
TIOCUCNTL = 0x80047466
|
||||
TOSTOP = 0x400000
|
||||
UTIME_NOW = -0x1
|
||||
UTIME_OMIT = -0x2
|
||||
VDISCARD = 0xf
|
||||
VDSUSP = 0xb
|
||||
VEOF = 0x0
|
||||
|
@ -1487,6 +1621,8 @@ const (
|
|||
VKILL = 0x5
|
||||
VLNEXT = 0xe
|
||||
VMIN = 0x10
|
||||
VM_BCACHE_SIZE_MAX = 0x70e0000
|
||||
VM_SWZONE_SIZE_MAX = 0x2280000
|
||||
VQUIT = 0x9
|
||||
VREPRINT = 0x6
|
||||
VSTART = 0xc
|
||||
|
|
|
@ -355,6 +355,22 @@ const (
|
|||
CTL_KERN = 0x1
|
||||
CTL_MAXNAME = 0x18
|
||||
CTL_NET = 0x4
|
||||
DIOCGATTR = 0xc148648e
|
||||
DIOCGDELETE = 0x80106488
|
||||
DIOCGFLUSH = 0x20006487
|
||||
DIOCGFRONTSTUFF = 0x40086486
|
||||
DIOCGFWHEADS = 0x40046483
|
||||
DIOCGFWSECTORS = 0x40046482
|
||||
DIOCGIDENT = 0x41006489
|
||||
DIOCGMEDIASIZE = 0x40086481
|
||||
DIOCGPHYSPATH = 0x4400648d
|
||||
DIOCGPROVIDERNAME = 0x4400648a
|
||||
DIOCGSECTORSIZE = 0x40046480
|
||||
DIOCGSTRIPEOFFSET = 0x4008648c
|
||||
DIOCGSTRIPESIZE = 0x4008648b
|
||||
DIOCSKERNELDUMP = 0x80506490
|
||||
DIOCSKERNELDUMP_FREEBSD11 = 0x80046485
|
||||
DIOCZONECMD = 0xc080648f
|
||||
DLT_A429 = 0xb8
|
||||
DLT_A653_ICM = 0xb9
|
||||
DLT_AIRONET_HEADER = 0x78
|
||||
|
@ -379,11 +395,14 @@ const (
|
|||
DLT_CHAOS = 0x5
|
||||
DLT_CHDLC = 0x68
|
||||
DLT_CISCO_IOS = 0x76
|
||||
DLT_CLASS_NETBSD_RAWAF = 0x2240000
|
||||
DLT_C_HDLC = 0x68
|
||||
DLT_C_HDLC_WITH_DIR = 0xcd
|
||||
DLT_DBUS = 0xe7
|
||||
DLT_DECT = 0xdd
|
||||
DLT_DISPLAYPORT_AUX = 0x113
|
||||
DLT_DOCSIS = 0x8f
|
||||
DLT_DOCSIS31_XRA31 = 0x111
|
||||
DLT_DVB_CI = 0xeb
|
||||
DLT_ECONET = 0x73
|
||||
DLT_EN10MB = 0x1
|
||||
|
@ -393,6 +412,7 @@ const (
|
|||
DLT_ERF = 0xc5
|
||||
DLT_ERF_ETH = 0xaf
|
||||
DLT_ERF_POS = 0xb0
|
||||
DLT_ETHERNET_MPACKET = 0x112
|
||||
DLT_FC_2 = 0xe0
|
||||
DLT_FC_2_WITH_FRAME_DELIMS = 0xe1
|
||||
DLT_FDDI = 0xa
|
||||
|
@ -406,7 +426,6 @@ const (
|
|||
DLT_GPRS_LLC = 0xa9
|
||||
DLT_GSMTAP_ABIS = 0xda
|
||||
DLT_GSMTAP_UM = 0xd9
|
||||
DLT_HHDLC = 0x79
|
||||
DLT_IBM_SN = 0x92
|
||||
DLT_IBM_SP = 0x91
|
||||
DLT_IEEE802 = 0x6
|
||||
|
@ -429,6 +448,7 @@ const (
|
|||
DLT_IPV4 = 0xe4
|
||||
DLT_IPV6 = 0xe5
|
||||
DLT_IP_OVER_FC = 0x7a
|
||||
DLT_ISO_14443 = 0x108
|
||||
DLT_JUNIPER_ATM1 = 0x89
|
||||
DLT_JUNIPER_ATM2 = 0x87
|
||||
DLT_JUNIPER_ATM_CEMIC = 0xee
|
||||
|
@ -461,8 +481,9 @@ const (
|
|||
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
||||
DLT_LINUX_SLL = 0x71
|
||||
DLT_LOOP = 0x6c
|
||||
DLT_LORATAP = 0x10e
|
||||
DLT_LTALK = 0x72
|
||||
DLT_MATCHING_MAX = 0x104
|
||||
DLT_MATCHING_MAX = 0x113
|
||||
DLT_MATCHING_MIN = 0x68
|
||||
DLT_MFR = 0xb6
|
||||
DLT_MOST = 0xd3
|
||||
|
@ -478,14 +499,16 @@ const (
|
|||
DLT_NFC_LLCP = 0xf5
|
||||
DLT_NFLOG = 0xef
|
||||
DLT_NG40 = 0xf4
|
||||
DLT_NORDIC_BLE = 0x110
|
||||
DLT_NULL = 0x0
|
||||
DLT_OPENFLOW = 0x10b
|
||||
DLT_PCI_EXP = 0x7d
|
||||
DLT_PFLOG = 0x75
|
||||
DLT_PFSYNC = 0x79
|
||||
DLT_PKTAP = 0x102
|
||||
DLT_PPI = 0xc0
|
||||
DLT_PPP = 0x9
|
||||
DLT_PPP_BSDOS = 0x10
|
||||
DLT_PPP_BSDOS = 0xe
|
||||
DLT_PPP_ETHER = 0x33
|
||||
DLT_PPP_PPPD = 0xa6
|
||||
DLT_PPP_SERIAL = 0x32
|
||||
|
@ -496,19 +519,25 @@ const (
|
|||
DLT_PRONET = 0x4
|
||||
DLT_RAIF1 = 0xc6
|
||||
DLT_RAW = 0xc
|
||||
DLT_RDS = 0x109
|
||||
DLT_REDBACK_SMARTEDGE = 0x20
|
||||
DLT_RIO = 0x7c
|
||||
DLT_RTAC_SERIAL = 0xfa
|
||||
DLT_SCCP = 0x8e
|
||||
DLT_SCTP = 0xf8
|
||||
DLT_SDLC = 0x10c
|
||||
DLT_SITA = 0xc4
|
||||
DLT_SLIP = 0x8
|
||||
DLT_SLIP_BSDOS = 0xf
|
||||
DLT_SLIP_BSDOS = 0xd
|
||||
DLT_STANAG_5066_D_PDU = 0xed
|
||||
DLT_SUNATM = 0x7b
|
||||
DLT_SYMANTEC_FIREWALL = 0x63
|
||||
DLT_TI_LLN_SNIFFER = 0x10d
|
||||
DLT_TZSP = 0x80
|
||||
DLT_USB = 0xba
|
||||
DLT_USBPCAP = 0xf9
|
||||
DLT_USB_DARWIN = 0x10a
|
||||
DLT_USB_FREEBSD = 0xba
|
||||
DLT_USB_LINUX = 0xbd
|
||||
DLT_USB_LINUX_MMAPPED = 0xdc
|
||||
DLT_USER0 = 0x93
|
||||
|
@ -527,10 +556,14 @@ const (
|
|||
DLT_USER7 = 0x9a
|
||||
DLT_USER8 = 0x9b
|
||||
DLT_USER9 = 0x9c
|
||||
DLT_VSOCK = 0x10f
|
||||
DLT_WATTSTOPPER_DLM = 0x107
|
||||
DLT_WIHART = 0xdf
|
||||
DLT_WIRESHARK_UPPER_PDU = 0xfc
|
||||
DLT_X2E_SERIAL = 0xd5
|
||||
DLT_X2E_XORAYA = 0xd6
|
||||
DLT_ZWAVE_R1_R2 = 0x105
|
||||
DLT_ZWAVE_R3 = 0x106
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
|
@ -548,6 +581,7 @@ const (
|
|||
ECHONL = 0x10
|
||||
ECHOPRT = 0x20
|
||||
EVFILT_AIO = -0x3
|
||||
EVFILT_EMPTY = -0xd
|
||||
EVFILT_FS = -0x9
|
||||
EVFILT_LIO = -0xa
|
||||
EVFILT_PROC = -0x5
|
||||
|
@ -555,11 +589,12 @@ const (
|
|||
EVFILT_READ = -0x1
|
||||
EVFILT_SENDFILE = -0xc
|
||||
EVFILT_SIGNAL = -0x6
|
||||
EVFILT_SYSCOUNT = 0xc
|
||||
EVFILT_SYSCOUNT = 0xd
|
||||
EVFILT_TIMER = -0x7
|
||||
EVFILT_USER = -0xb
|
||||
EVFILT_VNODE = -0x4
|
||||
EVFILT_WRITE = -0x2
|
||||
EVNAMEMAP_NAME_SIZE = 0x40
|
||||
EV_ADD = 0x1
|
||||
EV_CLEAR = 0x20
|
||||
EV_DELETE = 0x2
|
||||
|
@ -576,6 +611,7 @@ const (
|
|||
EV_RECEIPT = 0x40
|
||||
EV_SYSFLAGS = 0xf000
|
||||
EXTA = 0x4b00
|
||||
EXTATTR_MAXNAMELEN = 0xff
|
||||
EXTATTR_NAMESPACE_EMPTY = 0x0
|
||||
EXTATTR_NAMESPACE_SYSTEM = 0x2
|
||||
EXTATTR_NAMESPACE_USER = 0x1
|
||||
|
@ -617,6 +653,7 @@ const (
|
|||
IEXTEN = 0x400
|
||||
IFAN_ARRIVAL = 0x0
|
||||
IFAN_DEPARTURE = 0x1
|
||||
IFCAP_WOL_MAGIC = 0x2000
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ALTPHYS = 0x4000
|
||||
IFF_BROADCAST = 0x2
|
||||
|
@ -633,6 +670,7 @@ const (
|
|||
IFF_MONITOR = 0x40000
|
||||
IFF_MULTICAST = 0x8000
|
||||
IFF_NOARP = 0x80
|
||||
IFF_NOGROUP = 0x800000
|
||||
IFF_OACTIVE = 0x400
|
||||
IFF_POINTOPOINT = 0x10
|
||||
IFF_PPROMISC = 0x20000
|
||||
|
@ -807,6 +845,7 @@ const (
|
|||
IPV6_DSTOPTS = 0x32
|
||||
IPV6_FLOWID = 0x43
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_LEN = 0x14
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
IPV6_FLOWTYPE = 0x44
|
||||
IPV6_FRAGTTL = 0x78
|
||||
|
@ -827,13 +866,13 @@ const (
|
|||
IPV6_MAX_GROUP_SRC_FILTER = 0x200
|
||||
IPV6_MAX_MEMBERSHIPS = 0xfff
|
||||
IPV6_MAX_SOCK_SRC_FILTER = 0x80
|
||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||
IPV6_MMTU = 0x500
|
||||
IPV6_MSFILTER = 0x4a
|
||||
IPV6_MULTICAST_HOPS = 0xa
|
||||
IPV6_MULTICAST_IF = 0x9
|
||||
IPV6_MULTICAST_LOOP = 0xb
|
||||
IPV6_NEXTHOP = 0x30
|
||||
IPV6_ORIGDSTADDR = 0x48
|
||||
IPV6_PATHMTU = 0x2c
|
||||
IPV6_PKTINFO = 0x2e
|
||||
IPV6_PORTRANGE = 0xe
|
||||
|
@ -845,6 +884,7 @@ const (
|
|||
IPV6_RECVFLOWID = 0x46
|
||||
IPV6_RECVHOPLIMIT = 0x25
|
||||
IPV6_RECVHOPOPTS = 0x27
|
||||
IPV6_RECVORIGDSTADDR = 0x48
|
||||
IPV6_RECVPATHMTU = 0x2b
|
||||
IPV6_RECVPKTINFO = 0x24
|
||||
IPV6_RECVRSSBUCKETID = 0x47
|
||||
|
@ -905,10 +945,8 @@ const (
|
|||
IP_MAX_MEMBERSHIPS = 0xfff
|
||||
IP_MAX_SOCK_MUTE_FILTER = 0x80
|
||||
IP_MAX_SOCK_SRC_FILTER = 0x80
|
||||
IP_MAX_SOURCE_FILTER = 0x400
|
||||
IP_MF = 0x2000
|
||||
IP_MINTTL = 0x42
|
||||
IP_MIN_MEMBERSHIPS = 0x1f
|
||||
IP_MSFILTER = 0x4a
|
||||
IP_MSS = 0x240
|
||||
IP_MULTICAST_IF = 0x9
|
||||
|
@ -918,6 +956,7 @@ const (
|
|||
IP_OFFMASK = 0x1fff
|
||||
IP_ONESBCAST = 0x17
|
||||
IP_OPTIONS = 0x1
|
||||
IP_ORIGDSTADDR = 0x1b
|
||||
IP_PORTRANGE = 0x13
|
||||
IP_PORTRANGE_DEFAULT = 0x0
|
||||
IP_PORTRANGE_HIGH = 0x1
|
||||
|
@ -926,6 +965,7 @@ const (
|
|||
IP_RECVFLOWID = 0x5d
|
||||
IP_RECVIF = 0x14
|
||||
IP_RECVOPTS = 0x5
|
||||
IP_RECVORIGDSTADDR = 0x1b
|
||||
IP_RECVRETOPTS = 0x6
|
||||
IP_RECVRSSBUCKETID = 0x5e
|
||||
IP_RECVTOS = 0x44
|
||||
|
@ -976,6 +1016,7 @@ const (
|
|||
MAP_EXCL = 0x4000
|
||||
MAP_FILE = 0x0
|
||||
MAP_FIXED = 0x10
|
||||
MAP_GUARD = 0x2000
|
||||
MAP_HASSEMAPHORE = 0x200
|
||||
MAP_NOCORE = 0x20000
|
||||
MAP_NOSYNC = 0x800
|
||||
|
@ -987,6 +1028,15 @@ const (
|
|||
MAP_RESERVED0100 = 0x100
|
||||
MAP_SHARED = 0x1
|
||||
MAP_STACK = 0x400
|
||||
MCAST_BLOCK_SOURCE = 0x54
|
||||
MCAST_EXCLUDE = 0x2
|
||||
MCAST_INCLUDE = 0x1
|
||||
MCAST_JOIN_GROUP = 0x50
|
||||
MCAST_JOIN_SOURCE_GROUP = 0x52
|
||||
MCAST_LEAVE_GROUP = 0x51
|
||||
MCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||
MCAST_UNBLOCK_SOURCE = 0x55
|
||||
MCAST_UNDEFINED = 0x0
|
||||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MNT_ACLS = 0x8000000
|
||||
|
@ -1027,10 +1077,12 @@ const (
|
|||
MNT_SUSPEND = 0x4
|
||||
MNT_SYNCHRONOUS = 0x2
|
||||
MNT_UNION = 0x20
|
||||
MNT_UNTRUSTED = 0x800000000
|
||||
MNT_UPDATE = 0x10000
|
||||
MNT_UPDATEMASK = 0x2d8d0807e
|
||||
MNT_UPDATEMASK = 0xad8d0807e
|
||||
MNT_USER = 0x8000
|
||||
MNT_VISFLAGMASK = 0x3fef0ffff
|
||||
MNT_VERIFIED = 0x400000000
|
||||
MNT_VISFLAGMASK = 0xffef0ffff
|
||||
MNT_WAIT = 0x1
|
||||
MSG_CMSG_CLOEXEC = 0x40000
|
||||
MSG_COMPAT = 0x8000
|
||||
|
@ -1059,6 +1111,7 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NOFLSH = 0x80000000
|
||||
NOKERNINFO = 0x2000000
|
||||
NOTE_ABSTIME = 0x10
|
||||
NOTE_ATTRIB = 0x8
|
||||
NOTE_CHILD = 0x4
|
||||
NOTE_CLOSE = 0x100
|
||||
|
@ -1213,7 +1266,6 @@ const (
|
|||
RTV_WEIGHT = 0x100
|
||||
RT_ALL_FIBS = -0x1
|
||||
RT_BLACKHOLE = 0x40
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_DEFAULT_FIB = 0x0
|
||||
RT_HAS_GW = 0x80
|
||||
RT_HAS_HEADER = 0x10
|
||||
|
@ -1223,15 +1275,17 @@ const (
|
|||
RT_LLE_CACHE = 0x100
|
||||
RT_MAY_LOOP = 0x8
|
||||
RT_MAY_LOOP_BIT = 0x3
|
||||
RT_NORTREF = 0x2
|
||||
RT_REJECT = 0x20
|
||||
RUSAGE_CHILDREN = -0x1
|
||||
RUSAGE_SELF = 0x0
|
||||
RUSAGE_THREAD = 0x1
|
||||
SCM_BINTIME = 0x4
|
||||
SCM_CREDS = 0x3
|
||||
SCM_MONOTONIC = 0x6
|
||||
SCM_REALTIME = 0x5
|
||||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SCM_TIME_INFO = 0x7
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1247,6 +1301,7 @@ const (
|
|||
SIOCGETSGCNT = 0xc0207210
|
||||
SIOCGETVIFCNT = 0xc028720f
|
||||
SIOCGHIWAT = 0x40047301
|
||||
SIOCGHWADDR = 0xc020693e
|
||||
SIOCGI2C = 0xc020693d
|
||||
SIOCGIFADDR = 0xc0206921
|
||||
SIOCGIFBRDADDR = 0xc0206923
|
||||
|
@ -1268,8 +1323,11 @@ const (
|
|||
SIOCGIFPDSTADDR = 0xc0206948
|
||||
SIOCGIFPHYS = 0xc0206935
|
||||
SIOCGIFPSRCADDR = 0xc0206947
|
||||
SIOCGIFRSSHASH = 0xc0186997
|
||||
SIOCGIFRSSKEY = 0xc0946996
|
||||
SIOCGIFSTATUS = 0xc331693b
|
||||
SIOCGIFXMEDIA = 0xc030698b
|
||||
SIOCGLANPCP = 0xc0206998
|
||||
SIOCGLOWAT = 0x40047303
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCGPRIVATE_0 = 0xc0206950
|
||||
|
@ -1300,6 +1358,7 @@ const (
|
|||
SIOCSIFPHYS = 0x80206936
|
||||
SIOCSIFRVNET = 0xc020695b
|
||||
SIOCSIFVNET = 0xc020695a
|
||||
SIOCSLANPCP = 0x80206999
|
||||
SIOCSLOWAT = 0x80047302
|
||||
SIOCSPGRP = 0x80047308
|
||||
SIOCSTUNFIB = 0x8020695f
|
||||
|
@ -1318,6 +1377,7 @@ const (
|
|||
SO_BINTIME = 0x2000
|
||||
SO_BROADCAST = 0x20
|
||||
SO_DEBUG = 0x1
|
||||
SO_DOMAIN = 0x1019
|
||||
SO_DONTROUTE = 0x10
|
||||
SO_ERROR = 0x1007
|
||||
SO_KEEPALIVE = 0x8
|
||||
|
@ -1326,6 +1386,7 @@ const (
|
|||
SO_LISTENINCQLEN = 0x1013
|
||||
SO_LISTENQLEN = 0x1012
|
||||
SO_LISTENQLIMIT = 0x1011
|
||||
SO_MAX_PACING_RATE = 0x1018
|
||||
SO_NOSIGPIPE = 0x800
|
||||
SO_NO_DDP = 0x8000
|
||||
SO_NO_OFFLOAD = 0x4000
|
||||
|
@ -1338,11 +1399,19 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_REUSEPORT_LB = 0x10000
|
||||
SO_SETFIB = 0x1014
|
||||
SO_SNDBUF = 0x1001
|
||||
SO_SNDLOWAT = 0x1003
|
||||
SO_SNDTIMEO = 0x1005
|
||||
SO_TIMESTAMP = 0x400
|
||||
SO_TS_BINTIME = 0x1
|
||||
SO_TS_CLOCK = 0x1017
|
||||
SO_TS_CLOCK_MAX = 0x3
|
||||
SO_TS_DEFAULT = 0x0
|
||||
SO_TS_MONOTONIC = 0x3
|
||||
SO_TS_REALTIME = 0x2
|
||||
SO_TS_REALTIME_MICRO = 0x0
|
||||
SO_TYPE = 0x1008
|
||||
SO_USELOOPBACK = 0x40
|
||||
SO_USER_COOKIE = 0x1015
|
||||
|
@ -1386,10 +1455,45 @@ const (
|
|||
TCOFLUSH = 0x2
|
||||
TCOOFF = 0x1
|
||||
TCOON = 0x2
|
||||
TCP_BBR_ACK_COMP_ALG = 0x448
|
||||
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
||||
TCP_BBR_DRAIN_PG = 0x42e
|
||||
TCP_BBR_EXTRA_GAIN = 0x449
|
||||
TCP_BBR_IWINTSO = 0x42b
|
||||
TCP_BBR_LOWGAIN_FD = 0x436
|
||||
TCP_BBR_LOWGAIN_HALF = 0x435
|
||||
TCP_BBR_LOWGAIN_THRESH = 0x434
|
||||
TCP_BBR_MAX_RTO = 0x439
|
||||
TCP_BBR_MIN_RTO = 0x438
|
||||
TCP_BBR_ONE_RETRAN = 0x431
|
||||
TCP_BBR_PACE_CROSS = 0x442
|
||||
TCP_BBR_PACE_DEL_TAR = 0x43f
|
||||
TCP_BBR_PACE_PER_SEC = 0x43e
|
||||
TCP_BBR_PACE_SEG_MAX = 0x440
|
||||
TCP_BBR_PACE_SEG_MIN = 0x441
|
||||
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
||||
TCP_BBR_PROBE_RTT_INT = 0x430
|
||||
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
||||
TCP_BBR_RACK_RTT_USE = 0x44a
|
||||
TCP_BBR_RECFORCE = 0x42c
|
||||
TCP_BBR_REC_OVER_HPTS = 0x43a
|
||||
TCP_BBR_RETRAN_WTSO = 0x44b
|
||||
TCP_BBR_RWND_IS_APP = 0x42f
|
||||
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
||||
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
||||
TCP_BBR_STARTUP_PG = 0x42d
|
||||
TCP_BBR_UNLIMITED = 0x43b
|
||||
TCP_BBR_USEDEL_RATE = 0x437
|
||||
TCP_BBR_USE_LOWGAIN = 0x433
|
||||
TCP_CA_NAME_MAX = 0x10
|
||||
TCP_CCALGOOPT = 0x41
|
||||
TCP_CONGESTION = 0x40
|
||||
TCP_DATA_AFTER_CLOSE = 0x44c
|
||||
TCP_DELACK = 0x48
|
||||
TCP_FASTOPEN = 0x401
|
||||
TCP_FASTOPEN_MAX_COOKIE_LEN = 0x10
|
||||
TCP_FASTOPEN_MIN_COOKIE_LEN = 0x4
|
||||
TCP_FASTOPEN_PSK_LEN = 0x10
|
||||
TCP_FUNCTION_BLK = 0x2000
|
||||
TCP_FUNCTION_NAME_LEN_MAX = 0x20
|
||||
TCP_INFO = 0x20
|
||||
|
@ -1397,6 +1501,12 @@ const (
|
|||
TCP_KEEPIDLE = 0x100
|
||||
TCP_KEEPINIT = 0x80
|
||||
TCP_KEEPINTVL = 0x200
|
||||
TCP_LOG = 0x22
|
||||
TCP_LOGBUF = 0x23
|
||||
TCP_LOGDUMP = 0x25
|
||||
TCP_LOGDUMPID = 0x26
|
||||
TCP_LOGID = 0x24
|
||||
TCP_LOG_ID_LEN = 0x40
|
||||
TCP_MAXBURST = 0x4
|
||||
TCP_MAXHLEN = 0x3c
|
||||
TCP_MAXOLEN = 0x28
|
||||
|
@ -1412,8 +1522,30 @@ const (
|
|||
TCP_NOPUSH = 0x4
|
||||
TCP_PCAP_IN = 0x1000
|
||||
TCP_PCAP_OUT = 0x800
|
||||
TCP_RACK_EARLY_RECOV = 0x423
|
||||
TCP_RACK_EARLY_SEG = 0x424
|
||||
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
||||
TCP_RACK_MIN_PACE = 0x445
|
||||
TCP_RACK_MIN_PACE_SEG = 0x446
|
||||
TCP_RACK_MIN_TO = 0x422
|
||||
TCP_RACK_PACE_ALWAYS = 0x41f
|
||||
TCP_RACK_PACE_MAX_SEG = 0x41e
|
||||
TCP_RACK_PACE_REDUCE = 0x41d
|
||||
TCP_RACK_PKT_DELAY = 0x428
|
||||
TCP_RACK_PROP = 0x41b
|
||||
TCP_RACK_PROP_RATE = 0x420
|
||||
TCP_RACK_PRR_SENDALOT = 0x421
|
||||
TCP_RACK_REORD_FADE = 0x426
|
||||
TCP_RACK_REORD_THRESH = 0x425
|
||||
TCP_RACK_SESS_CWV = 0x42a
|
||||
TCP_RACK_TLP_INC_VAR = 0x429
|
||||
TCP_RACK_TLP_REDUCE = 0x41c
|
||||
TCP_RACK_TLP_THRESH = 0x427
|
||||
TCP_RACK_TLP_USE = 0x447
|
||||
TCP_VENDOR = 0x80000000
|
||||
TCSAFLUSH = 0x2
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIMER_RELTIME = 0x0
|
||||
TIOCCBRK = 0x2000747a
|
||||
TIOCCDTR = 0x20007478
|
||||
TIOCCONS = 0x80047462
|
||||
|
@ -1477,6 +1609,8 @@ const (
|
|||
TIOCTIMESTAMP = 0x40107459
|
||||
TIOCUCNTL = 0x80047466
|
||||
TOSTOP = 0x400000
|
||||
UTIME_NOW = -0x1
|
||||
UTIME_OMIT = -0x2
|
||||
VDISCARD = 0xf
|
||||
VDSUSP = 0xb
|
||||
VEOF = 0x0
|
||||
|
|
|
@ -355,6 +355,22 @@ const (
|
|||
CTL_KERN = 0x1
|
||||
CTL_MAXNAME = 0x18
|
||||
CTL_NET = 0x4
|
||||
DIOCGATTR = 0xc144648e
|
||||
DIOCGDELETE = 0x80106488
|
||||
DIOCGFLUSH = 0x20006487
|
||||
DIOCGFRONTSTUFF = 0x40086486
|
||||
DIOCGFWHEADS = 0x40046483
|
||||
DIOCGFWSECTORS = 0x40046482
|
||||
DIOCGIDENT = 0x41006489
|
||||
DIOCGMEDIASIZE = 0x40086481
|
||||
DIOCGPHYSPATH = 0x4400648d
|
||||
DIOCGPROVIDERNAME = 0x4400648a
|
||||
DIOCGSECTORSIZE = 0x40046480
|
||||
DIOCGSTRIPEOFFSET = 0x4008648c
|
||||
DIOCGSTRIPESIZE = 0x4008648b
|
||||
DIOCSKERNELDUMP = 0x804c6490
|
||||
DIOCSKERNELDUMP_FREEBSD11 = 0x80046485
|
||||
DIOCZONECMD = 0xc06c648f
|
||||
DLT_A429 = 0xb8
|
||||
DLT_A653_ICM = 0xb9
|
||||
DLT_AIRONET_HEADER = 0x78
|
||||
|
|
|
@ -355,6 +355,22 @@ const (
|
|||
CTL_KERN = 0x1
|
||||
CTL_MAXNAME = 0x18
|
||||
CTL_NET = 0x4
|
||||
DIOCGATTR = 0xc148648e
|
||||
DIOCGDELETE = 0x80106488
|
||||
DIOCGFLUSH = 0x20006487
|
||||
DIOCGFRONTSTUFF = 0x40086486
|
||||
DIOCGFWHEADS = 0x40046483
|
||||
DIOCGFWSECTORS = 0x40046482
|
||||
DIOCGIDENT = 0x41006489
|
||||
DIOCGMEDIASIZE = 0x40086481
|
||||
DIOCGPHYSPATH = 0x4400648d
|
||||
DIOCGPROVIDERNAME = 0x4400648a
|
||||
DIOCGSECTORSIZE = 0x40046480
|
||||
DIOCGSTRIPEOFFSET = 0x4008648c
|
||||
DIOCGSTRIPESIZE = 0x4008648b
|
||||
DIOCSKERNELDUMP = 0x80506490
|
||||
DIOCSKERNELDUMP_FREEBSD11 = 0x80046485
|
||||
DIOCZONECMD = 0xc080648f
|
||||
DLT_A429 = 0xb8
|
||||
DLT_A653_ICM = 0xb9
|
||||
DLT_AIRONET_HEADER = 0x78
|
||||
|
@ -379,11 +395,14 @@ const (
|
|||
DLT_CHAOS = 0x5
|
||||
DLT_CHDLC = 0x68
|
||||
DLT_CISCO_IOS = 0x76
|
||||
DLT_CLASS_NETBSD_RAWAF = 0x2240000
|
||||
DLT_C_HDLC = 0x68
|
||||
DLT_C_HDLC_WITH_DIR = 0xcd
|
||||
DLT_DBUS = 0xe7
|
||||
DLT_DECT = 0xdd
|
||||
DLT_DISPLAYPORT_AUX = 0x113
|
||||
DLT_DOCSIS = 0x8f
|
||||
DLT_DOCSIS31_XRA31 = 0x111
|
||||
DLT_DVB_CI = 0xeb
|
||||
DLT_ECONET = 0x73
|
||||
DLT_EN10MB = 0x1
|
||||
|
@ -393,6 +412,7 @@ const (
|
|||
DLT_ERF = 0xc5
|
||||
DLT_ERF_ETH = 0xaf
|
||||
DLT_ERF_POS = 0xb0
|
||||
DLT_ETHERNET_MPACKET = 0x112
|
||||
DLT_FC_2 = 0xe0
|
||||
DLT_FC_2_WITH_FRAME_DELIMS = 0xe1
|
||||
DLT_FDDI = 0xa
|
||||
|
@ -406,7 +426,6 @@ const (
|
|||
DLT_GPRS_LLC = 0xa9
|
||||
DLT_GSMTAP_ABIS = 0xda
|
||||
DLT_GSMTAP_UM = 0xd9
|
||||
DLT_HHDLC = 0x79
|
||||
DLT_IBM_SN = 0x92
|
||||
DLT_IBM_SP = 0x91
|
||||
DLT_IEEE802 = 0x6
|
||||
|
@ -429,6 +448,7 @@ const (
|
|||
DLT_IPV4 = 0xe4
|
||||
DLT_IPV6 = 0xe5
|
||||
DLT_IP_OVER_FC = 0x7a
|
||||
DLT_ISO_14443 = 0x108
|
||||
DLT_JUNIPER_ATM1 = 0x89
|
||||
DLT_JUNIPER_ATM2 = 0x87
|
||||
DLT_JUNIPER_ATM_CEMIC = 0xee
|
||||
|
@ -461,8 +481,9 @@ const (
|
|||
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
||||
DLT_LINUX_SLL = 0x71
|
||||
DLT_LOOP = 0x6c
|
||||
DLT_LORATAP = 0x10e
|
||||
DLT_LTALK = 0x72
|
||||
DLT_MATCHING_MAX = 0x104
|
||||
DLT_MATCHING_MAX = 0x113
|
||||
DLT_MATCHING_MIN = 0x68
|
||||
DLT_MFR = 0xb6
|
||||
DLT_MOST = 0xd3
|
||||
|
@ -478,14 +499,16 @@ const (
|
|||
DLT_NFC_LLCP = 0xf5
|
||||
DLT_NFLOG = 0xef
|
||||
DLT_NG40 = 0xf4
|
||||
DLT_NORDIC_BLE = 0x110
|
||||
DLT_NULL = 0x0
|
||||
DLT_OPENFLOW = 0x10b
|
||||
DLT_PCI_EXP = 0x7d
|
||||
DLT_PFLOG = 0x75
|
||||
DLT_PFSYNC = 0x79
|
||||
DLT_PKTAP = 0x102
|
||||
DLT_PPI = 0xc0
|
||||
DLT_PPP = 0x9
|
||||
DLT_PPP_BSDOS = 0x10
|
||||
DLT_PPP_BSDOS = 0xe
|
||||
DLT_PPP_ETHER = 0x33
|
||||
DLT_PPP_PPPD = 0xa6
|
||||
DLT_PPP_SERIAL = 0x32
|
||||
|
@ -496,19 +519,25 @@ const (
|
|||
DLT_PRONET = 0x4
|
||||
DLT_RAIF1 = 0xc6
|
||||
DLT_RAW = 0xc
|
||||
DLT_RDS = 0x109
|
||||
DLT_REDBACK_SMARTEDGE = 0x20
|
||||
DLT_RIO = 0x7c
|
||||
DLT_RTAC_SERIAL = 0xfa
|
||||
DLT_SCCP = 0x8e
|
||||
DLT_SCTP = 0xf8
|
||||
DLT_SDLC = 0x10c
|
||||
DLT_SITA = 0xc4
|
||||
DLT_SLIP = 0x8
|
||||
DLT_SLIP_BSDOS = 0xf
|
||||
DLT_SLIP_BSDOS = 0xd
|
||||
DLT_STANAG_5066_D_PDU = 0xed
|
||||
DLT_SUNATM = 0x7b
|
||||
DLT_SYMANTEC_FIREWALL = 0x63
|
||||
DLT_TI_LLN_SNIFFER = 0x10d
|
||||
DLT_TZSP = 0x80
|
||||
DLT_USB = 0xba
|
||||
DLT_USBPCAP = 0xf9
|
||||
DLT_USB_DARWIN = 0x10a
|
||||
DLT_USB_FREEBSD = 0xba
|
||||
DLT_USB_LINUX = 0xbd
|
||||
DLT_USB_LINUX_MMAPPED = 0xdc
|
||||
DLT_USER0 = 0x93
|
||||
|
@ -527,10 +556,14 @@ const (
|
|||
DLT_USER7 = 0x9a
|
||||
DLT_USER8 = 0x9b
|
||||
DLT_USER9 = 0x9c
|
||||
DLT_VSOCK = 0x10f
|
||||
DLT_WATTSTOPPER_DLM = 0x107
|
||||
DLT_WIHART = 0xdf
|
||||
DLT_WIRESHARK_UPPER_PDU = 0xfc
|
||||
DLT_X2E_SERIAL = 0xd5
|
||||
DLT_X2E_XORAYA = 0xd6
|
||||
DLT_ZWAVE_R1_R2 = 0x105
|
||||
DLT_ZWAVE_R3 = 0x106
|
||||
DT_BLK = 0x6
|
||||
DT_CHR = 0x2
|
||||
DT_DIR = 0x4
|
||||
|
@ -548,6 +581,7 @@ const (
|
|||
ECHONL = 0x10
|
||||
ECHOPRT = 0x20
|
||||
EVFILT_AIO = -0x3
|
||||
EVFILT_EMPTY = -0xd
|
||||
EVFILT_FS = -0x9
|
||||
EVFILT_LIO = -0xa
|
||||
EVFILT_PROC = -0x5
|
||||
|
@ -555,11 +589,12 @@ const (
|
|||
EVFILT_READ = -0x1
|
||||
EVFILT_SENDFILE = -0xc
|
||||
EVFILT_SIGNAL = -0x6
|
||||
EVFILT_SYSCOUNT = 0xc
|
||||
EVFILT_SYSCOUNT = 0xd
|
||||
EVFILT_TIMER = -0x7
|
||||
EVFILT_USER = -0xb
|
||||
EVFILT_VNODE = -0x4
|
||||
EVFILT_WRITE = -0x2
|
||||
EVNAMEMAP_NAME_SIZE = 0x40
|
||||
EV_ADD = 0x1
|
||||
EV_CLEAR = 0x20
|
||||
EV_DELETE = 0x2
|
||||
|
@ -576,6 +611,7 @@ const (
|
|||
EV_RECEIPT = 0x40
|
||||
EV_SYSFLAGS = 0xf000
|
||||
EXTA = 0x4b00
|
||||
EXTATTR_MAXNAMELEN = 0xff
|
||||
EXTATTR_NAMESPACE_EMPTY = 0x0
|
||||
EXTATTR_NAMESPACE_SYSTEM = 0x2
|
||||
EXTATTR_NAMESPACE_USER = 0x1
|
||||
|
@ -617,6 +653,7 @@ const (
|
|||
IEXTEN = 0x400
|
||||
IFAN_ARRIVAL = 0x0
|
||||
IFAN_DEPARTURE = 0x1
|
||||
IFCAP_WOL_MAGIC = 0x2000
|
||||
IFF_ALLMULTI = 0x200
|
||||
IFF_ALTPHYS = 0x4000
|
||||
IFF_BROADCAST = 0x2
|
||||
|
@ -633,6 +670,7 @@ const (
|
|||
IFF_MONITOR = 0x40000
|
||||
IFF_MULTICAST = 0x8000
|
||||
IFF_NOARP = 0x80
|
||||
IFF_NOGROUP = 0x800000
|
||||
IFF_OACTIVE = 0x400
|
||||
IFF_POINTOPOINT = 0x10
|
||||
IFF_PPROMISC = 0x20000
|
||||
|
@ -807,6 +845,7 @@ const (
|
|||
IPV6_DSTOPTS = 0x32
|
||||
IPV6_FLOWID = 0x43
|
||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||
IPV6_FLOWLABEL_LEN = 0x14
|
||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||
IPV6_FLOWTYPE = 0x44
|
||||
IPV6_FRAGTTL = 0x78
|
||||
|
@ -827,13 +866,13 @@ const (
|
|||
IPV6_MAX_GROUP_SRC_FILTER = 0x200
|
||||
IPV6_MAX_MEMBERSHIPS = 0xfff
|
||||
IPV6_MAX_SOCK_SRC_FILTER = 0x80
|
||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
||||
IPV6_MMTU = 0x500
|
||||
IPV6_MSFILTER = 0x4a
|
||||
IPV6_MULTICAST_HOPS = 0xa
|
||||
IPV6_MULTICAST_IF = 0x9
|
||||
IPV6_MULTICAST_LOOP = 0xb
|
||||
IPV6_NEXTHOP = 0x30
|
||||
IPV6_ORIGDSTADDR = 0x48
|
||||
IPV6_PATHMTU = 0x2c
|
||||
IPV6_PKTINFO = 0x2e
|
||||
IPV6_PORTRANGE = 0xe
|
||||
|
@ -845,6 +884,7 @@ const (
|
|||
IPV6_RECVFLOWID = 0x46
|
||||
IPV6_RECVHOPLIMIT = 0x25
|
||||
IPV6_RECVHOPOPTS = 0x27
|
||||
IPV6_RECVORIGDSTADDR = 0x48
|
||||
IPV6_RECVPATHMTU = 0x2b
|
||||
IPV6_RECVPKTINFO = 0x24
|
||||
IPV6_RECVRSSBUCKETID = 0x47
|
||||
|
@ -905,10 +945,8 @@ const (
|
|||
IP_MAX_MEMBERSHIPS = 0xfff
|
||||
IP_MAX_SOCK_MUTE_FILTER = 0x80
|
||||
IP_MAX_SOCK_SRC_FILTER = 0x80
|
||||
IP_MAX_SOURCE_FILTER = 0x400
|
||||
IP_MF = 0x2000
|
||||
IP_MINTTL = 0x42
|
||||
IP_MIN_MEMBERSHIPS = 0x1f
|
||||
IP_MSFILTER = 0x4a
|
||||
IP_MSS = 0x240
|
||||
IP_MULTICAST_IF = 0x9
|
||||
|
@ -918,6 +956,7 @@ const (
|
|||
IP_OFFMASK = 0x1fff
|
||||
IP_ONESBCAST = 0x17
|
||||
IP_OPTIONS = 0x1
|
||||
IP_ORIGDSTADDR = 0x1b
|
||||
IP_PORTRANGE = 0x13
|
||||
IP_PORTRANGE_DEFAULT = 0x0
|
||||
IP_PORTRANGE_HIGH = 0x1
|
||||
|
@ -926,6 +965,7 @@ const (
|
|||
IP_RECVFLOWID = 0x5d
|
||||
IP_RECVIF = 0x14
|
||||
IP_RECVOPTS = 0x5
|
||||
IP_RECVORIGDSTADDR = 0x1b
|
||||
IP_RECVRETOPTS = 0x6
|
||||
IP_RECVRSSBUCKETID = 0x5e
|
||||
IP_RECVTOS = 0x44
|
||||
|
@ -976,6 +1016,7 @@ const (
|
|||
MAP_EXCL = 0x4000
|
||||
MAP_FILE = 0x0
|
||||
MAP_FIXED = 0x10
|
||||
MAP_GUARD = 0x2000
|
||||
MAP_HASSEMAPHORE = 0x200
|
||||
MAP_NOCORE = 0x20000
|
||||
MAP_NOSYNC = 0x800
|
||||
|
@ -987,6 +1028,15 @@ const (
|
|||
MAP_RESERVED0100 = 0x100
|
||||
MAP_SHARED = 0x1
|
||||
MAP_STACK = 0x400
|
||||
MCAST_BLOCK_SOURCE = 0x54
|
||||
MCAST_EXCLUDE = 0x2
|
||||
MCAST_INCLUDE = 0x1
|
||||
MCAST_JOIN_GROUP = 0x50
|
||||
MCAST_JOIN_SOURCE_GROUP = 0x52
|
||||
MCAST_LEAVE_GROUP = 0x51
|
||||
MCAST_LEAVE_SOURCE_GROUP = 0x53
|
||||
MCAST_UNBLOCK_SOURCE = 0x55
|
||||
MCAST_UNDEFINED = 0x0
|
||||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MNT_ACLS = 0x8000000
|
||||
|
@ -1027,10 +1077,12 @@ const (
|
|||
MNT_SUSPEND = 0x4
|
||||
MNT_SYNCHRONOUS = 0x2
|
||||
MNT_UNION = 0x20
|
||||
MNT_UNTRUSTED = 0x800000000
|
||||
MNT_UPDATE = 0x10000
|
||||
MNT_UPDATEMASK = 0x2d8d0807e
|
||||
MNT_UPDATEMASK = 0xad8d0807e
|
||||
MNT_USER = 0x8000
|
||||
MNT_VISFLAGMASK = 0x3fef0ffff
|
||||
MNT_VERIFIED = 0x400000000
|
||||
MNT_VISFLAGMASK = 0xffef0ffff
|
||||
MNT_WAIT = 0x1
|
||||
MSG_CMSG_CLOEXEC = 0x40000
|
||||
MSG_COMPAT = 0x8000
|
||||
|
@ -1059,6 +1111,7 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NOFLSH = 0x80000000
|
||||
NOKERNINFO = 0x2000000
|
||||
NOTE_ABSTIME = 0x10
|
||||
NOTE_ATTRIB = 0x8
|
||||
NOTE_CHILD = 0x4
|
||||
NOTE_CLOSE = 0x100
|
||||
|
@ -1213,7 +1266,6 @@ const (
|
|||
RTV_WEIGHT = 0x100
|
||||
RT_ALL_FIBS = -0x1
|
||||
RT_BLACKHOLE = 0x40
|
||||
RT_CACHING_CONTEXT = 0x1
|
||||
RT_DEFAULT_FIB = 0x0
|
||||
RT_HAS_GW = 0x80
|
||||
RT_HAS_HEADER = 0x10
|
||||
|
@ -1223,15 +1275,17 @@ const (
|
|||
RT_LLE_CACHE = 0x100
|
||||
RT_MAY_LOOP = 0x8
|
||||
RT_MAY_LOOP_BIT = 0x3
|
||||
RT_NORTREF = 0x2
|
||||
RT_REJECT = 0x20
|
||||
RUSAGE_CHILDREN = -0x1
|
||||
RUSAGE_SELF = 0x0
|
||||
RUSAGE_THREAD = 0x1
|
||||
SCM_BINTIME = 0x4
|
||||
SCM_CREDS = 0x3
|
||||
SCM_MONOTONIC = 0x6
|
||||
SCM_REALTIME = 0x5
|
||||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
SCM_TIME_INFO = 0x7
|
||||
SHUT_RD = 0x0
|
||||
SHUT_RDWR = 0x2
|
||||
SHUT_WR = 0x1
|
||||
|
@ -1247,6 +1301,7 @@ const (
|
|||
SIOCGETSGCNT = 0xc0207210
|
||||
SIOCGETVIFCNT = 0xc028720f
|
||||
SIOCGHIWAT = 0x40047301
|
||||
SIOCGHWADDR = 0xc020693e
|
||||
SIOCGI2C = 0xc020693d
|
||||
SIOCGIFADDR = 0xc0206921
|
||||
SIOCGIFBRDADDR = 0xc0206923
|
||||
|
@ -1268,8 +1323,11 @@ const (
|
|||
SIOCGIFPDSTADDR = 0xc0206948
|
||||
SIOCGIFPHYS = 0xc0206935
|
||||
SIOCGIFPSRCADDR = 0xc0206947
|
||||
SIOCGIFRSSHASH = 0xc0186997
|
||||
SIOCGIFRSSKEY = 0xc0946996
|
||||
SIOCGIFSTATUS = 0xc331693b
|
||||
SIOCGIFXMEDIA = 0xc030698b
|
||||
SIOCGLANPCP = 0xc0206998
|
||||
SIOCGLOWAT = 0x40047303
|
||||
SIOCGPGRP = 0x40047309
|
||||
SIOCGPRIVATE_0 = 0xc0206950
|
||||
|
@ -1300,6 +1358,7 @@ const (
|
|||
SIOCSIFPHYS = 0x80206936
|
||||
SIOCSIFRVNET = 0xc020695b
|
||||
SIOCSIFVNET = 0xc020695a
|
||||
SIOCSLANPCP = 0x80206999
|
||||
SIOCSLOWAT = 0x80047302
|
||||
SIOCSPGRP = 0x80047308
|
||||
SIOCSTUNFIB = 0x8020695f
|
||||
|
@ -1318,6 +1377,7 @@ const (
|
|||
SO_BINTIME = 0x2000
|
||||
SO_BROADCAST = 0x20
|
||||
SO_DEBUG = 0x1
|
||||
SO_DOMAIN = 0x1019
|
||||
SO_DONTROUTE = 0x10
|
||||
SO_ERROR = 0x1007
|
||||
SO_KEEPALIVE = 0x8
|
||||
|
@ -1326,6 +1386,7 @@ const (
|
|||
SO_LISTENINCQLEN = 0x1013
|
||||
SO_LISTENQLEN = 0x1012
|
||||
SO_LISTENQLIMIT = 0x1011
|
||||
SO_MAX_PACING_RATE = 0x1018
|
||||
SO_NOSIGPIPE = 0x800
|
||||
SO_NO_DDP = 0x8000
|
||||
SO_NO_OFFLOAD = 0x4000
|
||||
|
@ -1338,11 +1399,19 @@ const (
|
|||
SO_RCVTIMEO = 0x1006
|
||||
SO_REUSEADDR = 0x4
|
||||
SO_REUSEPORT = 0x200
|
||||
SO_REUSEPORT_LB = 0x10000
|
||||
SO_SETFIB = 0x1014
|
||||
SO_SNDBUF = 0x1001
|
||||
SO_SNDLOWAT = 0x1003
|
||||
SO_SNDTIMEO = 0x1005
|
||||
SO_TIMESTAMP = 0x400
|
||||
SO_TS_BINTIME = 0x1
|
||||
SO_TS_CLOCK = 0x1017
|
||||
SO_TS_CLOCK_MAX = 0x3
|
||||
SO_TS_DEFAULT = 0x0
|
||||
SO_TS_MONOTONIC = 0x3
|
||||
SO_TS_REALTIME = 0x2
|
||||
SO_TS_REALTIME_MICRO = 0x0
|
||||
SO_TYPE = 0x1008
|
||||
SO_USELOOPBACK = 0x40
|
||||
SO_USER_COOKIE = 0x1015
|
||||
|
@ -1386,10 +1455,45 @@ const (
|
|||
TCOFLUSH = 0x2
|
||||
TCOOFF = 0x1
|
||||
TCOON = 0x2
|
||||
TCP_BBR_ACK_COMP_ALG = 0x448
|
||||
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
||||
TCP_BBR_DRAIN_PG = 0x42e
|
||||
TCP_BBR_EXTRA_GAIN = 0x449
|
||||
TCP_BBR_IWINTSO = 0x42b
|
||||
TCP_BBR_LOWGAIN_FD = 0x436
|
||||
TCP_BBR_LOWGAIN_HALF = 0x435
|
||||
TCP_BBR_LOWGAIN_THRESH = 0x434
|
||||
TCP_BBR_MAX_RTO = 0x439
|
||||
TCP_BBR_MIN_RTO = 0x438
|
||||
TCP_BBR_ONE_RETRAN = 0x431
|
||||
TCP_BBR_PACE_CROSS = 0x442
|
||||
TCP_BBR_PACE_DEL_TAR = 0x43f
|
||||
TCP_BBR_PACE_PER_SEC = 0x43e
|
||||
TCP_BBR_PACE_SEG_MAX = 0x440
|
||||
TCP_BBR_PACE_SEG_MIN = 0x441
|
||||
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
||||
TCP_BBR_PROBE_RTT_INT = 0x430
|
||||
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
||||
TCP_BBR_RACK_RTT_USE = 0x44a
|
||||
TCP_BBR_RECFORCE = 0x42c
|
||||
TCP_BBR_REC_OVER_HPTS = 0x43a
|
||||
TCP_BBR_RETRAN_WTSO = 0x44b
|
||||
TCP_BBR_RWND_IS_APP = 0x42f
|
||||
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
||||
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
||||
TCP_BBR_STARTUP_PG = 0x42d
|
||||
TCP_BBR_UNLIMITED = 0x43b
|
||||
TCP_BBR_USEDEL_RATE = 0x437
|
||||
TCP_BBR_USE_LOWGAIN = 0x433
|
||||
TCP_CA_NAME_MAX = 0x10
|
||||
TCP_CCALGOOPT = 0x41
|
||||
TCP_CONGESTION = 0x40
|
||||
TCP_DATA_AFTER_CLOSE = 0x44c
|
||||
TCP_DELACK = 0x48
|
||||
TCP_FASTOPEN = 0x401
|
||||
TCP_FASTOPEN_MAX_COOKIE_LEN = 0x10
|
||||
TCP_FASTOPEN_MIN_COOKIE_LEN = 0x4
|
||||
TCP_FASTOPEN_PSK_LEN = 0x10
|
||||
TCP_FUNCTION_BLK = 0x2000
|
||||
TCP_FUNCTION_NAME_LEN_MAX = 0x20
|
||||
TCP_INFO = 0x20
|
||||
|
@ -1397,6 +1501,12 @@ const (
|
|||
TCP_KEEPIDLE = 0x100
|
||||
TCP_KEEPINIT = 0x80
|
||||
TCP_KEEPINTVL = 0x200
|
||||
TCP_LOG = 0x22
|
||||
TCP_LOGBUF = 0x23
|
||||
TCP_LOGDUMP = 0x25
|
||||
TCP_LOGDUMPID = 0x26
|
||||
TCP_LOGID = 0x24
|
||||
TCP_LOG_ID_LEN = 0x40
|
||||
TCP_MAXBURST = 0x4
|
||||
TCP_MAXHLEN = 0x3c
|
||||
TCP_MAXOLEN = 0x28
|
||||
|
@ -1412,8 +1522,30 @@ const (
|
|||
TCP_NOPUSH = 0x4
|
||||
TCP_PCAP_IN = 0x1000
|
||||
TCP_PCAP_OUT = 0x800
|
||||
TCP_RACK_EARLY_RECOV = 0x423
|
||||
TCP_RACK_EARLY_SEG = 0x424
|
||||
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
||||
TCP_RACK_MIN_PACE = 0x445
|
||||
TCP_RACK_MIN_PACE_SEG = 0x446
|
||||
TCP_RACK_MIN_TO = 0x422
|
||||
TCP_RACK_PACE_ALWAYS = 0x41f
|
||||
TCP_RACK_PACE_MAX_SEG = 0x41e
|
||||
TCP_RACK_PACE_REDUCE = 0x41d
|
||||
TCP_RACK_PKT_DELAY = 0x428
|
||||
TCP_RACK_PROP = 0x41b
|
||||
TCP_RACK_PROP_RATE = 0x420
|
||||
TCP_RACK_PRR_SENDALOT = 0x421
|
||||
TCP_RACK_REORD_FADE = 0x426
|
||||
TCP_RACK_REORD_THRESH = 0x425
|
||||
TCP_RACK_SESS_CWV = 0x42a
|
||||
TCP_RACK_TLP_INC_VAR = 0x429
|
||||
TCP_RACK_TLP_REDUCE = 0x41c
|
||||
TCP_RACK_TLP_THRESH = 0x427
|
||||
TCP_RACK_TLP_USE = 0x447
|
||||
TCP_VENDOR = 0x80000000
|
||||
TCSAFLUSH = 0x2
|
||||
TIMER_ABSTIME = 0x1
|
||||
TIMER_RELTIME = 0x0
|
||||
TIOCCBRK = 0x2000747a
|
||||
TIOCCDTR = 0x20007478
|
||||
TIOCCONS = 0x80047462
|
||||
|
@ -1477,6 +1609,8 @@ const (
|
|||
TIOCTIMESTAMP = 0x40107459
|
||||
TIOCUCNTL = 0x80047466
|
||||
TOSTOP = 0x400000
|
||||
UTIME_NOW = -0x1
|
||||
UTIME_OMIT = -0x2
|
||||
VDISCARD = 0xf
|
||||
VDSUSP = 0xb
|
||||
VEOF = 0x0
|
||||
|
@ -1488,6 +1622,7 @@ const (
|
|||
VKILL = 0x5
|
||||
VLNEXT = 0xe
|
||||
VMIN = 0x10
|
||||
VM_BCACHE_SIZE_MAX = 0x19000000
|
||||
VQUIT = 0x9
|
||||
VREPRINT = 0x6
|
||||
VSTART = 0xc
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -214,22 +214,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(mib) > 0 {
|
||||
_p0 = unsafe.Pointer(&mib[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func utimes(path string, timeval *[2]Timeval) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
@ -376,16 +360,6 @@ func pipe2(p *[2]_C_int, flags int) (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Getcwd(buf []byte) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
|
@ -413,6 +387,32 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(mib) > 0 {
|
||||
_p0 = unsafe.Pointer(&mib[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Access(path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
@ -1352,7 +1352,7 @@ func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error)
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
|
||||
_, _, e1 := Syscall6(SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), uintptr(dev>>32), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
|
|
|
@ -350,22 +350,6 @@ func Munlockall() (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(mib) > 0 {
|
||||
_p0 = unsafe.Pointer(&mib[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func pipe2(p *[2]_C_int, flags int) (err error) {
|
||||
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
|
@ -403,6 +387,22 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(mib) > 0 {
|
||||
_p0 = unsafe.Pointer(&mib[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// go run mksyscall.go -tags freebsd,arm64 -- syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm64.go
|
||||
// go run mksyscall.go -tags freebsd,arm64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm64.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build freebsd,arm64
|
||||
|
@ -350,22 +350,6 @@ func Munlockall() (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(mib) > 0 {
|
||||
_p0 = unsafe.Pointer(&mib[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func pipe2(p *[2]_C_int, flags int) (err error) {
|
||||
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
|
@ -403,6 +387,22 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(mib) > 0 {
|
||||
_p0 = unsafe.Pointer(&mib[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
// go run mksyscall_solaris.go -illumos -tags illumos,amd64 syscall_illumos.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build illumos,amd64
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
//go:cgo_import_dynamic libc_readv readv "libc.so"
|
||||
//go:cgo_import_dynamic libc_preadv preadv "libc.so"
|
||||
//go:cgo_import_dynamic libc_writev writev "libc.so"
|
||||
//go:cgo_import_dynamic libc_pwritev pwritev "libc.so"
|
||||
|
||||
//go:linkname procreadv libc_readv
|
||||
//go:linkname procpreadv libc_preadv
|
||||
//go:linkname procwritev libc_writev
|
||||
//go:linkname procpwritev libc_pwritev
|
||||
|
||||
var (
|
||||
procreadv,
|
||||
procpreadv,
|
||||
procwritev,
|
||||
procpwritev syscallFunc
|
||||
)
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func readv(fd int, iovs []Iovec) (n int, err error) {
|
||||
var _p0 *Iovec
|
||||
if len(iovs) > 0 {
|
||||
_p0 = &iovs[0]
|
||||
}
|
||||
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procreadv)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0)
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func preadv(fd int, iovs []Iovec, off int64) (n int, err error) {
|
||||
var _p0 *Iovec
|
||||
if len(iovs) > 0 {
|
||||
_p0 = &iovs[0]
|
||||
}
|
||||
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpreadv)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0)
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func writev(fd int, iovs []Iovec) (n int, err error) {
|
||||
var _p0 *Iovec
|
||||
if len(iovs) > 0 {
|
||||
_p0 = &iovs[0]
|
||||
}
|
||||
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwritev)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0)
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func pwritev(fd int, iovs []Iovec, off int64) (n int, err error) {
|
||||
var _p0 *Iovec
|
||||
if len(iovs) > 0 {
|
||||
_p0 = &iovs[0]
|
||||
}
|
||||
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpwritev)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0)
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -431,4 +431,6 @@ const (
|
|||
SYS_FSPICK = 433
|
||||
SYS_PIDFD_OPEN = 434
|
||||
SYS_CLONE3 = 435
|
||||
SYS_OPENAT2 = 437
|
||||
SYS_PIDFD_GETFD = 438
|
||||
)
|
||||
|
|
|
@ -353,4 +353,6 @@ const (
|
|||
SYS_FSPICK = 433
|
||||
SYS_PIDFD_OPEN = 434
|
||||
SYS_CLONE3 = 435
|
||||
SYS_OPENAT2 = 437
|
||||
SYS_PIDFD_GETFD = 438
|
||||
)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue