WIP: Save agent roles integration work before CHORUS rebrand

- Agent roles and coordination features
- Chat API integration testing
- New configuration and workspace management

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-08-01 02:21:11 +10:00
parent 81b473d48f
commit 5978a0b8f5
3713 changed files with 1103925 additions and 59 deletions

22
vendor/github.com/marten-seemann/tcp/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,22 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe

16
vendor/github.com/marten-seemann/tcp/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,16 @@
language: go
os:
- linux
- osx
go:
- 1.11.6
- 1.12.1
- tip
script:
- go test -v -race
notifications:
email: false

23
vendor/github.com/marten-seemann/tcp/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,23 @@
Copyright (c) 2014, Mikio Hara
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.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

6
vendor/github.com/marten-seemann/tcp/README.md generated vendored Normal file
View File

@@ -0,0 +1,6 @@
Package tcp provides TCP-level socket options that allow manipulation of TCP connection facilities.
[![GoDoc](https://godoc.org/github.com/mikioh/tcp?status.png)](https://godoc.org/github.com/mikioh/tcp)
[![Build Status](https://travis-ci.org/mikioh/tcp.svg?branch=master)](https://travis-ci.org/mikioh/tcp)
[![Build status](https://ci.appveyor.com/api/projects/status/q8ejg9mvstq23j3r?svg=true)](https://ci.appveyor.com/project/mikioh/tcp)
[![Go Report Card](https://goreportcard.com/badge/github.com/mikioh/tcp)](https://goreportcard.com/report/github.com/mikioh/tcp)

19
vendor/github.com/marten-seemann/tcp/appveyor.yml generated vendored Normal file
View File

@@ -0,0 +1,19 @@
version: "{build}"
branches:
only:
- master
environment:
GOPATH: c:\gopath
install:
- set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
- mkdir c:\gopath
- go get github.com/mikioh/tcp
- go get github.com/mikioh/tcpopt
- go get github.com/mikioh/tcpinfo
- go get golang.org/x/net/nettest
build_script:
- go test -v -race

82
vendor/github.com/marten-seemann/tcp/conn.go generated vendored Normal file
View File

@@ -0,0 +1,82 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"net"
"syscall"
"github.com/mikioh/tcpopt"
)
var _ net.Conn = &Conn{}
// SetOption sets a socket option.
func (c *Conn) SetOption(o tcpopt.Option) error {
if !c.ok() {
return syscall.EINVAL
}
b, err := o.Marshal()
if err != nil {
return &net.OpError{Op: "raw-control", Net: c.LocalAddr().Network(), Source: nil, Addr: c.LocalAddr(), Err: err}
}
if err := c.setOption(o.Level(), o.Name(), b); err != nil {
return &net.OpError{Op: "raw-control", Net: c.LocalAddr().Network(), Source: nil, Addr: c.LocalAddr(), Err: err}
}
return nil
}
// Option returns a socket option.
func (c *Conn) Option(level, name int, b []byte) (tcpopt.Option, error) {
if !c.ok() || len(b) == 0 {
return nil, syscall.EINVAL
}
n, err := c.option(level, name, b)
if err != nil {
return nil, &net.OpError{Op: "raw-control", Net: c.LocalAddr().Network(), Source: nil, Addr: c.LocalAddr(), Err: err}
}
o, err := tcpopt.Parse(level, name, b[:n])
if err != nil {
return nil, &net.OpError{Op: "raw-control", Net: c.LocalAddr().Network(), Source: nil, Addr: c.LocalAddr(), Err: err}
}
return o, nil
}
// Buffered returns the number of bytes that can be read from the
// underlying socket read buffer.
// It returns -1 when the platform doesn't support this feature.
func (c *Conn) Buffered() int {
if !c.ok() {
return -1
}
return c.buffered()
}
// Available returns how many bytes are unused in the underlying
// socket write buffer.
// It returns -1 when the platform doesn't support this feature.
func (c *Conn) Available() int {
if !c.ok() {
return -1
}
return c.available()
}
// OriginalDst returns an original destination address, which is an
// address not modified by intermediate entities such as network
// address and port translators inside the kernel, on the connection.
//
// Only Linux and BSD variants using PF support this feature.
func (c *Conn) OriginalDst() (net.Addr, error) {
if !c.ok() {
return nil, syscall.EINVAL
}
la := c.LocalAddr().(*net.TCPAddr)
od, err := c.originalDst(la, c.RemoteAddr().(*net.TCPAddr))
if err != nil {
return nil, &net.OpError{Op: "raw-control", Net: c.LocalAddr().Network(), Source: nil, Addr: la, Err: err}
}
return od, nil
}

59
vendor/github.com/marten-seemann/tcp/conn_bsd.go generated vendored Normal file
View File

@@ -0,0 +1,59 @@
// Copyright 2016 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd openbsd
package tcp
import (
"net"
"os"
"syscall"
"unsafe"
)
func (*Conn) originalDst(la, ra *net.TCPAddr) (net.Addr, error) {
f, err := os.Open("/dev/pf")
if err != nil {
return nil, err
}
defer f.Close()
fd := f.Fd()
b := make([]byte, sizeofPfiocNatlook)
nl := (*pfiocNatlook)(unsafe.Pointer(&b[0]))
if ra.IP.To4() != nil {
copy(nl.Saddr[:net.IPv4len], ra.IP.To4())
copy(nl.Daddr[:net.IPv4len], la.IP.To4())
nl.Af = sysAF_INET
}
if ra.IP.To16() != nil && ra.IP.To4() == nil {
copy(nl.Saddr[:], ra.IP)
copy(nl.Daddr[:], la.IP)
nl.Af = sysAF_INET6
}
nl.setPort(ra.Port, la.Port)
nl.Proto = ianaProtocolTCP
ioc := uintptr(sysDIOCNATLOOK)
for _, dir := range []byte{sysPF_OUT, sysPF_IN} {
nl.Direction = dir
err = ioctl(fd, int(ioc), b)
if err == nil || err != syscall.ENOENT {
break
}
}
if err != nil {
return nil, os.NewSyscallError("ioctl", err)
}
od := new(net.TCPAddr)
od.Port = nl.rdPort()
switch nl.Af {
case sysAF_INET:
od.IP = make(net.IP, net.IPv4len)
copy(od.IP, nl.Rdaddr[:net.IPv4len])
case sysAF_INET6:
od.IP = make(net.IP, net.IPv6len)
copy(od.IP, nl.Rdaddr[:])
}
return od, nil
}

44
vendor/github.com/marten-seemann/tcp/conn_linux.go generated vendored Normal file
View File

@@ -0,0 +1,44 @@
// Copyright 2016 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"encoding/binary"
"net"
"unsafe"
)
func (c *Conn) originalDst(la, _ *net.TCPAddr) (net.Addr, error) {
var level, name int
var b []byte
if la.IP.To4() != nil {
level = ianaProtocolIP
name = sysSO_ORIGINAL_DST
b = make([]byte, sizeofSockaddrInet)
}
if la.IP.To16() != nil && la.IP.To4() == nil {
level = ianaProtocolIPv6
name = sysIP6T_SO_ORIGINAL_DST
b = make([]byte, sizeofSockaddrInet6)
}
if _, err := c.option(level, name, b); err != nil {
return nil, err
}
od := new(net.TCPAddr)
switch len(b) {
case sizeofSockaddrInet:
sa := (*sockaddrInet)(unsafe.Pointer(&b[0]))
od.IP = make(net.IP, net.IPv4len)
copy(od.IP, sa.Addr[:])
od.Port = int(binary.BigEndian.Uint16((*[2]byte)(unsafe.Pointer(&sa.Port))[:]))
case sizeofSockaddrInet6:
sa := (*sockaddrInet6)(unsafe.Pointer(&b[0]))
od.IP = make(net.IP, net.IPv6len)
copy(od.IP, sa.Addr[:])
od.Port = int(binary.BigEndian.Uint16((*[2]byte)(unsafe.Pointer(&sa.Port))[:]))
od.Zone = zoneCache.name(int(sa.Scope_id))
}
return od, nil
}

16
vendor/github.com/marten-seemann/tcp/conn_stub.go generated vendored Normal file
View File

@@ -0,0 +1,16 @@
// Copyright 2016 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !darwin,!dragonfly,!freebsd,!linux,!openbsd
package tcp
import (
"errors"
"net"
)
func (c *Conn) originalDst(la, ra *net.TCPAddr) (net.Addr, error) {
return nil, errors.New("not implemented")
}

9
vendor/github.com/marten-seemann/tcp/doc.go generated vendored Normal file
View File

@@ -0,0 +1,9 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package tcp implements TCP-level socket options.
//
// The package provides TCP-level socket options that allow
// manipulation of TCP connection facilities.
package tcp

73
vendor/github.com/marten-seemann/tcp/ipv6zone.go generated vendored Normal file
View File

@@ -0,0 +1,73 @@
// Copyright 2016 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"fmt"
"net"
"strconv"
"sync"
"time"
)
type ipv6ZoneCache struct {
sync.RWMutex
lastFetched time.Time
toIndex map[string]int
toName map[int]string
}
var zoneCache = ipv6ZoneCache{
toIndex: make(map[string]int),
toName: make(map[int]string),
}
func (zc *ipv6ZoneCache) index(name string) int {
if name == "" {
return 0
}
zc.update()
zc.RLock()
defer zc.RUnlock()
index, ok := zc.toIndex[name]
if !ok {
index, _ = strconv.Atoi(name)
}
return index
}
func (zc *ipv6ZoneCache) name(index int) string {
if index == 0 {
return ""
}
zc.update()
zc.RLock()
defer zc.RUnlock()
name, ok := zc.toName[index]
if !ok {
name = fmt.Sprintf("%d", index)
}
return name
}
func (zc *ipv6ZoneCache) update() {
zc.Lock()
defer zc.Unlock()
now := time.Now()
if zc.lastFetched.After(now.Add(-60 * time.Second)) {
return
}
zc.lastFetched = now
ift, err := net.Interfaces()
if err != nil {
return
}
zc.toIndex = make(map[string]int, len(ift))
zc.toName = make(map[int]string, len(ift))
for _, ifi := range ift {
zc.toIndex[ifi.Name] = ifi.Index
zc.toName[ifi.Index] = ifi.Name
}
}

117
vendor/github.com/marten-seemann/tcp/rawconn.go generated vendored Normal file
View File

@@ -0,0 +1,117 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"errors"
"net"
"os"
"runtime"
"syscall"
"github.com/mikioh/tcpopt"
)
// A Conn represents an end point that uses TCP connection.
// It allows to set non-portable, platform-dependent TCP-level socket
// options.
type Conn struct {
net.Conn
c syscall.RawConn
}
func (c *Conn) ok() bool { return c != nil && c.Conn != nil && c.c != nil }
func (c *Conn) setOption(level, name int, b []byte) error {
var operr error
fn := func(s uintptr) {
operr = setsockopt(s, level, name, b)
}
if err := c.c.Control(fn); err != nil {
return err
}
return os.NewSyscallError("setsockopt", operr)
}
func (c *Conn) option(level, name int, b []byte) (int, error) {
var operr error
var n int
fn := func(s uintptr) {
n, operr = getsockopt(s, level, name, b)
}
if err := c.c.Control(fn); err != nil {
return 0, err
}
return n, os.NewSyscallError("getsockopt", operr)
}
func (c *Conn) buffered() int {
var operr error
var n int
fn := func(s uintptr) {
var b [4]byte
operr = ioctl(s, options[soBuffered].name, b[:])
if operr != nil {
return
}
n = int(nativeEndian.Uint32(b[:]))
}
err := c.c.Control(fn)
if err != nil || operr != nil {
return -1
}
return n
}
func (c *Conn) available() int {
var operr error
var n int
fn := func(s uintptr) {
var b [4]byte
if runtime.GOOS == "darwin" {
_, operr = getsockopt(s, options[soAvailable].level, options[soAvailable].name, b[:])
} else {
operr = ioctl(s, options[soAvailable].name, b[:])
}
if operr != nil {
return
}
n = int(nativeEndian.Uint32(b[:]))
if runtime.GOOS == "darwin" || runtime.GOOS == "linux" {
var o tcpopt.SendBuffer
_, operr = getsockopt(s, o.Level(), o.Name(), b[:])
if operr != nil {
return
}
n = int(nativeEndian.Uint32(b[:])) - n
}
}
err := c.c.Control(fn)
if err != nil || operr != nil {
return -1
}
return n
}
// NewConn returns a new end point.
func NewConn(c net.Conn) (*Conn, error) {
type tcpConn interface {
SyscallConn() (syscall.RawConn, error)
SetLinger(int) error
}
var _ tcpConn = &net.TCPConn{}
cc := &Conn{Conn: c}
switch c := c.(type) {
case tcpConn:
var err error
cc.c, err = c.SyscallConn()
if err != nil {
return nil, err
}
return cc, nil
default:
return nil, errors.New("unknown connection type")
}
}

39
vendor/github.com/marten-seemann/tcp/sys.go generated vendored Normal file
View File

@@ -0,0 +1,39 @@
// Copyright 2016 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"encoding/binary"
"unsafe"
)
var nativeEndian binary.ByteOrder
func init() {
i := uint32(1)
b := (*[4]byte)(unsafe.Pointer(&i))
if b[0] == 1 {
nativeEndian = binary.LittleEndian
} else {
nativeEndian = binary.BigEndian
}
}
const (
ianaProtocolIP = 0x0
ianaProtocolTCP = 0x6
ianaProtocolIPv6 = 0x29
)
const (
soBuffered = iota
soAvailable
soMax
)
type option struct {
level int // option level
name int // option name, must be equal or greater than 1
}

24
vendor/github.com/marten-seemann/tcp/sys_darwin.go generated vendored Normal file
View File

@@ -0,0 +1,24 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"encoding/binary"
"unsafe"
)
var options = [soMax]option{
soBuffered: {0, sysFIONREAD},
soAvailable: {sysSOL_SOCKET, sysSO_NWRITE},
}
func (nl *pfiocNatlook) rdPort() int {
return int(binary.BigEndian.Uint16(nl.Rdxport[:2]))
}
func (nl *pfiocNatlook) setPort(remote, local int) {
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Sxport))[:2], uint16(remote))
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Dxport))[:2], uint16(local))
}

23
vendor/github.com/marten-seemann/tcp/sys_dragonfly.go generated vendored Normal file
View File

@@ -0,0 +1,23 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"encoding/binary"
"unsafe"
)
var options = [soMax]option{
soBuffered: {0, sysFIONREAD},
}
func (nl *pfiocNatlook) rdPort() int {
return int(binary.BigEndian.Uint16((*[2]byte)(unsafe.Pointer(&nl.Rdport))[:]))
}
func (nl *pfiocNatlook) setPort(remote, local int) {
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Sport))[:], uint16(remote))
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Dport))[:], uint16(local))
}

24
vendor/github.com/marten-seemann/tcp/sys_freebsd.go generated vendored Normal file
View File

@@ -0,0 +1,24 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"encoding/binary"
"unsafe"
)
var options = [soMax]option{
soBuffered: {0, sysFIONREAD},
soAvailable: {0, sysFIONSPACE},
}
func (nl *pfiocNatlook) rdPort() int {
return int(binary.BigEndian.Uint16((*[2]byte)(unsafe.Pointer(&nl.Rdport))[:]))
}
func (nl *pfiocNatlook) setPort(remote, local int) {
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Sport))[:], uint16(remote))
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Dport))[:], uint16(local))
}

10
vendor/github.com/marten-seemann/tcp/sys_linux.go generated vendored Normal file
View File

@@ -0,0 +1,10 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
var options = [soMax]option{
soBuffered: {0, sysSIOCINQ},
soAvailable: {0, sysSIOCOUTQ},
}

44
vendor/github.com/marten-seemann/tcp/sys_linux_386.go generated vendored Normal file
View File

@@ -0,0 +1,44 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"syscall"
"unsafe"
)
const (
sysSIOCINQ = 0x541b
sysSIOCOUTQ = 0x5411
)
func ioctl(s uintptr, ioc int, b []byte) error {
if _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, s, uintptr(ioc), uintptr(unsafe.Pointer(&b[0]))); errno != 0 {
return error(errno)
}
return nil
}
const (
sysSETSOCKOPT = 0xe
sysGETSOCKOPT = 0xf
)
func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
func setsockopt(s uintptr, level, name int, b []byte) error {
if _, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0); errno != 0 {
return error(errno)
}
return nil
}
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
l := uint32(len(b))
if _, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0); errno != 0 {
return int(l), error(errno)
}
return int(l), nil
}

8
vendor/github.com/marten-seemann/tcp/sys_linux_386.s generated vendored Normal file
View File

@@ -0,0 +1,8 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
TEXT ·socketcall(SB),NOSPLIT,$0-36
JMP syscall·socketcall(SB)

View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x541b
sysSIOCOUTQ = 0x5411
)

10
vendor/github.com/marten-seemann/tcp/sys_linux_arm.go generated vendored Normal file
View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x541b
sysSIOCOUTQ = 0x5411
)

View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x541b
sysSIOCOUTQ = 0x5411
)

10
vendor/github.com/marten-seemann/tcp/sys_linux_mips.go generated vendored Normal file
View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x467f
sysSIOCOUTQ = 0x7472
)

View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x467f
sysSIOCOUTQ = 0x7472
)

View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x467f
sysSIOCOUTQ = 0x7472
)

View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x467f
sysSIOCOUTQ = 0x7472
)

View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x4004667f
sysSIOCOUTQ = 0x40047473
)

View File

@@ -0,0 +1,10 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
const (
sysSIOCINQ = 0x4004667f
sysSIOCOUTQ = 0x40047473
)

View File

@@ -0,0 +1,44 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"syscall"
"unsafe"
)
const (
sysSIOCINQ = 0x541b
sysSIOCOUTQ = 0x5411
)
func ioctl(s uintptr, ioc int, b []byte) error {
if _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, s, uintptr(ioc), uintptr(unsafe.Pointer(&b[0]))); errno != 0 {
return error(errno)
}
return nil
}
const (
sysSETSOCKOPT = 0xe
sysGETSOCKOPT = 0xf
)
func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
func setsockopt(s uintptr, level, name int, b []byte) error {
if _, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0); errno != 0 {
return error(errno)
}
return nil
}
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
l := uint32(len(b))
if _, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0); errno != 0 {
return int(l), error(errno)
}
return int(l), nil
}

View File

@@ -0,0 +1,8 @@
// Copyright 2017 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
TEXT ·socketcall(SB),NOSPLIT,$0-72
JMP syscall·socketcall(SB)

10
vendor/github.com/marten-seemann/tcp/sys_netbsd.go generated vendored Normal file
View File

@@ -0,0 +1,10 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
var options = [soMax]option{
soBuffered: {0, sysFIONREAD},
soAvailable: {0, sysFIONSPACE},
}

23
vendor/github.com/marten-seemann/tcp/sys_openbsd.go generated vendored Normal file
View File

@@ -0,0 +1,23 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"encoding/binary"
"unsafe"
)
var options = [soMax]option{
soBuffered: {0, sysFIONREAD},
}
func (nl *pfiocNatlook) rdPort() int {
return int(binary.BigEndian.Uint16((*[2]byte)(unsafe.Pointer(&nl.Rdport))[:]))
}
func (nl *pfiocNatlook) setPort(remote, local int) {
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Sport))[:], uint16(remote))
binary.BigEndian.PutUint16((*[2]byte)(unsafe.Pointer(&nl.Dport))[:], uint16(local))
}

49
vendor/github.com/marten-seemann/tcp/sys_solaris.go generated vendored Normal file
View File

@@ -0,0 +1,49 @@
// Copyright 2016 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"syscall"
"unsafe"
)
var options [soMax]option
func rtioctl(s uintptr, ioc uintptr, arg uintptr) syscall.Errno
func ioctl(s uintptr, ioc int, b []byte) error {
if errno := rtioctl(s, uintptr(ioc), uintptr(unsafe.Pointer(&b[0]))); errno != 0 {
return error(errno)
}
return nil
}
//go:cgo_import_dynamic libcGetsockopt __xnet_getsockopt "libsocket.so"
//go:cgo_import_dynamic libcSetsockopt setsockopt "libsocket.so"
//go:linkname libcGetsockopt libcGetsockopt
//go:linkname libcSetsockopt libcSetsockopt
var (
libcGetsockopt uintptr
libcSetsockopt uintptr
)
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno)
func setsockopt(s uintptr, level, name int, b []byte) error {
if _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&libcSetsockopt)), 5, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0); errno != 0 {
return error(errno)
}
return nil
}
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
l := uint32(len(b))
if _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&libcGetsockopt)), 5, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0); errno != 0 {
return int(l), error(errno)
}
return int(l), nil
}

View File

@@ -0,0 +1,11 @@
// Copyright 2016 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
TEXT ·rtioctl(SB),NOSPLIT,$0
JMP runtime·syscall_ioctl(SB)
TEXT ·sysvicall6(SB),NOSPLIT,$0-88
JMP syscall·sysvicall6(SB)

23
vendor/github.com/marten-seemann/tcp/sys_stub.go generated vendored Normal file
View File

@@ -0,0 +1,23 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
package tcp
import "errors"
var options [soMax]option
func ioctl(s uintptr, ioc int, b []byte) error {
return errors.New("not implemented")
}
func setsockopt(s uintptr, level, name int, b []byte) error {
return errors.New("not implemented")
}
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
return 0, errors.New("not implemented")
}

34
vendor/github.com/marten-seemann/tcp/sys_unix.go generated vendored Normal file
View File

@@ -0,0 +1,34 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux,!s390x,!386 netbsd openbsd
package tcp
import (
"syscall"
"unsafe"
)
func ioctl(s uintptr, ioc int, b []byte) error {
if _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, s, uintptr(ioc), uintptr(unsafe.Pointer(&b[0]))); errno != 0 {
return error(errno)
}
return nil
}
func setsockopt(s uintptr, level, name int, b []byte) error {
if _, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0); errno != 0 {
return error(errno)
}
return nil
}
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
l := uint32(len(b))
if _, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0); errno != 0 {
return int(l), error(errno)
}
return int(l), nil
}

73
vendor/github.com/marten-seemann/tcp/sys_windows.go generated vendored Normal file
View File

@@ -0,0 +1,73 @@
// Copyright 2014 Mikio Hara. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tcp
import (
"errors"
"os"
"sync"
"syscall"
"time"
"unsafe"
"github.com/mikioh/tcpopt"
)
var options [soMax]option
func ioctl(s uintptr, ioc int, b []byte) error {
return errors.New("not implemented")
}
var keepAlive = struct {
sync.RWMutex
syscall.TCPKeepalive
}{
TCPKeepalive: syscall.TCPKeepalive{
OnOff: 1,
Time: uint32(2 * time.Hour / time.Millisecond),
Interval: uint32(time.Second / time.Millisecond),
},
}
func setsockopt(s uintptr, level, name int, b []byte) error {
var kai tcpopt.KeepAliveIdleInterval
var kap tcpopt.KeepAliveProbeInterval
if level == kai.Level() && name == kai.Name() {
keepAlive.Lock()
defer keepAlive.Unlock()
prev := keepAlive.Time
keepAlive.Time = nativeEndian.Uint32(b)
rv := uint32(0)
siz := uint32(unsafe.Sizeof(keepAlive))
if err := syscall.WSAIoctl(syscall.Handle(s), syscall.SIO_KEEPALIVE_VALS, (*byte)(unsafe.Pointer(&keepAlive)), siz, nil, 0, &rv, nil, 0); err != nil {
keepAlive.Time = prev
return os.NewSyscallError("wsaioctl", err)
}
return nil
}
if level == kap.Level() && name == kap.Name() {
keepAlive.Lock()
defer keepAlive.Unlock()
prev := keepAlive.Interval
keepAlive.Interval = nativeEndian.Uint32(b)
rv := uint32(0)
siz := uint32(unsafe.Sizeof(keepAlive))
if err := syscall.WSAIoctl(syscall.Handle(s), syscall.SIO_KEEPALIVE_VALS, (*byte)(unsafe.Pointer(&keepAlive)), siz, nil, 0, &rv, nil, 0); err != nil {
keepAlive.Interval = prev
return os.NewSyscallError("wsaioctl", err)
}
return nil
}
if len(b) == 4 {
v := int(nativeEndian.Uint32(b))
return syscall.SetsockoptInt(syscall.Handle(s), level, name, v)
}
return errors.New("not implemented")
}
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
return 0, errors.New("not implemented")
}

77
vendor/github.com/marten-seemann/tcp/zsys_darwin.go generated vendored Normal file
View File

@@ -0,0 +1,77 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs defs_darwin.go
package tcp
const (
sysSOL_SOCKET = 0xffff
sysFIONREAD = 0x4004667f
sysSO_NREAD = 0x1020
sysSO_NWRITE = 0x1024
sysSO_NUMRCVPKT = 0x1112
sysAF_INET = 0x2
sysAF_INET6 = 0x1e
sysPF_INOUT = 0
sysPF_IN = 1
sysPF_OUT = 2
sysDIOCNATLOOK = 0xc0544417
)
type sockaddrStorage struct {
Len uint8
Family uint8
X__ss_pad1 [6]int8
X__ss_align int64
X__ss_pad2 [112]int8
}
type sockaddr struct {
Len uint8
Family uint8
Data [14]int8
}
type sockaddrInet struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]int8
}
type sockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type pfiocNatlook struct {
Saddr [16]byte /* pf_addr */
Daddr [16]byte /* pf_addr */
Rsaddr [16]byte /* pf_addr */
Rdaddr [16]byte /* pf_addr */
Sxport [4]byte
Dxport [4]byte
Rsxport [4]byte
Rdxport [4]byte
Af uint8
Proto uint8
Variant uint8
Direction uint8
}
const (
sizeofSockaddrStorage = 0x80
sizeofSockaddr = 0x10
sizeofSockaddrInet = 0x10
sizeofSockaddrInet6 = 0x1c
sizeofPfiocNatlook = 0x54
)

71
vendor/github.com/marten-seemann/tcp/zsys_dragonfly.go generated vendored Normal file
View File

@@ -0,0 +1,71 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs defs_dragonfly.go
package tcp
const (
sysFIONREAD = 0x4004667f
sysAF_INET = 0x2
sysAF_INET6 = 0x1c
sysPF_INOUT = 0x0
sysPF_IN = 0x1
sysPF_OUT = 0x2
sysDIOCNATLOOK = 0xc04c4417
)
type sockaddrStorage struct {
Len uint8
Family uint8
X__ss_pad1 [6]int8
X__ss_align int64
X__ss_pad2 [112]int8
}
type sockaddr struct {
Len uint8
Family uint8
Data [14]int8
}
type sockaddrInet struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]int8
}
type sockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type pfiocNatlook struct {
Saddr [16]byte /* pf_addr */
Daddr [16]byte /* pf_addr */
Rsaddr [16]byte /* pf_addr */
Rdaddr [16]byte /* pf_addr */
Sport uint16
Dport uint16
Rsport uint16
Rdport uint16
Af uint8
Proto uint8
Direction uint8
Pad_cgo_0 [1]byte
}
const (
sizeofSockaddrStorage = 0x80
sizeofSockaddr = 0x10
sizeofSockaddrInet = 0x10
sizeofSockaddrInet6 = 0x1c
sizeofPfiocNatlook = 0x4c
)

74
vendor/github.com/marten-seemann/tcp/zsys_freebsd.go generated vendored Normal file
View File

@@ -0,0 +1,74 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs defs_freebsd.go
package tcp
const (
sysFIONREAD = 0x4004667f
sysFIONWRITE = 0x40046677
sysFIONSPACE = 0x40046676
sysAF_INET = 0x2
sysAF_INET6 = 0x1c
sysPF_INOUT = 0x0
sysPF_IN = 0x1
sysPF_OUT = 0x2
sysPF_FWD = 0x3
sysDIOCNATLOOK = 0xc04c4417
)
type sockaddrStorage struct {
Len uint8
Family uint8
X__ss_pad1 [6]int8
X__ss_align int64
X__ss_pad2 [112]int8
}
type sockaddr struct {
Len uint8
Family uint8
Data [14]int8
}
type sockaddrInet struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]int8
}
type sockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type pfiocNatlook struct {
Saddr [16]byte /* pf_addr */
Daddr [16]byte /* pf_addr */
Rsaddr [16]byte /* pf_addr */
Rdaddr [16]byte /* pf_addr */
Sport uint16
Dport uint16
Rsport uint16
Rdport uint16
Af uint8
Proto uint8
Direction uint8
Pad_cgo_0 [1]byte
}
const (
sizeofSockaddrStorage = 0x80
sizeofSockaddr = 0x10
sizeofSockaddrInet = 0x10
sizeofSockaddrInet6 = 0x1c
sizeofPfiocNatlook = 0x4c
)

42
vendor/github.com/marten-seemann/tcp/zsys_linux.go generated vendored Normal file
View File

@@ -0,0 +1,42 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs defs_linux.go
package tcp
const (
sysSO_ORIGINAL_DST = 0x50
sysIP6T_SO_ORIGINAL_DST = 0x50
)
type sockaddrStorage struct {
Family uint16
X__ss_padding [118]int8
X__ss_align uint64
}
type sockaddr struct {
Family uint16
Data [14]int8
}
type sockaddrInet struct {
Family uint16
Port uint16
Addr [4]byte /* in_addr */
X__pad [8]uint8
}
type sockaddrInet6 struct {
Family uint16
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
const (
sizeofSockaddrStorage = 0x80
sizeofSockaddr = 0x10
sizeofSockaddrInet = 0x10
sizeofSockaddrInet6 = 0x1c
)

10
vendor/github.com/marten-seemann/tcp/zsys_netbsd.go generated vendored Normal file
View File

@@ -0,0 +1,10 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs defs_netbsd.go
package tcp
const (
sysFIONREAD = 0x4004667f
sysFIONWRITE = 0x40046679
sysFIONSPACE = 0x40046678
)

74
vendor/github.com/marten-seemann/tcp/zsys_openbsd.go generated vendored Normal file
View File

@@ -0,0 +1,74 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs defs_openbsd.go
package tcp
const (
sysFIONREAD = 0x4004667f
sysAF_INET = 0x2
sysAF_INET6 = 0x18
sysPF_INOUT = 0x0
sysPF_IN = 0x1
sysPF_OUT = 0x2
sysPF_FWD = 0x3
sysDIOCNATLOOK = 0xc0504417
)
type sockaddrStorage struct {
Len uint8
Family uint8
X__ss_pad1 [6]uint8
X__ss_pad2 uint64
X__ss_pad3 [240]uint8
}
type sockaddr struct {
Len uint8
Family uint8
Data [14]int8
}
type sockaddrInet struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]int8
}
type sockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type pfiocNatlook struct {
Saddr [16]byte /* pf_addr */
Daddr [16]byte /* pf_addr */
Rsaddr [16]byte /* pf_addr */
Rdaddr [16]byte /* pf_addr */
Rdomain uint16
Rrdomain uint16
Sport uint16
Dport uint16
Rsport uint16
Rdport uint16
Af uint8
Proto uint8
Direction uint8
Pad_cgo_0 [1]byte
}
const (
sizeofSockaddrStorage = 0x100
sizeofSockaddr = 0x10
sizeofSockaddrInet = 0x10
sizeofSockaddrInet6 = 0x1c
sizeofPfiocNatlook = 0x50
)