Gomod: update deps (vendor'd)
This commit is contained in:
parent
42949acbaa
commit
a357f2a924
21
vendor/github.com/aymanbagabas/go-osc52/LICENSE
generated
vendored
Normal file
21
vendor/github.com/aymanbagabas/go-osc52/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Ayman Bagabas
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
25
vendor/github.com/aymanbagabas/go-osc52/README.md
generated
vendored
Normal file
25
vendor/github.com/aymanbagabas/go-osc52/README.md
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
# go-osc52
|
||||
|
||||
<p>
|
||||
<a href="https://github.com/aymanbagabas/go-osc52/releases"><img src="https://img.shields.io/github/release/aymanbagabas/go-osc52.svg" alt="Latest Release"></a>
|
||||
<a href="https://pkg.go.dev/github.com/aymanbagabas/go-osc52?tab=doc"><img src="https://godoc.org/github.com/golang/gddo?status.svg" alt="GoDoc"></a>
|
||||
</p>
|
||||
|
||||
A terminal Go library to copy text to clipboard from anywhere. It does so using [ANSI OSC52](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands). The `Copy()` function defaults to copying text from terminals running locally.
|
||||
|
||||
To use this over SSH, using [gliderlabs/ssh](https://github.com/gliderlabs/ssh), use `NewOutput(sshSession, sshSession.Environ())` and make sure you pass the `TERM` environment variable in your SSH connection.
|
||||
|
||||
```sh
|
||||
ssh -o SendEnv=TERM <host>
|
||||
```
|
||||
|
||||
Tmux users need to pass an additional environment variable `TMUX`.
|
||||
|
||||
```sh
|
||||
ssh -o SendEnv=TERM -o SendEnv=TMUX <host>
|
||||
```
|
||||
|
||||
# Credits
|
||||
|
||||
* [vim-oscyank](https://github.com/ojroques/vim-oscyank) this is heavily inspired by vim-oscyank.
|
110
vendor/github.com/aymanbagabas/go-osc52/osc52.go
generated
vendored
Normal file
110
vendor/github.com/aymanbagabas/go-osc52/osc52.go
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
package osc52
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// output is the default output for Copy which uses os.Stdout and os.Environ.
|
||||
var output = NewOutput(os.Stdout, os.Environ())
|
||||
|
||||
// envs is a map of environment variables.
|
||||
type envs map[string]string
|
||||
|
||||
// Get returns the value of the environment variable named by the key.
|
||||
func (e envs) Get(key string) string {
|
||||
v, ok := e[key]
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// Output is where the OSC52 string should be written.
|
||||
type Output struct {
|
||||
out io.Writer
|
||||
envs envs
|
||||
}
|
||||
|
||||
// NewOutput returns a new Output.
|
||||
func NewOutput(out io.Writer, envs []string) *Output {
|
||||
e := make(map[string]string, 0)
|
||||
for _, env := range envs {
|
||||
s := strings.Split(env, "=")
|
||||
k := s[0]
|
||||
v := strings.Join(s[1:], "=")
|
||||
e[k] = v
|
||||
}
|
||||
o := &Output{
|
||||
out: out,
|
||||
envs: e,
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
||||
// Copy copies the OSC52 string to the output. This is the default copy function.
|
||||
func Copy(str string) {
|
||||
output.Copy(str)
|
||||
}
|
||||
|
||||
// Copy copies the OSC52 string to the output.
|
||||
func (o *Output) Copy(str string) {
|
||||
mode := "default"
|
||||
term := o.envs.Get("TERM")
|
||||
switch {
|
||||
case o.envs.Get("TMUX") != "", strings.HasPrefix(term, "tmux"):
|
||||
mode = "tmux"
|
||||
case strings.HasPrefix(term, "screen"):
|
||||
mode = "screen"
|
||||
case strings.Contains(term, "kitty"):
|
||||
mode = "kitty"
|
||||
}
|
||||
|
||||
switch mode {
|
||||
case "default":
|
||||
o.copyDefault(str)
|
||||
case "tmux":
|
||||
o.copyTmux(str)
|
||||
case "screen":
|
||||
o.copyDCS(str)
|
||||
case "kitty":
|
||||
o.copyKitty(str)
|
||||
}
|
||||
}
|
||||
|
||||
// copyDefault copies the OSC52 string to the output.
|
||||
func (o *Output) copyDefault(str string) {
|
||||
b64 := base64.StdEncoding.EncodeToString([]byte(str))
|
||||
o.out.Write([]byte("\x1b]52;c;" + b64 + "\x07"))
|
||||
}
|
||||
|
||||
// copyTmux copies the OSC52 string escaped for Tmux.
|
||||
func (o *Output) copyTmux(str string) {
|
||||
b64 := base64.StdEncoding.EncodeToString([]byte(str))
|
||||
o.out.Write([]byte("\x1bPtmux;\x1b\x1b]52;c;" + b64 + "\x07\x1b\\"))
|
||||
}
|
||||
|
||||
// copyDCS copies the OSC52 string wrapped in a DCS sequence which is
|
||||
// appropriate when using screen.
|
||||
//
|
||||
// Screen doesn't support OSC52 but will pass the contents of a DCS sequence to
|
||||
// the outer terminal unchanged.
|
||||
func (o *Output) copyDCS(str string) {
|
||||
// Here, we split the encoded string into 76 bytes chunks and then join the
|
||||
// chunks with <end-dsc><start-dsc> sequences. Finally, wrap the whole thing in
|
||||
// <start-dsc><start-osc52><joined-chunks><end-osc52><end-dsc>.
|
||||
b64 := base64.StdEncoding.EncodeToString([]byte(str))
|
||||
s := strings.SplitN(b64, "", 76)
|
||||
q := fmt.Sprintf("\x1bP\x1b]52;c;%s\x07\x1b\x5c", strings.Join(s, "\x1b\\\x1bP"))
|
||||
o.out.Write([]byte(q))
|
||||
}
|
||||
|
||||
// copyKitty copies the OSC52 string to Kitty. First, it flushes the keyboard
|
||||
// before copying, this is required for Kitty < 0.22.0.
|
||||
func (o *Output) copyKitty(str string) {
|
||||
o.out.Write([]byte("\x1b]52;c;!\x07"))
|
||||
o.copyDefault(str)
|
||||
}
|
2
vendor/github.com/caarlos0/sshmarshal/.gitignore
generated
vendored
Normal file
2
vendor/github.com/caarlos0/sshmarshal/.gitignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
dist/
|
3
vendor/github.com/caarlos0/sshmarshal/.goreleaser.yml
generated
vendored
Normal file
3
vendor/github.com/caarlos0/sshmarshal/.goreleaser.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
includes:
|
||||
- from_url:
|
||||
url: https://raw.githubusercontent.com/caarlos0/.goreleaserfiles/main/lib.yml
|
7
vendor/github.com/caarlos0/sshmarshal/README.md
generated
vendored
Normal file
7
vendor/github.com/caarlos0/sshmarshal/README.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# sshmarshal
|
||||
|
||||
Library containing code copied from [x/crypto][crypto] and [this patch][patch] so we can
|
||||
more easily marshal SSH private keys.
|
||||
|
||||
[patch]: https://go-review.googlesource.com/c/crypto/+/218620/
|
||||
[crypto]: https://github.com/golang/crypto
|
93
vendor/github.com/caarlos0/sshmarshal/internal/bcrypt_pbkdf/bcrypt_pbkdf.go
generated
vendored
Normal file
93
vendor/github.com/caarlos0/sshmarshal/internal/bcrypt_pbkdf/bcrypt_pbkdf.go
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package bcrypt_pbkdf implements bcrypt_pbkdf(3) from OpenBSD.
|
||||
//
|
||||
// See https://flak.tedunangst.com/post/bcrypt-pbkdf and
|
||||
// https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/bcrypt_pbkdf.c.
|
||||
package bcrypt_pbkdf
|
||||
|
||||
import (
|
||||
"crypto/sha512"
|
||||
"errors"
|
||||
"golang.org/x/crypto/blowfish"
|
||||
)
|
||||
|
||||
const blockSize = 32
|
||||
|
||||
// Key derives a key from the password, salt and rounds count, returning a
|
||||
// []byte of length keyLen that can be used as cryptographic key.
|
||||
func Key(password, salt []byte, rounds, keyLen int) ([]byte, error) {
|
||||
if rounds < 1 {
|
||||
return nil, errors.New("bcrypt_pbkdf: number of rounds is too small")
|
||||
}
|
||||
if len(password) == 0 {
|
||||
return nil, errors.New("bcrypt_pbkdf: empty password")
|
||||
}
|
||||
if len(salt) == 0 || len(salt) > 1<<20 {
|
||||
return nil, errors.New("bcrypt_pbkdf: bad salt length")
|
||||
}
|
||||
if keyLen > 1024 {
|
||||
return nil, errors.New("bcrypt_pbkdf: keyLen is too large")
|
||||
}
|
||||
|
||||
numBlocks := (keyLen + blockSize - 1) / blockSize
|
||||
key := make([]byte, numBlocks*blockSize)
|
||||
|
||||
h := sha512.New()
|
||||
h.Write(password)
|
||||
shapass := h.Sum(nil)
|
||||
|
||||
shasalt := make([]byte, 0, sha512.Size)
|
||||
cnt, tmp := make([]byte, 4), make([]byte, blockSize)
|
||||
for block := 1; block <= numBlocks; block++ {
|
||||
h.Reset()
|
||||
h.Write(salt)
|
||||
cnt[0] = byte(block >> 24)
|
||||
cnt[1] = byte(block >> 16)
|
||||
cnt[2] = byte(block >> 8)
|
||||
cnt[3] = byte(block)
|
||||
h.Write(cnt)
|
||||
bcryptHash(tmp, shapass, h.Sum(shasalt))
|
||||
|
||||
out := make([]byte, blockSize)
|
||||
copy(out, tmp)
|
||||
for i := 2; i <= rounds; i++ {
|
||||
h.Reset()
|
||||
h.Write(tmp)
|
||||
bcryptHash(tmp, shapass, h.Sum(shasalt))
|
||||
for j := 0; j < len(out); j++ {
|
||||
out[j] ^= tmp[j]
|
||||
}
|
||||
}
|
||||
|
||||
for i, v := range out {
|
||||
key[i*numBlocks+(block-1)] = v
|
||||
}
|
||||
}
|
||||
return key[:keyLen], nil
|
||||
}
|
||||
|
||||
var magic = []byte("OxychromaticBlowfishSwatDynamite")
|
||||
|
||||
func bcryptHash(out, shapass, shasalt []byte) {
|
||||
c, err := blowfish.NewSaltedCipher(shapass, shasalt)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for i := 0; i < 64; i++ {
|
||||
blowfish.ExpandKey(shasalt, c)
|
||||
blowfish.ExpandKey(shapass, c)
|
||||
}
|
||||
copy(out, magic)
|
||||
for i := 0; i < 32; i += 8 {
|
||||
for j := 0; j < 64; j++ {
|
||||
c.Encrypt(out[i:i+8], out[i:i+8])
|
||||
}
|
||||
}
|
||||
// Swap bytes due to different endianness.
|
||||
for i := 0; i < 32; i += 4 {
|
||||
out[i+3], out[i+2], out[i+1], out[i] = out[i], out[i+1], out[i+2], out[i+3]
|
||||
}
|
||||
}
|
236
vendor/github.com/caarlos0/sshmarshal/marshal.go
generated
vendored
Normal file
236
vendor/github.com/caarlos0/sshmarshal/marshal.go
generated
vendored
Normal file
@ -0,0 +1,236 @@
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sshmarshal
|
||||
|
||||
import (
|
||||
"crypto"
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"crypto/ecdsa"
|
||||
"crypto/ed25519"
|
||||
"crypto/elliptic"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"encoding/binary"
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/big"
|
||||
|
||||
"github.com/caarlos0/sshmarshal/internal/bcrypt_pbkdf"
|
||||
. "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
// MarshalPrivateKey returns a PEM block with the private key serialized in the
|
||||
// OpenSSH format.
|
||||
func MarshalPrivateKey(key crypto.PrivateKey, comment string) (*pem.Block, error) {
|
||||
return marshalOpenSSHPrivateKey(key, comment, unencryptedOpenSSHMarshaler)
|
||||
}
|
||||
|
||||
// MarshalPrivateKeyWithPassphrase returns a PEM block holding the encrypted
|
||||
// private key serialized in the OpenSSH format.
|
||||
func MarshalPrivateKeyWithPassphrase(key crypto.PrivateKey, comment string, passphrase []byte) (*pem.Block, error) {
|
||||
return marshalOpenSSHPrivateKey(key, comment, passphraseProtectedOpenSSHMarshaler(passphrase))
|
||||
}
|
||||
|
||||
func unencryptedOpenSSHMarshaler(privKeyBlock []byte) ([]byte, string, string, string, error) {
|
||||
key := generateOpenSSHPadding(privKeyBlock, 8)
|
||||
return key, "none", "none", "", nil
|
||||
}
|
||||
|
||||
func passphraseProtectedOpenSSHMarshaler(passphrase []byte) openSSHEncryptFunc {
|
||||
return func(privKeyBlock []byte) ([]byte, string, string, string, error) {
|
||||
salt := make([]byte, 16)
|
||||
if _, err := io.ReadFull(rand.Reader, salt); err != nil {
|
||||
return nil, "", "", "", err
|
||||
}
|
||||
|
||||
opts := struct {
|
||||
Salt []byte
|
||||
Rounds uint32
|
||||
}{salt, 16}
|
||||
|
||||
// Derive key to encrypt the private key block.
|
||||
k, err := bcrypt_pbkdf.Key(passphrase, salt, int(opts.Rounds), 32+aes.BlockSize)
|
||||
if err != nil {
|
||||
return nil, "", "", "", err
|
||||
}
|
||||
|
||||
// Add padding matching the block size of AES.
|
||||
keyBlock := generateOpenSSHPadding(privKeyBlock, aes.BlockSize)
|
||||
|
||||
// Encrypt the private key using the derived secret.
|
||||
dst := make([]byte, len(keyBlock))
|
||||
iv := k[32 : 32+aes.BlockSize]
|
||||
block, err := aes.NewCipher(k[:32])
|
||||
if err != nil {
|
||||
return nil, "", "", "", err
|
||||
}
|
||||
|
||||
stream := cipher.NewCTR(block, iv)
|
||||
stream.XORKeyStream(dst, keyBlock)
|
||||
|
||||
return dst, "aes256-ctr", "bcrypt", string(Marshal(opts)), nil
|
||||
}
|
||||
}
|
||||
|
||||
const magic = "openssh-key-v1\x00"
|
||||
|
||||
type openSSHEncryptFunc func(privKeyBlock []byte) (protectedKeyBlock []byte, cipherName, kdfName, kdfOptions string, err error)
|
||||
|
||||
func marshalOpenSSHPrivateKey(key crypto.PrivateKey, comment string, encrypt openSSHEncryptFunc) (*pem.Block, error) {
|
||||
var w struct {
|
||||
CipherName string
|
||||
KdfName string
|
||||
KdfOpts string
|
||||
NumKeys uint32
|
||||
PubKey []byte
|
||||
PrivKeyBlock []byte
|
||||
}
|
||||
var pk1 struct {
|
||||
Check1 uint32
|
||||
Check2 uint32
|
||||
Keytype string
|
||||
Rest []byte `ssh:"rest"`
|
||||
}
|
||||
|
||||
// Random check bytes.
|
||||
var check uint32
|
||||
if err := binary.Read(rand.Reader, binary.BigEndian, &check); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pk1.Check1 = check
|
||||
pk1.Check2 = check
|
||||
w.NumKeys = 1
|
||||
|
||||
// Use a []byte directly on ed25519 keys.
|
||||
if k, ok := key.(*ed25519.PrivateKey); ok {
|
||||
key = *k
|
||||
}
|
||||
|
||||
switch k := key.(type) {
|
||||
case *rsa.PrivateKey:
|
||||
E := new(big.Int).SetInt64(int64(k.PublicKey.E))
|
||||
// Marshal public key:
|
||||
// E and N are in reversed order in the public and private key.
|
||||
pubKey := struct {
|
||||
KeyType string
|
||||
E *big.Int
|
||||
N *big.Int
|
||||
}{
|
||||
KeyAlgoRSA,
|
||||
E, k.PublicKey.N,
|
||||
}
|
||||
w.PubKey = Marshal(pubKey)
|
||||
|
||||
// Marshal private key.
|
||||
key := struct {
|
||||
N *big.Int
|
||||
E *big.Int
|
||||
D *big.Int
|
||||
Iqmp *big.Int
|
||||
P *big.Int
|
||||
Q *big.Int
|
||||
Comment string
|
||||
}{
|
||||
k.PublicKey.N, E,
|
||||
k.D, k.Precomputed.Qinv, k.Primes[0], k.Primes[1],
|
||||
comment,
|
||||
}
|
||||
pk1.Keytype = KeyAlgoRSA
|
||||
pk1.Rest = Marshal(key)
|
||||
case ed25519.PrivateKey:
|
||||
pub := make([]byte, ed25519.PublicKeySize)
|
||||
priv := make([]byte, ed25519.PrivateKeySize)
|
||||
copy(pub, k[ed25519.PublicKeySize:])
|
||||
copy(priv, k)
|
||||
|
||||
// Marshal public key.
|
||||
pubKey := struct {
|
||||
KeyType string
|
||||
Pub []byte
|
||||
}{
|
||||
KeyAlgoED25519, pub,
|
||||
}
|
||||
w.PubKey = Marshal(pubKey)
|
||||
|
||||
// Marshal private key.
|
||||
key := struct {
|
||||
Pub []byte
|
||||
Priv []byte
|
||||
Comment string
|
||||
}{
|
||||
pub, priv,
|
||||
comment,
|
||||
}
|
||||
pk1.Keytype = KeyAlgoED25519
|
||||
pk1.Rest = Marshal(key)
|
||||
case *ecdsa.PrivateKey:
|
||||
var curve, keyType string
|
||||
switch name := k.Curve.Params().Name; name {
|
||||
case "P-256":
|
||||
curve = "nistp256"
|
||||
keyType = KeyAlgoECDSA256
|
||||
case "P-384":
|
||||
curve = "nistp384"
|
||||
keyType = KeyAlgoECDSA384
|
||||
case "P-521":
|
||||
curve = "nistp521"
|
||||
keyType = KeyAlgoECDSA521
|
||||
default:
|
||||
return nil, errors.New("ssh: unhandled elliptic curve " + name)
|
||||
}
|
||||
|
||||
pub := elliptic.Marshal(k.Curve, k.PublicKey.X, k.PublicKey.Y)
|
||||
|
||||
// Marshal public key.
|
||||
pubKey := struct {
|
||||
KeyType string
|
||||
Curve string
|
||||
Pub []byte
|
||||
}{
|
||||
keyType, curve, pub,
|
||||
}
|
||||
w.PubKey = Marshal(pubKey)
|
||||
|
||||
// Marshal private key.
|
||||
key := struct {
|
||||
Curve string
|
||||
Pub []byte
|
||||
D *big.Int
|
||||
Comment string
|
||||
}{
|
||||
curve, pub, k.D,
|
||||
comment,
|
||||
}
|
||||
pk1.Keytype = keyType
|
||||
pk1.Rest = Marshal(key)
|
||||
default:
|
||||
return nil, fmt.Errorf("ssh: unsupported key type %T", k)
|
||||
}
|
||||
|
||||
var err error
|
||||
// Add padding and encrypt the key if necessary.
|
||||
w.PrivKeyBlock, w.CipherName, w.KdfName, w.KdfOpts, err = encrypt(Marshal(pk1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
b := Marshal(w)
|
||||
block := &pem.Block{
|
||||
Type: "OPENSSH PRIVATE KEY",
|
||||
Bytes: append([]byte(magic), b...),
|
||||
}
|
||||
return block, nil
|
||||
}
|
||||
|
||||
func generateOpenSSHPadding(block []byte, blockSize int) []byte {
|
||||
for i, l := 0, len(block); (l+i)%blockSize != 0; i++ {
|
||||
block = append(block, byte(i+1))
|
||||
}
|
||||
return block
|
||||
}
|
34
vendor/github.com/charmbracelet/keygen/.golangci.yml
generated
vendored
Normal file
34
vendor/github.com/charmbracelet/keygen/.golangci.yml
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
run:
|
||||
tests: false
|
||||
|
||||
issues:
|
||||
include:
|
||||
- EXC0001
|
||||
- EXC0005
|
||||
- EXC0011
|
||||
- EXC0012
|
||||
- EXC0013
|
||||
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- bodyclose
|
||||
- dupl
|
||||
- exportloopref
|
||||
- goconst
|
||||
- godot
|
||||
- godox
|
||||
- goimports
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- ifshort
|
||||
- misspell
|
||||
- prealloc
|
||||
- revive
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- whitespace
|
21
vendor/github.com/charmbracelet/keygen/LICENSE
generated
vendored
Normal file
21
vendor/github.com/charmbracelet/keygen/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Charmbracelet, Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
32
vendor/github.com/charmbracelet/keygen/README.md
generated
vendored
Normal file
32
vendor/github.com/charmbracelet/keygen/README.md
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
# Keygen
|
||||
|
||||
[![Latest Release](https://img.shields.io/github/release/charmbracelet/keygen.svg)](https://github.com/charmbracelet/keygen/releases)
|
||||
[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://pkg.go.dev/github.com/charmbracelet/keygen?tab=doc)
|
||||
[![Build Status](https://github.com/charmbracelet/keygen/workflows/build/badge.svg)](https://github.com/charmbracelet/keygen/actions)
|
||||
[![Go ReportCard](https://goreportcard.com/badge/charmbracelet/keygen)](https://goreportcard.com/report/charmbracelet/keygen)
|
||||
|
||||
An SSH key pair generator with password protected keys support. Supports generating RSA, ECDSA, and Ed25519 keys.
|
||||
|
||||
## Example
|
||||
|
||||
```go
|
||||
filepath := filepath.Join(".ssh", "my_awesome_key")
|
||||
passphrase := []byte("awesome_secret")
|
||||
k, err := NewWithWrite(filepath, passphrase, key.Ed25519)
|
||||
if err != nil {
|
||||
fmt.Printf("error creating SSH key pair: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/charmbracelet/keygen/raw/master/LICENSE)
|
||||
|
||||
***
|
||||
|
||||
Part of [Charm](https://charm.sh).
|
||||
|
||||
<a href="https://charm.sh/"><img alt="the Charm logo" src="https://stuff.charm.sh/charm-badge-unrounded.jpg" width="400"></a>
|
||||
|
||||
Charm热爱开源 • Charm loves open source
|
387
vendor/github.com/charmbracelet/keygen/keygen.go
generated
vendored
Normal file
387
vendor/github.com/charmbracelet/keygen/keygen.go
generated
vendored
Normal file
@ -0,0 +1,387 @@
|
||||
// Package keygen handles the creation of new SSH key pairs.
|
||||
package keygen
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto"
|
||||
"crypto/ecdsa"
|
||||
"crypto/ed25519"
|
||||
"crypto/elliptic"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/caarlos0/sshmarshal"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
// KeyType represents a type of SSH key.
|
||||
type KeyType string
|
||||
|
||||
// Supported key types.
|
||||
const (
|
||||
RSA KeyType = "rsa"
|
||||
Ed25519 KeyType = "ed25519"
|
||||
ECDSA KeyType = "ecdsa"
|
||||
)
|
||||
|
||||
const rsaDefaultBits = 4096
|
||||
|
||||
// ErrMissingSSHKeys indicates we're missing some keys that we expected to
|
||||
// have after generating. This should be an extreme edge case.
|
||||
var ErrMissingSSHKeys = errors.New("missing one or more keys; did something happen to them after they were generated?")
|
||||
|
||||
// ErrUnsupportedKeyType indicates an unsupported key type.
|
||||
type ErrUnsupportedKeyType struct {
|
||||
keyType string
|
||||
}
|
||||
|
||||
// Error implements the error interface for ErrUnsupportedKeyType
|
||||
func (e ErrUnsupportedKeyType) Error() string {
|
||||
err := "unsupported key type"
|
||||
if e.keyType != "" {
|
||||
err += fmt.Sprintf(": %s", e.keyType)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// FilesystemErr is used to signal there was a problem creating keys at the
|
||||
// filesystem-level. For example, when we're unable to create a directory to
|
||||
// store new SSH keys in.
|
||||
type FilesystemErr struct {
|
||||
Err error
|
||||
}
|
||||
|
||||
// Error returns a human-readable string for the error. It implements the error
|
||||
// interface.
|
||||
func (e FilesystemErr) Error() string {
|
||||
return e.Err.Error()
|
||||
}
|
||||
|
||||
// Unwrap returns the underlying error.
|
||||
func (e FilesystemErr) Unwrap() error {
|
||||
return e.Err
|
||||
}
|
||||
|
||||
// SSHKeysAlreadyExistErr indicates that files already exist at the location at
|
||||
// which we're attempting to create SSH keys.
|
||||
type SSHKeysAlreadyExistErr struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// SSHKeyPair holds a pair of SSH keys and associated methods.
|
||||
type SSHKeyPair struct {
|
||||
path string // private key filename path; public key will have .pub appended
|
||||
passphrase []byte
|
||||
keyType KeyType
|
||||
privateKey crypto.PrivateKey
|
||||
}
|
||||
|
||||
func (s SSHKeyPair) privateKeyPath() string {
|
||||
p := fmt.Sprintf("%s_%s", s.path, s.keyType)
|
||||
return p
|
||||
}
|
||||
|
||||
func (s SSHKeyPair) publicKeyPath() string {
|
||||
return s.privateKeyPath() + ".pub"
|
||||
}
|
||||
|
||||
// New generates an SSHKeyPair, which contains a pair of SSH keys.
|
||||
func New(path string, passphrase []byte, keyType KeyType) (*SSHKeyPair, error) {
|
||||
var err error
|
||||
s := &SSHKeyPair{
|
||||
path: path,
|
||||
keyType: keyType,
|
||||
passphrase: passphrase,
|
||||
}
|
||||
if s.KeyPairExists() {
|
||||
privData, err := ioutil.ReadFile(s.privateKeyPath())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var k interface{}
|
||||
if len(passphrase) > 0 {
|
||||
k, err = ssh.ParseRawPrivateKeyWithPassphrase(privData, passphrase)
|
||||
} else {
|
||||
k, err = ssh.ParseRawPrivateKey(privData)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch k := k.(type) {
|
||||
case *rsa.PrivateKey, *ecdsa.PrivateKey, *ed25519.PrivateKey:
|
||||
s.privateKey = k
|
||||
default:
|
||||
return nil, ErrUnsupportedKeyType{fmt.Sprintf("%T", k)}
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
switch keyType {
|
||||
case Ed25519:
|
||||
err = s.generateEd25519Keys()
|
||||
case RSA:
|
||||
err = s.generateRSAKeys(rsaDefaultBits)
|
||||
case ECDSA:
|
||||
err = s.generateECDSAKeys(elliptic.P384())
|
||||
default:
|
||||
return nil, ErrUnsupportedKeyType{string(keyType)}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// NewWithWrite generates an SSHKeyPair and writes it to disk if not exist.
|
||||
func NewWithWrite(path string, passphrase []byte, keyType KeyType) (*SSHKeyPair, error) {
|
||||
s, err := New(path, passphrase, keyType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !s.KeyPairExists() {
|
||||
if err = s.WriteKeys(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// PrivateKey returns the unencrypted private key.
|
||||
func (s *SSHKeyPair) PrivateKey() crypto.PrivateKey {
|
||||
switch s.keyType {
|
||||
case RSA, Ed25519, ECDSA:
|
||||
return s.privateKey
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// PrivateKeyPEM returns the unencrypted private key in OPENSSH PEM format.
|
||||
func (s *SSHKeyPair) PrivateKeyPEM() []byte {
|
||||
block, err := s.pemBlock(nil)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return pem.EncodeToMemory(block)
|
||||
}
|
||||
|
||||
// PublicKey returns the SSH public key (RFC 4253). Ready to be used in an
|
||||
// OpenSSH authorized_keys file.
|
||||
func (s *SSHKeyPair) PublicKey() []byte {
|
||||
var pk crypto.PublicKey
|
||||
// Prepare public key
|
||||
switch s.keyType {
|
||||
case RSA:
|
||||
key, ok := s.privateKey.(*rsa.PrivateKey)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
pk = key.Public()
|
||||
case Ed25519:
|
||||
key, ok := s.privateKey.(*ed25519.PrivateKey)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
pk = key.Public()
|
||||
case ECDSA:
|
||||
key, ok := s.privateKey.(*ecdsa.PrivateKey)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
pk = key.Public()
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
p, err := ssh.NewPublicKey(pk)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
// serialize public key
|
||||
ak := ssh.MarshalAuthorizedKey(p)
|
||||
return pubKeyWithMemo(ak)
|
||||
}
|
||||
|
||||
func (s *SSHKeyPair) pemBlock(passphrase []byte) (*pem.Block, error) {
|
||||
key := s.PrivateKey()
|
||||
if key == nil {
|
||||
return nil, ErrMissingSSHKeys
|
||||
}
|
||||
switch s.keyType {
|
||||
case RSA, Ed25519, ECDSA:
|
||||
if len(passphrase) > 0 {
|
||||
return sshmarshal.MarshalPrivateKeyWithPassphrase(key, "", passphrase)
|
||||
}
|
||||
return sshmarshal.MarshalPrivateKey(key, "")
|
||||
default:
|
||||
return nil, ErrUnsupportedKeyType{string(s.keyType)}
|
||||
}
|
||||
}
|
||||
|
||||
// generateEd25519Keys creates a pair of EdD25519 keys for SSH auth.
|
||||
func (s *SSHKeyPair) generateEd25519Keys() error {
|
||||
// Generate keys
|
||||
_, privateKey, err := ed25519.GenerateKey(rand.Reader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.privateKey = &privateKey
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// generateEd25519Keys creates a pair of EdD25519 keys for SSH auth.
|
||||
func (s *SSHKeyPair) generateECDSAKeys(curve elliptic.Curve) error {
|
||||
// Generate keys
|
||||
privateKey, err := ecdsa.GenerateKey(curve, rand.Reader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.privateKey = privateKey
|
||||
return nil
|
||||
}
|
||||
|
||||
// generateRSAKeys creates a pair for RSA keys for SSH auth.
|
||||
func (s *SSHKeyPair) generateRSAKeys(bitSize int) error {
|
||||
// Generate private key
|
||||
privateKey, err := rsa.GenerateKey(rand.Reader, bitSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Validate private key
|
||||
err = privateKey.Validate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.privateKey = privateKey
|
||||
return nil
|
||||
}
|
||||
|
||||
// prepFilesystem makes sure the state of the filesystem is as it needs to be
|
||||
// in order to write our keys to disk. It will create and/or set permissions on
|
||||
// the SSH directory we're going to write our keys to (for example, ~/.ssh) as
|
||||
// well as make sure that no files exist at the location in which we're going
|
||||
// to write out keys.
|
||||
func (s *SSHKeyPair) prepFilesystem() error {
|
||||
var err error
|
||||
|
||||
keyDir := filepath.Dir(s.path)
|
||||
if keyDir != "" {
|
||||
keyDir, err = homedir.Expand(keyDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
info, err := os.Stat(keyDir)
|
||||
if os.IsNotExist(err) {
|
||||
// Directory doesn't exist: create it
|
||||
return os.MkdirAll(keyDir, 0700)
|
||||
}
|
||||
if err != nil {
|
||||
// There was another error statting the directory; something is awry
|
||||
return FilesystemErr{Err: err}
|
||||
}
|
||||
if !info.IsDir() {
|
||||
// It exists but it's not a directory
|
||||
return FilesystemErr{Err: fmt.Errorf("%s is not a directory", keyDir)}
|
||||
}
|
||||
if info.Mode().Perm() != 0700 {
|
||||
// Permissions are wrong: fix 'em
|
||||
if err := os.Chmod(keyDir, 0700); err != nil {
|
||||
return FilesystemErr{Err: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the files we're going to write to don't already exist
|
||||
if fileExists(s.privateKeyPath()) {
|
||||
return SSHKeysAlreadyExistErr{Path: s.privateKeyPath()}
|
||||
}
|
||||
if fileExists(s.publicKeyPath()) {
|
||||
return SSHKeysAlreadyExistErr{Path: s.publicKeyPath()}
|
||||
}
|
||||
|
||||
// The directory looks good as-is
|
||||
return nil
|
||||
}
|
||||
|
||||
// WriteKeys writes the SSH key pair to disk.
|
||||
func (s *SSHKeyPair) WriteKeys() error {
|
||||
var err error
|
||||
priv := s.PrivateKeyPEM()
|
||||
pub := s.PublicKey()
|
||||
if priv == nil || pub == nil {
|
||||
return ErrMissingSSHKeys
|
||||
}
|
||||
|
||||
// Encrypt private key with passphrase
|
||||
if len(s.passphrase) > 0 {
|
||||
block, err := s.pemBlock(s.passphrase)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
priv = pem.EncodeToMemory(block)
|
||||
}
|
||||
if err = s.prepFilesystem(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := writeKeyToFile(priv, s.privateKeyPath()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := writeKeyToFile(pub, s.publicKeyPath()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// KeyPairExists checks if the SSH key pair exists on disk.
|
||||
func (s *SSHKeyPair) KeyPairExists() bool {
|
||||
return fileExists(s.privateKeyPath()) && fileExists(s.publicKeyPath())
|
||||
}
|
||||
|
||||
func writeKeyToFile(keyBytes []byte, path string) error {
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
return ioutil.WriteFile(path, keyBytes, 0600)
|
||||
}
|
||||
return FilesystemErr{Err: fmt.Errorf("file %s already exists", path)}
|
||||
}
|
||||
|
||||
func fileExists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// attaches a user@host suffix to a serialized public key. returns the original
|
||||
// pubkey if we can't get the username or host.
|
||||
func pubKeyWithMemo(pubKey []byte) []byte {
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
return pubKey
|
||||
}
|
||||
hostname, err := os.Hostname()
|
||||
if err != nil {
|
||||
return pubKey
|
||||
}
|
||||
|
||||
return append(bytes.TrimRight(pubKey, "\n"), []byte(fmt.Sprintf(" %s@%s\n", u.Username, hostname))...)
|
||||
}
|
||||
|
||||
// Error returns the a human-readable error message for SSHKeysAlreadyExistErr.
|
||||
// It satisfies the error interface.
|
||||
func (e SSHKeysAlreadyExistErr) Error() string {
|
||||
return fmt.Sprintf("ssh key %s already exists", e.Path)
|
||||
}
|
27
vendor/github.com/charmbracelet/ssh/LICENSE
generated
vendored
Normal file
27
vendor/github.com/charmbracelet/ssh/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2016 Glider Labs. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Glider Labs nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
96
vendor/github.com/charmbracelet/ssh/README.md
generated
vendored
Normal file
96
vendor/github.com/charmbracelet/ssh/README.md
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
# gliderlabs/ssh
|
||||
|
||||
[![GoDoc](https://godoc.org/github.com/gliderlabs/ssh?status.svg)](https://godoc.org/github.com/gliderlabs/ssh)
|
||||
[![CircleCI](https://img.shields.io/circleci/project/github/gliderlabs/ssh.svg)](https://circleci.com/gh/gliderlabs/ssh)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/gliderlabs/ssh)](https://goreportcard.com/report/github.com/gliderlabs/ssh)
|
||||
[![OpenCollective](https://opencollective.com/ssh/sponsors/badge.svg)](#sponsors)
|
||||
[![Slack](http://slack.gliderlabs.com/badge.svg)](http://slack.gliderlabs.com)
|
||||
[![Email Updates](https://img.shields.io/badge/updates-subscribe-yellow.svg)](https://app.convertkit.com/landing_pages/243312)
|
||||
|
||||
> The Glider Labs SSH server package is dope. —[@bradfitz](https://twitter.com/bradfitz), Go team member
|
||||
|
||||
This Go package wraps the [crypto/ssh
|
||||
package](https://godoc.org/golang.org/x/crypto/ssh) with a higher-level API for
|
||||
building SSH servers. The goal of the API was to make it as simple as using
|
||||
[net/http](https://golang.org/pkg/net/http/), so the API is very similar:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/gliderlabs/ssh"
|
||||
"io"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ssh.Handle(func(s ssh.Session) {
|
||||
io.WriteString(s, "Hello world\n")
|
||||
})
|
||||
|
||||
log.Fatal(ssh.ListenAndServe(":2222", nil))
|
||||
}
|
||||
|
||||
```
|
||||
This package was built by [@progrium](https://twitter.com/progrium) after working on nearly a dozen projects at Glider Labs using SSH and collaborating with [@shazow](https://twitter.com/shazow) (known for [ssh-chat](https://github.com/shazow/ssh-chat)).
|
||||
|
||||
## Examples
|
||||
|
||||
A bunch of great examples are in the `_examples` directory.
|
||||
|
||||
## Usage
|
||||
|
||||
[See GoDoc reference.](https://godoc.org/github.com/gliderlabs/ssh)
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests are welcome! However, since this project is very much about API
|
||||
design, please submit API changes as issues to discuss before submitting PRs.
|
||||
|
||||
Also, you can [join our Slack](http://slack.gliderlabs.com) to discuss as well.
|
||||
|
||||
## Roadmap
|
||||
|
||||
* Non-session channel handlers
|
||||
* Cleanup callback API
|
||||
* 1.0 release
|
||||
* High-level client?
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/ssh#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/ssh/sponsor/0/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/1/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/2/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/3/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/4/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/5/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/6/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/7/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/8/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/9/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/10/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/11/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/12/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/13/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/14/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/15/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/16/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/17/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/18/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/19/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/20/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/21/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/22/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/23/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/24/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/25/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/26/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/27/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/28/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/ssh/sponsor/29/website" target="_blank"><img src="https://opencollective.com/ssh/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
[BSD](LICENSE)
|
83
vendor/github.com/charmbracelet/ssh/agent.go
generated
vendored
Normal file
83
vendor/github.com/charmbracelet/ssh/agent.go
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"path"
|
||||
"sync"
|
||||
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
const (
|
||||
agentRequestType = "auth-agent-req@openssh.com"
|
||||
agentChannelType = "auth-agent@openssh.com"
|
||||
|
||||
agentTempDir = "auth-agent"
|
||||
agentListenFile = "listener.sock"
|
||||
)
|
||||
|
||||
// contextKeyAgentRequest is an internal context key for storing if the
|
||||
// client requested agent forwarding
|
||||
var contextKeyAgentRequest = &contextKey{"auth-agent-req"}
|
||||
|
||||
// SetAgentRequested sets up the session context so that AgentRequested
|
||||
// returns true.
|
||||
func SetAgentRequested(ctx Context) {
|
||||
ctx.SetValue(contextKeyAgentRequest, true)
|
||||
}
|
||||
|
||||
// AgentRequested returns true if the client requested agent forwarding.
|
||||
func AgentRequested(sess Session) bool {
|
||||
return sess.Context().Value(contextKeyAgentRequest) == true
|
||||
}
|
||||
|
||||
// NewAgentListener sets up a temporary Unix socket that can be communicated
|
||||
// to the session environment and used for forwarding connections.
|
||||
func NewAgentListener() (net.Listener, error) {
|
||||
dir, err := ioutil.TempDir("", agentTempDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
l, err := net.Listen("unix", path.Join(dir, agentListenFile))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
// ForwardAgentConnections takes connections from a listener to proxy into the
|
||||
// session on the OpenSSH channel for agent connections. It blocks and services
|
||||
// connections until the listener stop accepting.
|
||||
func ForwardAgentConnections(l net.Listener, s Session) {
|
||||
sshConn := s.Context().Value(ContextKeyConn).(gossh.Conn)
|
||||
for {
|
||||
conn, err := l.Accept()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
go func(conn net.Conn) {
|
||||
defer conn.Close()
|
||||
channel, reqs, err := sshConn.OpenChannel(agentChannelType, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer channel.Close()
|
||||
go gossh.DiscardRequests(reqs)
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
go func() {
|
||||
io.Copy(conn, channel)
|
||||
conn.(*net.UnixConn).CloseWrite()
|
||||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
io.Copy(channel, conn)
|
||||
channel.CloseWrite()
|
||||
wg.Done()
|
||||
}()
|
||||
wg.Wait()
|
||||
}(conn)
|
||||
}
|
||||
}
|
26
vendor/github.com/charmbracelet/ssh/circle.yml
generated
vendored
Normal file
26
vendor/github.com/charmbracelet/ssh/circle.yml
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
version: 2
|
||||
jobs:
|
||||
build-go-latest:
|
||||
docker:
|
||||
- image: golang:latest
|
||||
working_directory: /go/src/github.com/gliderlabs/ssh
|
||||
steps:
|
||||
- checkout
|
||||
- run: go get
|
||||
- run: go test -v -race
|
||||
|
||||
build-go-1.13:
|
||||
docker:
|
||||
- image: golang:1.13
|
||||
working_directory: /go/src/github.com/gliderlabs/ssh
|
||||
steps:
|
||||
- checkout
|
||||
- run: go get
|
||||
- run: go test -v -race
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- build-go-latest
|
||||
- build-go-1.13
|
55
vendor/github.com/charmbracelet/ssh/conn.go
generated
vendored
Normal file
55
vendor/github.com/charmbracelet/ssh/conn.go
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type serverConn struct {
|
||||
net.Conn
|
||||
|
||||
idleTimeout time.Duration
|
||||
maxDeadline time.Time
|
||||
closeCanceler context.CancelFunc
|
||||
}
|
||||
|
||||
func (c *serverConn) Write(p []byte) (n int, err error) {
|
||||
c.updateDeadline()
|
||||
n, err = c.Conn.Write(p)
|
||||
if _, isNetErr := err.(net.Error); isNetErr && c.closeCanceler != nil {
|
||||
c.closeCanceler()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *serverConn) Read(b []byte) (n int, err error) {
|
||||
c.updateDeadline()
|
||||
n, err = c.Conn.Read(b)
|
||||
if _, isNetErr := err.(net.Error); isNetErr && c.closeCanceler != nil {
|
||||
c.closeCanceler()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *serverConn) Close() (err error) {
|
||||
err = c.Conn.Close()
|
||||
if c.closeCanceler != nil {
|
||||
c.closeCanceler()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *serverConn) updateDeadline() {
|
||||
switch {
|
||||
case c.idleTimeout > 0:
|
||||
idleDeadline := time.Now().Add(c.idleTimeout)
|
||||
if idleDeadline.Unix() < c.maxDeadline.Unix() || c.maxDeadline.IsZero() {
|
||||
c.Conn.SetDeadline(idleDeadline)
|
||||
return
|
||||
}
|
||||
fallthrough
|
||||
default:
|
||||
c.Conn.SetDeadline(c.maxDeadline)
|
||||
}
|
||||
}
|
155
vendor/github.com/charmbracelet/ssh/context.go
generated
vendored
Normal file
155
vendor/github.com/charmbracelet/ssh/context.go
generated
vendored
Normal file
@ -0,0 +1,155 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
// contextKey is a value for use with context.WithValue. It's used as
|
||||
// a pointer so it fits in an interface{} without allocation.
|
||||
type contextKey struct {
|
||||
name string
|
||||
}
|
||||
|
||||
var (
|
||||
// ContextKeyUser is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type string.
|
||||
ContextKeyUser = &contextKey{"user"}
|
||||
|
||||
// ContextKeySessionID is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type string.
|
||||
ContextKeySessionID = &contextKey{"session-id"}
|
||||
|
||||
// ContextKeyPermissions is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type *Permissions.
|
||||
ContextKeyPermissions = &contextKey{"permissions"}
|
||||
|
||||
// ContextKeyClientVersion is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type string.
|
||||
ContextKeyClientVersion = &contextKey{"client-version"}
|
||||
|
||||
// ContextKeyServerVersion is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type string.
|
||||
ContextKeyServerVersion = &contextKey{"server-version"}
|
||||
|
||||
// ContextKeyLocalAddr is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type net.Addr.
|
||||
ContextKeyLocalAddr = &contextKey{"local-addr"}
|
||||
|
||||
// ContextKeyRemoteAddr is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type net.Addr.
|
||||
ContextKeyRemoteAddr = &contextKey{"remote-addr"}
|
||||
|
||||
// ContextKeyServer is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type *Server.
|
||||
ContextKeyServer = &contextKey{"ssh-server"}
|
||||
|
||||
// ContextKeyConn is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type gossh.ServerConn.
|
||||
ContextKeyConn = &contextKey{"ssh-conn"}
|
||||
|
||||
// ContextKeyPublicKey is a context key for use with Contexts in this package.
|
||||
// The associated value will be of type PublicKey.
|
||||
ContextKeyPublicKey = &contextKey{"public-key"}
|
||||
)
|
||||
|
||||
// Context is a package specific context interface. It exposes connection
|
||||
// metadata and allows new values to be easily written to it. It's used in
|
||||
// authentication handlers and callbacks, and its underlying context.Context is
|
||||
// exposed on Session in the session Handler. A connection-scoped lock is also
|
||||
// embedded in the context to make it easier to limit operations per-connection.
|
||||
type Context interface {
|
||||
context.Context
|
||||
sync.Locker
|
||||
|
||||
// User returns the username used when establishing the SSH connection.
|
||||
User() string
|
||||
|
||||
// SessionID returns the session hash.
|
||||
SessionID() string
|
||||
|
||||
// ClientVersion returns the version reported by the client.
|
||||
ClientVersion() string
|
||||
|
||||
// ServerVersion returns the version reported by the server.
|
||||
ServerVersion() string
|
||||
|
||||
// RemoteAddr returns the remote address for this connection.
|
||||
RemoteAddr() net.Addr
|
||||
|
||||
// LocalAddr returns the local address for this connection.
|
||||
LocalAddr() net.Addr
|
||||
|
||||
// Permissions returns the Permissions object used for this connection.
|
||||
Permissions() *Permissions
|
||||
|
||||
// SetValue allows you to easily write new values into the underlying context.
|
||||
SetValue(key, value interface{})
|
||||
}
|
||||
|
||||
type sshContext struct {
|
||||
context.Context
|
||||
*sync.Mutex
|
||||
}
|
||||
|
||||
func newContext(srv *Server) (*sshContext, context.CancelFunc) {
|
||||
innerCtx, cancel := context.WithCancel(context.Background())
|
||||
ctx := &sshContext{innerCtx, &sync.Mutex{}}
|
||||
ctx.SetValue(ContextKeyServer, srv)
|
||||
perms := &Permissions{&gossh.Permissions{}}
|
||||
ctx.SetValue(ContextKeyPermissions, perms)
|
||||
return ctx, cancel
|
||||
}
|
||||
|
||||
// this is separate from newContext because we will get ConnMetadata
|
||||
// at different points so it needs to be applied separately
|
||||
func applyConnMetadata(ctx Context, conn gossh.ConnMetadata) {
|
||||
if ctx.Value(ContextKeySessionID) != nil {
|
||||
return
|
||||
}
|
||||
ctx.SetValue(ContextKeySessionID, hex.EncodeToString(conn.SessionID()))
|
||||
ctx.SetValue(ContextKeyClientVersion, string(conn.ClientVersion()))
|
||||
ctx.SetValue(ContextKeyServerVersion, string(conn.ServerVersion()))
|
||||
ctx.SetValue(ContextKeyUser, conn.User())
|
||||
ctx.SetValue(ContextKeyLocalAddr, conn.LocalAddr())
|
||||
ctx.SetValue(ContextKeyRemoteAddr, conn.RemoteAddr())
|
||||
}
|
||||
|
||||
func (ctx *sshContext) SetValue(key, value interface{}) {
|
||||
ctx.Context = context.WithValue(ctx.Context, key, value)
|
||||
}
|
||||
|
||||
func (ctx *sshContext) User() string {
|
||||
return ctx.Value(ContextKeyUser).(string)
|
||||
}
|
||||
|
||||
func (ctx *sshContext) SessionID() string {
|
||||
return ctx.Value(ContextKeySessionID).(string)
|
||||
}
|
||||
|
||||
func (ctx *sshContext) ClientVersion() string {
|
||||
return ctx.Value(ContextKeyClientVersion).(string)
|
||||
}
|
||||
|
||||
func (ctx *sshContext) ServerVersion() string {
|
||||
return ctx.Value(ContextKeyServerVersion).(string)
|
||||
}
|
||||
|
||||
func (ctx *sshContext) RemoteAddr() net.Addr {
|
||||
if addr, ok := ctx.Value(ContextKeyRemoteAddr).(net.Addr); ok {
|
||||
return addr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ctx *sshContext) LocalAddr() net.Addr {
|
||||
return ctx.Value(ContextKeyLocalAddr).(net.Addr)
|
||||
}
|
||||
|
||||
func (ctx *sshContext) Permissions() *Permissions {
|
||||
return ctx.Value(ContextKeyPermissions).(*Permissions)
|
||||
}
|
45
vendor/github.com/charmbracelet/ssh/doc.go
generated
vendored
Normal file
45
vendor/github.com/charmbracelet/ssh/doc.go
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
Package ssh wraps the crypto/ssh package with a higher-level API for building
|
||||
SSH servers. The goal of the API was to make it as simple as using net/http, so
|
||||
the API is very similar.
|
||||
|
||||
You should be able to build any SSH server using only this package, which wraps
|
||||
relevant types and some functions from crypto/ssh. However, you still need to
|
||||
use crypto/ssh for building SSH clients.
|
||||
|
||||
ListenAndServe starts an SSH server with a given address, handler, and options. The
|
||||
handler is usually nil, which means to use DefaultHandler. Handle sets DefaultHandler:
|
||||
|
||||
ssh.Handle(func(s ssh.Session) {
|
||||
io.WriteString(s, "Hello world\n")
|
||||
})
|
||||
|
||||
log.Fatal(ssh.ListenAndServe(":2222", nil))
|
||||
|
||||
If you don't specify a host key, it will generate one every time. This is convenient
|
||||
except you'll have to deal with clients being confused that the host key is different.
|
||||
It's a better idea to generate or point to an existing key on your system:
|
||||
|
||||
log.Fatal(ssh.ListenAndServe(":2222", nil, ssh.HostKeyFile("/Users/progrium/.ssh/id_rsa")))
|
||||
|
||||
Although all options have functional option helpers, another way to control the
|
||||
server's behavior is by creating a custom Server:
|
||||
|
||||
s := &ssh.Server{
|
||||
Addr: ":2222",
|
||||
Handler: sessionHandler,
|
||||
PublicKeyHandler: authHandler,
|
||||
}
|
||||
s.AddHostKey(hostKeySigner)
|
||||
|
||||
log.Fatal(s.ListenAndServe())
|
||||
|
||||
This package automatically handles basic SSH requests like setting environment
|
||||
variables, requesting PTY, and changing window size. These requests are
|
||||
processed, responded to, and any relevant state is updated. This state is then
|
||||
exposed to you via the Session interface.
|
||||
|
||||
The one big feature missing from the Session abstraction is signals. This was
|
||||
started, but not completed. Pull Requests welcome!
|
||||
*/
|
||||
package ssh
|
84
vendor/github.com/charmbracelet/ssh/options.go
generated
vendored
Normal file
84
vendor/github.com/charmbracelet/ssh/options.go
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
// PasswordAuth returns a functional option that sets PasswordHandler on the server.
|
||||
func PasswordAuth(fn PasswordHandler) Option {
|
||||
return func(srv *Server) error {
|
||||
srv.PasswordHandler = fn
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// PublicKeyAuth returns a functional option that sets PublicKeyHandler on the server.
|
||||
func PublicKeyAuth(fn PublicKeyHandler) Option {
|
||||
return func(srv *Server) error {
|
||||
srv.PublicKeyHandler = fn
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// HostKeyFile returns a functional option that adds HostSigners to the server
|
||||
// from a PEM file at filepath.
|
||||
func HostKeyFile(filepath string) Option {
|
||||
return func(srv *Server) error {
|
||||
pemBytes, err := ioutil.ReadFile(filepath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
signer, err := gossh.ParsePrivateKey(pemBytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
srv.AddHostKey(signer)
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func KeyboardInteractiveAuth(fn KeyboardInteractiveHandler) Option {
|
||||
return func(srv *Server) error {
|
||||
srv.KeyboardInteractiveHandler = fn
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// HostKeyPEM returns a functional option that adds HostSigners to the server
|
||||
// from a PEM file as bytes.
|
||||
func HostKeyPEM(bytes []byte) Option {
|
||||
return func(srv *Server) error {
|
||||
signer, err := gossh.ParsePrivateKey(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
srv.AddHostKey(signer)
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// NoPty returns a functional option that sets PtyCallback to return false,
|
||||
// denying PTY requests.
|
||||
func NoPty() Option {
|
||||
return func(srv *Server) error {
|
||||
srv.PtyCallback = func(ctx Context, pty Pty) bool {
|
||||
return false
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WrapConn returns a functional option that sets ConnCallback on the server.
|
||||
func WrapConn(fn ConnCallback) Option {
|
||||
return func(srv *Server) error {
|
||||
srv.ConnCallback = fn
|
||||
return nil
|
||||
}
|
||||
}
|
57
vendor/github.com/charmbracelet/ssh/pty.go
generated
vendored
Normal file
57
vendor/github.com/charmbracelet/ssh/pty.go
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
)
|
||||
|
||||
// NewPtyWriter creates a writer that handles when the session has a active
|
||||
// PTY, replacing the \n with \r\n.
|
||||
func NewPtyWriter(w io.Writer) io.Writer {
|
||||
return ptyWriter{
|
||||
w: w,
|
||||
}
|
||||
}
|
||||
|
||||
var _ io.Writer = ptyWriter{}
|
||||
|
||||
type ptyWriter struct {
|
||||
w io.Writer
|
||||
}
|
||||
|
||||
func (w ptyWriter) Write(p []byte) (int, error) {
|
||||
m := len(p)
|
||||
// normalize \n to \r\n when pty is accepted.
|
||||
// this is a hardcoded shortcut since we don't support terminal modes.
|
||||
p = bytes.Replace(p, []byte{'\n'}, []byte{'\r', '\n'}, -1)
|
||||
p = bytes.Replace(p, []byte{'\r', '\r', '\n'}, []byte{'\r', '\n'}, -1)
|
||||
n, err := w.w.Write(p)
|
||||
if n > m {
|
||||
n = m
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
// NewPtyReadWriter return an io.ReadWriter that delegates the read to the
|
||||
// given io.ReadWriter, and the writes to a ptyWriter.
|
||||
func NewPtyReadWriter(rw io.ReadWriter) io.ReadWriter {
|
||||
return readWriterDelegate{
|
||||
w: NewPtyWriter(rw),
|
||||
r: rw,
|
||||
}
|
||||
}
|
||||
|
||||
var _ io.ReadWriter = readWriterDelegate{}
|
||||
|
||||
type readWriterDelegate struct {
|
||||
w io.Writer
|
||||
r io.Reader
|
||||
}
|
||||
|
||||
func (rw readWriterDelegate) Read(p []byte) (n int, err error) {
|
||||
return rw.r.Read(p)
|
||||
}
|
||||
|
||||
func (rw readWriterDelegate) Write(p []byte) (n int, err error) {
|
||||
return rw.w.Write(p)
|
||||
}
|
449
vendor/github.com/charmbracelet/ssh/server.go
generated
vendored
Normal file
449
vendor/github.com/charmbracelet/ssh/server.go
generated
vendored
Normal file
@ -0,0 +1,449 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
// ErrServerClosed is returned by the Server's Serve, ListenAndServe,
|
||||
// and ListenAndServeTLS methods after a call to Shutdown or Close.
|
||||
var ErrServerClosed = errors.New("ssh: Server closed")
|
||||
|
||||
type SubsystemHandler func(s Session)
|
||||
|
||||
var DefaultSubsystemHandlers = map[string]SubsystemHandler{}
|
||||
|
||||
type RequestHandler func(ctx Context, srv *Server, req *gossh.Request) (ok bool, payload []byte)
|
||||
|
||||
var DefaultRequestHandlers = map[string]RequestHandler{}
|
||||
|
||||
type ChannelHandler func(srv *Server, conn *gossh.ServerConn, newChan gossh.NewChannel, ctx Context)
|
||||
|
||||
var DefaultChannelHandlers = map[string]ChannelHandler{
|
||||
"session": DefaultSessionHandler,
|
||||
}
|
||||
|
||||
// Server defines parameters for running an SSH server. The zero value for
|
||||
// Server is a valid configuration. When both PasswordHandler and
|
||||
// PublicKeyHandler are nil, no client authentication is performed.
|
||||
type Server struct {
|
||||
Addr string // TCP address to listen on, ":22" if empty
|
||||
Handler Handler // handler to invoke, ssh.DefaultHandler if nil
|
||||
HostSigners []Signer // private keys for the host key, must have at least one
|
||||
Version string // server version to be sent before the initial handshake
|
||||
|
||||
KeyboardInteractiveHandler KeyboardInteractiveHandler // keyboard-interactive authentication handler
|
||||
PasswordHandler PasswordHandler // password authentication handler
|
||||
PublicKeyHandler PublicKeyHandler // public key authentication handler
|
||||
PtyCallback PtyCallback // callback for allowing PTY sessions, allows all if nil
|
||||
ConnCallback ConnCallback // optional callback for wrapping net.Conn before handling
|
||||
LocalPortForwardingCallback LocalPortForwardingCallback // callback for allowing local port forwarding, denies all if nil
|
||||
ReversePortForwardingCallback ReversePortForwardingCallback // callback for allowing reverse port forwarding, denies all if nil
|
||||
ServerConfigCallback ServerConfigCallback // callback for configuring detailed SSH options
|
||||
SessionRequestCallback SessionRequestCallback // callback for allowing or denying SSH sessions
|
||||
|
||||
ConnectionFailedCallback ConnectionFailedCallback // callback to report connection failures
|
||||
|
||||
IdleTimeout time.Duration // connection timeout when no activity, none if empty
|
||||
MaxTimeout time.Duration // absolute connection timeout, none if empty
|
||||
|
||||
// ChannelHandlers allow overriding the built-in session handlers or provide
|
||||
// extensions to the protocol, such as tcpip forwarding. By default only the
|
||||
// "session" handler is enabled.
|
||||
ChannelHandlers map[string]ChannelHandler
|
||||
|
||||
// RequestHandlers allow overriding the server-level request handlers or
|
||||
// provide extensions to the protocol, such as tcpip forwarding. By default
|
||||
// no handlers are enabled.
|
||||
RequestHandlers map[string]RequestHandler
|
||||
|
||||
// SubsystemHandlers are handlers which are similar to the usual SSH command
|
||||
// handlers, but handle named subsystems.
|
||||
SubsystemHandlers map[string]SubsystemHandler
|
||||
|
||||
listenerWg sync.WaitGroup
|
||||
mu sync.RWMutex
|
||||
listeners map[net.Listener]struct{}
|
||||
conns map[*gossh.ServerConn]struct{}
|
||||
connWg sync.WaitGroup
|
||||
doneChan chan struct{}
|
||||
}
|
||||
|
||||
func (srv *Server) ensureHostSigner() error {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
|
||||
if len(srv.HostSigners) == 0 {
|
||||
signer, err := generateSigner()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
srv.HostSigners = append(srv.HostSigners, signer)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (srv *Server) ensureHandlers() {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
|
||||
if srv.RequestHandlers == nil {
|
||||
srv.RequestHandlers = map[string]RequestHandler{}
|
||||
for k, v := range DefaultRequestHandlers {
|
||||
srv.RequestHandlers[k] = v
|
||||
}
|
||||
}
|
||||
if srv.ChannelHandlers == nil {
|
||||
srv.ChannelHandlers = map[string]ChannelHandler{}
|
||||
for k, v := range DefaultChannelHandlers {
|
||||
srv.ChannelHandlers[k] = v
|
||||
}
|
||||
}
|
||||
if srv.SubsystemHandlers == nil {
|
||||
srv.SubsystemHandlers = map[string]SubsystemHandler{}
|
||||
for k, v := range DefaultSubsystemHandlers {
|
||||
srv.SubsystemHandlers[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (srv *Server) config(ctx Context) *gossh.ServerConfig {
|
||||
srv.mu.RLock()
|
||||
defer srv.mu.RUnlock()
|
||||
|
||||
var config *gossh.ServerConfig
|
||||
if srv.ServerConfigCallback == nil {
|
||||
config = &gossh.ServerConfig{}
|
||||
} else {
|
||||
config = srv.ServerConfigCallback(ctx)
|
||||
}
|
||||
for _, signer := range srv.HostSigners {
|
||||
config.AddHostKey(signer)
|
||||
}
|
||||
if srv.PasswordHandler == nil && srv.PublicKeyHandler == nil && srv.KeyboardInteractiveHandler == nil {
|
||||
config.NoClientAuth = true
|
||||
}
|
||||
if srv.Version != "" {
|
||||
config.ServerVersion = "SSH-2.0-" + srv.Version
|
||||
}
|
||||
if srv.PasswordHandler != nil {
|
||||
config.PasswordCallback = func(conn gossh.ConnMetadata, password []byte) (*gossh.Permissions, error) {
|
||||
applyConnMetadata(ctx, conn)
|
||||
if ok := srv.PasswordHandler(ctx, string(password)); !ok {
|
||||
return ctx.Permissions().Permissions, fmt.Errorf("permission denied")
|
||||
}
|
||||
return ctx.Permissions().Permissions, nil
|
||||
}
|
||||
}
|
||||
if srv.PublicKeyHandler != nil {
|
||||
config.PublicKeyCallback = func(conn gossh.ConnMetadata, key gossh.PublicKey) (*gossh.Permissions, error) {
|
||||
applyConnMetadata(ctx, conn)
|
||||
if ok := srv.PublicKeyHandler(ctx, key); !ok {
|
||||
return ctx.Permissions().Permissions, fmt.Errorf("permission denied")
|
||||
}
|
||||
ctx.SetValue(ContextKeyPublicKey, key)
|
||||
return ctx.Permissions().Permissions, nil
|
||||
}
|
||||
}
|
||||
if srv.KeyboardInteractiveHandler != nil {
|
||||
config.KeyboardInteractiveCallback = func(conn gossh.ConnMetadata, challenger gossh.KeyboardInteractiveChallenge) (*gossh.Permissions, error) {
|
||||
applyConnMetadata(ctx, conn)
|
||||
if ok := srv.KeyboardInteractiveHandler(ctx, challenger); !ok {
|
||||
return ctx.Permissions().Permissions, fmt.Errorf("permission denied")
|
||||
}
|
||||
return ctx.Permissions().Permissions, nil
|
||||
}
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Handle sets the Handler for the server.
|
||||
func (srv *Server) Handle(fn Handler) {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
|
||||
srv.Handler = fn
|
||||
}
|
||||
|
||||
// Close immediately closes all active listeners and all active
|
||||
// connections.
|
||||
//
|
||||
// Close returns any error returned from closing the Server's
|
||||
// underlying Listener(s).
|
||||
func (srv *Server) Close() error {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
|
||||
srv.closeDoneChanLocked()
|
||||
err := srv.closeListenersLocked()
|
||||
for c := range srv.conns {
|
||||
c.Close()
|
||||
delete(srv.conns, c)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Shutdown gracefully shuts down the server without interrupting any
|
||||
// active connections. Shutdown works by first closing all open
|
||||
// listeners, and then waiting indefinitely for connections to close.
|
||||
// If the provided context expires before the shutdown is complete,
|
||||
// then the context's error is returned.
|
||||
func (srv *Server) Shutdown(ctx context.Context) error {
|
||||
srv.mu.Lock()
|
||||
lnerr := srv.closeListenersLocked()
|
||||
srv.closeDoneChanLocked()
|
||||
srv.mu.Unlock()
|
||||
|
||||
finished := make(chan struct{}, 1)
|
||||
go func() {
|
||||
srv.listenerWg.Wait()
|
||||
srv.connWg.Wait()
|
||||
finished <- struct{}{}
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case <-finished:
|
||||
return lnerr
|
||||
}
|
||||
}
|
||||
|
||||
// Serve accepts incoming connections on the Listener l, creating a new
|
||||
// connection goroutine for each. The connection goroutines read requests and then
|
||||
// calls srv.Handler to handle sessions.
|
||||
//
|
||||
// Serve always returns a non-nil error.
|
||||
func (srv *Server) Serve(l net.Listener) error {
|
||||
srv.ensureHandlers()
|
||||
defer l.Close()
|
||||
if err := srv.ensureHostSigner(); err != nil {
|
||||
return err
|
||||
}
|
||||
if srv.Handler == nil {
|
||||
srv.Handler = DefaultHandler
|
||||
}
|
||||
var tempDelay time.Duration
|
||||
|
||||
srv.trackListener(l, true)
|
||||
defer srv.trackListener(l, false)
|
||||
for {
|
||||
conn, e := l.Accept()
|
||||
if e != nil {
|
||||
select {
|
||||
case <-srv.getDoneChan():
|
||||
return ErrServerClosed
|
||||
default:
|
||||
}
|
||||
if ne, ok := e.(net.Error); ok && ne.Temporary() {
|
||||
if tempDelay == 0 {
|
||||
tempDelay = 5 * time.Millisecond
|
||||
} else {
|
||||
tempDelay *= 2
|
||||
}
|
||||
if max := 1 * time.Second; tempDelay > max {
|
||||
tempDelay = max
|
||||
}
|
||||
time.Sleep(tempDelay)
|
||||
continue
|
||||
}
|
||||
return e
|
||||
}
|
||||
go srv.HandleConn(conn)
|
||||
}
|
||||
}
|
||||
|
||||
func (srv *Server) HandleConn(newConn net.Conn) {
|
||||
ctx, cancel := newContext(srv)
|
||||
if srv.ConnCallback != nil {
|
||||
cbConn := srv.ConnCallback(ctx, newConn)
|
||||
if cbConn == nil {
|
||||
newConn.Close()
|
||||
return
|
||||
}
|
||||
newConn = cbConn
|
||||
}
|
||||
conn := &serverConn{
|
||||
Conn: newConn,
|
||||
idleTimeout: srv.IdleTimeout,
|
||||
closeCanceler: cancel,
|
||||
}
|
||||
if srv.MaxTimeout > 0 {
|
||||
conn.maxDeadline = time.Now().Add(srv.MaxTimeout)
|
||||
}
|
||||
defer conn.Close()
|
||||
sshConn, chans, reqs, err := gossh.NewServerConn(conn, srv.config(ctx))
|
||||
if err != nil {
|
||||
if srv.ConnectionFailedCallback != nil {
|
||||
srv.ConnectionFailedCallback(conn, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
srv.trackConn(sshConn, true)
|
||||
defer srv.trackConn(sshConn, false)
|
||||
|
||||
ctx.SetValue(ContextKeyConn, sshConn)
|
||||
applyConnMetadata(ctx, sshConn)
|
||||
//go gossh.DiscardRequests(reqs)
|
||||
go srv.handleRequests(ctx, reqs)
|
||||
for ch := range chans {
|
||||
handler := srv.ChannelHandlers[ch.ChannelType()]
|
||||
if handler == nil {
|
||||
handler = srv.ChannelHandlers["default"]
|
||||
}
|
||||
if handler == nil {
|
||||
ch.Reject(gossh.UnknownChannelType, "unsupported channel type")
|
||||
continue
|
||||
}
|
||||
go handler(srv, sshConn, ch, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
func (srv *Server) handleRequests(ctx Context, in <-chan *gossh.Request) {
|
||||
for req := range in {
|
||||
handler := srv.RequestHandlers[req.Type]
|
||||
if handler == nil {
|
||||
handler = srv.RequestHandlers["default"]
|
||||
}
|
||||
if handler == nil {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
/*reqCtx, cancel := context.WithCancel(ctx)
|
||||
defer cancel() */
|
||||
ret, payload := handler(ctx, srv, req)
|
||||
req.Reply(ret, payload)
|
||||
}
|
||||
}
|
||||
|
||||
// ListenAndServe listens on the TCP network address srv.Addr and then calls
|
||||
// Serve to handle incoming connections. If srv.Addr is blank, ":22" is used.
|
||||
// ListenAndServe always returns a non-nil error.
|
||||
func (srv *Server) ListenAndServe() error {
|
||||
addr := srv.Addr
|
||||
if addr == "" {
|
||||
addr = ":22"
|
||||
}
|
||||
ln, err := net.Listen("tcp", addr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.Serve(ln)
|
||||
}
|
||||
|
||||
// AddHostKey adds a private key as a host key. If an existing host key exists
|
||||
// with the same algorithm, it is overwritten. Each server config must have at
|
||||
// least one host key.
|
||||
func (srv *Server) AddHostKey(key Signer) {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
|
||||
// these are later added via AddHostKey on ServerConfig, which performs the
|
||||
// check for one of every algorithm.
|
||||
|
||||
// This check is based on the AddHostKey method from the x/crypto/ssh
|
||||
// library. This allows us to only keep one active key for each type on a
|
||||
// server at once. So, if you're dynamically updating keys at runtime, this
|
||||
// list will not keep growing.
|
||||
for i, k := range srv.HostSigners {
|
||||
if k.PublicKey().Type() == key.PublicKey().Type() {
|
||||
srv.HostSigners[i] = key
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
srv.HostSigners = append(srv.HostSigners, key)
|
||||
}
|
||||
|
||||
// SetOption runs a functional option against the server.
|
||||
func (srv *Server) SetOption(option Option) error {
|
||||
// NOTE: there is a potential race here for any option that doesn't call an
|
||||
// internal method. We can't actually lock here because if something calls
|
||||
// (as an example) AddHostKey, it will deadlock.
|
||||
|
||||
//srv.mu.Lock()
|
||||
//defer srv.mu.Unlock()
|
||||
|
||||
return option(srv)
|
||||
}
|
||||
|
||||
func (srv *Server) getDoneChan() <-chan struct{} {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
|
||||
return srv.getDoneChanLocked()
|
||||
}
|
||||
|
||||
func (srv *Server) getDoneChanLocked() chan struct{} {
|
||||
if srv.doneChan == nil {
|
||||
srv.doneChan = make(chan struct{})
|
||||
}
|
||||
return srv.doneChan
|
||||
}
|
||||
|
||||
func (srv *Server) closeDoneChanLocked() {
|
||||
ch := srv.getDoneChanLocked()
|
||||
select {
|
||||
case <-ch:
|
||||
// Already closed. Don't close again.
|
||||
default:
|
||||
// Safe to close here. We're the only closer, guarded
|
||||
// by srv.mu.
|
||||
close(ch)
|
||||
}
|
||||
}
|
||||
|
||||
func (srv *Server) closeListenersLocked() error {
|
||||
var err error
|
||||
for ln := range srv.listeners {
|
||||
if cerr := ln.Close(); cerr != nil && err == nil {
|
||||
err = cerr
|
||||
}
|
||||
delete(srv.listeners, ln)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (srv *Server) trackListener(ln net.Listener, add bool) {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
|
||||
if srv.listeners == nil {
|
||||
srv.listeners = make(map[net.Listener]struct{})
|
||||
}
|
||||
if add {
|
||||
// If the *Server is being reused after a previous
|
||||
// Close or Shutdown, reset its doneChan:
|
||||
if len(srv.listeners) == 0 && len(srv.conns) == 0 {
|
||||
srv.doneChan = nil
|
||||
}
|
||||
srv.listeners[ln] = struct{}{}
|
||||
srv.listenerWg.Add(1)
|
||||
} else {
|
||||
delete(srv.listeners, ln)
|
||||
srv.listenerWg.Done()
|
||||
}
|
||||
}
|
||||
|
||||
func (srv *Server) trackConn(c *gossh.ServerConn, add bool) {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
|
||||
if srv.conns == nil {
|
||||
srv.conns = make(map[*gossh.ServerConn]struct{})
|
||||
}
|
||||
if add {
|
||||
srv.conns[c] = struct{}{}
|
||||
srv.connWg.Add(1)
|
||||
} else {
|
||||
delete(srv.conns, c)
|
||||
srv.connWg.Done()
|
||||
}
|
||||
}
|
371
vendor/github.com/charmbracelet/ssh/session.go
generated
vendored
Normal file
371
vendor/github.com/charmbracelet/ssh/session.go
generated
vendored
Normal file
@ -0,0 +1,371 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
"github.com/anmitsu/go-shlex"
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
// Session provides access to information about an SSH session and methods
|
||||
// to read and write to the SSH channel with an embedded Channel interface from
|
||||
// crypto/ssh.
|
||||
//
|
||||
// When Command() returns an empty slice, the user requested a shell. Otherwise
|
||||
// the user is performing an exec with those command arguments.
|
||||
//
|
||||
// TODO: Signals
|
||||
type Session interface {
|
||||
gossh.Channel
|
||||
|
||||
// User returns the username used when establishing the SSH connection.
|
||||
User() string
|
||||
|
||||
// RemoteAddr returns the net.Addr of the client side of the connection.
|
||||
RemoteAddr() net.Addr
|
||||
|
||||
// LocalAddr returns the net.Addr of the server side of the connection.
|
||||
LocalAddr() net.Addr
|
||||
|
||||
// Environ returns a copy of strings representing the environment set by the
|
||||
// user for this session, in the form "key=value".
|
||||
Environ() []string
|
||||
|
||||
// Exit sends an exit status and then closes the session.
|
||||
Exit(code int) error
|
||||
|
||||
// Command returns a shell parsed slice of arguments that were provided by the
|
||||
// user. Shell parsing splits the command string according to POSIX shell rules,
|
||||
// which considers quoting not just whitespace.
|
||||
Command() []string
|
||||
|
||||
// RawCommand returns the exact command that was provided by the user.
|
||||
RawCommand() string
|
||||
|
||||
// Subsystem returns the subsystem requested by the user.
|
||||
Subsystem() string
|
||||
|
||||
// PublicKey returns the PublicKey used to authenticate. If a public key was not
|
||||
// used it will return nil.
|
||||
PublicKey() PublicKey
|
||||
|
||||
// Context returns the connection's context. The returned context is always
|
||||
// non-nil and holds the same data as the Context passed into auth
|
||||
// handlers and callbacks.
|
||||
//
|
||||
// The context is canceled when the client's connection closes or I/O
|
||||
// operation fails.
|
||||
Context() Context
|
||||
|
||||
// Permissions returns a copy of the Permissions object that was available for
|
||||
// setup in the auth handlers via the Context.
|
||||
Permissions() Permissions
|
||||
|
||||
// Pty returns PTY information, a channel of window size changes, and a boolean
|
||||
// of whether or not a PTY was accepted for this session.
|
||||
Pty() (Pty, <-chan Window, bool)
|
||||
|
||||
// Signals registers a channel to receive signals sent from the client. The
|
||||
// channel must handle signal sends or it will block the SSH request loop.
|
||||
// Registering nil will unregister the channel from signal sends. During the
|
||||
// time no channel is registered signals are buffered up to a reasonable amount.
|
||||
// If there are buffered signals when a channel is registered, they will be
|
||||
// sent in order on the channel immediately after registering.
|
||||
Signals(c chan<- Signal)
|
||||
|
||||
// Break regisers a channel to receive notifications of break requests sent
|
||||
// from the client. The channel must handle break requests, or it will block
|
||||
// the request handling loop. Registering nil will unregister the channel.
|
||||
// During the time that no channel is registered, breaks are ignored.
|
||||
Break(c chan<- bool)
|
||||
}
|
||||
|
||||
// maxSigBufSize is how many signals will be buffered
|
||||
// when there is no signal channel specified
|
||||
const maxSigBufSize = 128
|
||||
|
||||
func DefaultSessionHandler(srv *Server, conn *gossh.ServerConn, newChan gossh.NewChannel, ctx Context) {
|
||||
ch, reqs, err := newChan.Accept()
|
||||
if err != nil {
|
||||
// TODO: trigger event callback
|
||||
return
|
||||
}
|
||||
sess := &session{
|
||||
Channel: ch,
|
||||
conn: conn,
|
||||
handler: srv.Handler,
|
||||
ptyCb: srv.PtyCallback,
|
||||
sessReqCb: srv.SessionRequestCallback,
|
||||
subsystemHandlers: srv.SubsystemHandlers,
|
||||
ctx: ctx,
|
||||
}
|
||||
sess.handleRequests(reqs)
|
||||
}
|
||||
|
||||
type session struct {
|
||||
sync.Mutex
|
||||
gossh.Channel
|
||||
conn *gossh.ServerConn
|
||||
handler Handler
|
||||
subsystemHandlers map[string]SubsystemHandler
|
||||
handled bool
|
||||
exited bool
|
||||
pty *Pty
|
||||
winch chan Window
|
||||
env []string
|
||||
ptyCb PtyCallback
|
||||
sessReqCb SessionRequestCallback
|
||||
rawCmd string
|
||||
subsystem string
|
||||
ctx Context
|
||||
sigCh chan<- Signal
|
||||
sigBuf []Signal
|
||||
breakCh chan<- bool
|
||||
}
|
||||
|
||||
func (sess *session) Stderr() io.ReadWriter {
|
||||
if sess.pty != nil {
|
||||
return NewPtyReadWriter(sess.Channel.Stderr())
|
||||
}
|
||||
return sess.Channel.Stderr()
|
||||
}
|
||||
|
||||
func (sess *session) Write(p []byte) (int, error) {
|
||||
if sess.pty != nil {
|
||||
return NewPtyWriter(sess.Channel).Write(p)
|
||||
}
|
||||
return sess.Channel.Write(p)
|
||||
}
|
||||
|
||||
func (sess *session) PublicKey() PublicKey {
|
||||
sessionkey := sess.ctx.Value(ContextKeyPublicKey)
|
||||
if sessionkey == nil {
|
||||
return nil
|
||||
}
|
||||
return sessionkey.(PublicKey)
|
||||
}
|
||||
|
||||
func (sess *session) Permissions() Permissions {
|
||||
// use context permissions because its properly
|
||||
// wrapped and easier to dereference
|
||||
perms := sess.ctx.Value(ContextKeyPermissions).(*Permissions)
|
||||
return *perms
|
||||
}
|
||||
|
||||
func (sess *session) Context() Context {
|
||||
return sess.ctx
|
||||
}
|
||||
|
||||
func (sess *session) Exit(code int) error {
|
||||
sess.Lock()
|
||||
defer sess.Unlock()
|
||||
if sess.exited {
|
||||
return errors.New("Session.Exit called multiple times")
|
||||
}
|
||||
sess.exited = true
|
||||
|
||||
status := struct{ Status uint32 }{uint32(code)}
|
||||
_, err := sess.SendRequest("exit-status", false, gossh.Marshal(&status))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return sess.Close()
|
||||
}
|
||||
|
||||
func (sess *session) User() string {
|
||||
return sess.conn.User()
|
||||
}
|
||||
|
||||
func (sess *session) RemoteAddr() net.Addr {
|
||||
return sess.conn.RemoteAddr()
|
||||
}
|
||||
|
||||
func (sess *session) LocalAddr() net.Addr {
|
||||
return sess.conn.LocalAddr()
|
||||
}
|
||||
|
||||
func (sess *session) Environ() []string {
|
||||
return append([]string(nil), sess.env...)
|
||||
}
|
||||
|
||||
func (sess *session) RawCommand() string {
|
||||
return sess.rawCmd
|
||||
}
|
||||
|
||||
func (sess *session) Command() []string {
|
||||
cmd, _ := shlex.Split(sess.rawCmd, true)
|
||||
return append([]string(nil), cmd...)
|
||||
}
|
||||
|
||||
func (sess *session) Subsystem() string {
|
||||
return sess.subsystem
|
||||
}
|
||||
|
||||
func (sess *session) Pty() (Pty, <-chan Window, bool) {
|
||||
if sess.pty != nil {
|
||||
return *sess.pty, sess.winch, true
|
||||
}
|
||||
return Pty{}, sess.winch, false
|
||||
}
|
||||
|
||||
func (sess *session) Signals(c chan<- Signal) {
|
||||
sess.Lock()
|
||||
defer sess.Unlock()
|
||||
sess.sigCh = c
|
||||
if len(sess.sigBuf) > 0 {
|
||||
go func() {
|
||||
for _, sig := range sess.sigBuf {
|
||||
sess.sigCh <- sig
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
func (sess *session) Break(c chan<- bool) {
|
||||
sess.Lock()
|
||||
defer sess.Unlock()
|
||||
sess.breakCh = c
|
||||
}
|
||||
|
||||
func (sess *session) handleRequests(reqs <-chan *gossh.Request) {
|
||||
for req := range reqs {
|
||||
switch req.Type {
|
||||
case "shell", "exec":
|
||||
if sess.handled {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
|
||||
payload := struct{ Value string }{}
|
||||
gossh.Unmarshal(req.Payload, &payload)
|
||||
sess.rawCmd = payload.Value
|
||||
|
||||
// If there's a session policy callback, we need to confirm before
|
||||
// accepting the session.
|
||||
if sess.sessReqCb != nil && !sess.sessReqCb(sess, req.Type) {
|
||||
sess.rawCmd = ""
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
|
||||
sess.handled = true
|
||||
req.Reply(true, nil)
|
||||
|
||||
go func() {
|
||||
sess.handler(sess)
|
||||
sess.Exit(0)
|
||||
}()
|
||||
case "subsystem":
|
||||
if sess.handled {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
|
||||
payload := struct{ Value string }{}
|
||||
gossh.Unmarshal(req.Payload, &payload)
|
||||
sess.subsystem = payload.Value
|
||||
|
||||
// If there's a session policy callback, we need to confirm before
|
||||
// accepting the session.
|
||||
if sess.sessReqCb != nil && !sess.sessReqCb(sess, req.Type) {
|
||||
sess.rawCmd = ""
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
|
||||
handler := sess.subsystemHandlers[payload.Value]
|
||||
if handler == nil {
|
||||
handler = sess.subsystemHandlers["default"]
|
||||
}
|
||||
if handler == nil {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
|
||||
sess.handled = true
|
||||
req.Reply(true, nil)
|
||||
|
||||
go func() {
|
||||
handler(sess)
|
||||
sess.Exit(0)
|
||||
}()
|
||||
case "env":
|
||||
if sess.handled {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
var kv struct{ Key, Value string }
|
||||
gossh.Unmarshal(req.Payload, &kv)
|
||||
sess.env = append(sess.env, fmt.Sprintf("%s=%s", kv.Key, kv.Value))
|
||||
req.Reply(true, nil)
|
||||
case "signal":
|
||||
var payload struct{ Signal string }
|
||||
gossh.Unmarshal(req.Payload, &payload)
|
||||
sess.Lock()
|
||||
if sess.sigCh != nil {
|
||||
sess.sigCh <- Signal(payload.Signal)
|
||||
} else {
|
||||
if len(sess.sigBuf) < maxSigBufSize {
|
||||
sess.sigBuf = append(sess.sigBuf, Signal(payload.Signal))
|
||||
}
|
||||
}
|
||||
sess.Unlock()
|
||||
case "pty-req":
|
||||
if sess.handled || sess.pty != nil {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
ptyReq, ok := parsePtyRequest(req.Payload)
|
||||
if !ok {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
if sess.ptyCb != nil {
|
||||
ok := sess.ptyCb(sess.ctx, ptyReq)
|
||||
if !ok {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
}
|
||||
sess.pty = &ptyReq
|
||||
sess.winch = make(chan Window, 1)
|
||||
sess.winch <- ptyReq.Window
|
||||
defer func() {
|
||||
// when reqs is closed
|
||||
close(sess.winch)
|
||||
}()
|
||||
req.Reply(ok, nil)
|
||||
case "window-change":
|
||||
if sess.pty == nil {
|
||||
req.Reply(false, nil)
|
||||
continue
|
||||
}
|
||||
win, ok := parseWinchRequest(req.Payload)
|
||||
if ok {
|
||||
sess.pty.Window = win
|
||||
sess.winch <- win
|
||||
}
|
||||
req.Reply(ok, nil)
|
||||
case agentRequestType:
|
||||
// TODO: option/callback to allow agent forwarding
|
||||
SetAgentRequested(sess.ctx)
|
||||
req.Reply(true, nil)
|
||||
case "break":
|
||||
ok := false
|
||||
sess.Lock()
|
||||
if sess.breakCh != nil {
|
||||
sess.breakCh <- true
|
||||
ok = true
|
||||
}
|
||||
req.Reply(ok, nil)
|
||||
sess.Unlock()
|
||||
default:
|
||||
// TODO: debug log
|
||||
req.Reply(false, nil)
|
||||
}
|
||||
}
|
||||
}
|
127
vendor/github.com/charmbracelet/ssh/ssh.go
generated
vendored
Normal file
127
vendor/github.com/charmbracelet/ssh/ssh.go
generated
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"crypto/subtle"
|
||||
"net"
|
||||
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
type Signal string
|
||||
|
||||
// POSIX signals as listed in RFC 4254 Section 6.10.
|
||||
const (
|
||||
SIGABRT Signal = "ABRT"
|
||||
SIGALRM Signal = "ALRM"
|
||||
SIGFPE Signal = "FPE"
|
||||
SIGHUP Signal = "HUP"
|
||||
SIGILL Signal = "ILL"
|
||||
SIGINT Signal = "INT"
|
||||
SIGKILL Signal = "KILL"
|
||||
SIGPIPE Signal = "PIPE"
|
||||
SIGQUIT Signal = "QUIT"
|
||||
SIGSEGV Signal = "SEGV"
|
||||
SIGTERM Signal = "TERM"
|
||||
SIGUSR1 Signal = "USR1"
|
||||
SIGUSR2 Signal = "USR2"
|
||||
)
|
||||
|
||||
// DefaultHandler is the default Handler used by Serve.
|
||||
var DefaultHandler Handler
|
||||
|
||||
// Option is a functional option handler for Server.
|
||||
type Option func(*Server) error
|
||||
|
||||
// Handler is a callback for handling established SSH sessions.
|
||||
type Handler func(Session)
|
||||
|
||||
// PublicKeyHandler is a callback for performing public key authentication.
|
||||
type PublicKeyHandler func(ctx Context, key PublicKey) bool
|
||||
|
||||
// PasswordHandler is a callback for performing password authentication.
|
||||
type PasswordHandler func(ctx Context, password string) bool
|
||||
|
||||
// KeyboardInteractiveHandler is a callback for performing keyboard-interactive authentication.
|
||||
type KeyboardInteractiveHandler func(ctx Context, challenger gossh.KeyboardInteractiveChallenge) bool
|
||||
|
||||
// PtyCallback is a hook for allowing PTY sessions.
|
||||
type PtyCallback func(ctx Context, pty Pty) bool
|
||||
|
||||
// SessionRequestCallback is a callback for allowing or denying SSH sessions.
|
||||
type SessionRequestCallback func(sess Session, requestType string) bool
|
||||
|
||||
// ConnCallback is a hook for new connections before handling.
|
||||
// It allows wrapping for timeouts and limiting by returning
|
||||
// the net.Conn that will be used as the underlying connection.
|
||||
type ConnCallback func(ctx Context, conn net.Conn) net.Conn
|
||||
|
||||
// LocalPortForwardingCallback is a hook for allowing port forwarding
|
||||
type LocalPortForwardingCallback func(ctx Context, destinationHost string, destinationPort uint32) bool
|
||||
|
||||
// ReversePortForwardingCallback is a hook for allowing reverse port forwarding
|
||||
type ReversePortForwardingCallback func(ctx Context, bindHost string, bindPort uint32) bool
|
||||
|
||||
// ServerConfigCallback is a hook for creating custom default server configs
|
||||
type ServerConfigCallback func(ctx Context) *gossh.ServerConfig
|
||||
|
||||
// ConnectionFailedCallback is a hook for reporting failed connections
|
||||
// Please note: the net.Conn is likely to be closed at this point
|
||||
type ConnectionFailedCallback func(conn net.Conn, err error)
|
||||
|
||||
// Window represents the size of a PTY window.
|
||||
type Window struct {
|
||||
Width int
|
||||
Height int
|
||||
}
|
||||
|
||||
// Pty represents a PTY request and configuration.
|
||||
type Pty struct {
|
||||
Term string
|
||||
Window Window
|
||||
// HELP WANTED: terminal modes!
|
||||
}
|
||||
|
||||
// Serve accepts incoming SSH connections on the listener l, creating a new
|
||||
// connection goroutine for each. The connection goroutines read requests and
|
||||
// then calls handler to handle sessions. Handler is typically nil, in which
|
||||
// case the DefaultHandler is used.
|
||||
func Serve(l net.Listener, handler Handler, options ...Option) error {
|
||||
srv := &Server{Handler: handler}
|
||||
for _, option := range options {
|
||||
if err := srv.SetOption(option); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return srv.Serve(l)
|
||||
}
|
||||
|
||||
// ListenAndServe listens on the TCP network address addr and then calls Serve
|
||||
// with handler to handle sessions on incoming connections. Handler is typically
|
||||
// nil, in which case the DefaultHandler is used.
|
||||
func ListenAndServe(addr string, handler Handler, options ...Option) error {
|
||||
srv := &Server{Addr: addr, Handler: handler}
|
||||
for _, option := range options {
|
||||
if err := srv.SetOption(option); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return srv.ListenAndServe()
|
||||
}
|
||||
|
||||
// Handle registers the handler as the DefaultHandler.
|
||||
func Handle(handler Handler) {
|
||||
DefaultHandler = handler
|
||||
}
|
||||
|
||||
// KeysEqual is constant time compare of the keys to avoid timing attacks.
|
||||
func KeysEqual(ak, bk PublicKey) bool {
|
||||
|
||||
//avoid panic if one of the keys is nil, return false instead
|
||||
if ak == nil || bk == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
a := ak.Marshal()
|
||||
b := bk.Marshal()
|
||||
return (len(a) == len(b) && subtle.ConstantTimeCompare(a, b) == 1)
|
||||
}
|
193
vendor/github.com/charmbracelet/ssh/tcpip.go
generated
vendored
Normal file
193
vendor/github.com/charmbracelet/ssh/tcpip.go
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
const (
|
||||
forwardedTCPChannelType = "forwarded-tcpip"
|
||||
)
|
||||
|
||||
// direct-tcpip data struct as specified in RFC4254, Section 7.2
|
||||
type localForwardChannelData struct {
|
||||
DestAddr string
|
||||
DestPort uint32
|
||||
|
||||
OriginAddr string
|
||||
OriginPort uint32
|
||||
}
|
||||
|
||||
// DirectTCPIPHandler can be enabled by adding it to the server's
|
||||
// ChannelHandlers under direct-tcpip.
|
||||
func DirectTCPIPHandler(srv *Server, conn *gossh.ServerConn, newChan gossh.NewChannel, ctx Context) {
|
||||
d := localForwardChannelData{}
|
||||
if err := gossh.Unmarshal(newChan.ExtraData(), &d); err != nil {
|
||||
newChan.Reject(gossh.ConnectionFailed, "error parsing forward data: "+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if srv.LocalPortForwardingCallback == nil || !srv.LocalPortForwardingCallback(ctx, d.DestAddr, d.DestPort) {
|
||||
newChan.Reject(gossh.Prohibited, "port forwarding is disabled")
|
||||
return
|
||||
}
|
||||
|
||||
dest := net.JoinHostPort(d.DestAddr, strconv.FormatInt(int64(d.DestPort), 10))
|
||||
|
||||
var dialer net.Dialer
|
||||
dconn, err := dialer.DialContext(ctx, "tcp", dest)
|
||||
if err != nil {
|
||||
newChan.Reject(gossh.ConnectionFailed, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
ch, reqs, err := newChan.Accept()
|
||||
if err != nil {
|
||||
dconn.Close()
|
||||
return
|
||||
}
|
||||
go gossh.DiscardRequests(reqs)
|
||||
|
||||
go func() {
|
||||
defer ch.Close()
|
||||
defer dconn.Close()
|
||||
io.Copy(ch, dconn)
|
||||
}()
|
||||
go func() {
|
||||
defer ch.Close()
|
||||
defer dconn.Close()
|
||||
io.Copy(dconn, ch)
|
||||
}()
|
||||
}
|
||||
|
||||
type remoteForwardRequest struct {
|
||||
BindAddr string
|
||||
BindPort uint32
|
||||
}
|
||||
|
||||
type remoteForwardSuccess struct {
|
||||
BindPort uint32
|
||||
}
|
||||
|
||||
type remoteForwardCancelRequest struct {
|
||||
BindAddr string
|
||||
BindPort uint32
|
||||
}
|
||||
|
||||
type remoteForwardChannelData struct {
|
||||
DestAddr string
|
||||
DestPort uint32
|
||||
OriginAddr string
|
||||
OriginPort uint32
|
||||
}
|
||||
|
||||
// ForwardedTCPHandler can be enabled by creating a ForwardedTCPHandler and
|
||||
// adding the HandleSSHRequest callback to the server's RequestHandlers under
|
||||
// tcpip-forward and cancel-tcpip-forward.
|
||||
type ForwardedTCPHandler struct {
|
||||
forwards map[string]net.Listener
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func (h *ForwardedTCPHandler) HandleSSHRequest(ctx Context, srv *Server, req *gossh.Request) (bool, []byte) {
|
||||
h.Lock()
|
||||
if h.forwards == nil {
|
||||
h.forwards = make(map[string]net.Listener)
|
||||
}
|
||||
h.Unlock()
|
||||
conn := ctx.Value(ContextKeyConn).(*gossh.ServerConn)
|
||||
switch req.Type {
|
||||
case "tcpip-forward":
|
||||
var reqPayload remoteForwardRequest
|
||||
if err := gossh.Unmarshal(req.Payload, &reqPayload); err != nil {
|
||||
// TODO: log parse failure
|
||||
return false, []byte{}
|
||||
}
|
||||
if srv.ReversePortForwardingCallback == nil || !srv.ReversePortForwardingCallback(ctx, reqPayload.BindAddr, reqPayload.BindPort) {
|
||||
return false, []byte("port forwarding is disabled")
|
||||
}
|
||||
addr := net.JoinHostPort(reqPayload.BindAddr, strconv.Itoa(int(reqPayload.BindPort)))
|
||||
ln, err := net.Listen("tcp", addr)
|
||||
if err != nil {
|
||||
// TODO: log listen failure
|
||||
return false, []byte{}
|
||||
}
|
||||
_, destPortStr, _ := net.SplitHostPort(ln.Addr().String())
|
||||
destPort, _ := strconv.Atoi(destPortStr)
|
||||
h.Lock()
|
||||
h.forwards[addr] = ln
|
||||
h.Unlock()
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
h.Lock()
|
||||
ln, ok := h.forwards[addr]
|
||||
h.Unlock()
|
||||
if ok {
|
||||
ln.Close()
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
for {
|
||||
c, err := ln.Accept()
|
||||
if err != nil {
|
||||
// TODO: log accept failure
|
||||
break
|
||||
}
|
||||
originAddr, orignPortStr, _ := net.SplitHostPort(c.RemoteAddr().String())
|
||||
originPort, _ := strconv.Atoi(orignPortStr)
|
||||
payload := gossh.Marshal(&remoteForwardChannelData{
|
||||
DestAddr: reqPayload.BindAddr,
|
||||
DestPort: uint32(destPort),
|
||||
OriginAddr: originAddr,
|
||||
OriginPort: uint32(originPort),
|
||||
})
|
||||
go func() {
|
||||
ch, reqs, err := conn.OpenChannel(forwardedTCPChannelType, payload)
|
||||
if err != nil {
|
||||
// TODO: log failure to open channel
|
||||
log.Println(err)
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
go gossh.DiscardRequests(reqs)
|
||||
go func() {
|
||||
defer ch.Close()
|
||||
defer c.Close()
|
||||
io.Copy(ch, c)
|
||||
}()
|
||||
go func() {
|
||||
defer ch.Close()
|
||||
defer c.Close()
|
||||
io.Copy(c, ch)
|
||||
}()
|
||||
}()
|
||||
}
|
||||
h.Lock()
|
||||
delete(h.forwards, addr)
|
||||
h.Unlock()
|
||||
}()
|
||||
return true, gossh.Marshal(&remoteForwardSuccess{uint32(destPort)})
|
||||
|
||||
case "cancel-tcpip-forward":
|
||||
var reqPayload remoteForwardCancelRequest
|
||||
if err := gossh.Unmarshal(req.Payload, &reqPayload); err != nil {
|
||||
// TODO: log parse failure
|
||||
return false, []byte{}
|
||||
}
|
||||
addr := net.JoinHostPort(reqPayload.BindAddr, strconv.Itoa(int(reqPayload.BindPort)))
|
||||
h.Lock()
|
||||
ln, ok := h.forwards[addr]
|
||||
h.Unlock()
|
||||
if ok {
|
||||
ln.Close()
|
||||
}
|
||||
return true, nil
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
83
vendor/github.com/charmbracelet/ssh/util.go
generated
vendored
Normal file
83
vendor/github.com/charmbracelet/ssh/util.go
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"encoding/binary"
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
func generateSigner() (ssh.Signer, error) {
|
||||
key, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ssh.NewSignerFromKey(key)
|
||||
}
|
||||
|
||||
func parsePtyRequest(s []byte) (pty Pty, ok bool) {
|
||||
term, s, ok := parseString(s)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
width32, s, ok := parseUint32(s)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
height32, _, ok := parseUint32(s)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
pty = Pty{
|
||||
Term: term,
|
||||
Window: Window{
|
||||
Width: int(width32),
|
||||
Height: int(height32),
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func parseWinchRequest(s []byte) (win Window, ok bool) {
|
||||
width32, s, ok := parseUint32(s)
|
||||
if width32 < 1 {
|
||||
ok = false
|
||||
}
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
height32, _, ok := parseUint32(s)
|
||||
if height32 < 1 {
|
||||
ok = false
|
||||
}
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
win = Window{
|
||||
Width: int(width32),
|
||||
Height: int(height32),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func parseString(in []byte) (out string, rest []byte, ok bool) {
|
||||
if len(in) < 4 {
|
||||
return
|
||||
}
|
||||
length := binary.BigEndian.Uint32(in)
|
||||
if uint32(len(in)) < 4+length {
|
||||
return
|
||||
}
|
||||
out = string(in[4 : 4+length])
|
||||
rest = in[4+length:]
|
||||
ok = true
|
||||
return
|
||||
}
|
||||
|
||||
func parseUint32(in []byte) (uint32, []byte, bool) {
|
||||
if len(in) < 4 {
|
||||
return 0, nil, false
|
||||
}
|
||||
return binary.BigEndian.Uint32(in), in[4:], true
|
||||
}
|
33
vendor/github.com/charmbracelet/ssh/wrap.go
generated
vendored
Normal file
33
vendor/github.com/charmbracelet/ssh/wrap.go
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
package ssh
|
||||
|
||||
import gossh "golang.org/x/crypto/ssh"
|
||||
|
||||
// PublicKey is an abstraction of different types of public keys.
|
||||
type PublicKey interface {
|
||||
gossh.PublicKey
|
||||
}
|
||||
|
||||
// The Permissions type holds fine-grained permissions that are specific to a
|
||||
// user or a specific authentication method for a user. Permissions, except for
|
||||
// "source-address", must be enforced in the server application layer, after
|
||||
// successful authentication.
|
||||
type Permissions struct {
|
||||
*gossh.Permissions
|
||||
}
|
||||
|
||||
// A Signer can create signatures that verify against a public key.
|
||||
type Signer interface {
|
||||
gossh.Signer
|
||||
}
|
||||
|
||||
// ParseAuthorizedKey parses a public key from an authorized_keys file used in
|
||||
// OpenSSH according to the sshd(8) manual page.
|
||||
func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) {
|
||||
return gossh.ParseAuthorizedKey(in)
|
||||
}
|
||||
|
||||
// ParsePublicKey parses an SSH public key formatted for use in
|
||||
// the SSH wire protocol according to RFC 4253, section 6.6.
|
||||
func ParsePublicKey(in []byte) (out PublicKey, err error) {
|
||||
return gossh.ParsePublicKey(in)
|
||||
}
|
11
vendor/github.com/charmbracelet/wish/.gitignore
generated
vendored
Normal file
11
vendor/github.com/charmbracelet/wish/.gitignore
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
examples/bubbletea/bubbletea
|
||||
examples/bubbletea/.ssh
|
||||
examples/git/git
|
||||
examples/git/.ssh
|
||||
examples/git/.repos
|
||||
.repos
|
||||
.ssh
|
||||
coverage.txt
|
||||
|
||||
# MacOS specific
|
||||
.DS_Store
|
34
vendor/github.com/charmbracelet/wish/.golangci.yml
generated
vendored
Normal file
34
vendor/github.com/charmbracelet/wish/.golangci.yml
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
run:
|
||||
tests: false
|
||||
|
||||
issues:
|
||||
include:
|
||||
- EXC0001
|
||||
- EXC0005
|
||||
- EXC0011
|
||||
- EXC0012
|
||||
- EXC0013
|
||||
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- bodyclose
|
||||
- dupl
|
||||
- exportloopref
|
||||
- goconst
|
||||
- godot
|
||||
- godox
|
||||
- goimports
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- ifshort
|
||||
- misspell
|
||||
- prealloc
|
||||
- revive
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- whitespace
|
8
vendor/github.com/charmbracelet/wish/.goreleaser.yml
generated
vendored
Normal file
8
vendor/github.com/charmbracelet/wish/.goreleaser.yml
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
includes:
|
||||
- from_url:
|
||||
url: charmbracelet/meta/main/goreleaser-lib.yaml
|
||||
- from_url:
|
||||
url: charmbracelet/meta/main/goreleaser-announce.yaml
|
||||
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
|
||||
|
21
vendor/github.com/charmbracelet/wish/LICENSE
generated
vendored
Normal file
21
vendor/github.com/charmbracelet/wish/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2021 Charmbracelet, Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
142
vendor/github.com/charmbracelet/wish/README.md
generated
vendored
Normal file
142
vendor/github.com/charmbracelet/wish/README.md
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
# Wish
|
||||
|
||||
<p>
|
||||
<img style="width: 247px" src="https://stuff.charm.sh/wish/wish-header.png" alt="A nice rendering of a star, anthropomorphized somewhat by means of a smile, with the words ‘Charm Wish’ next to it">
|
||||
<br>
|
||||
<a href="https://github.com/charmbracelet/wish/releases"><img src="https://img.shields.io/github/release/charmbracelet/wish.svg" alt="Latest Release"></a>
|
||||
<a href="https://pkg.go.dev/github.com/charmbracelet/wish?tab=doc"><img src="https://godoc.org/github.com/golang/gddo?status.svg" alt="GoDoc"></a>
|
||||
<a href="https://github.com/charmbracelet/wish/actions"><img src="https://github.com/charmbracelet/wish/workflows/Build/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://codecov.io/gh/charmbracelet/wish"><img alt="Codecov branch" src="https://img.shields.io/codecov/c/github/charmbracelet/wish/main.svg"></a>
|
||||
<a href="https://goreportcard.com/report/github.com/charmbracelet/wish"><img alt="Go Report Card" src="https://goreportcard.com/badge/github.com/charmbracelet/wish"></a>
|
||||
</p>
|
||||
|
||||
|
||||
Make SSH apps, just like that! 💫
|
||||
|
||||
SSH is an excellent platform to build remotely accessible applications on. It
|
||||
offers secure communication without the hassle of HTTPS certificates, it has
|
||||
user identification with SSH keys and it's accessible from anywhere with a
|
||||
terminal. Powerful protocols like Git work over SSH and you can even render
|
||||
TUIs directly over an SSH connection.
|
||||
|
||||
Wish is an SSH server with sensible defaults and a collection of middleware that
|
||||
makes building SSH apps easy. Wish is built on [gliderlabs/ssh][gliderlabs/ssh]
|
||||
and should be easy to integrate into any existing projects.
|
||||
|
||||
## What are SSH Apps?
|
||||
|
||||
Usually, when we think about SSH, we think about remote shell access into servers,
|
||||
most commonly through `openssh-server`.
|
||||
|
||||
That's a perfectly valid and probably the most common use of SSH, but it can do so much more than that.
|
||||
Just like HTTP, SMTP, FTP and others, SSH is a protocol!
|
||||
It is a cryptographic network protocol for operating network services securely over an unsecured network. [^1]
|
||||
|
||||
[^1]: https://en.wikipedia.org/wiki/Secure_Shell
|
||||
|
||||
That means, among other things, that we can write custom SSH servers, without touching `openssh-server`,
|
||||
so we can securely do more things than just providing a shell.
|
||||
|
||||
Wish is a library that helps writing these kind of apps using Go.
|
||||
|
||||
## Middleware
|
||||
|
||||
Wish middlewares are analogous to those in several HTTP frameworks.
|
||||
They are essentially SSH handlers that you can use to do specific tasks,
|
||||
and then call the next middleware.
|
||||
|
||||
Notice that middlewares are composed from first to last,
|
||||
which means the last one is executed first.
|
||||
|
||||
### Bubble Tea
|
||||
|
||||
The [`bubbletea`](bubbletea) middleware makes it easy to serve any
|
||||
[Bubble Tea][bubbletea] application over SSH. Each SSH session will get their own
|
||||
`tea.Program` with the SSH pty input and output connected. Client window
|
||||
dimension and resize messages are also natively handled by the `tea.Program`.
|
||||
|
||||
You can see a demo of the Wish middleware in action at: `ssh git.charm.sh`
|
||||
|
||||
### Git
|
||||
|
||||
The [`git`](git) middleware adds `git` server functionality to any ssh server.
|
||||
It supports repo creation on initial push and custom public key based auth.
|
||||
|
||||
This middleware requires that `git` is installed on the server.
|
||||
|
||||
### Logging
|
||||
|
||||
The [`logging`](logging) middleware provides basic connection logging. Connects
|
||||
are logged with the remote address, invoked command, TERM setting, window
|
||||
dimensions and if the auth was public key based. Disconnect will log the remote
|
||||
address and connection duration.
|
||||
|
||||
### Access Control
|
||||
|
||||
Not all applications will support general SSH connections. To restrict access
|
||||
to supported methods, you can use the [`activeterm`](activeterm) middleware to
|
||||
only allow connections with active terminals connected and the
|
||||
[`accesscontrol`](accesscontrol) middleware that lets you specify allowed
|
||||
commands.
|
||||
|
||||
## Default Server
|
||||
|
||||
Wish includes the ability to easily create an always authenticating default SSH
|
||||
server with automatic server key generation.
|
||||
|
||||
## Examples
|
||||
|
||||
There are examples for a standalone [Bubble Tea application](examples/bubbletea)
|
||||
and [Git server](examples/git) in the [examples](examples) folder.
|
||||
|
||||
## Apps Built With Wish
|
||||
|
||||
* [Soft Serve](https://github.com/charmbracelet/soft-serve)
|
||||
* [Wishlist](https://github.com/charmbracelet/wishlist)
|
||||
* [SSHWordle](https://github.com/davidcroda/sshwordle)
|
||||
* [clidle](https://github.com/ajeetdsouza/clidle)
|
||||
* [ssh-warm-welcome](https://git.vvvvvvaria.org/decentral1se/ssh-warm-welcome)
|
||||
|
||||
[bubbletea]: https://github.com/charmbracelet/bubbletea
|
||||
[gliderlabs/ssh]: https://github.com/gliderlabs/ssh
|
||||
|
||||
## Pro Tip
|
||||
|
||||
When building various Wish applications locally you can add the following to
|
||||
your `~/.ssh/config` to avoid having to clear out `localhost` entries in your
|
||||
`~/.ssh/known_hosts` file:
|
||||
|
||||
```
|
||||
Host localhost
|
||||
UserKnownHostsFile /dev/null
|
||||
```
|
||||
|
||||
## How it works?
|
||||
|
||||
Wish uses [gliderlabs/ssh][gliderlabs/ssh] to implement its SSH server, and
|
||||
the OpenSSH is never used nor needed — you can even uninstall it if you want to.
|
||||
|
||||
Incidentally, there's no risk of accidentally sharing a shell because there's no
|
||||
default behavior that does that on Wish.
|
||||
|
||||
###
|
||||
|
||||
## Feedback
|
||||
|
||||
We’d love to hear your thoughts on this project. Feel free to drop us a note!
|
||||
|
||||
* [Twitter](https://twitter.com/charmcli)
|
||||
* [The Fediverse](https://mastodon.social/@charmcli)
|
||||
* [Discord](https://charm.sh/chat)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/charmbracelet/wish/raw/main/LICENSE)
|
||||
|
||||
***
|
||||
|
||||
Part of [Charm](https://charm.sh).
|
||||
|
||||
<a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a>
|
||||
|
||||
Charm热爱开源 • Charm loves open source
|
41
vendor/github.com/charmbracelet/wish/logging/logging.go
generated
vendored
Normal file
41
vendor/github.com/charmbracelet/wish/logging/logging.go
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/ssh"
|
||||
"github.com/charmbracelet/wish"
|
||||
)
|
||||
|
||||
// Middleware provides basic connection logging. Connects are logged with the
|
||||
// remote address, invoked command, TERM setting, window dimensions and if the
|
||||
// auth was public key based. Disconnect will log the remote address and
|
||||
// connection duration.
|
||||
//
|
||||
// The logger is set to the std default logger.
|
||||
func Middleware() wish.Middleware {
|
||||
return MiddlewareWithLogger(log.Default())
|
||||
}
|
||||
|
||||
// Logger is the interface that wraps the basic Log method.
|
||||
type Logger interface {
|
||||
Printf(format string, v ...interface{})
|
||||
}
|
||||
|
||||
// MiddlewareWithLogger provides basic connection logging. Connects are logged with the
|
||||
// remote address, invoked command, TERM setting, window dimensions and if the
|
||||
// auth was public key based. Disconnect will log the remote address and
|
||||
// connection duration.
|
||||
func MiddlewareWithLogger(l Logger) wish.Middleware {
|
||||
return func(sh ssh.Handler) ssh.Handler {
|
||||
return func(s ssh.Session) {
|
||||
ct := time.Now()
|
||||
hpk := s.PublicKey() != nil
|
||||
pty, _, _ := s.Pty()
|
||||
l.Printf("%s connect %s %v %v %s %v %v\n", s.User(), s.RemoteAddr().String(), hpk, s.Command(), pty.Term, pty.Window.Width, pty.Window.Height)
|
||||
sh(s)
|
||||
l.Printf("%s disconnect %s\n", s.RemoteAddr().String(), time.Since(ct))
|
||||
}
|
||||
}
|
||||
}
|
188
vendor/github.com/charmbracelet/wish/options.go
generated
vendored
Normal file
188
vendor/github.com/charmbracelet/wish/options.go
generated
vendored
Normal file
@ -0,0 +1,188 @@
|
||||
package wish
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/keygen"
|
||||
"github.com/charmbracelet/ssh"
|
||||
gossh "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
// WithAddress returns an ssh.Option that sets the address to listen on.
|
||||
func WithAddress(addr string) ssh.Option {
|
||||
return func(s *ssh.Server) error {
|
||||
s.Addr = addr
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithVersion returns an ssh.Option that sets the server version.
|
||||
func WithVersion(version string) ssh.Option {
|
||||
return func(s *ssh.Server) error {
|
||||
s.Version = version
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithMiddleware composes the provided Middleware and return a ssh.Option.
|
||||
// This useful if you manually create an ssh.Server and want to set the
|
||||
// Server.Handler.
|
||||
//
|
||||
// Notice that middlewares are composed from first to last, which means the last one is executed first.
|
||||
func WithMiddleware(mw ...Middleware) ssh.Option {
|
||||
return func(s *ssh.Server) error {
|
||||
h := func(s ssh.Session) {}
|
||||
for _, m := range mw {
|
||||
h = m(h)
|
||||
}
|
||||
s.Handler = h
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithHostKeyFile returns an ssh.Option that sets the path to the private.
|
||||
func WithHostKeyPath(path string) ssh.Option {
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
dir, f := filepath.Split(path)
|
||||
n := strings.TrimSuffix(f, "_ed25519")
|
||||
_, err := keygen.NewWithWrite(filepath.Join(dir, n), nil, keygen.Ed25519)
|
||||
if err != nil {
|
||||
return func(*ssh.Server) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
path = filepath.Join(dir, n+"_ed25519")
|
||||
}
|
||||
return ssh.HostKeyFile(path)
|
||||
}
|
||||
|
||||
// WithHostKeyPEM returns an ssh.Option that sets the host key from a PEM block.
|
||||
func WithHostKeyPEM(pem []byte) ssh.Option {
|
||||
return ssh.HostKeyPEM(pem)
|
||||
}
|
||||
|
||||
// WithAuthorizedKeys allows to use a SSH authorized_keys file to allowlist users.
|
||||
func WithAuthorizedKeys(path string) ssh.Option {
|
||||
return func(s *ssh.Server) error {
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
return err
|
||||
}
|
||||
return WithPublicKeyAuth(func(_ ssh.Context, key ssh.PublicKey) bool {
|
||||
return isAuthorized(path, func(k ssh.PublicKey) bool {
|
||||
return ssh.KeysEqual(key, k)
|
||||
})
|
||||
})(s)
|
||||
}
|
||||
}
|
||||
|
||||
// WithTrustedUserCAKeys authorize certificates that are signed with the given
|
||||
// Certificate Authority public key, and are valid.
|
||||
// Analogous to the TrustedUserCAKeys OpenSSH option.
|
||||
func WithTrustedUserCAKeys(path string) ssh.Option {
|
||||
return func(s *ssh.Server) error {
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
return err
|
||||
}
|
||||
return WithPublicKeyAuth(func(ctx ssh.Context, key ssh.PublicKey) bool {
|
||||
cert, ok := key.(*gossh.Certificate)
|
||||
if !ok {
|
||||
// not a certificate...
|
||||
return false
|
||||
}
|
||||
|
||||
return isAuthorized(path, func(k ssh.PublicKey) bool {
|
||||
checker := &gossh.CertChecker{
|
||||
IsUserAuthority: func(auth gossh.PublicKey) bool {
|
||||
// its a cert signed by one of the CAs
|
||||
return bytes.Equal(auth.Marshal(), k.Marshal())
|
||||
},
|
||||
}
|
||||
|
||||
if !checker.IsUserAuthority(cert.SignatureKey) {
|
||||
return false
|
||||
}
|
||||
|
||||
if err := checker.CheckCert(ctx.User(), cert); err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
})(s)
|
||||
}
|
||||
}
|
||||
|
||||
func isAuthorized(path string, checker func(k ssh.PublicKey) bool) bool {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
log.Printf("failed to parse %q: %s", path, err)
|
||||
return false
|
||||
}
|
||||
defer f.Close() // nolint: errcheck
|
||||
|
||||
rd := bufio.NewReader(f)
|
||||
for {
|
||||
line, _, err := rd.ReadLine()
|
||||
if err != nil {
|
||||
if errors.Is(err, io.EOF) {
|
||||
break
|
||||
}
|
||||
log.Printf("failed to parse %q: %s", path, err)
|
||||
return false
|
||||
}
|
||||
if strings.TrimSpace(string(line)) == "" {
|
||||
continue
|
||||
}
|
||||
if bytes.HasPrefix(line, []byte{'#'}) {
|
||||
continue
|
||||
}
|
||||
upk, _, _, _, err := ssh.ParseAuthorizedKey(line)
|
||||
if err != nil {
|
||||
log.Printf("failed to parse %q: %s", path, err)
|
||||
return false
|
||||
}
|
||||
if checker(upk) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// WithPublicKeyAuth returns an ssh.Option that sets the public key auth handler.
|
||||
func WithPublicKeyAuth(h ssh.PublicKeyHandler) ssh.Option {
|
||||
return ssh.PublicKeyAuth(h)
|
||||
}
|
||||
|
||||
// WithPasswordAuth returns an ssh.Option that sets the password auth handler.
|
||||
func WithPasswordAuth(p ssh.PasswordHandler) ssh.Option {
|
||||
return ssh.PasswordAuth(p)
|
||||
}
|
||||
|
||||
// WithKeyboardInteractiveAuth returns an ssh.Option that sets the keyboard interactive auth handler.
|
||||
func WithKeyboardInteractiveAuth(h ssh.KeyboardInteractiveHandler) ssh.Option {
|
||||
return ssh.KeyboardInteractiveAuth(h)
|
||||
}
|
||||
|
||||
// WithIdleTimeout returns an ssh.Option that sets the connection's idle timeout.
|
||||
func WithIdleTimeout(d time.Duration) ssh.Option {
|
||||
return func(s *ssh.Server) error {
|
||||
s.IdleTimeout = d
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithMaxTimeout returns an ssh.Option that sets the connection's absolute timeout.
|
||||
func WithMaxTimeout(d time.Duration) ssh.Option {
|
||||
return func(s *ssh.Server) error {
|
||||
s.MaxTimeout = d
|
||||
return nil
|
||||
}
|
||||
}
|
100
vendor/github.com/charmbracelet/wish/wish.go
generated
vendored
Normal file
100
vendor/github.com/charmbracelet/wish/wish.go
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
package wish
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/charmbracelet/keygen"
|
||||
"github.com/charmbracelet/ssh"
|
||||
)
|
||||
|
||||
// Middleware is a function that takes an ssh.Handler and returns an
|
||||
// ssh.Handler. Implementations should call the provided handler argument.
|
||||
type Middleware func(ssh.Handler) ssh.Handler
|
||||
|
||||
// NewServer is returns a default SSH server with the provided Middleware. A
|
||||
// new SSH key pair of type ed25519 will be created if one does not exist. By
|
||||
// default this server will accept all incoming connections, password and
|
||||
// public key.
|
||||
func NewServer(ops ...ssh.Option) (*ssh.Server, error) {
|
||||
s := &ssh.Server{}
|
||||
// Some sensible defaults
|
||||
s.Version = "OpenSSH_7.6p1"
|
||||
for _, op := range ops {
|
||||
if err := s.SetOption(op); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if len(s.HostSigners) == 0 {
|
||||
k, err := keygen.New("", nil, keygen.Ed25519)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = s.SetOption(WithHostKeyPEM(k.PrivateKeyPEM()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// Fatal prints to the given session's STDERR and exits 1.
|
||||
func Fatal(s ssh.Session, v ...interface{}) {
|
||||
Error(s, v...)
|
||||
_ = s.Exit(1)
|
||||
_ = s.Close()
|
||||
}
|
||||
|
||||
// Fatalf formats according to the given format, prints to the session's STDERR
|
||||
// followed by an exit 1.
|
||||
//
|
||||
// Notice that this might cause formatting issues if you don't add a \r\n in the end of your string.
|
||||
func Fatalf(s ssh.Session, f string, v ...interface{}) {
|
||||
Errorf(s, f, v...)
|
||||
_ = s.Exit(1)
|
||||
_ = s.Close()
|
||||
}
|
||||
|
||||
// Fatalln formats according to the default format, prints to the session's
|
||||
// STDERR, followed by a new line and an exit 1.
|
||||
func Fatalln(s ssh.Session, v ...interface{}) {
|
||||
Errorln(s, v...)
|
||||
Errorf(s, "\r")
|
||||
_ = s.Exit(1)
|
||||
_ = s.Close()
|
||||
}
|
||||
|
||||
// Error prints the given error the the session's STDERR.
|
||||
func Error(s ssh.Session, v ...interface{}) {
|
||||
_, _ = fmt.Fprint(s.Stderr(), v...)
|
||||
}
|
||||
|
||||
// Errorf formats according to the given format and prints to the session's STDERR.
|
||||
func Errorf(s ssh.Session, f string, v ...interface{}) {
|
||||
_, _ = fmt.Fprintf(s.Stderr(), f, v...)
|
||||
}
|
||||
|
||||
// Errorf formats according to the default format and prints to the session's STDERR.
|
||||
func Errorln(s ssh.Session, v ...interface{}) {
|
||||
_, _ = fmt.Fprintln(s.Stderr(), v...)
|
||||
}
|
||||
|
||||
// Print writes to the session's STDOUT followed.
|
||||
func Print(s ssh.Session, v ...interface{}) {
|
||||
_, _ = fmt.Fprint(s, v...)
|
||||
}
|
||||
|
||||
// Printf formats according to the given format and writes to the session's STDOUT.
|
||||
func Printf(s ssh.Session, f string, v ...interface{}) {
|
||||
_, _ = fmt.Fprintf(s, f, v...)
|
||||
}
|
||||
|
||||
// Println formats according to the default format and writes to the session's STDOUT.
|
||||
func Println(s ssh.Session, v ...interface{}) {
|
||||
_, _ = fmt.Fprintln(s, v...)
|
||||
}
|
||||
|
||||
// WriteString writes the given string to the session's STDOUT.
|
||||
func WriteString(s ssh.Session, v string) (int, error) {
|
||||
return io.WriteString(s, v)
|
||||
}
|
202
vendor/github.com/google/shlex/COPYING
generated
vendored
Normal file
202
vendor/github.com/google/shlex/COPYING
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
2
vendor/github.com/google/shlex/README
generated
vendored
Normal file
2
vendor/github.com/google/shlex/README
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
go-shlex is a simple lexer for go that supports shell-style quoting,
|
||||
commenting, and escaping.
|
416
vendor/github.com/google/shlex/shlex.go
generated
vendored
Normal file
416
vendor/github.com/google/shlex/shlex.go
generated
vendored
Normal file
@ -0,0 +1,416 @@
|
||||
/*
|
||||
Copyright 2012 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Package shlex implements a simple lexer which splits input in to tokens using
|
||||
shell-style rules for quoting and commenting.
|
||||
|
||||
The basic use case uses the default ASCII lexer to split a string into sub-strings:
|
||||
|
||||
shlex.Split("one \"two three\" four") -> []string{"one", "two three", "four"}
|
||||
|
||||
To process a stream of strings:
|
||||
|
||||
l := NewLexer(os.Stdin)
|
||||
for ; token, err := l.Next(); err != nil {
|
||||
// process token
|
||||
}
|
||||
|
||||
To access the raw token stream (which includes tokens for comments):
|
||||
|
||||
t := NewTokenizer(os.Stdin)
|
||||
for ; token, err := t.Next(); err != nil {
|
||||
// process token
|
||||
}
|
||||
|
||||
*/
|
||||
package shlex
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// TokenType is a top-level token classification: A word, space, comment, unknown.
|
||||
type TokenType int
|
||||
|
||||
// runeTokenClass is the type of a UTF-8 character classification: A quote, space, escape.
|
||||
type runeTokenClass int
|
||||
|
||||
// the internal state used by the lexer state machine
|
||||
type lexerState int
|
||||
|
||||
// Token is a (type, value) pair representing a lexographical token.
|
||||
type Token struct {
|
||||
tokenType TokenType
|
||||
value string
|
||||
}
|
||||
|
||||
// Equal reports whether tokens a, and b, are equal.
|
||||
// Two tokens are equal if both their types and values are equal. A nil token can
|
||||
// never be equal to another token.
|
||||
func (a *Token) Equal(b *Token) bool {
|
||||
if a == nil || b == nil {
|
||||
return false
|
||||
}
|
||||
if a.tokenType != b.tokenType {
|
||||
return false
|
||||
}
|
||||
return a.value == b.value
|
||||
}
|
||||
|
||||
// Named classes of UTF-8 runes
|
||||
const (
|
||||
spaceRunes = " \t\r\n"
|
||||
escapingQuoteRunes = `"`
|
||||
nonEscapingQuoteRunes = "'"
|
||||
escapeRunes = `\`
|
||||
commentRunes = "#"
|
||||
)
|
||||
|
||||
// Classes of rune token
|
||||
const (
|
||||
unknownRuneClass runeTokenClass = iota
|
||||
spaceRuneClass
|
||||
escapingQuoteRuneClass
|
||||
nonEscapingQuoteRuneClass
|
||||
escapeRuneClass
|
||||
commentRuneClass
|
||||
eofRuneClass
|
||||
)
|
||||
|
||||
// Classes of lexographic token
|
||||
const (
|
||||
UnknownToken TokenType = iota
|
||||
WordToken
|
||||
SpaceToken
|
||||
CommentToken
|
||||
)
|
||||
|
||||
// Lexer state machine states
|
||||
const (
|
||||
startState lexerState = iota // no runes have been seen
|
||||
inWordState // processing regular runes in a word
|
||||
escapingState // we have just consumed an escape rune; the next rune is literal
|
||||
escapingQuotedState // we have just consumed an escape rune within a quoted string
|
||||
quotingEscapingState // we are within a quoted string that supports escaping ("...")
|
||||
quotingState // we are within a string that does not support escaping ('...')
|
||||
commentState // we are within a comment (everything following an unquoted or unescaped #
|
||||
)
|
||||
|
||||
// tokenClassifier is used for classifying rune characters.
|
||||
type tokenClassifier map[rune]runeTokenClass
|
||||
|
||||
func (typeMap tokenClassifier) addRuneClass(runes string, tokenType runeTokenClass) {
|
||||
for _, runeChar := range runes {
|
||||
typeMap[runeChar] = tokenType
|
||||
}
|
||||
}
|
||||
|
||||
// newDefaultClassifier creates a new classifier for ASCII characters.
|
||||
func newDefaultClassifier() tokenClassifier {
|
||||
t := tokenClassifier{}
|
||||
t.addRuneClass(spaceRunes, spaceRuneClass)
|
||||
t.addRuneClass(escapingQuoteRunes, escapingQuoteRuneClass)
|
||||
t.addRuneClass(nonEscapingQuoteRunes, nonEscapingQuoteRuneClass)
|
||||
t.addRuneClass(escapeRunes, escapeRuneClass)
|
||||
t.addRuneClass(commentRunes, commentRuneClass)
|
||||
return t
|
||||
}
|
||||
|
||||
// ClassifyRune classifiees a rune
|
||||
func (t tokenClassifier) ClassifyRune(runeVal rune) runeTokenClass {
|
||||
return t[runeVal]
|
||||
}
|
||||
|
||||
// Lexer turns an input stream into a sequence of tokens. Whitespace and comments are skipped.
|
||||
type Lexer Tokenizer
|
||||
|
||||
// NewLexer creates a new lexer from an input stream.
|
||||
func NewLexer(r io.Reader) *Lexer {
|
||||
|
||||
return (*Lexer)(NewTokenizer(r))
|
||||
}
|
||||
|
||||
// Next returns the next word, or an error. If there are no more words,
|
||||
// the error will be io.EOF.
|
||||
func (l *Lexer) Next() (string, error) {
|
||||
for {
|
||||
token, err := (*Tokenizer)(l).Next()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
switch token.tokenType {
|
||||
case WordToken:
|
||||
return token.value, nil
|
||||
case CommentToken:
|
||||
// skip comments
|
||||
default:
|
||||
return "", fmt.Errorf("Unknown token type: %v", token.tokenType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tokenizer turns an input stream into a sequence of typed tokens
|
||||
type Tokenizer struct {
|
||||
input bufio.Reader
|
||||
classifier tokenClassifier
|
||||
}
|
||||
|
||||
// NewTokenizer creates a new tokenizer from an input stream.
|
||||
func NewTokenizer(r io.Reader) *Tokenizer {
|
||||
input := bufio.NewReader(r)
|
||||
classifier := newDefaultClassifier()
|
||||
return &Tokenizer{
|
||||
input: *input,
|
||||
classifier: classifier}
|
||||
}
|
||||
|
||||
// scanStream scans the stream for the next token using the internal state machine.
|
||||
// It will panic if it encounters a rune which it does not know how to handle.
|
||||
func (t *Tokenizer) scanStream() (*Token, error) {
|
||||
state := startState
|
||||
var tokenType TokenType
|
||||
var value []rune
|
||||
var nextRune rune
|
||||
var nextRuneType runeTokenClass
|
||||
var err error
|
||||
|
||||
for {
|
||||
nextRune, _, err = t.input.ReadRune()
|
||||
nextRuneType = t.classifier.ClassifyRune(nextRune)
|
||||
|
||||
if err == io.EOF {
|
||||
nextRuneType = eofRuneClass
|
||||
err = nil
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch state {
|
||||
case startState: // no runes read yet
|
||||
{
|
||||
switch nextRuneType {
|
||||
case eofRuneClass:
|
||||
{
|
||||
return nil, io.EOF
|
||||
}
|
||||
case spaceRuneClass:
|
||||
{
|
||||
}
|
||||
case escapingQuoteRuneClass:
|
||||
{
|
||||
tokenType = WordToken
|
||||
state = quotingEscapingState
|
||||
}
|
||||
case nonEscapingQuoteRuneClass:
|
||||
{
|
||||
tokenType = WordToken
|
||||
state = quotingState
|
||||
}
|
||||
case escapeRuneClass:
|
||||
{
|
||||
tokenType = WordToken
|
||||
state = escapingState
|
||||
}
|
||||
case commentRuneClass:
|
||||
{
|
||||
tokenType = CommentToken
|
||||
state = commentState
|
||||
}
|
||||
default:
|
||||
{
|
||||
tokenType = WordToken
|
||||
value = append(value, nextRune)
|
||||
state = inWordState
|
||||
}
|
||||
}
|
||||
}
|
||||
case inWordState: // in a regular word
|
||||
{
|
||||
switch nextRuneType {
|
||||
case eofRuneClass:
|
||||
{
|
||||
token := &Token{
|
||||
tokenType: tokenType,
|
||||
value: string(value)}
|
||||
return token, err
|
||||
}
|
||||
case spaceRuneClass:
|
||||
{
|
||||
token := &Token{
|
||||
tokenType: tokenType,
|
||||
value: string(value)}
|
||||
return token, err
|
||||
}
|
||||
case escapingQuoteRuneClass:
|
||||
{
|
||||
state = quotingEscapingState
|
||||
}
|
||||
case nonEscapingQuoteRuneClass:
|
||||
{
|
||||
state = quotingState
|
||||
}
|
||||
case escapeRuneClass:
|
||||
{
|
||||
state = escapingState
|
||||
}
|
||||
default:
|
||||
{
|
||||
value = append(value, nextRune)
|
||||
}
|
||||
}
|
||||
}
|
||||
case escapingState: // the rune after an escape character
|
||||
{
|
||||
switch nextRuneType {
|
||||
case eofRuneClass:
|
||||
{
|
||||
err = fmt.Errorf("EOF found after escape character")
|
||||
token := &Token{
|
||||
tokenType: tokenType,
|
||||
value: string(value)}
|
||||
return token, err
|
||||
}
|
||||
default:
|
||||
{
|
||||
state = inWordState
|
||||
value = append(value, nextRune)
|
||||
}
|
||||
}
|
||||
}
|
||||
case escapingQuotedState: // the next rune after an escape character, in double quotes
|
||||
{
|
||||
switch nextRuneType {
|
||||
case eofRuneClass:
|
||||
{
|
||||
err = fmt.Errorf("EOF found after escape character")
|
||||
token := &Token{
|
||||
tokenType: tokenType,
|
||||
value: string(value)}
|
||||
return token, err
|
||||
}
|
||||
default:
|
||||
{
|
||||
state = quotingEscapingState
|
||||
value = append(value, nextRune)
|
||||
}
|
||||
}
|
||||
}
|
||||
case quotingEscapingState: // in escaping double quotes
|
||||
{
|
||||
switch nextRuneType {
|
||||
case eofRuneClass:
|
||||
{
|
||||
err = fmt.Errorf("EOF found when expecting closing quote")
|
||||
token := &Token{
|
||||
tokenType: tokenType,
|
||||
value: string(value)}
|
||||
return token, err
|
||||
}
|
||||
case escapingQuoteRuneClass:
|
||||
{
|
||||
state = inWordState
|
||||
}
|
||||
case escapeRuneClass:
|
||||
{
|
||||
state = escapingQuotedState
|
||||
}
|
||||
default:
|
||||
{
|
||||
value = append(value, nextRune)
|
||||
}
|
||||
}
|
||||
}
|
||||
case quotingState: // in non-escaping single quotes
|
||||
{
|
||||
switch nextRuneType {
|
||||
case eofRuneClass:
|
||||
{
|
||||
err = fmt.Errorf("EOF found when expecting closing quote")
|
||||
token := &Token{
|
||||
tokenType: tokenType,
|
||||
value: string(value)}
|
||||
return token, err
|
||||
}
|
||||
case nonEscapingQuoteRuneClass:
|
||||
{
|
||||
state = inWordState
|
||||
}
|
||||
default:
|
||||
{
|
||||
value = append(value, nextRune)
|
||||
}
|
||||
}
|
||||
}
|
||||
case commentState: // in a comment
|
||||
{
|
||||
switch nextRuneType {
|
||||
case eofRuneClass:
|
||||
{
|
||||
token := &Token{
|
||||
tokenType: tokenType,
|
||||
value: string(value)}
|
||||
return token, err
|
||||
}
|
||||
case spaceRuneClass:
|
||||
{
|
||||
if nextRune == '\n' {
|
||||
state = startState
|
||||
token := &Token{
|
||||
tokenType: tokenType,
|
||||
value: string(value)}
|
||||
return token, err
|
||||
} else {
|
||||
value = append(value, nextRune)
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
value = append(value, nextRune)
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
return nil, fmt.Errorf("Unexpected state: %v", state)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns the next token in the stream.
|
||||
func (t *Tokenizer) Next() (*Token, error) {
|
||||
return t.scanStream()
|
||||
}
|
||||
|
||||
// Split partitions a string into a slice of strings.
|
||||
func Split(s string) ([]string, error) {
|
||||
l := NewLexer(strings.NewReader(s))
|
||||
subStrings := make([]string, 0)
|
||||
for {
|
||||
word, err := l.Next()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
return subStrings, nil
|
||||
}
|
||||
return subStrings, err
|
||||
}
|
||||
subStrings = append(subStrings, word)
|
||||
}
|
||||
}
|
21
vendor/github.com/mitchellh/go-homedir/LICENSE
generated
vendored
Normal file
21
vendor/github.com/mitchellh/go-homedir/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Mitchell Hashimoto
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
14
vendor/github.com/mitchellh/go-homedir/README.md
generated
vendored
Normal file
14
vendor/github.com/mitchellh/go-homedir/README.md
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# go-homedir
|
||||
|
||||
This is a Go library for detecting the user's home directory without
|
||||
the use of cgo, so the library can be used in cross-compilation environments.
|
||||
|
||||
Usage is incredibly simple, just call `homedir.Dir()` to get the home directory
|
||||
for a user, and `homedir.Expand()` to expand the `~` in a path to the home
|
||||
directory.
|
||||
|
||||
**Why not just use `os/user`?** The built-in `os/user` package requires
|
||||
cgo on Darwin systems. This means that any Go code that uses that package
|
||||
cannot cross compile. But 99% of the time the use for `os/user` is just to
|
||||
retrieve the home directory, which we can do for the current user without
|
||||
cgo. This library does that, enabling cross-compilation.
|
167
vendor/github.com/mitchellh/go-homedir/homedir.go
generated
vendored
Normal file
167
vendor/github.com/mitchellh/go-homedir/homedir.go
generated
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
package homedir
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// DisableCache will disable caching of the home directory. Caching is enabled
|
||||
// by default.
|
||||
var DisableCache bool
|
||||
|
||||
var homedirCache string
|
||||
var cacheLock sync.RWMutex
|
||||
|
||||
// Dir returns the home directory for the executing user.
|
||||
//
|
||||
// This uses an OS-specific method for discovering the home directory.
|
||||
// An error is returned if a home directory cannot be detected.
|
||||
func Dir() (string, error) {
|
||||
if !DisableCache {
|
||||
cacheLock.RLock()
|
||||
cached := homedirCache
|
||||
cacheLock.RUnlock()
|
||||
if cached != "" {
|
||||
return cached, nil
|
||||
}
|
||||
}
|
||||
|
||||
cacheLock.Lock()
|
||||
defer cacheLock.Unlock()
|
||||
|
||||
var result string
|
||||
var err error
|
||||
if runtime.GOOS == "windows" {
|
||||
result, err = dirWindows()
|
||||
} else {
|
||||
// Unix-like system, so just assume Unix
|
||||
result, err = dirUnix()
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
homedirCache = result
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Expand expands the path to include the home directory if the path
|
||||
// is prefixed with `~`. If it isn't prefixed with `~`, the path is
|
||||
// returned as-is.
|
||||
func Expand(path string) (string, error) {
|
||||
if len(path) == 0 {
|
||||
return path, nil
|
||||
}
|
||||
|
||||
if path[0] != '~' {
|
||||
return path, nil
|
||||
}
|
||||
|
||||
if len(path) > 1 && path[1] != '/' && path[1] != '\\' {
|
||||
return "", errors.New("cannot expand user-specific home dir")
|
||||
}
|
||||
|
||||
dir, err := Dir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return filepath.Join(dir, path[1:]), nil
|
||||
}
|
||||
|
||||
// Reset clears the cache, forcing the next call to Dir to re-detect
|
||||
// the home directory. This generally never has to be called, but can be
|
||||
// useful in tests if you're modifying the home directory via the HOME
|
||||
// env var or something.
|
||||
func Reset() {
|
||||
cacheLock.Lock()
|
||||
defer cacheLock.Unlock()
|
||||
homedirCache = ""
|
||||
}
|
||||
|
||||
func dirUnix() (string, error) {
|
||||
homeEnv := "HOME"
|
||||
if runtime.GOOS == "plan9" {
|
||||
// On plan9, env vars are lowercase.
|
||||
homeEnv = "home"
|
||||
}
|
||||
|
||||
// First prefer the HOME environmental variable
|
||||
if home := os.Getenv(homeEnv); home != "" {
|
||||
return home, nil
|
||||
}
|
||||
|
||||
var stdout bytes.Buffer
|
||||
|
||||
// If that fails, try OS specific commands
|
||||
if runtime.GOOS == "darwin" {
|
||||
cmd := exec.Command("sh", "-c", `dscl -q . -read /Users/"$(whoami)" NFSHomeDirectory | sed 's/^[^ ]*: //'`)
|
||||
cmd.Stdout = &stdout
|
||||
if err := cmd.Run(); err == nil {
|
||||
result := strings.TrimSpace(stdout.String())
|
||||
if result != "" {
|
||||
return result, nil
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cmd := exec.Command("getent", "passwd", strconv.Itoa(os.Getuid()))
|
||||
cmd.Stdout = &stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
// If the error is ErrNotFound, we ignore it. Otherwise, return it.
|
||||
if err != exec.ErrNotFound {
|
||||
return "", err
|
||||
}
|
||||
} else {
|
||||
if passwd := strings.TrimSpace(stdout.String()); passwd != "" {
|
||||
// username:password:uid:gid:gecos:home:shell
|
||||
passwdParts := strings.SplitN(passwd, ":", 7)
|
||||
if len(passwdParts) > 5 {
|
||||
return passwdParts[5], nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If all else fails, try the shell
|
||||
stdout.Reset()
|
||||
cmd := exec.Command("sh", "-c", "cd && pwd")
|
||||
cmd.Stdout = &stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
result := strings.TrimSpace(stdout.String())
|
||||
if result == "" {
|
||||
return "", errors.New("blank output when reading home directory")
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func dirWindows() (string, error) {
|
||||
// First prefer the HOME environmental variable
|
||||
if home := os.Getenv("HOME"); home != "" {
|
||||
return home, nil
|
||||
}
|
||||
|
||||
// Prefer standard environment variable USERPROFILE
|
||||
if home := os.Getenv("USERPROFILE"); home != "" {
|
||||
return home, nil
|
||||
}
|
||||
|
||||
drive := os.Getenv("HOMEDRIVE")
|
||||
path := os.Getenv("HOMEPATH")
|
||||
home := drive + path
|
||||
if drive == "" || path == "" {
|
||||
return "", errors.New("HOMEDRIVE, HOMEPATH, or USERPROFILE are blank")
|
||||
}
|
||||
|
||||
return home, nil
|
||||
}
|
16
vendor/github.com/muesli/termenv/copy.go
generated
vendored
Normal file
16
vendor/github.com/muesli/termenv/copy.go
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"github.com/aymanbagabas/go-osc52"
|
||||
)
|
||||
|
||||
// Copy copies text to clipboard using OSC 52 escape sequence.
|
||||
func (o Output) Copy(str string) {
|
||||
out := osc52.NewOutput(o.tty, o.environ.Environ())
|
||||
out.Copy(str)
|
||||
}
|
||||
|
||||
// Copy copies text to clipboard using OSC 52 escape sequence.
|
||||
func Copy(str string) {
|
||||
output.Copy(str)
|
||||
}
|
15
vendor/github.com/muesli/termenv/hyperlink.go
generated
vendored
Normal file
15
vendor/github.com/muesli/termenv/hyperlink.go
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Hyperlink creates a hyperlink using OSC8.
|
||||
func Hyperlink(link, name string) string {
|
||||
return output.Hyperlink(link, name)
|
||||
}
|
||||
|
||||
// Hyperlink creates a hyperlink using OSC8.
|
||||
func (o *Output) Hyperlink(link, name string) string {
|
||||
return fmt.Sprintf("\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\", link, name)
|
||||
}
|
163
vendor/github.com/muesli/termenv/output.go
generated
vendored
Normal file
163
vendor/github.com/muesli/termenv/output.go
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
// output is the default global output.
|
||||
output = NewOutput(os.Stdout)
|
||||
)
|
||||
|
||||
// File represents a file descriptor.
|
||||
type File interface {
|
||||
io.ReadWriter
|
||||
Fd() uintptr
|
||||
}
|
||||
|
||||
// Output is a terminal output.
|
||||
type Output struct {
|
||||
Profile
|
||||
tty io.Writer
|
||||
environ Environ
|
||||
|
||||
cache bool
|
||||
fgSync *sync.Once
|
||||
fgColor Color
|
||||
bgSync *sync.Once
|
||||
bgColor Color
|
||||
}
|
||||
|
||||
// Environ is an interface for getting environment variables.
|
||||
type Environ interface {
|
||||
Environ() []string
|
||||
Getenv(string) string
|
||||
}
|
||||
|
||||
type osEnviron struct{}
|
||||
|
||||
func (oe *osEnviron) Environ() []string {
|
||||
return os.Environ()
|
||||
}
|
||||
|
||||
func (oe *osEnviron) Getenv(key string) string {
|
||||
return os.Getenv(key)
|
||||
}
|
||||
|
||||
// DefaultOutput returns the default global output.
|
||||
func DefaultOutput() *Output {
|
||||
return output
|
||||
}
|
||||
|
||||
// NewOutput returns a new Output for the given file descriptor.
|
||||
func NewOutput(tty io.Writer, opts ...func(*Output)) *Output {
|
||||
o := &Output{
|
||||
tty: tty,
|
||||
environ: &osEnviron{},
|
||||
Profile: -1,
|
||||
fgSync: &sync.Once{},
|
||||
fgColor: NoColor{},
|
||||
bgSync: &sync.Once{},
|
||||
bgColor: NoColor{},
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(o)
|
||||
}
|
||||
if o.Profile < 0 {
|
||||
o.Profile = o.EnvColorProfile()
|
||||
}
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
// WithEnvironment returns a new Output for the given environment.
|
||||
func WithEnvironment(environ Environ) func(*Output) {
|
||||
return func(o *Output) {
|
||||
o.environ = environ
|
||||
}
|
||||
}
|
||||
|
||||
// WithProfile returns a new Output for the given profile.
|
||||
func WithProfile(profile Profile) func(*Output) {
|
||||
return func(o *Output) {
|
||||
o.Profile = profile
|
||||
}
|
||||
}
|
||||
|
||||
// WithColorCache returns a new Output with fore- and background color values
|
||||
// pre-fetched and cached.
|
||||
func WithColorCache(v bool) func(*Output) {
|
||||
return func(o *Output) {
|
||||
o.cache = v
|
||||
|
||||
// cache the values now
|
||||
_ = o.ForegroundColor()
|
||||
_ = o.BackgroundColor()
|
||||
}
|
||||
}
|
||||
|
||||
// ForegroundColor returns the terminal's default foreground color.
|
||||
func (o *Output) ForegroundColor() Color {
|
||||
f := func() {
|
||||
if !o.isTTY() {
|
||||
return
|
||||
}
|
||||
|
||||
o.fgColor = o.foregroundColor()
|
||||
}
|
||||
|
||||
if o.cache {
|
||||
o.fgSync.Do(f)
|
||||
} else {
|
||||
f()
|
||||
}
|
||||
|
||||
return o.fgColor
|
||||
}
|
||||
|
||||
// BackgroundColor returns the terminal's default background color.
|
||||
func (o *Output) BackgroundColor() Color {
|
||||
f := func() {
|
||||
if !o.isTTY() {
|
||||
return
|
||||
}
|
||||
|
||||
o.bgColor = o.backgroundColor()
|
||||
}
|
||||
|
||||
if o.cache {
|
||||
o.bgSync.Do(f)
|
||||
} else {
|
||||
f()
|
||||
}
|
||||
|
||||
return o.bgColor
|
||||
}
|
||||
|
||||
// HasDarkBackground returns whether terminal uses a dark-ish background.
|
||||
func (o *Output) HasDarkBackground() bool {
|
||||
c := ConvertToRGB(o.BackgroundColor())
|
||||
_, _, l := c.Hsl()
|
||||
return l < 0.5
|
||||
}
|
||||
|
||||
// TTY returns the terminal's file descriptor. This may be nil if the output is
|
||||
// not a terminal.
|
||||
func (o Output) TTY() File {
|
||||
if f, ok := o.tty.(File); ok {
|
||||
return f
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o Output) Write(p []byte) (int, error) {
|
||||
return o.tty.Write(p)
|
||||
}
|
||||
|
||||
// WriteString writes the given string to the output.
|
||||
func (o Output) WriteString(s string) (int, error) {
|
||||
return o.Write([]byte(s))
|
||||
}
|
97
vendor/github.com/muesli/termenv/profile.go
generated
vendored
Normal file
97
vendor/github.com/muesli/termenv/profile.go
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/lucasb-eyer/go-colorful"
|
||||
)
|
||||
|
||||
// Profile is a color profile: Ascii, ANSI, ANSI256, or TrueColor.
|
||||
type Profile int
|
||||
|
||||
const (
|
||||
// TrueColor, 24-bit color profile
|
||||
TrueColor = Profile(iota)
|
||||
// ANSI256, 8-bit color profile
|
||||
ANSI256
|
||||
// ANSI, 4-bit color profile
|
||||
ANSI
|
||||
// Ascii, uncolored profile
|
||||
Ascii //nolint:revive
|
||||
)
|
||||
|
||||
// String returns a new Style.
|
||||
func (p Profile) String(s ...string) Style {
|
||||
return Style{
|
||||
profile: p,
|
||||
string: strings.Join(s, " "),
|
||||
}
|
||||
}
|
||||
|
||||
// Convert transforms a given Color to a Color supported within the Profile.
|
||||
func (p Profile) Convert(c Color) Color {
|
||||
if p == Ascii {
|
||||
return NoColor{}
|
||||
}
|
||||
|
||||
switch v := c.(type) {
|
||||
case ANSIColor:
|
||||
return v
|
||||
|
||||
case ANSI256Color:
|
||||
if p == ANSI {
|
||||
return ansi256ToANSIColor(v)
|
||||
}
|
||||
return v
|
||||
|
||||
case RGBColor:
|
||||
h, err := colorful.Hex(string(v))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if p != TrueColor {
|
||||
ac := hexToANSI256Color(h)
|
||||
if p == ANSI {
|
||||
return ansi256ToANSIColor(ac)
|
||||
}
|
||||
return ac
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
// Color creates a Color from a string. Valid inputs are hex colors, as well as
|
||||
// ANSI color codes (0-15, 16-255).
|
||||
func (p Profile) Color(s string) Color {
|
||||
if len(s) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var c Color
|
||||
if strings.HasPrefix(s, "#") {
|
||||
c = RGBColor(s)
|
||||
} else {
|
||||
i, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if i < 16 {
|
||||
c = ANSIColor(i)
|
||||
} else {
|
||||
c = ANSI256Color(i)
|
||||
}
|
||||
}
|
||||
|
||||
return p.Convert(c)
|
||||
}
|
||||
|
||||
// FromColor creates a Color from a color.Color.
|
||||
func (p Profile) FromColor(c color.Color) Color {
|
||||
col, _ := colorful.MakeColor(c)
|
||||
return p.Color(col.Hex())
|
||||
}
|
3
vendor/go4.org/netipx/.gitignore
generated
vendored
Normal file
3
vendor/go4.org/netipx/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
crashers
|
||||
suppressions
|
||||
netaddr-fuzz.zip
|
3
vendor/go4.org/netipx/.gitmodules
generated
vendored
Normal file
3
vendor/go4.org/netipx/.gitmodules
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "corpus"]
|
||||
path = corpus
|
||||
url = https://github.com/inetaf/netaddr-corpus.git
|
4
vendor/go4.org/netipx/AUTHORS
generated
vendored
Normal file
4
vendor/go4.org/netipx/AUTHORS
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
Alex Willmer <alex@moreati.org.uk>
|
||||
Matt Layher <mdlayher@gmail.com>
|
||||
Tailscale Inc.
|
||||
Tobias Klauser <tklauser@distanz.ch>
|
27
vendor/go4.org/netipx/LICENSE
generated
vendored
Normal file
27
vendor/go4.org/netipx/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2020 The Inet.af AUTHORS. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Tailscale Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
vendor/go4.org/netipx/README.md
generated
vendored
Normal file
26
vendor/go4.org/netipx/README.md
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
# netipx [![Test Status](https://github.com/go4org/netipx/workflows/Linux/badge.svg)](https://github.com/go4org/netipx/actions) [![Go Reference](https://pkg.go.dev/badge/go4.org/netipx.svg)](https://pkg.go.dev/go4.org/netipx)
|
||||
|
||||
## What
|
||||
|
||||
This is a package containing the bits of the old `inet.af/netaddr` package that didn't make it
|
||||
into Go 1.18's `net/netip` standard library package.
|
||||
|
||||
As background, see:
|
||||
|
||||
* https://github.com/inetaf/netaddr/ (now deprecated)
|
||||
* https://tailscale.com/blog/netaddr-new-ip-type-for-go/ - blog post about why the package came to be originally
|
||||
* https://go.dev/doc/go1.18#netip - Go 1.18 release notes
|
||||
|
||||
This package requires Go 1.18+ to use and complements the `net/netip`.
|
||||
|
||||
## FAQ
|
||||
|
||||
**Why's it no longer under `inet.af`?** Since that joke started, that
|
||||
TLD is now under control of the Taliban. (Yes, we should've known
|
||||
better. We'd even previously scolded people for relying on
|
||||
questionable ccTLDs. Whoops.)
|
||||
|
||||
**Will this stuff make it into the standard library?** [Maybe](https://github.com/golang/go/issues/53236).
|
||||
We'll see.
|
||||
|
||||
|
498
vendor/go4.org/netipx/ipset.go
generated
vendored
Normal file
498
vendor/go4.org/netipx/ipset.go
generated
vendored
Normal file
@ -0,0 +1,498 @@
|
||||
// Copyright 2020 The Inet.Af AUTHORS. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package netipx
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/netip"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// IPSetBuilder builds an immutable IPSet.
|
||||
//
|
||||
// The zero value is a valid value representing a set of no IPs.
|
||||
//
|
||||
// The Add and Remove methods add or remove IPs to/from the set.
|
||||
// Removals only affect the current membership of the set, so in
|
||||
// general Adds should be called first. Input ranges may overlap in
|
||||
// any way.
|
||||
//
|
||||
// Most IPSetBuilder methods do not return errors.
|
||||
// Instead, errors are accumulated and reported by IPSetBuilder.IPSet.
|
||||
type IPSetBuilder struct {
|
||||
// in are the ranges in the set.
|
||||
in []IPRange
|
||||
|
||||
// out are the ranges to be removed from 'in'.
|
||||
out []IPRange
|
||||
|
||||
// errs are errors accumulated during construction.
|
||||
errs multiErr
|
||||
}
|
||||
|
||||
// normalize normalizes s: s.in becomes the minimal sorted list of
|
||||
// ranges required to describe s, and s.out becomes empty.
|
||||
func (s *IPSetBuilder) normalize() {
|
||||
const debug = false
|
||||
if debug {
|
||||
debugf("ranges start in=%v out=%v", s.in, s.out)
|
||||
}
|
||||
in, ok := mergeIPRanges(s.in)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
out, ok := mergeIPRanges(s.out)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if debug {
|
||||
debugf("ranges sort in=%v out=%v", in, out)
|
||||
}
|
||||
|
||||
// in and out are sorted in ascending range order, and have no
|
||||
// overlaps within each other. We can run a merge of the two lists
|
||||
// in one pass.
|
||||
|
||||
min := make([]IPRange, 0, len(in))
|
||||
for len(in) > 0 && len(out) > 0 {
|
||||
rin, rout := in[0], out[0]
|
||||
if debug {
|
||||
debugf("step in=%v out=%v", rin, rout)
|
||||
}
|
||||
|
||||
switch {
|
||||
case !rout.IsValid() || !rin.IsValid():
|
||||
// mergeIPRanges should have prevented invalid ranges from
|
||||
// sneaking in.
|
||||
panic("invalid IPRanges during Ranges merge")
|
||||
case rout.entirelyBefore(rin):
|
||||
// "out" is entirely before "in".
|
||||
//
|
||||
// out in
|
||||
// f-------t f-------t
|
||||
out = out[1:]
|
||||
if debug {
|
||||
debugf("out before in; drop out")
|
||||
}
|
||||
case rin.entirelyBefore(rout):
|
||||
// "in" is entirely before "out".
|
||||
//
|
||||
// in out
|
||||
// f------t f-------t
|
||||
min = append(min, rin)
|
||||
in = in[1:]
|
||||
if debug {
|
||||
debugf("in before out; append in")
|
||||
debugf("min=%v", min)
|
||||
}
|
||||
case rin.coveredBy(rout):
|
||||
// "out" entirely covers "in".
|
||||
//
|
||||
// out
|
||||
// f-------------t
|
||||
// f------t
|
||||
// in
|
||||
in = in[1:]
|
||||
if debug {
|
||||
debugf("in inside out; drop in")
|
||||
}
|
||||
case rout.inMiddleOf(rin):
|
||||
// "in" entirely covers "out".
|
||||
//
|
||||
// in
|
||||
// f-------------t
|
||||
// f------t
|
||||
// out
|
||||
min = append(min, IPRange{from: rin.from, to: AddrPrior(rout.from)})
|
||||
// Adjust in[0], not ir, because we want to consider the
|
||||
// mutated range on the next iteration.
|
||||
in[0].from = rout.to.Next()
|
||||
out = out[1:]
|
||||
if debug {
|
||||
debugf("out inside in; split in, append first in, drop out, adjust second in")
|
||||
debugf("min=%v", min)
|
||||
}
|
||||
case rout.overlapsStartOf(rin):
|
||||
// "out" overlaps start of "in".
|
||||
//
|
||||
// out
|
||||
// f------t
|
||||
// f------t
|
||||
// in
|
||||
in[0].from = rout.to.Next()
|
||||
// Can't move ir onto min yet, another later out might
|
||||
// trim it further. Just discard or and continue.
|
||||
out = out[1:]
|
||||
if debug {
|
||||
debugf("out cuts start of in; adjust in, drop out")
|
||||
}
|
||||
case rout.overlapsEndOf(rin):
|
||||
// "out" overlaps end of "in".
|
||||
//
|
||||
// out
|
||||
// f------t
|
||||
// f------t
|
||||
// in
|
||||
min = append(min, IPRange{from: rin.from, to: AddrPrior(rout.from)})
|
||||
in = in[1:]
|
||||
if debug {
|
||||
debugf("merge out cuts end of in; append shortened in")
|
||||
debugf("min=%v", min)
|
||||
}
|
||||
default:
|
||||
// The above should account for all combinations of in and
|
||||
// out overlapping, but insert a panic to be sure.
|
||||
panic("unexpected additional overlap scenario")
|
||||
}
|
||||
}
|
||||
if len(in) > 0 {
|
||||
// Ran out of removals before the end of in.
|
||||
min = append(min, in...)
|
||||
if debug {
|
||||
debugf("min=%v", min)
|
||||
}
|
||||
}
|
||||
|
||||
s.in = min
|
||||
s.out = nil
|
||||
}
|
||||
|
||||
// Clone returns a copy of s that shares no memory with s.
|
||||
func (s *IPSetBuilder) Clone() *IPSetBuilder {
|
||||
return &IPSetBuilder{
|
||||
in: append([]IPRange(nil), s.in...),
|
||||
out: append([]IPRange(nil), s.out...),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IPSetBuilder) addError(msg string, args ...interface{}) {
|
||||
se := new(stacktraceErr)
|
||||
// Skip three frames: runtime.Callers, addError, and the IPSetBuilder
|
||||
// method that called addError (such as IPSetBuilder.Add).
|
||||
// The resulting stack trace ends at the line in the user's
|
||||
// code where they called into netaddr.
|
||||
n := runtime.Callers(3, se.pcs[:])
|
||||
se.at = se.pcs[:n]
|
||||
se.err = fmt.Errorf(msg, args...)
|
||||
s.errs = append(s.errs, se)
|
||||
}
|
||||
|
||||
// Add adds ip to s.
|
||||
func (s *IPSetBuilder) Add(ip netip.Addr) {
|
||||
if !ip.IsValid() {
|
||||
s.addError("Add(IP{})")
|
||||
return
|
||||
}
|
||||
s.AddRange(IPRangeFrom(ip, ip))
|
||||
}
|
||||
|
||||
// AddPrefix adds all IPs in p to s.
|
||||
func (s *IPSetBuilder) AddPrefix(p netip.Prefix) {
|
||||
if r := RangeOfPrefix(p); r.IsValid() {
|
||||
s.AddRange(r)
|
||||
} else {
|
||||
s.addError("AddPrefix(%v/%v)", p.Addr(), p.Bits())
|
||||
}
|
||||
}
|
||||
|
||||
// AddRange adds r to s.
|
||||
// If r is not Valid, AddRange does nothing.
|
||||
func (s *IPSetBuilder) AddRange(r IPRange) {
|
||||
if !r.IsValid() {
|
||||
s.addError("AddRange(%v-%v)", r.From(), r.To())
|
||||
return
|
||||
}
|
||||
// If there are any removals (s.out), then we need to compact the set
|
||||
// first to get the order right.
|
||||
if len(s.out) > 0 {
|
||||
s.normalize()
|
||||
}
|
||||
s.in = append(s.in, r)
|
||||
}
|
||||
|
||||
// AddSet adds all IPs in b to s.
|
||||
func (s *IPSetBuilder) AddSet(b *IPSet) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
for _, r := range b.rr {
|
||||
s.AddRange(r)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove removes ip from s.
|
||||
func (s *IPSetBuilder) Remove(ip netip.Addr) {
|
||||
if !ip.IsValid() {
|
||||
s.addError("Remove(IP{})")
|
||||
} else {
|
||||
s.RemoveRange(IPRangeFrom(ip, ip))
|
||||
}
|
||||
}
|
||||
|
||||
// RemovePrefix removes all IPs in p from s.
|
||||
func (s *IPSetBuilder) RemovePrefix(p netip.Prefix) {
|
||||
if r := RangeOfPrefix(p); r.IsValid() {
|
||||
s.RemoveRange(r)
|
||||
} else {
|
||||
s.addError("RemovePrefix(%v/%v)", p.Addr(), p.Bits())
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveRange removes all IPs in r from s.
|
||||
func (s *IPSetBuilder) RemoveRange(r IPRange) {
|
||||
if r.IsValid() {
|
||||
s.out = append(s.out, r)
|
||||
} else {
|
||||
s.addError("RemoveRange(%v-%v)", r.From(), r.To())
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveSet removes all IPs in o from s.
|
||||
func (s *IPSetBuilder) RemoveSet(b *IPSet) {
|
||||
if b == nil {
|
||||
return
|
||||
}
|
||||
for _, r := range b.rr {
|
||||
s.RemoveRange(r)
|
||||
}
|
||||
}
|
||||
|
||||
// removeBuilder removes all IPs in b from s.
|
||||
func (s *IPSetBuilder) removeBuilder(b *IPSetBuilder) {
|
||||
b.normalize()
|
||||
for _, r := range b.in {
|
||||
s.RemoveRange(r)
|
||||
}
|
||||
}
|
||||
|
||||
// Complement updates s to contain the complement of its current
|
||||
// contents.
|
||||
func (s *IPSetBuilder) Complement() {
|
||||
s.normalize()
|
||||
s.out = s.in
|
||||
s.in = []IPRange{
|
||||
RangeOfPrefix(netip.PrefixFrom(netip.AddrFrom4([4]byte{}), 0)),
|
||||
RangeOfPrefix(netip.PrefixFrom(netip.IPv6Unspecified(), 0)),
|
||||
}
|
||||
}
|
||||
|
||||
// Intersect updates s to the set intersection of s and b.
|
||||
func (s *IPSetBuilder) Intersect(b *IPSet) {
|
||||
var o IPSetBuilder
|
||||
o.Complement()
|
||||
o.RemoveSet(b)
|
||||
s.removeBuilder(&o)
|
||||
}
|
||||
|
||||
func discardf(format string, args ...interface{}) {}
|
||||
|
||||
// debugf is reassigned by tests.
|
||||
var debugf = discardf
|
||||
|
||||
// IPSet returns an immutable IPSet representing the current state of s.
|
||||
//
|
||||
// Most IPSetBuilder methods do not return errors.
|
||||
// Rather, the builder ignores any invalid inputs (such as an invalid IPPrefix),
|
||||
// and accumulates a list of any such errors that it encountered.
|
||||
//
|
||||
// IPSet also reports any such accumulated errors.
|
||||
// Even if the returned error is non-nil, the returned IPSet is usable
|
||||
// and contains all modifications made with valid inputs.
|
||||
//
|
||||
// The builder remains usable after calling IPSet.
|
||||
// Calling IPSet clears any accumulated errors.
|
||||
func (s *IPSetBuilder) IPSet() (*IPSet, error) {
|
||||
s.normalize()
|
||||
ret := &IPSet{
|
||||
rr: append([]IPRange{}, s.in...),
|
||||
}
|
||||
if len(s.errs) == 0 {
|
||||
return ret, nil
|
||||
} else {
|
||||
errs := s.errs
|
||||
s.errs = nil
|
||||
return ret, errs
|
||||
}
|
||||
}
|
||||
|
||||
// IPSet represents a set of IP addresses.
|
||||
//
|
||||
// IPSet is safe for concurrent use.
|
||||
// The zero value is a valid value representing a set of no IPs.
|
||||
// Use IPSetBuilder to construct IPSets.
|
||||
type IPSet struct {
|
||||
// rr is the set of IPs that belong to this IPSet. The IPRanges
|
||||
// are normalized according to IPSetBuilder.normalize, meaning
|
||||
// they are a sorted, minimal representation (no overlapping
|
||||
// ranges, no contiguous ranges). The implementation of various
|
||||
// methods rely on this property.
|
||||
rr []IPRange
|
||||
}
|
||||
|
||||
// Ranges returns the minimum and sorted set of IP
|
||||
// ranges that covers s.
|
||||
func (s *IPSet) Ranges() []IPRange {
|
||||
return append([]IPRange{}, s.rr...)
|
||||
}
|
||||
|
||||
// Prefixes returns the minimum and sorted set of IP prefixes
|
||||
// that covers s.
|
||||
func (s *IPSet) Prefixes() []netip.Prefix {
|
||||
out := make([]netip.Prefix, 0, len(s.rr))
|
||||
for _, r := range s.rr {
|
||||
out = append(out, r.Prefixes()...)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Equal reports whether s and o represent the same set of IP
|
||||
// addresses.
|
||||
func (s *IPSet) Equal(o *IPSet) bool {
|
||||
if len(s.rr) != len(o.rr) {
|
||||
return false
|
||||
}
|
||||
for i := range s.rr {
|
||||
if s.rr[i] != o.rr[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Contains reports whether ip is in s.
|
||||
// If ip has an IPv6 zone, Contains returns false,
|
||||
// because IPSets do not track zones.
|
||||
func (s *IPSet) Contains(ip netip.Addr) bool {
|
||||
if ip.Zone() != "" {
|
||||
return false
|
||||
}
|
||||
// TODO: data structure permitting more efficient lookups:
|
||||
// https://github.com/inetaf/netaddr/issues/139
|
||||
i := sort.Search(len(s.rr), func(i int) bool {
|
||||
return ip.Less(s.rr[i].from)
|
||||
})
|
||||
if i == 0 {
|
||||
return false
|
||||
}
|
||||
i--
|
||||
return s.rr[i].contains(ip)
|
||||
}
|
||||
|
||||
// ContainsRange reports whether all IPs in r are in s.
|
||||
func (s *IPSet) ContainsRange(r IPRange) bool {
|
||||
for _, x := range s.rr {
|
||||
if r.coveredBy(x) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// ContainsPrefix reports whether all IPs in p are in s.
|
||||
func (s *IPSet) ContainsPrefix(p netip.Prefix) bool {
|
||||
return s.ContainsRange(RangeOfPrefix(p))
|
||||
}
|
||||
|
||||
// Overlaps reports whether any IP in b is also in s.
|
||||
func (s *IPSet) Overlaps(b *IPSet) bool {
|
||||
// TODO: sorted ranges lets us do this in O(n+m)
|
||||
for _, r := range s.rr {
|
||||
for _, or := range b.rr {
|
||||
if r.Overlaps(or) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OverlapsRange reports whether any IP in r is also in s.
|
||||
func (s *IPSet) OverlapsRange(r IPRange) bool {
|
||||
// TODO: sorted ranges lets us do this more efficiently.
|
||||
for _, x := range s.rr {
|
||||
if x.Overlaps(r) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// OverlapsPrefix reports whether any IP in p is also in s.
|
||||
func (s *IPSet) OverlapsPrefix(p netip.Prefix) bool {
|
||||
return s.OverlapsRange(RangeOfPrefix(p))
|
||||
}
|
||||
|
||||
// RemoveFreePrefix splits s into a Prefix of length bitLen and a new
|
||||
// IPSet with that prefix removed.
|
||||
//
|
||||
// If no contiguous prefix of length bitLen exists in s,
|
||||
// RemoveFreePrefix returns ok=false.
|
||||
func (s *IPSet) RemoveFreePrefix(bitLen uint8) (p netip.Prefix, newSet *IPSet, ok bool) {
|
||||
var bestFit netip.Prefix
|
||||
for _, r := range s.rr {
|
||||
for _, prefix := range r.Prefixes() {
|
||||
if uint8(prefix.Bits()) > bitLen {
|
||||
continue
|
||||
}
|
||||
if !bestFit.Addr().IsValid() || prefix.Bits() > bestFit.Bits() {
|
||||
bestFit = prefix
|
||||
if uint8(bestFit.Bits()) == bitLen {
|
||||
// exact match, done.
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !bestFit.Addr().IsValid() {
|
||||
return netip.Prefix{}, s, false
|
||||
}
|
||||
|
||||
prefix := netip.PrefixFrom(bestFit.Addr(), int(bitLen))
|
||||
|
||||
var b IPSetBuilder
|
||||
b.AddSet(s)
|
||||
b.RemovePrefix(prefix)
|
||||
newSet, _ = b.IPSet()
|
||||
return prefix, newSet, true
|
||||
}
|
||||
|
||||
type multiErr []error
|
||||
|
||||
func (e multiErr) Error() string {
|
||||
var ret []string
|
||||
for _, err := range e {
|
||||
ret = append(ret, err.Error())
|
||||
}
|
||||
return strings.Join(ret, "; ")
|
||||
}
|
||||
|
||||
// A stacktraceErr combines an error with a stack trace.
|
||||
type stacktraceErr struct {
|
||||
pcs [16]uintptr // preallocated array of PCs
|
||||
at []uintptr // stack trace whence the error
|
||||
err error // underlying error
|
||||
}
|
||||
|
||||
func (e *stacktraceErr) Error() string {
|
||||
frames := runtime.CallersFrames(e.at)
|
||||
buf := new(strings.Builder)
|
||||
buf.WriteString(e.err.Error())
|
||||
buf.WriteString(" @ ")
|
||||
for {
|
||||
frame, more := frames.Next()
|
||||
if !more {
|
||||
break
|
||||
}
|
||||
fmt.Fprintf(buf, "%s:%d ", frame.File, frame.Line)
|
||||
}
|
||||
return strings.TrimSpace(buf.String())
|
||||
}
|
||||
|
||||
func (e *stacktraceErr) Unwrap() error {
|
||||
return e.err
|
||||
}
|
141
vendor/go4.org/netipx/mask6.go
generated
vendored
Normal file
141
vendor/go4.org/netipx/mask6.go
generated
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
// Copyright 2021 The Inet.Af AUTHORS. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package netipx
|
||||
|
||||
// mask6 are bitmasks with the topmost n bits of a
|
||||
// 128-bit number, where n is the array index.
|
||||
//
|
||||
// generated with https://play.golang.org/p/64XKxaUSa_9
|
||||
var mask6 = [...]uint128{
|
||||
0: {0x0000000000000000, 0x0000000000000000},
|
||||
1: {0x8000000000000000, 0x0000000000000000},
|
||||
2: {0xc000000000000000, 0x0000000000000000},
|
||||
3: {0xe000000000000000, 0x0000000000000000},
|
||||
4: {0xf000000000000000, 0x0000000000000000},
|
||||
5: {0xf800000000000000, 0x0000000000000000},
|
||||
6: {0xfc00000000000000, 0x0000000000000000},
|
||||
7: {0xfe00000000000000, 0x0000000000000000},
|
||||
8: {0xff00000000000000, 0x0000000000000000},
|
||||
9: {0xff80000000000000, 0x0000000000000000},
|
||||
10: {0xffc0000000000000, 0x0000000000000000},
|
||||
11: {0xffe0000000000000, 0x0000000000000000},
|
||||
12: {0xfff0000000000000, 0x0000000000000000},
|
||||
13: {0xfff8000000000000, 0x0000000000000000},
|
||||
14: {0xfffc000000000000, 0x0000000000000000},
|
||||
15: {0xfffe000000000000, 0x0000000000000000},
|
||||
16: {0xffff000000000000, 0x0000000000000000},
|
||||
17: {0xffff800000000000, 0x0000000000000000},
|
||||
18: {0xffffc00000000000, 0x0000000000000000},
|
||||
19: {0xffffe00000000000, 0x0000000000000000},
|
||||
20: {0xfffff00000000000, 0x0000000000000000},
|
||||
21: {0xfffff80000000000, 0x0000000000000000},
|
||||
22: {0xfffffc0000000000, 0x0000000000000000},
|
||||
23: {0xfffffe0000000000, 0x0000000000000000},
|
||||
24: {0xffffff0000000000, 0x0000000000000000},
|
||||
25: {0xffffff8000000000, 0x0000000000000000},
|
||||
26: {0xffffffc000000000, 0x0000000000000000},
|
||||
27: {0xffffffe000000000, 0x0000000000000000},
|
||||
28: {0xfffffff000000000, 0x0000000000000000},
|
||||
29: {0xfffffff800000000, 0x0000000000000000},
|
||||
30: {0xfffffffc00000000, 0x0000000000000000},
|
||||
31: {0xfffffffe00000000, 0x0000000000000000},
|
||||
32: {0xffffffff00000000, 0x0000000000000000},
|
||||
33: {0xffffffff80000000, 0x0000000000000000},
|
||||
34: {0xffffffffc0000000, 0x0000000000000000},
|
||||
35: {0xffffffffe0000000, 0x0000000000000000},
|
||||
36: {0xfffffffff0000000, 0x0000000000000000},
|
||||
37: {0xfffffffff8000000, 0x0000000000000000},
|
||||
38: {0xfffffffffc000000, 0x0000000000000000},
|
||||
39: {0xfffffffffe000000, 0x0000000000000000},
|
||||
40: {0xffffffffff000000, 0x0000000000000000},
|
||||
41: {0xffffffffff800000, 0x0000000000000000},
|
||||
42: {0xffffffffffc00000, 0x0000000000000000},
|
||||
43: {0xffffffffffe00000, 0x0000000000000000},
|
||||
44: {0xfffffffffff00000, 0x0000000000000000},
|
||||
45: {0xfffffffffff80000, 0x0000000000000000},
|
||||
46: {0xfffffffffffc0000, 0x0000000000000000},
|
||||
47: {0xfffffffffffe0000, 0x0000000000000000},
|
||||
48: {0xffffffffffff0000, 0x0000000000000000},
|
||||
49: {0xffffffffffff8000, 0x0000000000000000},
|
||||
50: {0xffffffffffffc000, 0x0000000000000000},
|
||||
51: {0xffffffffffffe000, 0x0000000000000000},
|
||||
52: {0xfffffffffffff000, 0x0000000000000000},
|
||||
53: {0xfffffffffffff800, 0x0000000000000000},
|
||||
54: {0xfffffffffffffc00, 0x0000000000000000},
|
||||
55: {0xfffffffffffffe00, 0x0000000000000000},
|
||||
56: {0xffffffffffffff00, 0x0000000000000000},
|
||||
57: {0xffffffffffffff80, 0x0000000000000000},
|
||||
58: {0xffffffffffffffc0, 0x0000000000000000},
|
||||
59: {0xffffffffffffffe0, 0x0000000000000000},
|
||||
60: {0xfffffffffffffff0, 0x0000000000000000},
|
||||
61: {0xfffffffffffffff8, 0x0000000000000000},
|
||||
62: {0xfffffffffffffffc, 0x0000000000000000},
|
||||
63: {0xfffffffffffffffe, 0x0000000000000000},
|
||||
64: {0xffffffffffffffff, 0x0000000000000000},
|
||||
65: {0xffffffffffffffff, 0x8000000000000000},
|
||||
66: {0xffffffffffffffff, 0xc000000000000000},
|
||||
67: {0xffffffffffffffff, 0xe000000000000000},
|
||||
68: {0xffffffffffffffff, 0xf000000000000000},
|
||||
69: {0xffffffffffffffff, 0xf800000000000000},
|
||||
70: {0xffffffffffffffff, 0xfc00000000000000},
|
||||
71: {0xffffffffffffffff, 0xfe00000000000000},
|
||||
72: {0xffffffffffffffff, 0xff00000000000000},
|
||||
73: {0xffffffffffffffff, 0xff80000000000000},
|
||||
74: {0xffffffffffffffff, 0xffc0000000000000},
|
||||
75: {0xffffffffffffffff, 0xffe0000000000000},
|
||||
76: {0xffffffffffffffff, 0xfff0000000000000},
|
||||
77: {0xffffffffffffffff, 0xfff8000000000000},
|
||||
78: {0xffffffffffffffff, 0xfffc000000000000},
|
||||
79: {0xffffffffffffffff, 0xfffe000000000000},
|
||||
80: {0xffffffffffffffff, 0xffff000000000000},
|
||||
81: {0xffffffffffffffff, 0xffff800000000000},
|
||||
82: {0xffffffffffffffff, 0xffffc00000000000},
|
||||
83: {0xffffffffffffffff, 0xffffe00000000000},
|
||||
84: {0xffffffffffffffff, 0xfffff00000000000},
|
||||
85: {0xffffffffffffffff, 0xfffff80000000000},
|
||||
86: {0xffffffffffffffff, 0xfffffc0000000000},
|
||||
87: {0xffffffffffffffff, 0xfffffe0000000000},
|
||||
88: {0xffffffffffffffff, 0xffffff0000000000},
|
||||
89: {0xffffffffffffffff, 0xffffff8000000000},
|
||||
90: {0xffffffffffffffff, 0xffffffc000000000},
|
||||
91: {0xffffffffffffffff, 0xffffffe000000000},
|
||||
92: {0xffffffffffffffff, 0xfffffff000000000},
|
||||
93: {0xffffffffffffffff, 0xfffffff800000000},
|
||||
94: {0xffffffffffffffff, 0xfffffffc00000000},
|
||||
95: {0xffffffffffffffff, 0xfffffffe00000000},
|
||||
96: {0xffffffffffffffff, 0xffffffff00000000},
|
||||
97: {0xffffffffffffffff, 0xffffffff80000000},
|
||||
98: {0xffffffffffffffff, 0xffffffffc0000000},
|
||||
99: {0xffffffffffffffff, 0xffffffffe0000000},
|
||||
100: {0xffffffffffffffff, 0xfffffffff0000000},
|
||||
101: {0xffffffffffffffff, 0xfffffffff8000000},
|
||||
102: {0xffffffffffffffff, 0xfffffffffc000000},
|
||||
103: {0xffffffffffffffff, 0xfffffffffe000000},
|
||||
104: {0xffffffffffffffff, 0xffffffffff000000},
|
||||
105: {0xffffffffffffffff, 0xffffffffff800000},
|
||||
106: {0xffffffffffffffff, 0xffffffffffc00000},
|
||||
107: {0xffffffffffffffff, 0xffffffffffe00000},
|
||||
108: {0xffffffffffffffff, 0xfffffffffff00000},
|
||||
109: {0xffffffffffffffff, 0xfffffffffff80000},
|
||||
110: {0xffffffffffffffff, 0xfffffffffffc0000},
|
||||
111: {0xffffffffffffffff, 0xfffffffffffe0000},
|
||||
112: {0xffffffffffffffff, 0xffffffffffff0000},
|
||||
113: {0xffffffffffffffff, 0xffffffffffff8000},
|
||||
114: {0xffffffffffffffff, 0xffffffffffffc000},
|
||||
115: {0xffffffffffffffff, 0xffffffffffffe000},
|
||||
116: {0xffffffffffffffff, 0xfffffffffffff000},
|
||||
117: {0xffffffffffffffff, 0xfffffffffffff800},
|
||||
118: {0xffffffffffffffff, 0xfffffffffffffc00},
|
||||
119: {0xffffffffffffffff, 0xfffffffffffffe00},
|
||||
120: {0xffffffffffffffff, 0xffffffffffffff00},
|
||||
121: {0xffffffffffffffff, 0xffffffffffffff80},
|
||||
122: {0xffffffffffffffff, 0xffffffffffffffc0},
|
||||
123: {0xffffffffffffffff, 0xffffffffffffffe0},
|
||||
124: {0xffffffffffffffff, 0xfffffffffffffff0},
|
||||
125: {0xffffffffffffffff, 0xfffffffffffffff8},
|
||||
126: {0xffffffffffffffff, 0xfffffffffffffffc},
|
||||
127: {0xffffffffffffffff, 0xfffffffffffffffe},
|
||||
128: {0xffffffffffffffff, 0xffffffffffffffff},
|
||||
}
|
547
vendor/go4.org/netipx/netipx.go
generated
vendored
Normal file
547
vendor/go4.org/netipx/netipx.go
generated
vendored
Normal file
@ -0,0 +1,547 @@
|
||||
// Copyright 2020 The Inet.Af AUTHORS. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package netipx contains code and types that were left behind when
|
||||
// the old inet.af/netaddr package moved to the standard library in Go
|
||||
// 1.18 as net/netip.
|
||||
package netipx // import "go4.org/netipx"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
"net/netip"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// FromStdIP returns an IP from the standard library's IP type.
|
||||
//
|
||||
// If std is invalid, ok is false.
|
||||
//
|
||||
// FromStdIP implicitly unmaps IPv6-mapped IPv4 addresses. That is, if
|
||||
// len(std) == 16 and contains an IPv4 address, only the IPv4 part is
|
||||
// returned, without the IPv6 wrapper. This is the common form returned by
|
||||
// the standard library's ParseIP: https://play.golang.org/p/qdjylUkKWxl.
|
||||
// To convert a standard library IP without the implicit unmapping, use
|
||||
// netip.AddrFromSlice.
|
||||
func FromStdIP(std net.IP) (ip netip.Addr, ok bool) {
|
||||
ret, ok := netip.AddrFromSlice(std)
|
||||
return ret.Unmap(), ok
|
||||
}
|
||||
|
||||
// MustFromStdIP is like FromStdIP, but it panics if std is invalid.
|
||||
func MustFromStdIP(std net.IP) netip.Addr {
|
||||
ret, ok := netip.AddrFromSlice(std)
|
||||
if !ok {
|
||||
panic("not a valid IP address")
|
||||
}
|
||||
return ret.Unmap()
|
||||
}
|
||||
|
||||
// FromStdIPRaw returns an IP from the standard library's IP type.
|
||||
// If std is invalid, ok is false.
|
||||
// Unlike FromStdIP, FromStdIPRaw does not do an implicit Unmap if
|
||||
// len(std) == 16 and contains an IPv6-mapped IPv4 address.
|
||||
//
|
||||
// Deprecated: use netip.AddrFromSlice instead.
|
||||
func FromStdIPRaw(std net.IP) (ip netip.Addr, ok bool) {
|
||||
return netip.AddrFromSlice(std)
|
||||
}
|
||||
|
||||
// AddrNext returns the IP following ip.
|
||||
// If there is none, it returns the IP zero value.
|
||||
//
|
||||
// Deprecated: use netip.Addr.Next instead.
|
||||
func AddrNext(ip netip.Addr) netip.Addr {
|
||||
addr := u128From16(ip.As16()).addOne()
|
||||
if ip.Is4() {
|
||||
if uint32(addr.lo) == 0 {
|
||||
// Overflowed.
|
||||
return netip.Addr{}
|
||||
}
|
||||
return addr.IP4()
|
||||
} else {
|
||||
if addr.isZero() {
|
||||
// Overflowed
|
||||
return netip.Addr{}
|
||||
}
|
||||
return addr.IP6().WithZone(ip.Zone())
|
||||
}
|
||||
}
|
||||
|
||||
// AddrPrior returns the IP before ip.
|
||||
// If there is none, it returns the IP zero value.
|
||||
//
|
||||
// Deprecated: use netip.Addr.Prev instead.
|
||||
func AddrPrior(ip netip.Addr) netip.Addr {
|
||||
addr := u128From16(ip.As16())
|
||||
if ip.Is4() {
|
||||
if uint32(addr.lo) == 0 {
|
||||
return netip.Addr{}
|
||||
}
|
||||
return addr.subOne().IP4()
|
||||
} else {
|
||||
if addr.isZero() {
|
||||
return netip.Addr{}
|
||||
}
|
||||
return addr.subOne().IP6().WithZone(ip.Zone())
|
||||
}
|
||||
}
|
||||
|
||||
// FromStdAddr maps the components of a standard library TCPAddr or
|
||||
// UDPAddr into an IPPort.
|
||||
func FromStdAddr(stdIP net.IP, port int, zone string) (_ netip.AddrPort, ok bool) {
|
||||
ip, ok := FromStdIP(stdIP)
|
||||
if !ok || port < 0 || port > math.MaxUint16 {
|
||||
return netip.AddrPort{}, false
|
||||
}
|
||||
ip = ip.Unmap()
|
||||
if zone != "" {
|
||||
if ip.Is4() {
|
||||
ok = false
|
||||
return
|
||||
}
|
||||
ip = ip.WithZone(zone)
|
||||
}
|
||||
return netip.AddrPortFrom(ip, uint16(port)), true
|
||||
}
|
||||
|
||||
// FromStdIPNet returns an netip.Prefix from the standard library's IPNet type.
|
||||
// If std is invalid, ok is false.
|
||||
func FromStdIPNet(std *net.IPNet) (prefix netip.Prefix, ok bool) {
|
||||
ip, ok := FromStdIP(std.IP)
|
||||
if !ok {
|
||||
return netip.Prefix{}, false
|
||||
}
|
||||
|
||||
if l := len(std.Mask); l != net.IPv4len && l != net.IPv6len {
|
||||
// Invalid mask.
|
||||
return netip.Prefix{}, false
|
||||
}
|
||||
|
||||
ones, bits := std.Mask.Size()
|
||||
if ones == 0 && bits == 0 {
|
||||
// IPPrefix does not support non-contiguous masks.
|
||||
return netip.Prefix{}, false
|
||||
}
|
||||
|
||||
return netip.PrefixFrom(ip, ones), true
|
||||
}
|
||||
|
||||
// RangeOfPrefix returns the inclusive range of IPs that p covers.
|
||||
//
|
||||
// If p is zero or otherwise invalid, Range returns the zero value.
|
||||
func RangeOfPrefix(p netip.Prefix) IPRange {
|
||||
p = p.Masked()
|
||||
if !p.IsValid() {
|
||||
return IPRange{}
|
||||
}
|
||||
return IPRangeFrom(p.Addr(), PrefixLastIP(p))
|
||||
}
|
||||
|
||||
// PrefixIPNet returns the net.IPNet representation of an netip.Prefix.
|
||||
// The returned value is always non-nil.
|
||||
// Any zone identifier is dropped in the conversion.
|
||||
func PrefixIPNet(p netip.Prefix) *net.IPNet {
|
||||
if !p.IsValid() {
|
||||
return &net.IPNet{}
|
||||
}
|
||||
return &net.IPNet{
|
||||
IP: p.Addr().AsSlice(),
|
||||
Mask: net.CIDRMask(p.Bits(), p.Addr().BitLen()),
|
||||
}
|
||||
}
|
||||
|
||||
// AddrIPNet returns the net.IPNet representation of an netip.Addr
|
||||
// with a mask corresponding to the addresses's bit length.
|
||||
// The returned value is always non-nil.
|
||||
// Any zone identifier is dropped in the conversion.
|
||||
func AddrIPNet(addr netip.Addr) *net.IPNet {
|
||||
if !addr.IsValid() {
|
||||
return &net.IPNet{}
|
||||
}
|
||||
return &net.IPNet{
|
||||
IP: addr.AsSlice(),
|
||||
Mask: net.CIDRMask(addr.BitLen(), addr.BitLen()),
|
||||
}
|
||||
}
|
||||
|
||||
// PrefixLastIP returns the last IP in the prefix.
|
||||
func PrefixLastIP(p netip.Prefix) netip.Addr {
|
||||
if !p.IsValid() {
|
||||
return netip.Addr{}
|
||||
}
|
||||
a16 := p.Addr().As16()
|
||||
var off uint8
|
||||
var bits uint8 = 128
|
||||
if p.Addr().Is4() {
|
||||
off = 12
|
||||
bits = 32
|
||||
}
|
||||
for b := uint8(p.Bits()); b < bits; b++ {
|
||||
byteNum, bitInByte := b/8, 7-(b%8)
|
||||
a16[off+byteNum] |= 1 << uint(bitInByte)
|
||||
}
|
||||
if p.Addr().Is4() {
|
||||
return netip.AddrFrom16(a16).Unmap()
|
||||
} else {
|
||||
return netip.AddrFrom16(a16) // doesn't unmap
|
||||
}
|
||||
}
|
||||
|
||||
// IPRange represents an inclusive range of IP addresses
|
||||
// from the same address family.
|
||||
//
|
||||
// The From and To IPs are inclusive bounds, with both included in the
|
||||
// range.
|
||||
//
|
||||
// To be valid, the From and To values must be non-zero, have matching
|
||||
// address families (IPv4 vs IPv6), and From must be less than or equal to To.
|
||||
// IPv6 zones are stripped out and ignored.
|
||||
// An invalid range may be ignored.
|
||||
type IPRange struct {
|
||||
// from is the initial IP address in the range.
|
||||
from netip.Addr
|
||||
|
||||
// to is the final IP address in the range.
|
||||
to netip.Addr
|
||||
}
|
||||
|
||||
// IPRangeFrom returns an IPRange from from to to.
|
||||
// It does not allocate.
|
||||
func IPRangeFrom(from, to netip.Addr) IPRange {
|
||||
return IPRange{
|
||||
from: from.WithZone(""),
|
||||
to: to.WithZone(""),
|
||||
}
|
||||
}
|
||||
|
||||
// From returns the lower bound of r.
|
||||
func (r IPRange) From() netip.Addr { return r.from }
|
||||
|
||||
// To returns the upper bound of r.
|
||||
func (r IPRange) To() netip.Addr { return r.to }
|
||||
|
||||
// ParseIPRange parses a range out of two IPs separated by a hyphen.
|
||||
//
|
||||
// It returns an error if the range is not valid.
|
||||
func ParseIPRange(s string) (IPRange, error) {
|
||||
var r IPRange
|
||||
h := strings.IndexByte(s, '-')
|
||||
if h == -1 {
|
||||
return r, fmt.Errorf("no hyphen in range %q", s)
|
||||
}
|
||||
from, to := s[:h], s[h+1:]
|
||||
var err error
|
||||
r.from, err = netip.ParseAddr(from)
|
||||
if err != nil {
|
||||
return r, fmt.Errorf("invalid From IP %q in range %q", from, s)
|
||||
}
|
||||
r.from = r.from.WithZone("")
|
||||
r.to, err = netip.ParseAddr(to)
|
||||
if err != nil {
|
||||
return r, fmt.Errorf("invalid To IP %q in range %q", to, s)
|
||||
}
|
||||
r.to = r.to.WithZone("")
|
||||
if !r.IsValid() {
|
||||
return r, fmt.Errorf("range %v to %v not valid", r.from, r.to)
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
// MustParseIPRange calls ParseIPRange(s) and panics on error.
|
||||
// It is intended for use in tests with hard-coded strings.
|
||||
func MustParseIPRange(s string) IPRange {
|
||||
r, err := ParseIPRange(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// String returns a string representation of the range.
|
||||
//
|
||||
// For a valid range, the form is "From-To" with a single hyphen
|
||||
// separating the IPs, the same format recognized by
|
||||
// ParseIPRange.
|
||||
func (r IPRange) String() string {
|
||||
if r.IsValid() {
|
||||
return fmt.Sprintf("%s-%s", r.from, r.to)
|
||||
}
|
||||
if !r.from.IsValid() || !r.to.IsValid() {
|
||||
return "zero IPRange"
|
||||
}
|
||||
return "invalid IPRange"
|
||||
}
|
||||
|
||||
// AppendTo appends a text encoding of r,
|
||||
// as generated by MarshalText,
|
||||
// to b and returns the extended buffer.
|
||||
func (r IPRange) AppendTo(b []byte) []byte {
|
||||
if r.IsZero() {
|
||||
return b
|
||||
}
|
||||
b = r.from.AppendTo(b)
|
||||
b = append(b, '-')
|
||||
b = r.to.AppendTo(b)
|
||||
return b
|
||||
}
|
||||
|
||||
// MarshalText implements the encoding.TextMarshaler interface,
|
||||
// The encoding is the same as returned by String, with one exception:
|
||||
// If ip is the zero value, the encoding is the empty string.
|
||||
func (r IPRange) MarshalText() ([]byte, error) {
|
||||
if r.IsZero() {
|
||||
return []byte(""), nil
|
||||
}
|
||||
var max int
|
||||
if r.from.Is4() {
|
||||
max = len("255.255.255.255-255.255.255.255")
|
||||
} else {
|
||||
max = len("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
|
||||
}
|
||||
b := make([]byte, 0, max)
|
||||
return r.AppendTo(b), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements the encoding.TextUnmarshaler interface.
|
||||
// The IP range is expected in a form accepted by ParseIPRange.
|
||||
// It returns an error if *r is not the IPRange zero value.
|
||||
func (r *IPRange) UnmarshalText(text []byte) error {
|
||||
if *r != (IPRange{}) {
|
||||
return errors.New("refusing to Unmarshal into non-zero IPRange")
|
||||
}
|
||||
if len(text) == 0 {
|
||||
return nil
|
||||
}
|
||||
var err error
|
||||
*r, err = ParseIPRange(string(text))
|
||||
return err
|
||||
}
|
||||
|
||||
// IsZero reports whether r is the zero value of the IPRange type.
|
||||
func (r IPRange) IsZero() bool {
|
||||
return r == IPRange{}
|
||||
}
|
||||
|
||||
// IsValid reports whether r.From() and r.To() are both non-zero and
|
||||
// obey the documented requirements: address families match, and From
|
||||
// is less than or equal to To.
|
||||
func (r IPRange) IsValid() bool {
|
||||
return r.from.IsValid() &&
|
||||
r.from.BitLen() == r.to.BitLen() &&
|
||||
r.from.Zone() == r.to.Zone() &&
|
||||
!r.to.Less(r.from)
|
||||
}
|
||||
|
||||
// Valid reports whether r.From() and r.To() are both non-zero and
|
||||
// obey the documented requirements: address families match, and From
|
||||
// is less than or equal to To.
|
||||
//
|
||||
// Deprecated: use the correctly named and identical IsValid method instead.
|
||||
func (r IPRange) Valid() bool { return r.IsValid() }
|
||||
|
||||
// Contains reports whether the range r includes addr.
|
||||
//
|
||||
// An invalid range always reports false.
|
||||
//
|
||||
// If ip has an IPv6 zone, Contains returns false,
|
||||
// because IPPrefixes strip zones.
|
||||
func (r IPRange) Contains(addr netip.Addr) bool {
|
||||
return r.IsValid() && addr.Zone() == "" && r.contains(addr)
|
||||
}
|
||||
|
||||
// contains is like Contains, but without the validity check.
|
||||
// addr must not have a zone.
|
||||
func (r IPRange) contains(addr netip.Addr) bool {
|
||||
return r.from.Compare(addr) <= 0 && r.to.Compare(addr) >= 0
|
||||
}
|
||||
|
||||
// less reports whether r is "before" other. It is before if r.From()
|
||||
// is before other.From(). If they're equal, then the larger range
|
||||
// (higher To()) comes first.
|
||||
func (r IPRange) less(other IPRange) bool {
|
||||
if cmp := r.from.Compare(other.from); cmp != 0 {
|
||||
return cmp < 0
|
||||
}
|
||||
return other.to.Less(r.to)
|
||||
}
|
||||
|
||||
// entirelyBefore returns whether r lies entirely before other in IP
|
||||
// space.
|
||||
func (r IPRange) entirelyBefore(other IPRange) bool {
|
||||
return r.to.Less(other.from)
|
||||
}
|
||||
|
||||
func lessOrEq(ip, ip2 netip.Addr) bool { return ip.Compare(ip2) <= 0 }
|
||||
|
||||
// entirelyWithin returns whether r is entirely contained within
|
||||
// other.
|
||||
func (r IPRange) coveredBy(other IPRange) bool {
|
||||
return lessOrEq(other.from, r.from) && lessOrEq(r.to, other.to)
|
||||
}
|
||||
|
||||
// inMiddleOf returns whether r is inside other, but not touching the
|
||||
// edges of other.
|
||||
func (r IPRange) inMiddleOf(other IPRange) bool {
|
||||
return other.from.Less(r.from) && r.to.Less(other.to)
|
||||
}
|
||||
|
||||
// overlapsStartOf returns whether r entirely overlaps the start of
|
||||
// other, but not all of other.
|
||||
func (r IPRange) overlapsStartOf(other IPRange) bool {
|
||||
return lessOrEq(r.from, other.from) && r.to.Less(other.to)
|
||||
}
|
||||
|
||||
// overlapsEndOf returns whether r entirely overlaps the end of
|
||||
// other, but not all of other.
|
||||
func (r IPRange) overlapsEndOf(other IPRange) bool {
|
||||
return other.from.Less(r.from) && lessOrEq(other.to, r.to)
|
||||
}
|
||||
|
||||
// mergeIPRanges returns the minimum and sorted set of IP ranges that
|
||||
// cover r.
|
||||
func mergeIPRanges(rr []IPRange) (out []IPRange, valid bool) {
|
||||
// Always return a copy of r, to avoid aliasing slice memory in
|
||||
// the caller.
|
||||
switch len(rr) {
|
||||
case 0:
|
||||
return nil, true
|
||||
case 1:
|
||||
return []IPRange{rr[0]}, true
|
||||
}
|
||||
|
||||
sort.Slice(rr, func(i, j int) bool { return rr[i].less(rr[j]) })
|
||||
out = make([]IPRange, 1, len(rr))
|
||||
out[0] = rr[0]
|
||||
for _, r := range rr[1:] {
|
||||
prev := &out[len(out)-1]
|
||||
switch {
|
||||
case !r.IsValid():
|
||||
// Invalid ranges make no sense to merge, refuse to
|
||||
// perform.
|
||||
return nil, false
|
||||
case prev.to.Next() == r.from:
|
||||
// prev and r touch, merge them.
|
||||
//
|
||||
// prev r
|
||||
// f------tf-----t
|
||||
prev.to = r.to
|
||||
case prev.to.Less(r.from):
|
||||
// No overlap and not adjacent (per previous case), no
|
||||
// merging possible.
|
||||
//
|
||||
// prev r
|
||||
// f------t f-----t
|
||||
out = append(out, r)
|
||||
case prev.to.Less(r.to):
|
||||
// Partial overlap, update prev
|
||||
//
|
||||
// prev
|
||||
// f------t
|
||||
// f-----t
|
||||
// r
|
||||
prev.to = r.to
|
||||
default:
|
||||
// r entirely contained in prev, nothing to do.
|
||||
//
|
||||
// prev
|
||||
// f--------t
|
||||
// f-----t
|
||||
// r
|
||||
}
|
||||
}
|
||||
return out, true
|
||||
}
|
||||
|
||||
// Overlaps reports whether p and o overlap at all.
|
||||
//
|
||||
// If p and o are of different address families or either are invalid,
|
||||
// it reports false.
|
||||
func (r IPRange) Overlaps(o IPRange) bool {
|
||||
return r.IsValid() &&
|
||||
o.IsValid() &&
|
||||
r.from.Compare(o.to) <= 0 &&
|
||||
o.from.Compare(r.to) <= 0
|
||||
}
|
||||
|
||||
// prefixMaker returns a address-family-corrected IPPrefix from a and bits,
|
||||
// where the input bits is always in the IPv6-mapped form for IPv4 addresses.
|
||||
type prefixMaker func(a uint128, bits uint8) netip.Prefix
|
||||
|
||||
// Prefixes returns the set of IPPrefix entries that covers r.
|
||||
//
|
||||
// If either of r's bounds are invalid, in the wrong order, or if
|
||||
// they're of different address families, then Prefixes returns nil.
|
||||
//
|
||||
// Prefixes necessarily allocates. See AppendPrefixes for a version that uses
|
||||
// memory you provide.
|
||||
func (r IPRange) Prefixes() []netip.Prefix {
|
||||
return r.AppendPrefixes(nil)
|
||||
}
|
||||
|
||||
// AppendPrefixes is an append version of IPRange.Prefixes. It appends
|
||||
// the netip.Prefix entries that cover r to dst.
|
||||
func (r IPRange) AppendPrefixes(dst []netip.Prefix) []netip.Prefix {
|
||||
if !r.IsValid() {
|
||||
return nil
|
||||
}
|
||||
return appendRangePrefixes(dst, r.prefixFrom128AndBits, u128From16(r.from.As16()), u128From16(r.to.As16()))
|
||||
}
|
||||
|
||||
func (r IPRange) prefixFrom128AndBits(a uint128, bits uint8) netip.Prefix {
|
||||
var ip netip.Addr
|
||||
if r.from.Is4() {
|
||||
bits -= 12 * 8
|
||||
ip = a.IP4()
|
||||
} else {
|
||||
ip = a.IP6()
|
||||
}
|
||||
return netip.PrefixFrom(ip, int(bits))
|
||||
}
|
||||
|
||||
// aZeroBSet is whether, after the common bits, a is all zero bits and
|
||||
// b is all set (one) bits.
|
||||
func comparePrefixes(a, b uint128) (common uint8, aZeroBSet bool) {
|
||||
common = a.commonPrefixLen(b)
|
||||
|
||||
// See whether a and b, after their common shared bits, end
|
||||
// in all zero bits or all one bits, respectively.
|
||||
if common == 128 {
|
||||
return common, true
|
||||
}
|
||||
|
||||
m := mask6[common]
|
||||
return common, (a.xor(a.and(m)).isZero() &&
|
||||
b.or(m) == uint128{^uint64(0), ^uint64(0)})
|
||||
}
|
||||
|
||||
// Prefix returns r as an IPPrefix, if it can be presented exactly as such.
|
||||
// If r is not valid or is not exactly equal to one prefix, ok is false.
|
||||
func (r IPRange) Prefix() (p netip.Prefix, ok bool) {
|
||||
if !r.IsValid() {
|
||||
return
|
||||
}
|
||||
from128 := u128From16(r.from.As16())
|
||||
to128 := u128From16(r.to.As16())
|
||||
if common, ok := comparePrefixes(from128, to128); ok {
|
||||
return r.prefixFrom128AndBits(from128, common), true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func appendRangePrefixes(dst []netip.Prefix, makePrefix prefixMaker, a, b uint128) []netip.Prefix {
|
||||
common, ok := comparePrefixes(a, b)
|
||||
if ok {
|
||||
// a to b represents a whole range, like 10.50.0.0/16.
|
||||
// (a being 10.50.0.0 and b being 10.50.255.255)
|
||||
return append(dst, makePrefix(a, common))
|
||||
}
|
||||
// Otherwise recursively do both halves.
|
||||
dst = appendRangePrefixes(dst, makePrefix, a, a.bitsSetFrom(common+1))
|
||||
dst = appendRangePrefixes(dst, makePrefix, b.bitsClearedFrom(common+1), b)
|
||||
return dst
|
||||
}
|
106
vendor/go4.org/netipx/uint128.go
generated
vendored
Normal file
106
vendor/go4.org/netipx/uint128.go
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
// Copyright 2020 The Inet.Af AUTHORS. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package netipx
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math/bits"
|
||||
"net/netip"
|
||||
)
|
||||
|
||||
// uint128 represents a uint128 using two uint64s.
|
||||
//
|
||||
// When the methods below mention a bit number, bit 0 is the most
|
||||
// significant bit (in hi) and bit 127 is the lowest (lo&1).
|
||||
type uint128 struct {
|
||||
hi uint64
|
||||
lo uint64
|
||||
}
|
||||
|
||||
func u128From16(a [16]byte) uint128 {
|
||||
return uint128{
|
||||
binary.BigEndian.Uint64(a[:8]),
|
||||
binary.BigEndian.Uint64(a[8:]),
|
||||
}
|
||||
}
|
||||
|
||||
func (u uint128) IP6() netip.Addr {
|
||||
var a [16]byte
|
||||
binary.BigEndian.PutUint64(a[:8], u.hi)
|
||||
binary.BigEndian.PutUint64(a[8:], u.lo)
|
||||
return netip.AddrFrom16(a)
|
||||
}
|
||||
|
||||
func (u uint128) IP4() netip.Addr {
|
||||
var a [8]byte
|
||||
binary.BigEndian.PutUint64(a[:], u.lo)
|
||||
return netip.AddrFrom4([4]byte{a[4], a[5], a[6], a[7]})
|
||||
}
|
||||
|
||||
// isZero reports whether u == 0.
|
||||
//
|
||||
// It's faster than u == (uint128{}) because the compiler (as of Go
|
||||
// 1.15/1.16b1) doesn't do this trick and instead inserts a branch in
|
||||
// its eq alg's generated code.
|
||||
func (u uint128) isZero() bool { return u.hi|u.lo == 0 }
|
||||
|
||||
// and returns the bitwise AND of u and m (u&m).
|
||||
func (u uint128) and(m uint128) uint128 {
|
||||
return uint128{u.hi & m.hi, u.lo & m.lo}
|
||||
}
|
||||
|
||||
// xor returns the bitwise XOR of u and m (u^m).
|
||||
func (u uint128) xor(m uint128) uint128 {
|
||||
return uint128{u.hi ^ m.hi, u.lo ^ m.lo}
|
||||
}
|
||||
|
||||
// or returns the bitwise OR of u and m (u|m).
|
||||
func (u uint128) or(m uint128) uint128 {
|
||||
return uint128{u.hi | m.hi, u.lo | m.lo}
|
||||
}
|
||||
|
||||
// not returns the bitwise NOT of u.
|
||||
func (u uint128) not() uint128 {
|
||||
return uint128{^u.hi, ^u.lo}
|
||||
}
|
||||
|
||||
// subOne returns u - 1.
|
||||
func (u uint128) subOne() uint128 {
|
||||
lo, borrow := bits.Sub64(u.lo, 1, 0)
|
||||
return uint128{u.hi - borrow, lo}
|
||||
}
|
||||
|
||||
// addOne returns u + 1.
|
||||
func (u uint128) addOne() uint128 {
|
||||
lo, carry := bits.Add64(u.lo, 1, 0)
|
||||
return uint128{u.hi + carry, lo}
|
||||
}
|
||||
|
||||
func u64CommonPrefixLen(a, b uint64) uint8 {
|
||||
return uint8(bits.LeadingZeros64(a ^ b))
|
||||
}
|
||||
|
||||
func (u uint128) commonPrefixLen(v uint128) (n uint8) {
|
||||
if n = u64CommonPrefixLen(u.hi, v.hi); n == 64 {
|
||||
n += u64CommonPrefixLen(u.lo, v.lo)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// func (u *uint128) halves() [2]*uint64 {
|
||||
// return [2]*uint64{&u.hi, &u.lo}
|
||||
// }
|
||||
|
||||
// bitsSetFrom returns a copy of u with the given bit
|
||||
// and all subsequent ones set.
|
||||
func (u uint128) bitsSetFrom(bit uint8) uint128 {
|
||||
return u.or(mask6[bit].not())
|
||||
}
|
||||
|
||||
// bitsClearedFrom returns a copy of u with the given bit
|
||||
// and all subsequent ones cleared.
|
||||
func (u uint128) bitsClearedFrom(bit uint8) uint128 {
|
||||
return u.and(mask6[bit])
|
||||
}
|
188
vendor/golang.org/x/net/http2/hpack/static_table.go
generated
vendored
Normal file
188
vendor/golang.org/x/net/http2/hpack/static_table.go
generated
vendored
Normal file
@ -0,0 +1,188 @@
|
||||
// go generate gen.go
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
|
||||
package hpack
|
||||
|
||||
var staticTable = &headerFieldTable{
|
||||
evictCount: 0,
|
||||
byName: map[string]uint64{
|
||||
":authority": 1,
|
||||
":method": 3,
|
||||
":path": 5,
|
||||
":scheme": 7,
|
||||
":status": 14,
|
||||
"accept-charset": 15,
|
||||
"accept-encoding": 16,
|
||||
"accept-language": 17,
|
||||
"accept-ranges": 18,
|
||||
"accept": 19,
|
||||
"access-control-allow-origin": 20,
|
||||
"age": 21,
|
||||
"allow": 22,
|
||||
"authorization": 23,
|
||||
"cache-control": 24,
|
||||
"content-disposition": 25,
|
||||
"content-encoding": 26,
|
||||
"content-language": 27,
|
||||
"content-length": 28,
|
||||
"content-location": 29,
|
||||
"content-range": 30,
|
||||
"content-type": 31,
|
||||
"cookie": 32,
|
||||
"date": 33,
|
||||
"etag": 34,
|
||||
"expect": 35,
|
||||
"expires": 36,
|
||||
"from": 37,
|
||||
"host": 38,
|
||||
"if-match": 39,
|
||||
"if-modified-since": 40,
|
||||
"if-none-match": 41,
|
||||
"if-range": 42,
|
||||
"if-unmodified-since": 43,
|
||||
"last-modified": 44,
|
||||
"link": 45,
|
||||
"location": 46,
|
||||
"max-forwards": 47,
|
||||
"proxy-authenticate": 48,
|
||||
"proxy-authorization": 49,
|
||||
"range": 50,
|
||||
"referer": 51,
|
||||
"refresh": 52,
|
||||
"retry-after": 53,
|
||||
"server": 54,
|
||||
"set-cookie": 55,
|
||||
"strict-transport-security": 56,
|
||||
"transfer-encoding": 57,
|
||||
"user-agent": 58,
|
||||
"vary": 59,
|
||||
"via": 60,
|
||||
"www-authenticate": 61,
|
||||
},
|
||||
byNameValue: map[pairNameValue]uint64{
|
||||
{name: ":authority", value: ""}: 1,
|
||||
{name: ":method", value: "GET"}: 2,
|
||||
{name: ":method", value: "POST"}: 3,
|
||||
{name: ":path", value: "/"}: 4,
|
||||
{name: ":path", value: "/index.html"}: 5,
|
||||
{name: ":scheme", value: "http"}: 6,
|
||||
{name: ":scheme", value: "https"}: 7,
|
||||
{name: ":status", value: "200"}: 8,
|
||||
{name: ":status", value: "204"}: 9,
|
||||
{name: ":status", value: "206"}: 10,
|
||||
{name: ":status", value: "304"}: 11,
|
||||
{name: ":status", value: "400"}: 12,
|
||||
{name: ":status", value: "404"}: 13,
|
||||
{name: ":status", value: "500"}: 14,
|
||||
{name: "accept-charset", value: ""}: 15,
|
||||
{name: "accept-encoding", value: "gzip, deflate"}: 16,
|
||||
{name: "accept-language", value: ""}: 17,
|
||||
{name: "accept-ranges", value: ""}: 18,
|
||||
{name: "accept", value: ""}: 19,
|
||||
{name: "access-control-allow-origin", value: ""}: 20,
|
||||
{name: "age", value: ""}: 21,
|
||||
{name: "allow", value: ""}: 22,
|
||||
{name: "authorization", value: ""}: 23,
|
||||
{name: "cache-control", value: ""}: 24,
|
||||
{name: "content-disposition", value: ""}: 25,
|
||||
{name: "content-encoding", value: ""}: 26,
|
||||
{name: "content-language", value: ""}: 27,
|
||||
{name: "content-length", value: ""}: 28,
|
||||
{name: "content-location", value: ""}: 29,
|
||||
{name: "content-range", value: ""}: 30,
|
||||
{name: "content-type", value: ""}: 31,
|
||||
{name: "cookie", value: ""}: 32,
|
||||
{name: "date", value: ""}: 33,
|
||||
{name: "etag", value: ""}: 34,
|
||||
{name: "expect", value: ""}: 35,
|
||||
{name: "expires", value: ""}: 36,
|
||||
{name: "from", value: ""}: 37,
|
||||
{name: "host", value: ""}: 38,
|
||||
{name: "if-match", value: ""}: 39,
|
||||
{name: "if-modified-since", value: ""}: 40,
|
||||
{name: "if-none-match", value: ""}: 41,
|
||||
{name: "if-range", value: ""}: 42,
|
||||
{name: "if-unmodified-since", value: ""}: 43,
|
||||
{name: "last-modified", value: ""}: 44,
|
||||
{name: "link", value: ""}: 45,
|
||||
{name: "location", value: ""}: 46,
|
||||
{name: "max-forwards", value: ""}: 47,
|
||||
{name: "proxy-authenticate", value: ""}: 48,
|
||||
{name: "proxy-authorization", value: ""}: 49,
|
||||
{name: "range", value: ""}: 50,
|
||||
{name: "referer", value: ""}: 51,
|
||||
{name: "refresh", value: ""}: 52,
|
||||
{name: "retry-after", value: ""}: 53,
|
||||
{name: "server", value: ""}: 54,
|
||||
{name: "set-cookie", value: ""}: 55,
|
||||
{name: "strict-transport-security", value: ""}: 56,
|
||||
{name: "transfer-encoding", value: ""}: 57,
|
||||
{name: "user-agent", value: ""}: 58,
|
||||
{name: "vary", value: ""}: 59,
|
||||
{name: "via", value: ""}: 60,
|
||||
{name: "www-authenticate", value: ""}: 61,
|
||||
},
|
||||
ents: []HeaderField{
|
||||
{Name: ":authority", Value: "", Sensitive: false},
|
||||
{Name: ":method", Value: "GET", Sensitive: false},
|
||||
{Name: ":method", Value: "POST", Sensitive: false},
|
||||
{Name: ":path", Value: "/", Sensitive: false},
|
||||
{Name: ":path", Value: "/index.html", Sensitive: false},
|
||||
{Name: ":scheme", Value: "http", Sensitive: false},
|
||||
{Name: ":scheme", Value: "https", Sensitive: false},
|
||||
{Name: ":status", Value: "200", Sensitive: false},
|
||||
{Name: ":status", Value: "204", Sensitive: false},
|
||||
{Name: ":status", Value: "206", Sensitive: false},
|
||||
{Name: ":status", Value: "304", Sensitive: false},
|
||||
{Name: ":status", Value: "400", Sensitive: false},
|
||||
{Name: ":status", Value: "404", Sensitive: false},
|
||||
{Name: ":status", Value: "500", Sensitive: false},
|
||||
{Name: "accept-charset", Value: "", Sensitive: false},
|
||||
{Name: "accept-encoding", Value: "gzip, deflate", Sensitive: false},
|
||||
{Name: "accept-language", Value: "", Sensitive: false},
|
||||
{Name: "accept-ranges", Value: "", Sensitive: false},
|
||||
{Name: "accept", Value: "", Sensitive: false},
|
||||
{Name: "access-control-allow-origin", Value: "", Sensitive: false},
|
||||
{Name: "age", Value: "", Sensitive: false},
|
||||
{Name: "allow", Value: "", Sensitive: false},
|
||||
{Name: "authorization", Value: "", Sensitive: false},
|
||||
{Name: "cache-control", Value: "", Sensitive: false},
|
||||
{Name: "content-disposition", Value: "", Sensitive: false},
|
||||
{Name: "content-encoding", Value: "", Sensitive: false},
|
||||
{Name: "content-language", Value: "", Sensitive: false},
|
||||
{Name: "content-length", Value: "", Sensitive: false},
|
||||
{Name: "content-location", Value: "", Sensitive: false},
|
||||
{Name: "content-range", Value: "", Sensitive: false},
|
||||
{Name: "content-type", Value: "", Sensitive: false},
|
||||
{Name: "cookie", Value: "", Sensitive: false},
|
||||
{Name: "date", Value: "", Sensitive: false},
|
||||
{Name: "etag", Value: "", Sensitive: false},
|
||||
{Name: "expect", Value: "", Sensitive: false},
|
||||
{Name: "expires", Value: "", Sensitive: false},
|
||||
{Name: "from", Value: "", Sensitive: false},
|
||||
{Name: "host", Value: "", Sensitive: false},
|
||||
{Name: "if-match", Value: "", Sensitive: false},
|
||||
{Name: "if-modified-since", Value: "", Sensitive: false},
|
||||
{Name: "if-none-match", Value: "", Sensitive: false},
|
||||
{Name: "if-range", Value: "", Sensitive: false},
|
||||
{Name: "if-unmodified-since", Value: "", Sensitive: false},
|
||||
{Name: "last-modified", Value: "", Sensitive: false},
|
||||
{Name: "link", Value: "", Sensitive: false},
|
||||
{Name: "location", Value: "", Sensitive: false},
|
||||
{Name: "max-forwards", Value: "", Sensitive: false},
|
||||
{Name: "proxy-authenticate", Value: "", Sensitive: false},
|
||||
{Name: "proxy-authorization", Value: "", Sensitive: false},
|
||||
{Name: "range", Value: "", Sensitive: false},
|
||||
{Name: "referer", Value: "", Sensitive: false},
|
||||
{Name: "refresh", Value: "", Sensitive: false},
|
||||
{Name: "retry-after", Value: "", Sensitive: false},
|
||||
{Name: "server", Value: "", Sensitive: false},
|
||||
{Name: "set-cookie", Value: "", Sensitive: false},
|
||||
{Name: "strict-transport-security", Value: "", Sensitive: false},
|
||||
{Name: "transfer-encoding", Value: "", Sensitive: false},
|
||||
{Name: "user-agent", Value: "", Sensitive: false},
|
||||
{Name: "vary", Value: "", Sensitive: false},
|
||||
{Name: "via", Value: "", Sensitive: false},
|
||||
{Name: "www-authenticate", Value: "", Sensitive: false},
|
||||
},
|
||||
}
|
15
vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go
generated
vendored
Normal file
15
vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2022 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !aix && !linux && (ppc64 || ppc64le)
|
||||
// +build !aix
|
||||
// +build !linux
|
||||
// +build ppc64 ppc64le
|
||||
|
||||
package cpu
|
||||
|
||||
func archInit() {
|
||||
PPC64.IsPOWER8 = true
|
||||
Initialized = true
|
||||
}
|
31
vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s
generated
vendored
Normal file
31
vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2022 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (darwin || freebsd || netbsd || openbsd) && gc
|
||||
// +build darwin freebsd netbsd openbsd
|
||||
// +build gc
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ppc64, BSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
||||
JMP syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·RawSyscall6(SB)
|
42
vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go
generated
vendored
Normal file
42
vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ppc64 && openbsd
|
||||
// +build ppc64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||
k.Ident = uint64(fd)
|
||||
k.Filter = int16(mode)
|
||||
k.Flags = uint16(flags)
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetIovlen(length int) {
|
||||
msghdr.Iovlen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of openbsd/ppc64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
42
vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go
generated
vendored
Normal file
42
vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build riscv64 && openbsd
|
||||
// +build riscv64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||
k.Ident = uint64(fd)
|
||||
k.Filter = int16(mode)
|
||||
k.Flags = uint16(flags)
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetIovlen(length int) {
|
||||
msghdr.Iovlen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of openbsd/riscv64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
1905
vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go
generated
vendored
Normal file
1905
vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1904
vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go
generated
vendored
Normal file
1904
vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2221
vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go
generated
vendored
Normal file
2221
vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
796
vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s
generated
vendored
Normal file
796
vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s
generated
vendored
Normal file
@ -0,0 +1,796 @@
|
||||
// go run mkasm.go openbsd ppc64
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getgroups(SB)
|
||||
RET
|
||||
GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setgroups(SB)
|
||||
RET
|
||||
GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB)
|
||||
|
||||
TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_wait4(SB)
|
||||
RET
|
||||
GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB)
|
||||
|
||||
TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_accept(SB)
|
||||
RET
|
||||
GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB)
|
||||
|
||||
TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_bind(SB)
|
||||
RET
|
||||
GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB)
|
||||
|
||||
TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_connect(SB)
|
||||
RET
|
||||
GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB)
|
||||
|
||||
TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_socket(SB)
|
||||
RET
|
||||
GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getsockopt(SB)
|
||||
RET
|
||||
GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setsockopt(SB)
|
||||
RET
|
||||
GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getpeername(SB)
|
||||
RET
|
||||
GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getsockname(SB)
|
||||
RET
|
||||
GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_shutdown(SB)
|
||||
RET
|
||||
GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB)
|
||||
|
||||
TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_socketpair(SB)
|
||||
RET
|
||||
GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB)
|
||||
|
||||
TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_recvfrom(SB)
|
||||
RET
|
||||
GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_sendto(SB)
|
||||
RET
|
||||
GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB)
|
||||
|
||||
TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_recvmsg(SB)
|
||||
RET
|
||||
GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_sendmsg(SB)
|
||||
RET
|
||||
GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB)
|
||||
|
||||
TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_kevent(SB)
|
||||
RET
|
||||
GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB)
|
||||
|
||||
TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_utimes(SB)
|
||||
RET
|
||||
GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB)
|
||||
|
||||
TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_futimes(SB)
|
||||
RET
|
||||
GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB)
|
||||
|
||||
TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_poll(SB)
|
||||
RET
|
||||
GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB)
|
||||
|
||||
TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_madvise(SB)
|
||||
RET
|
||||
GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mlock(SB)
|
||||
RET
|
||||
GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mlockall(SB)
|
||||
RET
|
||||
GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mprotect(SB)
|
||||
RET
|
||||
GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB)
|
||||
|
||||
TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_msync(SB)
|
||||
RET
|
||||
GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB)
|
||||
|
||||
TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_munlock(SB)
|
||||
RET
|
||||
GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB)
|
||||
|
||||
TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_munlockall(SB)
|
||||
RET
|
||||
GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB)
|
||||
|
||||
TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_pipe2(SB)
|
||||
RET
|
||||
GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pipe2_trampoline_addr(SB)/8, $libc_pipe2_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getdents(SB)
|
||||
RET
|
||||
GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getdents_trampoline_addr(SB)/8, $libc_getdents_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getcwd(SB)
|
||||
RET
|
||||
GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB)
|
||||
|
||||
TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_ioctl(SB)
|
||||
RET
|
||||
GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_sysctl(SB)
|
||||
RET
|
||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||
|
||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_ppoll(SB)
|
||||
RET
|
||||
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_ppoll_trampoline_addr(SB)/8, $libc_ppoll_trampoline<>(SB)
|
||||
|
||||
TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_access(SB)
|
||||
RET
|
||||
GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB)
|
||||
|
||||
TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_adjtime(SB)
|
||||
RET
|
||||
GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_chdir(SB)
|
||||
RET
|
||||
GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_chflags(SB)
|
||||
RET
|
||||
GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_chmod(SB)
|
||||
RET
|
||||
GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_chown(SB)
|
||||
RET
|
||||
GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_chroot(SB)
|
||||
RET
|
||||
GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB)
|
||||
|
||||
TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_close(SB)
|
||||
RET
|
||||
GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB)
|
||||
|
||||
TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_dup(SB)
|
||||
RET
|
||||
GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB)
|
||||
|
||||
TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_dup2(SB)
|
||||
RET
|
||||
GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB)
|
||||
|
||||
TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_dup3(SB)
|
||||
RET
|
||||
GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_dup3_trampoline_addr(SB)/8, $libc_dup3_trampoline<>(SB)
|
||||
|
||||
TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_exit(SB)
|
||||
RET
|
||||
GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB)
|
||||
|
||||
TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_faccessat(SB)
|
||||
RET
|
||||
GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fchdir(SB)
|
||||
RET
|
||||
GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fchflags(SB)
|
||||
RET
|
||||
GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fchmod(SB)
|
||||
RET
|
||||
GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fchmodat(SB)
|
||||
RET
|
||||
GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fchown(SB)
|
||||
RET
|
||||
GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fchownat(SB)
|
||||
RET
|
||||
GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_flock(SB)
|
||||
RET
|
||||
GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fpathconf(SB)
|
||||
RET
|
||||
GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fstat(SB)
|
||||
RET
|
||||
GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fstatat(SB)
|
||||
RET
|
||||
GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fstatfs(SB)
|
||||
RET
|
||||
GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_fsync(SB)
|
||||
RET
|
||||
GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB)
|
||||
|
||||
TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_ftruncate(SB)
|
||||
RET
|
||||
GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getegid(SB)
|
||||
RET
|
||||
GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_geteuid(SB)
|
||||
RET
|
||||
GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getgid(SB)
|
||||
RET
|
||||
GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getpgid(SB)
|
||||
RET
|
||||
GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getpgrp(SB)
|
||||
RET
|
||||
GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getpid(SB)
|
||||
RET
|
||||
GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getppid(SB)
|
||||
RET
|
||||
GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getpriority(SB)
|
||||
RET
|
||||
GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getrlimit(SB)
|
||||
RET
|
||||
GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getrtable(SB)
|
||||
RET
|
||||
GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getrtable_trampoline_addr(SB)/8, $libc_getrtable_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getrusage(SB)
|
||||
RET
|
||||
GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getsid(SB)
|
||||
RET
|
||||
GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_gettimeofday(SB)
|
||||
RET
|
||||
GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_getuid(SB)
|
||||
RET
|
||||
GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_issetugid(SB)
|
||||
RET
|
||||
GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_kill(SB)
|
||||
RET
|
||||
GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB)
|
||||
|
||||
TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_kqueue(SB)
|
||||
RET
|
||||
GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB)
|
||||
|
||||
TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_lchown(SB)
|
||||
RET
|
||||
GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB)
|
||||
|
||||
TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_link(SB)
|
||||
RET
|
||||
GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB)
|
||||
|
||||
TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_linkat(SB)
|
||||
RET
|
||||
GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_listen(SB)
|
||||
RET
|
||||
GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB)
|
||||
|
||||
TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_lstat(SB)
|
||||
RET
|
||||
GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mkdir(SB)
|
||||
RET
|
||||
GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mkdirat(SB)
|
||||
RET
|
||||
GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mkfifo(SB)
|
||||
RET
|
||||
GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mkfifoat(SB)
|
||||
RET
|
||||
GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mkfifoat_trampoline_addr(SB)/8, $libc_mkfifoat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mknod(SB)
|
||||
RET
|
||||
GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mknodat(SB)
|
||||
RET
|
||||
GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_nanosleep(SB)
|
||||
RET
|
||||
GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_nanosleep_trampoline_addr(SB)/8, $libc_nanosleep_trampoline<>(SB)
|
||||
|
||||
TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_open(SB)
|
||||
RET
|
||||
GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB)
|
||||
|
||||
TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_openat(SB)
|
||||
RET
|
||||
GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_pathconf(SB)
|
||||
RET
|
||||
GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB)
|
||||
|
||||
TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_pread(SB)
|
||||
RET
|
||||
GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB)
|
||||
|
||||
TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_pwrite(SB)
|
||||
RET
|
||||
GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB)
|
||||
|
||||
TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_read(SB)
|
||||
RET
|
||||
GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB)
|
||||
|
||||
TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_readlink(SB)
|
||||
RET
|
||||
GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB)
|
||||
|
||||
TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_readlinkat(SB)
|
||||
RET
|
||||
GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_rename(SB)
|
||||
RET
|
||||
GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB)
|
||||
|
||||
TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_renameat(SB)
|
||||
RET
|
||||
GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_revoke(SB)
|
||||
RET
|
||||
GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB)
|
||||
|
||||
TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_rmdir(SB)
|
||||
RET
|
||||
GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB)
|
||||
|
||||
TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_lseek(SB)
|
||||
RET
|
||||
GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB)
|
||||
|
||||
TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_select(SB)
|
||||
RET
|
||||
GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setegid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_seteuid(SB)
|
||||
RET
|
||||
GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setgid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setlogin(SB)
|
||||
RET
|
||||
GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setpgid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setpriority(SB)
|
||||
RET
|
||||
GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setregid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setreuid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setresgid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setresgid_trampoline_addr(SB)/8, $libc_setresgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setresuid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setrlimit(SB)
|
||||
RET
|
||||
GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setrtable(SB)
|
||||
RET
|
||||
GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setrtable_trampoline_addr(SB)/8, $libc_setrtable_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setsid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_settimeofday(SB)
|
||||
RET
|
||||
GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_setuid(SB)
|
||||
RET
|
||||
GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_stat(SB)
|
||||
RET
|
||||
GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_statfs(SB)
|
||||
RET
|
||||
GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB)
|
||||
|
||||
TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_symlink(SB)
|
||||
RET
|
||||
GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB)
|
||||
|
||||
TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_symlinkat(SB)
|
||||
RET
|
||||
GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_sync(SB)
|
||||
RET
|
||||
GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB)
|
||||
|
||||
TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_truncate(SB)
|
||||
RET
|
||||
GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB)
|
||||
|
||||
TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_umask(SB)
|
||||
RET
|
||||
GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB)
|
||||
|
||||
TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_unlink(SB)
|
||||
RET
|
||||
GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB)
|
||||
|
||||
TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_unlinkat(SB)
|
||||
RET
|
||||
GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_unmount(SB)
|
||||
RET
|
||||
GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB)
|
||||
|
||||
TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_write(SB)
|
||||
RET
|
||||
GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_mmap(SB)
|
||||
RET
|
||||
GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB)
|
||||
|
||||
TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_munmap(SB)
|
||||
RET
|
||||
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
|
||||
|
||||
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
CALL libc_utimensat(SB)
|
||||
RET
|
||||
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
|
2221
vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go
generated
vendored
Normal file
2221
vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
796
vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s
generated
vendored
Normal file
796
vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s
generated
vendored
Normal file
@ -0,0 +1,796 @@
|
||||
// go run mkasm.go openbsd riscv64
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getgroups(SB)
|
||||
|
||||
GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setgroups(SB)
|
||||
|
||||
GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB)
|
||||
|
||||
TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_wait4(SB)
|
||||
|
||||
GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB)
|
||||
|
||||
TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_accept(SB)
|
||||
|
||||
GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB)
|
||||
|
||||
TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_bind(SB)
|
||||
|
||||
GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB)
|
||||
|
||||
TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_connect(SB)
|
||||
|
||||
GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB)
|
||||
|
||||
TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_socket(SB)
|
||||
|
||||
GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsockopt(SB)
|
||||
|
||||
GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setsockopt(SB)
|
||||
|
||||
GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpeername(SB)
|
||||
|
||||
GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsockname(SB)
|
||||
|
||||
GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shutdown(SB)
|
||||
|
||||
GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB)
|
||||
|
||||
TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_socketpair(SB)
|
||||
|
||||
GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB)
|
||||
|
||||
TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_recvfrom(SB)
|
||||
|
||||
GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendto(SB)
|
||||
|
||||
GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB)
|
||||
|
||||
TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_recvmsg(SB)
|
||||
|
||||
GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendmsg(SB)
|
||||
|
||||
GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB)
|
||||
|
||||
TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_kevent(SB)
|
||||
|
||||
GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB)
|
||||
|
||||
TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_utimes(SB)
|
||||
|
||||
GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB)
|
||||
|
||||
TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_futimes(SB)
|
||||
|
||||
GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB)
|
||||
|
||||
TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_poll(SB)
|
||||
|
||||
GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB)
|
||||
|
||||
TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_madvise(SB)
|
||||
|
||||
GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mlock(SB)
|
||||
|
||||
GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mlockall(SB)
|
||||
|
||||
GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mprotect(SB)
|
||||
|
||||
GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB)
|
||||
|
||||
TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_msync(SB)
|
||||
|
||||
GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB)
|
||||
|
||||
TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_munlock(SB)
|
||||
|
||||
GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB)
|
||||
|
||||
TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_munlockall(SB)
|
||||
|
||||
GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB)
|
||||
|
||||
TEXT libc_pipe2_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_pipe2(SB)
|
||||
|
||||
GLOBL ·libc_pipe2_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pipe2_trampoline_addr(SB)/8, $libc_pipe2_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getdents_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getdents(SB)
|
||||
|
||||
GLOBL ·libc_getdents_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getdents_trampoline_addr(SB)/8, $libc_getdents_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getcwd(SB)
|
||||
|
||||
GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB)
|
||||
|
||||
TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_ioctl(SB)
|
||||
|
||||
GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_sysctl(SB)
|
||||
|
||||
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
|
||||
|
||||
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_ppoll(SB)
|
||||
|
||||
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_ppoll_trampoline_addr(SB)/8, $libc_ppoll_trampoline<>(SB)
|
||||
|
||||
TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_access(SB)
|
||||
|
||||
GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB)
|
||||
|
||||
TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_adjtime(SB)
|
||||
|
||||
GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_chdir(SB)
|
||||
|
||||
GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_chflags(SB)
|
||||
|
||||
GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_chmod(SB)
|
||||
|
||||
GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_chown(SB)
|
||||
|
||||
GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB)
|
||||
|
||||
TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_chroot(SB)
|
||||
|
||||
GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB)
|
||||
|
||||
TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_close(SB)
|
||||
|
||||
GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB)
|
||||
|
||||
TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_dup(SB)
|
||||
|
||||
GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB)
|
||||
|
||||
TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_dup2(SB)
|
||||
|
||||
GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB)
|
||||
|
||||
TEXT libc_dup3_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_dup3(SB)
|
||||
|
||||
GLOBL ·libc_dup3_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_dup3_trampoline_addr(SB)/8, $libc_dup3_trampoline<>(SB)
|
||||
|
||||
TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_exit(SB)
|
||||
|
||||
GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB)
|
||||
|
||||
TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_faccessat(SB)
|
||||
|
||||
GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchdir(SB)
|
||||
|
||||
GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchflags(SB)
|
||||
|
||||
GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchmod(SB)
|
||||
|
||||
GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchmodat(SB)
|
||||
|
||||
GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchown(SB)
|
||||
|
||||
GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchownat(SB)
|
||||
|
||||
GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_flock(SB)
|
||||
|
||||
GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fpathconf(SB)
|
||||
|
||||
GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstat(SB)
|
||||
|
||||
GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstatat(SB)
|
||||
|
||||
GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstatfs(SB)
|
||||
|
||||
GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB)
|
||||
|
||||
TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_fsync(SB)
|
||||
|
||||
GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB)
|
||||
|
||||
TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_ftruncate(SB)
|
||||
|
||||
GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getegid(SB)
|
||||
|
||||
GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_geteuid(SB)
|
||||
|
||||
GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getgid(SB)
|
||||
|
||||
GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpgid(SB)
|
||||
|
||||
GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpgrp(SB)
|
||||
|
||||
GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpid(SB)
|
||||
|
||||
GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getppid(SB)
|
||||
|
||||
GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpriority(SB)
|
||||
|
||||
GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getrlimit(SB)
|
||||
|
||||
GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getrtable_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getrtable(SB)
|
||||
|
||||
GLOBL ·libc_getrtable_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getrtable_trampoline_addr(SB)/8, $libc_getrtable_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getrusage(SB)
|
||||
|
||||
GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsid(SB)
|
||||
|
||||
GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_gettimeofday(SB)
|
||||
|
||||
GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB)
|
||||
|
||||
TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_getuid(SB)
|
||||
|
||||
GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_issetugid(SB)
|
||||
|
||||
GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_kill(SB)
|
||||
|
||||
GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB)
|
||||
|
||||
TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_kqueue(SB)
|
||||
|
||||
GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB)
|
||||
|
||||
TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_lchown(SB)
|
||||
|
||||
GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB)
|
||||
|
||||
TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_link(SB)
|
||||
|
||||
GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB)
|
||||
|
||||
TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_linkat(SB)
|
||||
|
||||
GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_listen(SB)
|
||||
|
||||
GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB)
|
||||
|
||||
TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_lstat(SB)
|
||||
|
||||
GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkdir(SB)
|
||||
|
||||
GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkdirat(SB)
|
||||
|
||||
GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkfifo(SB)
|
||||
|
||||
GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mkfifoat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkfifoat(SB)
|
||||
|
||||
GLOBL ·libc_mkfifoat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mkfifoat_trampoline_addr(SB)/8, $libc_mkfifoat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mknod(SB)
|
||||
|
||||
GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mknodat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mknodat(SB)
|
||||
|
||||
GLOBL ·libc_mknodat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mknodat_trampoline_addr(SB)/8, $libc_mknodat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_nanosleep_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_nanosleep(SB)
|
||||
|
||||
GLOBL ·libc_nanosleep_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_nanosleep_trampoline_addr(SB)/8, $libc_nanosleep_trampoline<>(SB)
|
||||
|
||||
TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_open(SB)
|
||||
|
||||
GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB)
|
||||
|
||||
TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_openat(SB)
|
||||
|
||||
GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_pathconf(SB)
|
||||
|
||||
GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB)
|
||||
|
||||
TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_pread(SB)
|
||||
|
||||
GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB)
|
||||
|
||||
TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_pwrite(SB)
|
||||
|
||||
GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB)
|
||||
|
||||
TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_read(SB)
|
||||
|
||||
GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB)
|
||||
|
||||
TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_readlink(SB)
|
||||
|
||||
GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB)
|
||||
|
||||
TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_readlinkat(SB)
|
||||
|
||||
GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_rename(SB)
|
||||
|
||||
GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB)
|
||||
|
||||
TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_renameat(SB)
|
||||
|
||||
GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_revoke(SB)
|
||||
|
||||
GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB)
|
||||
|
||||
TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_rmdir(SB)
|
||||
|
||||
GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB)
|
||||
|
||||
TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_lseek(SB)
|
||||
|
||||
GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB)
|
||||
|
||||
TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_select(SB)
|
||||
|
||||
GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setegid(SB)
|
||||
|
||||
GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_seteuid(SB)
|
||||
|
||||
GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setgid(SB)
|
||||
|
||||
GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setlogin(SB)
|
||||
|
||||
GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setpgid(SB)
|
||||
|
||||
GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setpriority(SB)
|
||||
|
||||
GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setregid(SB)
|
||||
|
||||
GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setreuid(SB)
|
||||
|
||||
GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setresgid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setresgid(SB)
|
||||
|
||||
GLOBL ·libc_setresgid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setresgid_trampoline_addr(SB)/8, $libc_setresgid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setresuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setresuid(SB)
|
||||
|
||||
GLOBL ·libc_setresuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setresuid_trampoline_addr(SB)/8, $libc_setresuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setrlimit(SB)
|
||||
|
||||
GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setrtable_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setrtable(SB)
|
||||
|
||||
GLOBL ·libc_setrtable_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setrtable_trampoline_addr(SB)/8, $libc_setrtable_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setsid(SB)
|
||||
|
||||
GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_settimeofday(SB)
|
||||
|
||||
GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB)
|
||||
|
||||
TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_setuid(SB)
|
||||
|
||||
GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB)
|
||||
|
||||
TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_stat(SB)
|
||||
|
||||
GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_statfs(SB)
|
||||
|
||||
GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB)
|
||||
|
||||
TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_symlink(SB)
|
||||
|
||||
GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB)
|
||||
|
||||
TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_symlinkat(SB)
|
||||
|
||||
GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_sync(SB)
|
||||
|
||||
GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB)
|
||||
|
||||
TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_truncate(SB)
|
||||
|
||||
GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB)
|
||||
|
||||
TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_umask(SB)
|
||||
|
||||
GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB)
|
||||
|
||||
TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_unlink(SB)
|
||||
|
||||
GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB)
|
||||
|
||||
TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_unlinkat(SB)
|
||||
|
||||
GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_unmount(SB)
|
||||
|
||||
GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB)
|
||||
|
||||
TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_write(SB)
|
||||
|
||||
GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB)
|
||||
|
||||
TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_mmap(SB)
|
||||
|
||||
GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB)
|
||||
|
||||
TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_munmap(SB)
|
||||
|
||||
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
|
||||
|
||||
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_utimensat(SB)
|
||||
|
||||
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
|
281
vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go
generated
vendored
Normal file
281
vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go
generated
vendored
Normal file
@ -0,0 +1,281 @@
|
||||
// go run mksysctl_openbsd.go
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
|
||||
//go:build ppc64 && openbsd
|
||||
// +build ppc64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
type mibentry struct {
|
||||
ctlname string
|
||||
ctloid []_C_int
|
||||
}
|
||||
|
||||
var sysctlMib = []mibentry{
|
||||
{"ddb.console", []_C_int{9, 6}},
|
||||
{"ddb.log", []_C_int{9, 7}},
|
||||
{"ddb.max_line", []_C_int{9, 3}},
|
||||
{"ddb.max_width", []_C_int{9, 2}},
|
||||
{"ddb.panic", []_C_int{9, 5}},
|
||||
{"ddb.profile", []_C_int{9, 9}},
|
||||
{"ddb.radix", []_C_int{9, 1}},
|
||||
{"ddb.tab_stop_width", []_C_int{9, 4}},
|
||||
{"ddb.trigger", []_C_int{9, 8}},
|
||||
{"fs.posix.setuid", []_C_int{3, 1, 1}},
|
||||
{"hw.allowpowerdown", []_C_int{6, 22}},
|
||||
{"hw.byteorder", []_C_int{6, 4}},
|
||||
{"hw.cpuspeed", []_C_int{6, 12}},
|
||||
{"hw.diskcount", []_C_int{6, 10}},
|
||||
{"hw.disknames", []_C_int{6, 8}},
|
||||
{"hw.diskstats", []_C_int{6, 9}},
|
||||
{"hw.machine", []_C_int{6, 1}},
|
||||
{"hw.model", []_C_int{6, 2}},
|
||||
{"hw.ncpu", []_C_int{6, 3}},
|
||||
{"hw.ncpufound", []_C_int{6, 21}},
|
||||
{"hw.ncpuonline", []_C_int{6, 25}},
|
||||
{"hw.pagesize", []_C_int{6, 7}},
|
||||
{"hw.perfpolicy", []_C_int{6, 23}},
|
||||
{"hw.physmem", []_C_int{6, 19}},
|
||||
{"hw.power", []_C_int{6, 26}},
|
||||
{"hw.product", []_C_int{6, 15}},
|
||||
{"hw.serialno", []_C_int{6, 17}},
|
||||
{"hw.setperf", []_C_int{6, 13}},
|
||||
{"hw.smt", []_C_int{6, 24}},
|
||||
{"hw.usermem", []_C_int{6, 20}},
|
||||
{"hw.uuid", []_C_int{6, 18}},
|
||||
{"hw.vendor", []_C_int{6, 14}},
|
||||
{"hw.version", []_C_int{6, 16}},
|
||||
{"kern.allowdt", []_C_int{1, 65}},
|
||||
{"kern.allowkmem", []_C_int{1, 52}},
|
||||
{"kern.argmax", []_C_int{1, 8}},
|
||||
{"kern.audio", []_C_int{1, 84}},
|
||||
{"kern.boottime", []_C_int{1, 21}},
|
||||
{"kern.bufcachepercent", []_C_int{1, 72}},
|
||||
{"kern.ccpu", []_C_int{1, 45}},
|
||||
{"kern.clockrate", []_C_int{1, 12}},
|
||||
{"kern.consbuf", []_C_int{1, 83}},
|
||||
{"kern.consbufsize", []_C_int{1, 82}},
|
||||
{"kern.consdev", []_C_int{1, 75}},
|
||||
{"kern.cp_time", []_C_int{1, 40}},
|
||||
{"kern.cp_time2", []_C_int{1, 71}},
|
||||
{"kern.cpustats", []_C_int{1, 85}},
|
||||
{"kern.domainname", []_C_int{1, 22}},
|
||||
{"kern.file", []_C_int{1, 73}},
|
||||
{"kern.forkstat", []_C_int{1, 42}},
|
||||
{"kern.fscale", []_C_int{1, 46}},
|
||||
{"kern.fsync", []_C_int{1, 33}},
|
||||
{"kern.global_ptrace", []_C_int{1, 81}},
|
||||
{"kern.hostid", []_C_int{1, 11}},
|
||||
{"kern.hostname", []_C_int{1, 10}},
|
||||
{"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}},
|
||||
{"kern.job_control", []_C_int{1, 19}},
|
||||
{"kern.malloc.buckets", []_C_int{1, 39, 1}},
|
||||
{"kern.malloc.kmemnames", []_C_int{1, 39, 3}},
|
||||
{"kern.maxclusters", []_C_int{1, 67}},
|
||||
{"kern.maxfiles", []_C_int{1, 7}},
|
||||
{"kern.maxlocksperuid", []_C_int{1, 70}},
|
||||
{"kern.maxpartitions", []_C_int{1, 23}},
|
||||
{"kern.maxproc", []_C_int{1, 6}},
|
||||
{"kern.maxthread", []_C_int{1, 25}},
|
||||
{"kern.maxvnodes", []_C_int{1, 5}},
|
||||
{"kern.mbstat", []_C_int{1, 59}},
|
||||
{"kern.msgbuf", []_C_int{1, 48}},
|
||||
{"kern.msgbufsize", []_C_int{1, 38}},
|
||||
{"kern.nchstats", []_C_int{1, 41}},
|
||||
{"kern.netlivelocks", []_C_int{1, 76}},
|
||||
{"kern.nfiles", []_C_int{1, 56}},
|
||||
{"kern.ngroups", []_C_int{1, 18}},
|
||||
{"kern.nosuidcoredump", []_C_int{1, 32}},
|
||||
{"kern.nprocs", []_C_int{1, 47}},
|
||||
{"kern.nthreads", []_C_int{1, 26}},
|
||||
{"kern.numvnodes", []_C_int{1, 58}},
|
||||
{"kern.osrelease", []_C_int{1, 2}},
|
||||
{"kern.osrevision", []_C_int{1, 3}},
|
||||
{"kern.ostype", []_C_int{1, 1}},
|
||||
{"kern.osversion", []_C_int{1, 27}},
|
||||
{"kern.pfstatus", []_C_int{1, 86}},
|
||||
{"kern.pool_debug", []_C_int{1, 77}},
|
||||
{"kern.posix1version", []_C_int{1, 17}},
|
||||
{"kern.proc", []_C_int{1, 66}},
|
||||
{"kern.rawpartition", []_C_int{1, 24}},
|
||||
{"kern.saved_ids", []_C_int{1, 20}},
|
||||
{"kern.securelevel", []_C_int{1, 9}},
|
||||
{"kern.seminfo", []_C_int{1, 61}},
|
||||
{"kern.shminfo", []_C_int{1, 62}},
|
||||
{"kern.somaxconn", []_C_int{1, 28}},
|
||||
{"kern.sominconn", []_C_int{1, 29}},
|
||||
{"kern.splassert", []_C_int{1, 54}},
|
||||
{"kern.stackgap_random", []_C_int{1, 50}},
|
||||
{"kern.sysvipc_info", []_C_int{1, 51}},
|
||||
{"kern.sysvmsg", []_C_int{1, 34}},
|
||||
{"kern.sysvsem", []_C_int{1, 35}},
|
||||
{"kern.sysvshm", []_C_int{1, 36}},
|
||||
{"kern.timecounter.choice", []_C_int{1, 69, 4}},
|
||||
{"kern.timecounter.hardware", []_C_int{1, 69, 3}},
|
||||
{"kern.timecounter.tick", []_C_int{1, 69, 1}},
|
||||
{"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}},
|
||||
{"kern.timeout_stats", []_C_int{1, 87}},
|
||||
{"kern.tty.tk_cancc", []_C_int{1, 44, 4}},
|
||||
{"kern.tty.tk_nin", []_C_int{1, 44, 1}},
|
||||
{"kern.tty.tk_nout", []_C_int{1, 44, 2}},
|
||||
{"kern.tty.tk_rawcc", []_C_int{1, 44, 3}},
|
||||
{"kern.tty.ttyinfo", []_C_int{1, 44, 5}},
|
||||
{"kern.ttycount", []_C_int{1, 57}},
|
||||
{"kern.utc_offset", []_C_int{1, 88}},
|
||||
{"kern.version", []_C_int{1, 4}},
|
||||
{"kern.video", []_C_int{1, 89}},
|
||||
{"kern.watchdog.auto", []_C_int{1, 64, 2}},
|
||||
{"kern.watchdog.period", []_C_int{1, 64, 1}},
|
||||
{"kern.witnesswatch", []_C_int{1, 53}},
|
||||
{"kern.wxabort", []_C_int{1, 74}},
|
||||
{"net.bpf.bufsize", []_C_int{4, 31, 1}},
|
||||
{"net.bpf.maxbufsize", []_C_int{4, 31, 2}},
|
||||
{"net.inet.ah.enable", []_C_int{4, 2, 51, 1}},
|
||||
{"net.inet.ah.stats", []_C_int{4, 2, 51, 2}},
|
||||
{"net.inet.carp.allow", []_C_int{4, 2, 112, 1}},
|
||||
{"net.inet.carp.log", []_C_int{4, 2, 112, 3}},
|
||||
{"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}},
|
||||
{"net.inet.carp.stats", []_C_int{4, 2, 112, 4}},
|
||||
{"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}},
|
||||
{"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}},
|
||||
{"net.inet.divert.stats", []_C_int{4, 2, 258, 3}},
|
||||
{"net.inet.esp.enable", []_C_int{4, 2, 50, 1}},
|
||||
{"net.inet.esp.stats", []_C_int{4, 2, 50, 4}},
|
||||
{"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}},
|
||||
{"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}},
|
||||
{"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}},
|
||||
{"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}},
|
||||
{"net.inet.gre.allow", []_C_int{4, 2, 47, 1}},
|
||||
{"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}},
|
||||
{"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}},
|
||||
{"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}},
|
||||
{"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}},
|
||||
{"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}},
|
||||
{"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}},
|
||||
{"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}},
|
||||
{"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}},
|
||||
{"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}},
|
||||
{"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}},
|
||||
{"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}},
|
||||
{"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}},
|
||||
{"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}},
|
||||
{"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}},
|
||||
{"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}},
|
||||
{"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}},
|
||||
{"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}},
|
||||
{"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}},
|
||||
{"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}},
|
||||
{"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}},
|
||||
{"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}},
|
||||
{"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}},
|
||||
{"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}},
|
||||
{"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}},
|
||||
{"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}},
|
||||
{"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}},
|
||||
{"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}},
|
||||
{"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}},
|
||||
{"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}},
|
||||
{"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}},
|
||||
{"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}},
|
||||
{"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}},
|
||||
{"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}},
|
||||
{"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}},
|
||||
{"net.inet.ip.stats", []_C_int{4, 2, 0, 33}},
|
||||
{"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}},
|
||||
{"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}},
|
||||
{"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}},
|
||||
{"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}},
|
||||
{"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}},
|
||||
{"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}},
|
||||
{"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}},
|
||||
{"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}},
|
||||
{"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}},
|
||||
{"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}},
|
||||
{"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}},
|
||||
{"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}},
|
||||
{"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}},
|
||||
{"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}},
|
||||
{"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}},
|
||||
{"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}},
|
||||
{"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}},
|
||||
{"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}},
|
||||
{"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}},
|
||||
{"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}},
|
||||
{"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}},
|
||||
{"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}},
|
||||
{"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}},
|
||||
{"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}},
|
||||
{"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}},
|
||||
{"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}},
|
||||
{"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}},
|
||||
{"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}},
|
||||
{"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}},
|
||||
{"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}},
|
||||
{"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}},
|
||||
{"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}},
|
||||
{"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}},
|
||||
{"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}},
|
||||
{"net.inet.udp.stats", []_C_int{4, 2, 17, 5}},
|
||||
{"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}},
|
||||
{"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}},
|
||||
{"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}},
|
||||
{"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}},
|
||||
{"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}},
|
||||
{"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}},
|
||||
{"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}},
|
||||
{"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}},
|
||||
{"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}},
|
||||
{"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}},
|
||||
{"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}},
|
||||
{"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}},
|
||||
{"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}},
|
||||
{"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}},
|
||||
{"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}},
|
||||
{"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}},
|
||||
{"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}},
|
||||
{"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}},
|
||||
{"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}},
|
||||
{"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}},
|
||||
{"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}},
|
||||
{"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}},
|
||||
{"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}},
|
||||
{"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}},
|
||||
{"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}},
|
||||
{"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}},
|
||||
{"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}},
|
||||
{"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}},
|
||||
{"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}},
|
||||
{"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}},
|
||||
{"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}},
|
||||
{"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}},
|
||||
{"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}},
|
||||
{"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}},
|
||||
{"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}},
|
||||
{"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}},
|
||||
{"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}},
|
||||
{"net.key.sadb_dump", []_C_int{4, 30, 1}},
|
||||
{"net.key.spd_dump", []_C_int{4, 30, 2}},
|
||||
{"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}},
|
||||
{"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}},
|
||||
{"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}},
|
||||
{"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}},
|
||||
{"net.mpls.mapttl_ip", []_C_int{4, 33, 5}},
|
||||
{"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}},
|
||||
{"net.mpls.ttl", []_C_int{4, 33, 2}},
|
||||
{"net.pflow.stats", []_C_int{4, 34, 1}},
|
||||
{"net.pipex.enable", []_C_int{4, 35, 1}},
|
||||
{"vm.anonmin", []_C_int{2, 7}},
|
||||
{"vm.loadavg", []_C_int{2, 2}},
|
||||
{"vm.malloc_conf", []_C_int{2, 12}},
|
||||
{"vm.maxslp", []_C_int{2, 10}},
|
||||
{"vm.nkmempages", []_C_int{2, 6}},
|
||||
{"vm.psstrings", []_C_int{2, 3}},
|
||||
{"vm.swapencrypt.enable", []_C_int{2, 5, 0}},
|
||||
{"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}},
|
||||
{"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}},
|
||||
{"vm.uspace", []_C_int{2, 11}},
|
||||
{"vm.uvmexp", []_C_int{2, 4}},
|
||||
{"vm.vmmeter", []_C_int{2, 1}},
|
||||
{"vm.vnodemin", []_C_int{2, 9}},
|
||||
{"vm.vtextmin", []_C_int{2, 8}},
|
||||
}
|
282
vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go
generated
vendored
Normal file
282
vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go
generated
vendored
Normal file
@ -0,0 +1,282 @@
|
||||
// go run mksysctl_openbsd.go
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
|
||||
//go:build riscv64 && openbsd
|
||||
// +build riscv64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
type mibentry struct {
|
||||
ctlname string
|
||||
ctloid []_C_int
|
||||
}
|
||||
|
||||
var sysctlMib = []mibentry{
|
||||
{"ddb.console", []_C_int{9, 6}},
|
||||
{"ddb.log", []_C_int{9, 7}},
|
||||
{"ddb.max_line", []_C_int{9, 3}},
|
||||
{"ddb.max_width", []_C_int{9, 2}},
|
||||
{"ddb.panic", []_C_int{9, 5}},
|
||||
{"ddb.profile", []_C_int{9, 9}},
|
||||
{"ddb.radix", []_C_int{9, 1}},
|
||||
{"ddb.tab_stop_width", []_C_int{9, 4}},
|
||||
{"ddb.trigger", []_C_int{9, 8}},
|
||||
{"fs.posix.setuid", []_C_int{3, 1, 1}},
|
||||
{"hw.allowpowerdown", []_C_int{6, 22}},
|
||||
{"hw.byteorder", []_C_int{6, 4}},
|
||||
{"hw.cpuspeed", []_C_int{6, 12}},
|
||||
{"hw.diskcount", []_C_int{6, 10}},
|
||||
{"hw.disknames", []_C_int{6, 8}},
|
||||
{"hw.diskstats", []_C_int{6, 9}},
|
||||
{"hw.machine", []_C_int{6, 1}},
|
||||
{"hw.model", []_C_int{6, 2}},
|
||||
{"hw.ncpu", []_C_int{6, 3}},
|
||||
{"hw.ncpufound", []_C_int{6, 21}},
|
||||
{"hw.ncpuonline", []_C_int{6, 25}},
|
||||
{"hw.pagesize", []_C_int{6, 7}},
|
||||
{"hw.perfpolicy", []_C_int{6, 23}},
|
||||
{"hw.physmem", []_C_int{6, 19}},
|
||||
{"hw.power", []_C_int{6, 26}},
|
||||
{"hw.product", []_C_int{6, 15}},
|
||||
{"hw.serialno", []_C_int{6, 17}},
|
||||
{"hw.setperf", []_C_int{6, 13}},
|
||||
{"hw.smt", []_C_int{6, 24}},
|
||||
{"hw.usermem", []_C_int{6, 20}},
|
||||
{"hw.uuid", []_C_int{6, 18}},
|
||||
{"hw.vendor", []_C_int{6, 14}},
|
||||
{"hw.version", []_C_int{6, 16}},
|
||||
{"kern.allowdt", []_C_int{1, 65}},
|
||||
{"kern.allowkmem", []_C_int{1, 52}},
|
||||
{"kern.argmax", []_C_int{1, 8}},
|
||||
{"kern.audio", []_C_int{1, 84}},
|
||||
{"kern.boottime", []_C_int{1, 21}},
|
||||
{"kern.bufcachepercent", []_C_int{1, 72}},
|
||||
{"kern.ccpu", []_C_int{1, 45}},
|
||||
{"kern.clockrate", []_C_int{1, 12}},
|
||||
{"kern.consbuf", []_C_int{1, 83}},
|
||||
{"kern.consbufsize", []_C_int{1, 82}},
|
||||
{"kern.consdev", []_C_int{1, 75}},
|
||||
{"kern.cp_time", []_C_int{1, 40}},
|
||||
{"kern.cp_time2", []_C_int{1, 71}},
|
||||
{"kern.cpustats", []_C_int{1, 85}},
|
||||
{"kern.domainname", []_C_int{1, 22}},
|
||||
{"kern.file", []_C_int{1, 73}},
|
||||
{"kern.forkstat", []_C_int{1, 42}},
|
||||
{"kern.fscale", []_C_int{1, 46}},
|
||||
{"kern.fsync", []_C_int{1, 33}},
|
||||
{"kern.global_ptrace", []_C_int{1, 81}},
|
||||
{"kern.hostid", []_C_int{1, 11}},
|
||||
{"kern.hostname", []_C_int{1, 10}},
|
||||
{"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}},
|
||||
{"kern.job_control", []_C_int{1, 19}},
|
||||
{"kern.malloc.buckets", []_C_int{1, 39, 1}},
|
||||
{"kern.malloc.kmemnames", []_C_int{1, 39, 3}},
|
||||
{"kern.maxclusters", []_C_int{1, 67}},
|
||||
{"kern.maxfiles", []_C_int{1, 7}},
|
||||
{"kern.maxlocksperuid", []_C_int{1, 70}},
|
||||
{"kern.maxpartitions", []_C_int{1, 23}},
|
||||
{"kern.maxproc", []_C_int{1, 6}},
|
||||
{"kern.maxthread", []_C_int{1, 25}},
|
||||
{"kern.maxvnodes", []_C_int{1, 5}},
|
||||
{"kern.mbstat", []_C_int{1, 59}},
|
||||
{"kern.msgbuf", []_C_int{1, 48}},
|
||||
{"kern.msgbufsize", []_C_int{1, 38}},
|
||||
{"kern.nchstats", []_C_int{1, 41}},
|
||||
{"kern.netlivelocks", []_C_int{1, 76}},
|
||||
{"kern.nfiles", []_C_int{1, 56}},
|
||||
{"kern.ngroups", []_C_int{1, 18}},
|
||||
{"kern.nosuidcoredump", []_C_int{1, 32}},
|
||||
{"kern.nprocs", []_C_int{1, 47}},
|
||||
{"kern.nselcoll", []_C_int{1, 43}},
|
||||
{"kern.nthreads", []_C_int{1, 26}},
|
||||
{"kern.numvnodes", []_C_int{1, 58}},
|
||||
{"kern.osrelease", []_C_int{1, 2}},
|
||||
{"kern.osrevision", []_C_int{1, 3}},
|
||||
{"kern.ostype", []_C_int{1, 1}},
|
||||
{"kern.osversion", []_C_int{1, 27}},
|
||||
{"kern.pfstatus", []_C_int{1, 86}},
|
||||
{"kern.pool_debug", []_C_int{1, 77}},
|
||||
{"kern.posix1version", []_C_int{1, 17}},
|
||||
{"kern.proc", []_C_int{1, 66}},
|
||||
{"kern.rawpartition", []_C_int{1, 24}},
|
||||
{"kern.saved_ids", []_C_int{1, 20}},
|
||||
{"kern.securelevel", []_C_int{1, 9}},
|
||||
{"kern.seminfo", []_C_int{1, 61}},
|
||||
{"kern.shminfo", []_C_int{1, 62}},
|
||||
{"kern.somaxconn", []_C_int{1, 28}},
|
||||
{"kern.sominconn", []_C_int{1, 29}},
|
||||
{"kern.splassert", []_C_int{1, 54}},
|
||||
{"kern.stackgap_random", []_C_int{1, 50}},
|
||||
{"kern.sysvipc_info", []_C_int{1, 51}},
|
||||
{"kern.sysvmsg", []_C_int{1, 34}},
|
||||
{"kern.sysvsem", []_C_int{1, 35}},
|
||||
{"kern.sysvshm", []_C_int{1, 36}},
|
||||
{"kern.timecounter.choice", []_C_int{1, 69, 4}},
|
||||
{"kern.timecounter.hardware", []_C_int{1, 69, 3}},
|
||||
{"kern.timecounter.tick", []_C_int{1, 69, 1}},
|
||||
{"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}},
|
||||
{"kern.timeout_stats", []_C_int{1, 87}},
|
||||
{"kern.tty.tk_cancc", []_C_int{1, 44, 4}},
|
||||
{"kern.tty.tk_nin", []_C_int{1, 44, 1}},
|
||||
{"kern.tty.tk_nout", []_C_int{1, 44, 2}},
|
||||
{"kern.tty.tk_rawcc", []_C_int{1, 44, 3}},
|
||||
{"kern.tty.ttyinfo", []_C_int{1, 44, 5}},
|
||||
{"kern.ttycount", []_C_int{1, 57}},
|
||||
{"kern.utc_offset", []_C_int{1, 88}},
|
||||
{"kern.version", []_C_int{1, 4}},
|
||||
{"kern.video", []_C_int{1, 89}},
|
||||
{"kern.watchdog.auto", []_C_int{1, 64, 2}},
|
||||
{"kern.watchdog.period", []_C_int{1, 64, 1}},
|
||||
{"kern.witnesswatch", []_C_int{1, 53}},
|
||||
{"kern.wxabort", []_C_int{1, 74}},
|
||||
{"net.bpf.bufsize", []_C_int{4, 31, 1}},
|
||||
{"net.bpf.maxbufsize", []_C_int{4, 31, 2}},
|
||||
{"net.inet.ah.enable", []_C_int{4, 2, 51, 1}},
|
||||
{"net.inet.ah.stats", []_C_int{4, 2, 51, 2}},
|
||||
{"net.inet.carp.allow", []_C_int{4, 2, 112, 1}},
|
||||
{"net.inet.carp.log", []_C_int{4, 2, 112, 3}},
|
||||
{"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}},
|
||||
{"net.inet.carp.stats", []_C_int{4, 2, 112, 4}},
|
||||
{"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}},
|
||||
{"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}},
|
||||
{"net.inet.divert.stats", []_C_int{4, 2, 258, 3}},
|
||||
{"net.inet.esp.enable", []_C_int{4, 2, 50, 1}},
|
||||
{"net.inet.esp.stats", []_C_int{4, 2, 50, 4}},
|
||||
{"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}},
|
||||
{"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}},
|
||||
{"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}},
|
||||
{"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}},
|
||||
{"net.inet.gre.allow", []_C_int{4, 2, 47, 1}},
|
||||
{"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}},
|
||||
{"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}},
|
||||
{"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}},
|
||||
{"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}},
|
||||
{"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}},
|
||||
{"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}},
|
||||
{"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}},
|
||||
{"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}},
|
||||
{"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}},
|
||||
{"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}},
|
||||
{"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}},
|
||||
{"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}},
|
||||
{"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}},
|
||||
{"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}},
|
||||
{"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}},
|
||||
{"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}},
|
||||
{"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}},
|
||||
{"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}},
|
||||
{"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}},
|
||||
{"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}},
|
||||
{"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}},
|
||||
{"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}},
|
||||
{"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}},
|
||||
{"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}},
|
||||
{"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}},
|
||||
{"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}},
|
||||
{"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}},
|
||||
{"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}},
|
||||
{"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}},
|
||||
{"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}},
|
||||
{"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}},
|
||||
{"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}},
|
||||
{"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}},
|
||||
{"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}},
|
||||
{"net.inet.ip.stats", []_C_int{4, 2, 0, 33}},
|
||||
{"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}},
|
||||
{"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}},
|
||||
{"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}},
|
||||
{"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}},
|
||||
{"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}},
|
||||
{"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}},
|
||||
{"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}},
|
||||
{"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}},
|
||||
{"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}},
|
||||
{"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}},
|
||||
{"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}},
|
||||
{"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}},
|
||||
{"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}},
|
||||
{"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}},
|
||||
{"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}},
|
||||
{"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}},
|
||||
{"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}},
|
||||
{"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}},
|
||||
{"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}},
|
||||
{"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}},
|
||||
{"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}},
|
||||
{"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}},
|
||||
{"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}},
|
||||
{"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}},
|
||||
{"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}},
|
||||
{"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}},
|
||||
{"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}},
|
||||
{"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}},
|
||||
{"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}},
|
||||
{"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}},
|
||||
{"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}},
|
||||
{"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}},
|
||||
{"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}},
|
||||
{"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}},
|
||||
{"net.inet.udp.stats", []_C_int{4, 2, 17, 5}},
|
||||
{"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}},
|
||||
{"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}},
|
||||
{"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}},
|
||||
{"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}},
|
||||
{"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}},
|
||||
{"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}},
|
||||
{"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}},
|
||||
{"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}},
|
||||
{"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}},
|
||||
{"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}},
|
||||
{"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}},
|
||||
{"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}},
|
||||
{"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}},
|
||||
{"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}},
|
||||
{"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}},
|
||||
{"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}},
|
||||
{"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}},
|
||||
{"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}},
|
||||
{"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}},
|
||||
{"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}},
|
||||
{"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}},
|
||||
{"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}},
|
||||
{"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}},
|
||||
{"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}},
|
||||
{"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}},
|
||||
{"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}},
|
||||
{"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}},
|
||||
{"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}},
|
||||
{"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}},
|
||||
{"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}},
|
||||
{"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}},
|
||||
{"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}},
|
||||
{"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}},
|
||||
{"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}},
|
||||
{"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}},
|
||||
{"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}},
|
||||
{"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}},
|
||||
{"net.key.sadb_dump", []_C_int{4, 30, 1}},
|
||||
{"net.key.spd_dump", []_C_int{4, 30, 2}},
|
||||
{"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}},
|
||||
{"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}},
|
||||
{"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}},
|
||||
{"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}},
|
||||
{"net.mpls.mapttl_ip", []_C_int{4, 33, 5}},
|
||||
{"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}},
|
||||
{"net.mpls.ttl", []_C_int{4, 33, 2}},
|
||||
{"net.pflow.stats", []_C_int{4, 34, 1}},
|
||||
{"net.pipex.enable", []_C_int{4, 35, 1}},
|
||||
{"vm.anonmin", []_C_int{2, 7}},
|
||||
{"vm.loadavg", []_C_int{2, 2}},
|
||||
{"vm.malloc_conf", []_C_int{2, 12}},
|
||||
{"vm.maxslp", []_C_int{2, 10}},
|
||||
{"vm.nkmempages", []_C_int{2, 6}},
|
||||
{"vm.psstrings", []_C_int{2, 3}},
|
||||
{"vm.swapencrypt.enable", []_C_int{2, 5, 0}},
|
||||
{"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}},
|
||||
{"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}},
|
||||
{"vm.uspace", []_C_int{2, 11}},
|
||||
{"vm.uvmexp", []_C_int{2, 4}},
|
||||
{"vm.vmmeter", []_C_int{2, 1}},
|
||||
{"vm.vnodemin", []_C_int{2, 9}},
|
||||
{"vm.vtextmin", []_C_int{2, 8}},
|
||||
}
|
218
vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go
generated
vendored
Normal file
218
vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go
generated
vendored
Normal file
@ -0,0 +1,218 @@
|
||||
// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
//go:build ppc64 && openbsd
|
||||
// +build ppc64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
SYS_EXIT = 1 // { void sys_exit(int rval); }
|
||||
SYS_FORK = 2 // { int sys_fork(void); }
|
||||
SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); }
|
||||
SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); }
|
||||
SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); }
|
||||
SYS_CLOSE = 6 // { int sys_close(int fd); }
|
||||
SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); }
|
||||
SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); }
|
||||
SYS_LINK = 9 // { int sys_link(const char *path, const char *link); }
|
||||
SYS_UNLINK = 10 // { int sys_unlink(const char *path); }
|
||||
SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); }
|
||||
SYS_CHDIR = 12 // { int sys_chdir(const char *path); }
|
||||
SYS_FCHDIR = 13 // { int sys_fchdir(int fd); }
|
||||
SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); }
|
||||
SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); }
|
||||
SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); }
|
||||
SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break
|
||||
SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); }
|
||||
SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); }
|
||||
SYS_GETPID = 20 // { pid_t sys_getpid(void); }
|
||||
SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); }
|
||||
SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); }
|
||||
SYS_SETUID = 23 // { int sys_setuid(uid_t uid); }
|
||||
SYS_GETUID = 24 // { uid_t sys_getuid(void); }
|
||||
SYS_GETEUID = 25 // { uid_t sys_geteuid(void); }
|
||||
SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); }
|
||||
SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); }
|
||||
SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); }
|
||||
SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); }
|
||||
SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); }
|
||||
SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); }
|
||||
SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); }
|
||||
SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); }
|
||||
SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); }
|
||||
SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); }
|
||||
SYS_SYNC = 36 // { void sys_sync(void); }
|
||||
SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); }
|
||||
SYS_GETPPID = 39 // { pid_t sys_getppid(void); }
|
||||
SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); }
|
||||
SYS_DUP = 41 // { int sys_dup(int fd); }
|
||||
SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); }
|
||||
SYS_GETEGID = 43 // { gid_t sys_getegid(void); }
|
||||
SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); }
|
||||
SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); }
|
||||
SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); }
|
||||
SYS_GETGID = 47 // { gid_t sys_getgid(void); }
|
||||
SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); }
|
||||
SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); }
|
||||
SYS_ACCT = 51 // { int sys_acct(const char *path); }
|
||||
SYS_SIGPENDING = 52 // { int sys_sigpending(void); }
|
||||
SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); }
|
||||
SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); }
|
||||
SYS_REBOOT = 55 // { int sys_reboot(int opt); }
|
||||
SYS_REVOKE = 56 // { int sys_revoke(const char *path); }
|
||||
SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); }
|
||||
SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); }
|
||||
SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); }
|
||||
SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); }
|
||||
SYS_CHROOT = 61 // { int sys_chroot(const char *path); }
|
||||
SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); }
|
||||
SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); }
|
||||
SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); }
|
||||
SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); }
|
||||
SYS_VFORK = 66 // { int sys_vfork(void); }
|
||||
SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); }
|
||||
SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); }
|
||||
SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); }
|
||||
SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); }
|
||||
SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
|
||||
SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); }
|
||||
SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); }
|
||||
SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); }
|
||||
SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); }
|
||||
SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); }
|
||||
SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); }
|
||||
SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); }
|
||||
SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); }
|
||||
SYS_GETPGRP = 81 // { int sys_getpgrp(void); }
|
||||
SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); }
|
||||
SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); }
|
||||
SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); }
|
||||
SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); }
|
||||
SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); }
|
||||
SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); }
|
||||
SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); }
|
||||
SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); }
|
||||
SYS_DUP2 = 90 // { int sys_dup2(int from, int to); }
|
||||
SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); }
|
||||
SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); }
|
||||
SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); }
|
||||
SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); }
|
||||
SYS_FSYNC = 95 // { int sys_fsync(int fd); }
|
||||
SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); }
|
||||
SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); }
|
||||
SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); }
|
||||
SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); }
|
||||
SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); }
|
||||
SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); }
|
||||
SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); }
|
||||
SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); }
|
||||
SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); }
|
||||
SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); }
|
||||
SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); }
|
||||
SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); }
|
||||
SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); }
|
||||
SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); }
|
||||
SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); }
|
||||
SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); }
|
||||
SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); }
|
||||
SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); }
|
||||
SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); }
|
||||
SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); }
|
||||
SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); }
|
||||
SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); }
|
||||
SYS_KILL = 122 // { int sys_kill(int pid, int signum); }
|
||||
SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); }
|
||||
SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); }
|
||||
SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); }
|
||||
SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); }
|
||||
SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); }
|
||||
SYS_FLOCK = 131 // { int sys_flock(int fd, int how); }
|
||||
SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); }
|
||||
SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); }
|
||||
SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); }
|
||||
SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); }
|
||||
SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); }
|
||||
SYS_RMDIR = 137 // { int sys_rmdir(const char *path); }
|
||||
SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); }
|
||||
SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); }
|
||||
SYS_SETSID = 147 // { int sys_setsid(void); }
|
||||
SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); }
|
||||
SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); }
|
||||
SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); }
|
||||
SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); }
|
||||
SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); }
|
||||
SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); }
|
||||
SYS_SETGID = 181 // { int sys_setgid(gid_t gid); }
|
||||
SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); }
|
||||
SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); }
|
||||
SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); }
|
||||
SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); }
|
||||
SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); }
|
||||
SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); }
|
||||
SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); }
|
||||
SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); }
|
||||
SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); }
|
||||
SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); }
|
||||
SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); }
|
||||
SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); }
|
||||
SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); }
|
||||
SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); }
|
||||
SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); }
|
||||
SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); }
|
||||
SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); }
|
||||
SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); }
|
||||
SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); }
|
||||
SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); }
|
||||
SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); }
|
||||
SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); }
|
||||
SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); }
|
||||
SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); }
|
||||
SYS_ISSETUGID = 253 // { int sys_issetugid(void); }
|
||||
SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); }
|
||||
SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); }
|
||||
SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); }
|
||||
SYS_PIPE = 263 // { int sys_pipe(int *fdp); }
|
||||
SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); }
|
||||
SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); }
|
||||
SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); }
|
||||
SYS_KQUEUE = 269 // { int sys_kqueue(void); }
|
||||
SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); }
|
||||
SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); }
|
||||
SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); }
|
||||
SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); }
|
||||
SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); }
|
||||
SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); }
|
||||
SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); }
|
||||
SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); }
|
||||
SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); }
|
||||
SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); }
|
||||
SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); }
|
||||
SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); }
|
||||
SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); }
|
||||
SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); }
|
||||
SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); }
|
||||
SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); }
|
||||
SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); }
|
||||
SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); }
|
||||
SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); }
|
||||
SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); }
|
||||
SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); }
|
||||
SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); }
|
||||
SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); }
|
||||
SYS_GETRTABLE = 311 // { int sys_getrtable(void); }
|
||||
SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); }
|
||||
SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); }
|
||||
SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); }
|
||||
SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); }
|
||||
SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); }
|
||||
SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); }
|
||||
SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); }
|
||||
SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); }
|
||||
SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); }
|
||||
SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); }
|
||||
SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); }
|
||||
SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); }
|
||||
SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); }
|
||||
SYS___GET_TCB = 330 // { void *sys___get_tcb(void); }
|
||||
)
|
219
vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go
generated
vendored
Normal file
219
vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go
generated
vendored
Normal file
@ -0,0 +1,219 @@
|
||||
// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
//go:build riscv64 && openbsd
|
||||
// +build riscv64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
// Deprecated: Use libc wrappers instead of direct syscalls.
|
||||
const (
|
||||
SYS_EXIT = 1 // { void sys_exit(int rval); }
|
||||
SYS_FORK = 2 // { int sys_fork(void); }
|
||||
SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); }
|
||||
SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); }
|
||||
SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); }
|
||||
SYS_CLOSE = 6 // { int sys_close(int fd); }
|
||||
SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); }
|
||||
SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); }
|
||||
SYS_LINK = 9 // { int sys_link(const char *path, const char *link); }
|
||||
SYS_UNLINK = 10 // { int sys_unlink(const char *path); }
|
||||
SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); }
|
||||
SYS_CHDIR = 12 // { int sys_chdir(const char *path); }
|
||||
SYS_FCHDIR = 13 // { int sys_fchdir(int fd); }
|
||||
SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); }
|
||||
SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); }
|
||||
SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); }
|
||||
SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break
|
||||
SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); }
|
||||
SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); }
|
||||
SYS_GETPID = 20 // { pid_t sys_getpid(void); }
|
||||
SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); }
|
||||
SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); }
|
||||
SYS_SETUID = 23 // { int sys_setuid(uid_t uid); }
|
||||
SYS_GETUID = 24 // { uid_t sys_getuid(void); }
|
||||
SYS_GETEUID = 25 // { uid_t sys_geteuid(void); }
|
||||
SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); }
|
||||
SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); }
|
||||
SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); }
|
||||
SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); }
|
||||
SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); }
|
||||
SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); }
|
||||
SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); }
|
||||
SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); }
|
||||
SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); }
|
||||
SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); }
|
||||
SYS_SYNC = 36 // { void sys_sync(void); }
|
||||
SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); }
|
||||
SYS_GETPPID = 39 // { pid_t sys_getppid(void); }
|
||||
SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); }
|
||||
SYS_DUP = 41 // { int sys_dup(int fd); }
|
||||
SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); }
|
||||
SYS_GETEGID = 43 // { gid_t sys_getegid(void); }
|
||||
SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); }
|
||||
SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); }
|
||||
SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); }
|
||||
SYS_GETGID = 47 // { gid_t sys_getgid(void); }
|
||||
SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); }
|
||||
SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); }
|
||||
SYS_ACCT = 51 // { int sys_acct(const char *path); }
|
||||
SYS_SIGPENDING = 52 // { int sys_sigpending(void); }
|
||||
SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); }
|
||||
SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); }
|
||||
SYS_REBOOT = 55 // { int sys_reboot(int opt); }
|
||||
SYS_REVOKE = 56 // { int sys_revoke(const char *path); }
|
||||
SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); }
|
||||
SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); }
|
||||
SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); }
|
||||
SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); }
|
||||
SYS_CHROOT = 61 // { int sys_chroot(const char *path); }
|
||||
SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); }
|
||||
SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); }
|
||||
SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); }
|
||||
SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); }
|
||||
SYS_VFORK = 66 // { int sys_vfork(void); }
|
||||
SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); }
|
||||
SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); }
|
||||
SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); }
|
||||
SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); }
|
||||
SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); }
|
||||
SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); }
|
||||
SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); }
|
||||
SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); }
|
||||
SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); }
|
||||
SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); }
|
||||
SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); }
|
||||
SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); }
|
||||
SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); }
|
||||
SYS_GETPGRP = 81 // { int sys_getpgrp(void); }
|
||||
SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); }
|
||||
SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); }
|
||||
SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); }
|
||||
SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); }
|
||||
SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); }
|
||||
SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); }
|
||||
SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); }
|
||||
SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); }
|
||||
SYS_DUP2 = 90 // { int sys_dup2(int from, int to); }
|
||||
SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); }
|
||||
SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); }
|
||||
SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); }
|
||||
SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); }
|
||||
SYS_FSYNC = 95 // { int sys_fsync(int fd); }
|
||||
SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); }
|
||||
SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); }
|
||||
SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); }
|
||||
SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); }
|
||||
SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); }
|
||||
SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); }
|
||||
SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); }
|
||||
SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); }
|
||||
SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); }
|
||||
SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); }
|
||||
SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); }
|
||||
SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); }
|
||||
SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); }
|
||||
SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); }
|
||||
SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); }
|
||||
SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); }
|
||||
SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); }
|
||||
SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); }
|
||||
SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); }
|
||||
SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); }
|
||||
SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); }
|
||||
SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); }
|
||||
SYS_KILL = 122 // { int sys_kill(int pid, int signum); }
|
||||
SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); }
|
||||
SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); }
|
||||
SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); }
|
||||
SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); }
|
||||
SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); }
|
||||
SYS_FLOCK = 131 // { int sys_flock(int fd, int how); }
|
||||
SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); }
|
||||
SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); }
|
||||
SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); }
|
||||
SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); }
|
||||
SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); }
|
||||
SYS_RMDIR = 137 // { int sys_rmdir(const char *path); }
|
||||
SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); }
|
||||
SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); }
|
||||
SYS_SETSID = 147 // { int sys_setsid(void); }
|
||||
SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); }
|
||||
SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); }
|
||||
SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); }
|
||||
SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); }
|
||||
SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); }
|
||||
SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); }
|
||||
SYS_SETGID = 181 // { int sys_setgid(gid_t gid); }
|
||||
SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); }
|
||||
SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); }
|
||||
SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); }
|
||||
SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); }
|
||||
SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); }
|
||||
SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); }
|
||||
SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); }
|
||||
SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); }
|
||||
SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); }
|
||||
SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); }
|
||||
SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); }
|
||||
SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); }
|
||||
SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); }
|
||||
SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); }
|
||||
SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); }
|
||||
SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); }
|
||||
SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); }
|
||||
SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); }
|
||||
SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); }
|
||||
SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); }
|
||||
SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); }
|
||||
SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); }
|
||||
SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); }
|
||||
SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); }
|
||||
SYS_ISSETUGID = 253 // { int sys_issetugid(void); }
|
||||
SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); }
|
||||
SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); }
|
||||
SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); }
|
||||
SYS_PIPE = 263 // { int sys_pipe(int *fdp); }
|
||||
SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); }
|
||||
SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); }
|
||||
SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); }
|
||||
SYS_KQUEUE = 269 // { int sys_kqueue(void); }
|
||||
SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); }
|
||||
SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); }
|
||||
SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); }
|
||||
SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); }
|
||||
SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); }
|
||||
SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); }
|
||||
SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); }
|
||||
SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); }
|
||||
SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); }
|
||||
SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); }
|
||||
SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); }
|
||||
SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); }
|
||||
SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); }
|
||||
SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); }
|
||||
SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); }
|
||||
SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); }
|
||||
SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); }
|
||||
SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); }
|
||||
SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); }
|
||||
SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); }
|
||||
SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); }
|
||||
SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); }
|
||||
SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); }
|
||||
SYS_GETRTABLE = 311 // { int sys_getrtable(void); }
|
||||
SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); }
|
||||
SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); }
|
||||
SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); }
|
||||
SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); }
|
||||
SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); }
|
||||
SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); }
|
||||
SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); }
|
||||
SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); }
|
||||
SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); }
|
||||
SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); }
|
||||
SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); }
|
||||
SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); }
|
||||
SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); }
|
||||
SYS___GET_TCB = 330 // { void *sys___get_tcb(void); }
|
||||
)
|
571
vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go
generated
vendored
Normal file
571
vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go
generated
vendored
Normal file
@ -0,0 +1,571 @@
|
||||
// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
//go:build ppc64 && openbsd
|
||||
// +build ppc64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
SizeofPtr = 0x8
|
||||
SizeofShort = 0x2
|
||||
SizeofInt = 0x4
|
||||
SizeofLong = 0x8
|
||||
SizeofLongLong = 0x8
|
||||
)
|
||||
|
||||
type (
|
||||
_C_short int16
|
||||
_C_int int32
|
||||
_C_long int64
|
||||
_C_long_long int64
|
||||
)
|
||||
|
||||
type Timespec struct {
|
||||
Sec int64
|
||||
Nsec int64
|
||||
}
|
||||
|
||||
type Timeval struct {
|
||||
Sec int64
|
||||
Usec int64
|
||||
}
|
||||
|
||||
type Rusage struct {
|
||||
Utime Timeval
|
||||
Stime Timeval
|
||||
Maxrss int64
|
||||
Ixrss int64
|
||||
Idrss int64
|
||||
Isrss int64
|
||||
Minflt int64
|
||||
Majflt int64
|
||||
Nswap int64
|
||||
Inblock int64
|
||||
Oublock int64
|
||||
Msgsnd int64
|
||||
Msgrcv int64
|
||||
Nsignals int64
|
||||
Nvcsw int64
|
||||
Nivcsw int64
|
||||
}
|
||||
|
||||
type Rlimit struct {
|
||||
Cur uint64
|
||||
Max uint64
|
||||
}
|
||||
|
||||
type _Gid_t uint32
|
||||
|
||||
type Stat_t struct {
|
||||
Mode uint32
|
||||
Dev int32
|
||||
Ino uint64
|
||||
Nlink uint32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Rdev int32
|
||||
Atim Timespec
|
||||
Mtim Timespec
|
||||
Ctim Timespec
|
||||
Size int64
|
||||
Blocks int64
|
||||
Blksize int32
|
||||
Flags uint32
|
||||
Gen uint32
|
||||
_ Timespec
|
||||
}
|
||||
|
||||
type Statfs_t struct {
|
||||
F_flags uint32
|
||||
F_bsize uint32
|
||||
F_iosize uint32
|
||||
F_blocks uint64
|
||||
F_bfree uint64
|
||||
F_bavail int64
|
||||
F_files uint64
|
||||
F_ffree uint64
|
||||
F_favail int64
|
||||
F_syncwrites uint64
|
||||
F_syncreads uint64
|
||||
F_asyncwrites uint64
|
||||
F_asyncreads uint64
|
||||
F_fsid Fsid
|
||||
F_namemax uint32
|
||||
F_owner uint32
|
||||
F_ctime uint64
|
||||
F_fstypename [16]byte
|
||||
F_mntonname [90]byte
|
||||
F_mntfromname [90]byte
|
||||
F_mntfromspec [90]byte
|
||||
_ [2]byte
|
||||
Mount_info [160]byte
|
||||
}
|
||||
|
||||
type Flock_t struct {
|
||||
Start int64
|
||||
Len int64
|
||||
Pid int32
|
||||
Type int16
|
||||
Whence int16
|
||||
}
|
||||
|
||||
type Dirent struct {
|
||||
Fileno uint64
|
||||
Off int64
|
||||
Reclen uint16
|
||||
Type uint8
|
||||
Namlen uint8
|
||||
_ [4]uint8
|
||||
Name [256]int8
|
||||
}
|
||||
|
||||
type Fsid struct {
|
||||
Val [2]int32
|
||||
}
|
||||
|
||||
const (
|
||||
PathMax = 0x400
|
||||
)
|
||||
|
||||
type RawSockaddrInet4 struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type RawSockaddrInet6 struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
Flowinfo uint32
|
||||
Addr [16]byte /* in6_addr */
|
||||
Scope_id uint32
|
||||
}
|
||||
|
||||
type RawSockaddrUnix struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Path [104]int8
|
||||
}
|
||||
|
||||
type RawSockaddrDatalink struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Index uint16
|
||||
Type uint8
|
||||
Nlen uint8
|
||||
Alen uint8
|
||||
Slen uint8
|
||||
Data [24]int8
|
||||
}
|
||||
|
||||
type RawSockaddr struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Data [14]int8
|
||||
}
|
||||
|
||||
type RawSockaddrAny struct {
|
||||
Addr RawSockaddr
|
||||
Pad [92]int8
|
||||
}
|
||||
|
||||
type _Socklen uint32
|
||||
|
||||
type Linger struct {
|
||||
Onoff int32
|
||||
Linger int32
|
||||
}
|
||||
|
||||
type Iovec struct {
|
||||
Base *byte
|
||||
Len uint64
|
||||
}
|
||||
|
||||
type IPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type IPv6Mreq struct {
|
||||
Multiaddr [16]byte /* in6_addr */
|
||||
Interface uint32
|
||||
}
|
||||
|
||||
type Msghdr struct {
|
||||
Name *byte
|
||||
Namelen uint32
|
||||
Iov *Iovec
|
||||
Iovlen uint32
|
||||
Control *byte
|
||||
Controllen uint32
|
||||
Flags int32
|
||||
}
|
||||
|
||||
type Cmsghdr struct {
|
||||
Len uint32
|
||||
Level int32
|
||||
Type int32
|
||||
}
|
||||
|
||||
type Inet6Pktinfo struct {
|
||||
Addr [16]byte /* in6_addr */
|
||||
Ifindex uint32
|
||||
}
|
||||
|
||||
type IPv6MTUInfo struct {
|
||||
Addr RawSockaddrInet6
|
||||
Mtu uint32
|
||||
}
|
||||
|
||||
type ICMPv6Filter struct {
|
||||
Filt [8]uint32
|
||||
}
|
||||
|
||||
const (
|
||||
SizeofSockaddrInet4 = 0x10
|
||||
SizeofSockaddrInet6 = 0x1c
|
||||
SizeofSockaddrAny = 0x6c
|
||||
SizeofSockaddrUnix = 0x6a
|
||||
SizeofSockaddrDatalink = 0x20
|
||||
SizeofLinger = 0x8
|
||||
SizeofIovec = 0x10
|
||||
SizeofIPMreq = 0x8
|
||||
SizeofIPv6Mreq = 0x14
|
||||
SizeofMsghdr = 0x30
|
||||
SizeofCmsghdr = 0xc
|
||||
SizeofInet6Pktinfo = 0x14
|
||||
SizeofIPv6MTUInfo = 0x20
|
||||
SizeofICMPv6Filter = 0x20
|
||||
)
|
||||
|
||||
const (
|
||||
PTRACE_TRACEME = 0x0
|
||||
PTRACE_CONT = 0x7
|
||||
PTRACE_KILL = 0x8
|
||||
)
|
||||
|
||||
type Kevent_t struct {
|
||||
Ident uint64
|
||||
Filter int16
|
||||
Flags uint16
|
||||
Fflags uint32
|
||||
Data int64
|
||||
Udata *byte
|
||||
}
|
||||
|
||||
type FdSet struct {
|
||||
Bits [32]uint32
|
||||
}
|
||||
|
||||
const (
|
||||
SizeofIfMsghdr = 0xa8
|
||||
SizeofIfData = 0x90
|
||||
SizeofIfaMsghdr = 0x18
|
||||
SizeofIfAnnounceMsghdr = 0x1a
|
||||
SizeofRtMsghdr = 0x60
|
||||
SizeofRtMetrics = 0x38
|
||||
)
|
||||
|
||||
type IfMsghdr struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
Hdrlen uint16
|
||||
Index uint16
|
||||
Tableid uint16
|
||||
Pad1 uint8
|
||||
Pad2 uint8
|
||||
Addrs int32
|
||||
Flags int32
|
||||
Xflags int32
|
||||
Data IfData
|
||||
}
|
||||
|
||||
type IfData struct {
|
||||
Type uint8
|
||||
Addrlen uint8
|
||||
Hdrlen uint8
|
||||
Link_state uint8
|
||||
Mtu uint32
|
||||
Metric uint32
|
||||
Rdomain uint32
|
||||
Baudrate uint64
|
||||
Ipackets uint64
|
||||
Ierrors uint64
|
||||
Opackets uint64
|
||||
Oerrors uint64
|
||||
Collisions uint64
|
||||
Ibytes uint64
|
||||
Obytes uint64
|
||||
Imcasts uint64
|
||||
Omcasts uint64
|
||||
Iqdrops uint64
|
||||
Oqdrops uint64
|
||||
Noproto uint64
|
||||
Capabilities uint32
|
||||
Lastchange Timeval
|
||||
}
|
||||
|
||||
type IfaMsghdr struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
Hdrlen uint16
|
||||
Index uint16
|
||||
Tableid uint16
|
||||
Pad1 uint8
|
||||
Pad2 uint8
|
||||
Addrs int32
|
||||
Flags int32
|
||||
Metric int32
|
||||
}
|
||||
|
||||
type IfAnnounceMsghdr struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
Hdrlen uint16
|
||||
Index uint16
|
||||
What uint16
|
||||
Name [16]int8
|
||||
}
|
||||
|
||||
type RtMsghdr struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
Hdrlen uint16
|
||||
Index uint16
|
||||
Tableid uint16
|
||||
Priority uint8
|
||||
Mpls uint8
|
||||
Addrs int32
|
||||
Flags int32
|
||||
Fmask int32
|
||||
Pid int32
|
||||
Seq int32
|
||||
Errno int32
|
||||
Inits uint32
|
||||
Rmx RtMetrics
|
||||
}
|
||||
|
||||
type RtMetrics struct {
|
||||
Pksent uint64
|
||||
Expire int64
|
||||
Locks uint32
|
||||
Mtu uint32
|
||||
Refcnt uint32
|
||||
Hopcount uint32
|
||||
Recvpipe uint32
|
||||
Sendpipe uint32
|
||||
Ssthresh uint32
|
||||
Rtt uint32
|
||||
Rttvar uint32
|
||||
Pad uint32
|
||||
}
|
||||
|
||||
type Mclpool struct{}
|
||||
|
||||
const (
|
||||
SizeofBpfVersion = 0x4
|
||||
SizeofBpfStat = 0x8
|
||||
SizeofBpfProgram = 0x10
|
||||
SizeofBpfInsn = 0x8
|
||||
SizeofBpfHdr = 0x18
|
||||
)
|
||||
|
||||
type BpfVersion struct {
|
||||
Major uint16
|
||||
Minor uint16
|
||||
}
|
||||
|
||||
type BpfStat struct {
|
||||
Recv uint32
|
||||
Drop uint32
|
||||
}
|
||||
|
||||
type BpfProgram struct {
|
||||
Len uint32
|
||||
Insns *BpfInsn
|
||||
}
|
||||
|
||||
type BpfInsn struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
|
||||
type BpfHdr struct {
|
||||
Tstamp BpfTimeval
|
||||
Caplen uint32
|
||||
Datalen uint32
|
||||
Hdrlen uint16
|
||||
Ifidx uint16
|
||||
Flowid uint16
|
||||
Flags uint8
|
||||
Drops uint8
|
||||
}
|
||||
|
||||
type BpfTimeval struct {
|
||||
Sec uint32
|
||||
Usec uint32
|
||||
}
|
||||
|
||||
type Termios struct {
|
||||
Iflag uint32
|
||||
Oflag uint32
|
||||
Cflag uint32
|
||||
Lflag uint32
|
||||
Cc [20]uint8
|
||||
Ispeed int32
|
||||
Ospeed int32
|
||||
}
|
||||
|
||||
type Winsize struct {
|
||||
Row uint16
|
||||
Col uint16
|
||||
Xpixel uint16
|
||||
Ypixel uint16
|
||||
}
|
||||
|
||||
const (
|
||||
AT_FDCWD = -0x64
|
||||
AT_EACCESS = 0x1
|
||||
AT_SYMLINK_NOFOLLOW = 0x2
|
||||
AT_SYMLINK_FOLLOW = 0x4
|
||||
AT_REMOVEDIR = 0x8
|
||||
)
|
||||
|
||||
type PollFd struct {
|
||||
Fd int32
|
||||
Events int16
|
||||
Revents int16
|
||||
}
|
||||
|
||||
const (
|
||||
POLLERR = 0x8
|
||||
POLLHUP = 0x10
|
||||
POLLIN = 0x1
|
||||
POLLNVAL = 0x20
|
||||
POLLOUT = 0x4
|
||||
POLLPRI = 0x2
|
||||
POLLRDBAND = 0x80
|
||||
POLLRDNORM = 0x40
|
||||
POLLWRBAND = 0x100
|
||||
POLLWRNORM = 0x4
|
||||
)
|
||||
|
||||
type Sigset_t uint32
|
||||
|
||||
type Utsname struct {
|
||||
Sysname [256]byte
|
||||
Nodename [256]byte
|
||||
Release [256]byte
|
||||
Version [256]byte
|
||||
Machine [256]byte
|
||||
}
|
||||
|
||||
const SizeofUvmexp = 0x158
|
||||
|
||||
type Uvmexp struct {
|
||||
Pagesize int32
|
||||
Pagemask int32
|
||||
Pageshift int32
|
||||
Npages int32
|
||||
Free int32
|
||||
Active int32
|
||||
Inactive int32
|
||||
Paging int32
|
||||
Wired int32
|
||||
Zeropages int32
|
||||
Reserve_pagedaemon int32
|
||||
Reserve_kernel int32
|
||||
Unused01 int32
|
||||
Vnodepages int32
|
||||
Vtextpages int32
|
||||
Freemin int32
|
||||
Freetarg int32
|
||||
Inactarg int32
|
||||
Wiredmax int32
|
||||
Anonmin int32
|
||||
Vtextmin int32
|
||||
Vnodemin int32
|
||||
Anonminpct int32
|
||||
Vtextminpct int32
|
||||
Vnodeminpct int32
|
||||
Nswapdev int32
|
||||
Swpages int32
|
||||
Swpginuse int32
|
||||
Swpgonly int32
|
||||
Nswget int32
|
||||
Nanon int32
|
||||
Unused05 int32
|
||||
Unused06 int32
|
||||
Faults int32
|
||||
Traps int32
|
||||
Intrs int32
|
||||
Swtch int32
|
||||
Softs int32
|
||||
Syscalls int32
|
||||
Pageins int32
|
||||
Unused07 int32
|
||||
Unused08 int32
|
||||
Pgswapin int32
|
||||
Pgswapout int32
|
||||
Forks int32
|
||||
Forks_ppwait int32
|
||||
Forks_sharevm int32
|
||||
Pga_zerohit int32
|
||||
Pga_zeromiss int32
|
||||
Unused09 int32
|
||||
Fltnoram int32
|
||||
Fltnoanon int32
|
||||
Fltnoamap int32
|
||||
Fltpgwait int32
|
||||
Fltpgrele int32
|
||||
Fltrelck int32
|
||||
Fltrelckok int32
|
||||
Fltanget int32
|
||||
Fltanretry int32
|
||||
Fltamcopy int32
|
||||
Fltnamap int32
|
||||
Fltnomap int32
|
||||
Fltlget int32
|
||||
Fltget int32
|
||||
Flt_anon int32
|
||||
Flt_acow int32
|
||||
Flt_obj int32
|
||||
Flt_prcopy int32
|
||||
Flt_przero int32
|
||||
Pdwoke int32
|
||||
Pdrevs int32
|
||||
Pdswout int32
|
||||
Pdfreed int32
|
||||
Pdscans int32
|
||||
Pdanscan int32
|
||||
Pdobscan int32
|
||||
Pdreact int32
|
||||
Pdbusy int32
|
||||
Pdpageouts int32
|
||||
Pdpending int32
|
||||
Pddeact int32
|
||||
Unused11 int32
|
||||
Unused12 int32
|
||||
Unused13 int32
|
||||
Fpswtch int32
|
||||
Kmapent int32
|
||||
}
|
||||
|
||||
const SizeofClockinfo = 0x10
|
||||
|
||||
type Clockinfo struct {
|
||||
Hz int32
|
||||
Tick int32
|
||||
Stathz int32
|
||||
Profhz int32
|
||||
}
|
571
vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go
generated
vendored
Normal file
571
vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go
generated
vendored
Normal file
@ -0,0 +1,571 @@
|
||||
// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
//go:build riscv64 && openbsd
|
||||
// +build riscv64,openbsd
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
SizeofPtr = 0x8
|
||||
SizeofShort = 0x2
|
||||
SizeofInt = 0x4
|
||||
SizeofLong = 0x8
|
||||
SizeofLongLong = 0x8
|
||||
)
|
||||
|
||||
type (
|
||||
_C_short int16
|
||||
_C_int int32
|
||||
_C_long int64
|
||||
_C_long_long int64
|
||||
)
|
||||
|
||||
type Timespec struct {
|
||||
Sec int64
|
||||
Nsec int64
|
||||
}
|
||||
|
||||
type Timeval struct {
|
||||
Sec int64
|
||||
Usec int64
|
||||
}
|
||||
|
||||
type Rusage struct {
|
||||
Utime Timeval
|
||||
Stime Timeval
|
||||
Maxrss int64
|
||||
Ixrss int64
|
||||
Idrss int64
|
||||
Isrss int64
|
||||
Minflt int64
|
||||
Majflt int64
|
||||
Nswap int64
|
||||
Inblock int64
|
||||
Oublock int64
|
||||
Msgsnd int64
|
||||
Msgrcv int64
|
||||
Nsignals int64
|
||||
Nvcsw int64
|
||||
Nivcsw int64
|
||||
}
|
||||
|
||||
type Rlimit struct {
|
||||
Cur uint64
|
||||
Max uint64
|
||||
}
|
||||
|
||||
type _Gid_t uint32
|
||||
|
||||
type Stat_t struct {
|
||||
Mode uint32
|
||||
Dev int32
|
||||
Ino uint64
|
||||
Nlink uint32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Rdev int32
|
||||
Atim Timespec
|
||||
Mtim Timespec
|
||||
Ctim Timespec
|
||||
Size int64
|
||||
Blocks int64
|
||||
Blksize int32
|
||||
Flags uint32
|
||||
Gen uint32
|
||||
_ Timespec
|
||||
}
|
||||
|
||||
type Statfs_t struct {
|
||||
F_flags uint32
|
||||
F_bsize uint32
|
||||
F_iosize uint32
|
||||
F_blocks uint64
|
||||
F_bfree uint64
|
||||
F_bavail int64
|
||||
F_files uint64
|
||||
F_ffree uint64
|
||||
F_favail int64
|
||||
F_syncwrites uint64
|
||||
F_syncreads uint64
|
||||
F_asyncwrites uint64
|
||||
F_asyncreads uint64
|
||||
F_fsid Fsid
|
||||
F_namemax uint32
|
||||
F_owner uint32
|
||||
F_ctime uint64
|
||||
F_fstypename [16]byte
|
||||
F_mntonname [90]byte
|
||||
F_mntfromname [90]byte
|
||||
F_mntfromspec [90]byte
|
||||
_ [2]byte
|
||||
Mount_info [160]byte
|
||||
}
|
||||
|
||||
type Flock_t struct {
|
||||
Start int64
|
||||
Len int64
|
||||
Pid int32
|
||||
Type int16
|
||||
Whence int16
|
||||
}
|
||||
|
||||
type Dirent struct {
|
||||
Fileno uint64
|
||||
Off int64
|
||||
Reclen uint16
|
||||
Type uint8
|
||||
Namlen uint8
|
||||
_ [4]uint8
|
||||
Name [256]int8
|
||||
}
|
||||
|
||||
type Fsid struct {
|
||||
Val [2]int32
|
||||
}
|
||||
|
||||
const (
|
||||
PathMax = 0x400
|
||||
)
|
||||
|
||||
type RawSockaddrInet4 struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
Addr [4]byte /* in_addr */
|
||||
Zero [8]int8
|
||||
}
|
||||
|
||||
type RawSockaddrInet6 struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Port uint16
|
||||
Flowinfo uint32
|
||||
Addr [16]byte /* in6_addr */
|
||||
Scope_id uint32
|
||||
}
|
||||
|
||||
type RawSockaddrUnix struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Path [104]int8
|
||||
}
|
||||
|
||||
type RawSockaddrDatalink struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Index uint16
|
||||
Type uint8
|
||||
Nlen uint8
|
||||
Alen uint8
|
||||
Slen uint8
|
||||
Data [24]int8
|
||||
}
|
||||
|
||||
type RawSockaddr struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Data [14]int8
|
||||
}
|
||||
|
||||
type RawSockaddrAny struct {
|
||||
Addr RawSockaddr
|
||||
Pad [92]int8
|
||||
}
|
||||
|
||||
type _Socklen uint32
|
||||
|
||||
type Linger struct {
|
||||
Onoff int32
|
||||
Linger int32
|
||||
}
|
||||
|
||||
type Iovec struct {
|
||||
Base *byte
|
||||
Len uint64
|
||||
}
|
||||
|
||||
type IPMreq struct {
|
||||
Multiaddr [4]byte /* in_addr */
|
||||
Interface [4]byte /* in_addr */
|
||||
}
|
||||
|
||||
type IPv6Mreq struct {
|
||||
Multiaddr [16]byte /* in6_addr */
|
||||
Interface uint32
|
||||
}
|
||||
|
||||
type Msghdr struct {
|
||||
Name *byte
|
||||
Namelen uint32
|
||||
Iov *Iovec
|
||||
Iovlen uint32
|
||||
Control *byte
|
||||
Controllen uint32
|
||||
Flags int32
|
||||
}
|
||||
|
||||
type Cmsghdr struct {
|
||||
Len uint32
|
||||
Level int32
|
||||
Type int32
|
||||
}
|
||||
|
||||
type Inet6Pktinfo struct {
|
||||
Addr [16]byte /* in6_addr */
|
||||
Ifindex uint32
|
||||
}
|
||||
|
||||
type IPv6MTUInfo struct {
|
||||
Addr RawSockaddrInet6
|
||||
Mtu uint32
|
||||
}
|
||||
|
||||
type ICMPv6Filter struct {
|
||||
Filt [8]uint32
|
||||
}
|
||||
|
||||
const (
|
||||
SizeofSockaddrInet4 = 0x10
|
||||
SizeofSockaddrInet6 = 0x1c
|
||||
SizeofSockaddrAny = 0x6c
|
||||
SizeofSockaddrUnix = 0x6a
|
||||
SizeofSockaddrDatalink = 0x20
|
||||
SizeofLinger = 0x8
|
||||
SizeofIovec = 0x10
|
||||
SizeofIPMreq = 0x8
|
||||
SizeofIPv6Mreq = 0x14
|
||||
SizeofMsghdr = 0x30
|
||||
SizeofCmsghdr = 0xc
|
||||
SizeofInet6Pktinfo = 0x14
|
||||
SizeofIPv6MTUInfo = 0x20
|
||||
SizeofICMPv6Filter = 0x20
|
||||
)
|
||||
|
||||
const (
|
||||
PTRACE_TRACEME = 0x0
|
||||
PTRACE_CONT = 0x7
|
||||
PTRACE_KILL = 0x8
|
||||
)
|
||||
|
||||
type Kevent_t struct {
|
||||
Ident uint64
|
||||
Filter int16
|
||||
Flags uint16
|
||||
Fflags uint32
|
||||
Data int64
|
||||
Udata *byte
|
||||
}
|
||||
|
||||
type FdSet struct {
|
||||
Bits [32]uint32
|
||||
}
|
||||
|
||||
const (
|
||||
SizeofIfMsghdr = 0xa8
|
||||
SizeofIfData = 0x90
|
||||
SizeofIfaMsghdr = 0x18
|
||||
SizeofIfAnnounceMsghdr = 0x1a
|
||||
SizeofRtMsghdr = 0x60
|
||||
SizeofRtMetrics = 0x38
|
||||
)
|
||||
|
||||
type IfMsghdr struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
Hdrlen uint16
|
||||
Index uint16
|
||||
Tableid uint16
|
||||
Pad1 uint8
|
||||
Pad2 uint8
|
||||
Addrs int32
|
||||
Flags int32
|
||||
Xflags int32
|
||||
Data IfData
|
||||
}
|
||||
|
||||
type IfData struct {
|
||||
Type uint8
|
||||
Addrlen uint8
|
||||
Hdrlen uint8
|
||||
Link_state uint8
|
||||
Mtu uint32
|
||||
Metric uint32
|
||||
Rdomain uint32
|
||||
Baudrate uint64
|
||||
Ipackets uint64
|
||||
Ierrors uint64
|
||||
Opackets uint64
|
||||
Oerrors uint64
|
||||
Collisions uint64
|
||||
Ibytes uint64
|
||||
Obytes uint64
|
||||
Imcasts uint64
|
||||
Omcasts uint64
|
||||
Iqdrops uint64
|
||||
Oqdrops uint64
|
||||
Noproto uint64
|
||||
Capabilities uint32
|
||||
Lastchange Timeval
|
||||
}
|
||||
|
||||
type IfaMsghdr struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
Hdrlen uint16
|
||||
Index uint16
|
||||
Tableid uint16
|
||||
Pad1 uint8
|
||||
Pad2 uint8
|
||||
Addrs int32
|
||||
Flags int32
|
||||
Metric int32
|
||||
}
|
||||
|
||||
type IfAnnounceMsghdr struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
Hdrlen uint16
|
||||
Index uint16
|
||||
What uint16
|
||||
Name [16]int8
|
||||
}
|
||||
|
||||
type RtMsghdr struct {
|
||||
Msglen uint16
|
||||
Version uint8
|
||||
Type uint8
|
||||
Hdrlen uint16
|
||||
Index uint16
|
||||
Tableid uint16
|
||||
Priority uint8
|
||||
Mpls uint8
|
||||
Addrs int32
|
||||
Flags int32
|
||||
Fmask int32
|
||||
Pid int32
|
||||
Seq int32
|
||||
Errno int32
|
||||
Inits uint32
|
||||
Rmx RtMetrics
|
||||
}
|
||||
|
||||
type RtMetrics struct {
|
||||
Pksent uint64
|
||||
Expire int64
|
||||
Locks uint32
|
||||
Mtu uint32
|
||||
Refcnt uint32
|
||||
Hopcount uint32
|
||||
Recvpipe uint32
|
||||
Sendpipe uint32
|
||||
Ssthresh uint32
|
||||
Rtt uint32
|
||||
Rttvar uint32
|
||||
Pad uint32
|
||||
}
|
||||
|
||||
type Mclpool struct{}
|
||||
|
||||
const (
|
||||
SizeofBpfVersion = 0x4
|
||||
SizeofBpfStat = 0x8
|
||||
SizeofBpfProgram = 0x10
|
||||
SizeofBpfInsn = 0x8
|
||||
SizeofBpfHdr = 0x18
|
||||
)
|
||||
|
||||
type BpfVersion struct {
|
||||
Major uint16
|
||||
Minor uint16
|
||||
}
|
||||
|
||||
type BpfStat struct {
|
||||
Recv uint32
|
||||
Drop uint32
|
||||
}
|
||||
|
||||
type BpfProgram struct {
|
||||
Len uint32
|
||||
Insns *BpfInsn
|
||||
}
|
||||
|
||||
type BpfInsn struct {
|
||||
Code uint16
|
||||
Jt uint8
|
||||
Jf uint8
|
||||
K uint32
|
||||
}
|
||||
|
||||
type BpfHdr struct {
|
||||
Tstamp BpfTimeval
|
||||
Caplen uint32
|
||||
Datalen uint32
|
||||
Hdrlen uint16
|
||||
Ifidx uint16
|
||||
Flowid uint16
|
||||
Flags uint8
|
||||
Drops uint8
|
||||
}
|
||||
|
||||
type BpfTimeval struct {
|
||||
Sec uint32
|
||||
Usec uint32
|
||||
}
|
||||
|
||||
type Termios struct {
|
||||
Iflag uint32
|
||||
Oflag uint32
|
||||
Cflag uint32
|
||||
Lflag uint32
|
||||
Cc [20]uint8
|
||||
Ispeed int32
|
||||
Ospeed int32
|
||||
}
|
||||
|
||||
type Winsize struct {
|
||||
Row uint16
|
||||
Col uint16
|
||||
Xpixel uint16
|
||||
Ypixel uint16
|
||||
}
|
||||
|
||||
const (
|
||||
AT_FDCWD = -0x64
|
||||
AT_EACCESS = 0x1
|
||||
AT_SYMLINK_NOFOLLOW = 0x2
|
||||
AT_SYMLINK_FOLLOW = 0x4
|
||||
AT_REMOVEDIR = 0x8
|
||||
)
|
||||
|
||||
type PollFd struct {
|
||||
Fd int32
|
||||
Events int16
|
||||
Revents int16
|
||||
}
|
||||
|
||||
const (
|
||||
POLLERR = 0x8
|
||||
POLLHUP = 0x10
|
||||
POLLIN = 0x1
|
||||
POLLNVAL = 0x20
|
||||
POLLOUT = 0x4
|
||||
POLLPRI = 0x2
|
||||
POLLRDBAND = 0x80
|
||||
POLLRDNORM = 0x40
|
||||
POLLWRBAND = 0x100
|
||||
POLLWRNORM = 0x4
|
||||
)
|
||||
|
||||
type Sigset_t uint32
|
||||
|
||||
type Utsname struct {
|
||||
Sysname [256]byte
|
||||
Nodename [256]byte
|
||||
Release [256]byte
|
||||
Version [256]byte
|
||||
Machine [256]byte
|
||||
}
|
||||
|
||||
const SizeofUvmexp = 0x158
|
||||
|
||||
type Uvmexp struct {
|
||||
Pagesize int32
|
||||
Pagemask int32
|
||||
Pageshift int32
|
||||
Npages int32
|
||||
Free int32
|
||||
Active int32
|
||||
Inactive int32
|
||||
Paging int32
|
||||
Wired int32
|
||||
Zeropages int32
|
||||
Reserve_pagedaemon int32
|
||||
Reserve_kernel int32
|
||||
Unused01 int32
|
||||
Vnodepages int32
|
||||
Vtextpages int32
|
||||
Freemin int32
|
||||
Freetarg int32
|
||||
Inactarg int32
|
||||
Wiredmax int32
|
||||
Anonmin int32
|
||||
Vtextmin int32
|
||||
Vnodemin int32
|
||||
Anonminpct int32
|
||||
Vtextminpct int32
|
||||
Vnodeminpct int32
|
||||
Nswapdev int32
|
||||
Swpages int32
|
||||
Swpginuse int32
|
||||
Swpgonly int32
|
||||
Nswget int32
|
||||
Nanon int32
|
||||
Unused05 int32
|
||||
Unused06 int32
|
||||
Faults int32
|
||||
Traps int32
|
||||
Intrs int32
|
||||
Swtch int32
|
||||
Softs int32
|
||||
Syscalls int32
|
||||
Pageins int32
|
||||
Unused07 int32
|
||||
Unused08 int32
|
||||
Pgswapin int32
|
||||
Pgswapout int32
|
||||
Forks int32
|
||||
Forks_ppwait int32
|
||||
Forks_sharevm int32
|
||||
Pga_zerohit int32
|
||||
Pga_zeromiss int32
|
||||
Unused09 int32
|
||||
Fltnoram int32
|
||||
Fltnoanon int32
|
||||
Fltnoamap int32
|
||||
Fltpgwait int32
|
||||
Fltpgrele int32
|
||||
Fltrelck int32
|
||||
Fltrelckok int32
|
||||
Fltanget int32
|
||||
Fltanretry int32
|
||||
Fltamcopy int32
|
||||
Fltnamap int32
|
||||
Fltnomap int32
|
||||
Fltlget int32
|
||||
Fltget int32
|
||||
Flt_anon int32
|
||||
Flt_acow int32
|
||||
Flt_obj int32
|
||||
Flt_prcopy int32
|
||||
Flt_przero int32
|
||||
Pdwoke int32
|
||||
Pdrevs int32
|
||||
Pdswout int32
|
||||
Pdfreed int32
|
||||
Pdscans int32
|
||||
Pdanscan int32
|
||||
Pdobscan int32
|
||||
Pdreact int32
|
||||
Pdbusy int32
|
||||
Pdpageouts int32
|
||||
Pdpending int32
|
||||
Pddeact int32
|
||||
Unused11 int32
|
||||
Unused12 int32
|
||||
Unused13 int32
|
||||
Fpswtch int32
|
||||
Kmapent int32
|
||||
}
|
||||
|
||||
const SizeofClockinfo = 0x10
|
||||
|
||||
type Clockinfo struct {
|
||||
Hz int32
|
||||
Tick int32
|
||||
Stathz int32
|
||||
Profhz int32
|
||||
}
|
Loading…
Reference in New Issue
Block a user