Integrate BACKBEAT SDK and resolve KACHING license validation
Major integrations and fixes: - Added BACKBEAT SDK integration for P2P operation timing - Implemented beat-aware status tracking for distributed operations - Added Docker secrets support for secure license management - Resolved KACHING license validation via HTTPS/TLS - Updated docker-compose configuration for clean stack deployment - Disabled rollback policies to prevent deployment failures - Added license credential storage (CHORUS-DEV-MULTI-001) Technical improvements: - BACKBEAT P2P operation tracking with phase management - Enhanced configuration system with file-based secrets - Improved error handling for license validation - Clean separation of KACHING and CHORUS deployment stacks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
24
vendor/github.com/mikioh/tcpopt/.gitignore
generated
vendored
Normal file
24
vendor/github.com/mikioh/tcpopt/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
16
vendor/github.com/mikioh/tcpopt/.travis.yml
generated
vendored
Normal file
16
vendor/github.com/mikioh/tcpopt/.travis.yml
generated
vendored
Normal 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/mikioh/tcpopt/LICENSE
generated
vendored
Normal file
23
vendor/github.com/mikioh/tcpopt/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright (c) 2016, 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/mikioh/tcpopt/README.md
generated
vendored
Normal file
6
vendor/github.com/mikioh/tcpopt/README.md
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
Package tcpopt implements encoding and decoding of TCP-level socket options.
|
||||
|
||||
[](https://godoc.org/github.com/mikioh/tcpopt)
|
||||
[](https://travis-ci.org/mikioh/tcpopt)
|
||||
[](https://ci.appveyor.com/project/mikioh/tcpopt)
|
||||
[](https://goreportcard.com/report/github.com/mikioh/tcpopt)
|
||||
18
vendor/github.com/mikioh/tcpopt/appveyor.yml
generated
vendored
Normal file
18
vendor/github.com/mikioh/tcpopt/appveyor.yml
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
|
||||
build_script:
|
||||
- go test -v -race
|
||||
7
vendor/github.com/mikioh/tcpopt/doc.go
generated
vendored
Normal file
7
vendor/github.com/mikioh/tcpopt/doc.go
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// 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 tcpopt implements encoding and decoding of TCP-level socket
|
||||
// options.
|
||||
package tcpopt
|
||||
150
vendor/github.com/mikioh/tcpopt/option.go
generated
vendored
Normal file
150
vendor/github.com/mikioh/tcpopt/option.go
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
// 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 tcpopt
|
||||
|
||||
import "time"
|
||||
|
||||
// An Option represents a socket option.
|
||||
type Option interface {
|
||||
// Level returns the platform-specific socket option level.
|
||||
Level() int
|
||||
|
||||
// Name returns the platform-specific socket option name.
|
||||
Name() int
|
||||
|
||||
// Marshal returns the binary encoding of socket option.
|
||||
Marshal() ([]byte, error)
|
||||
}
|
||||
|
||||
// NoDelay specifies the use of Nagle's algorithm.
|
||||
type NoDelay bool
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (nd NoDelay) Level() int { return options[soNodelay].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (nd NoDelay) Name() int { return options[soNodelay].name }
|
||||
|
||||
// MSS specifies the maximum segment size.
|
||||
type MSS int
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (mss MSS) Level() int { return options[soMaxseg].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (mss MSS) Name() int { return options[soMaxseg].name }
|
||||
|
||||
// SendBuffer specifies the size of send buffer.
|
||||
type SendBuffer int
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (sb SendBuffer) Level() int { return options[soSndbuf].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (sb SendBuffer) Name() int { return options[soSndbuf].name }
|
||||
|
||||
// ReceiveBuffer specifies the size of receive buffer.
|
||||
type ReceiveBuffer int
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (rb ReceiveBuffer) Level() int { return options[soRcvbuf].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (rb ReceiveBuffer) Name() int { return options[soRcvbuf].name }
|
||||
|
||||
// KeepAlive specifies the use of keep alive.
|
||||
type KeepAlive bool
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (ka KeepAlive) Level() int { return options[soKeepalive].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (ka KeepAlive) Name() int { return options[soKeepalive].name }
|
||||
|
||||
// KeepAliveIdleInterval is the idle interval until the first probe is
|
||||
// sent.
|
||||
//
|
||||
// OpenBSD doesn't support this option.
|
||||
// See TCP_KEEPIDLE or TCP_KEEPALIVE for further information.
|
||||
type KeepAliveIdleInterval time.Duration
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (ka KeepAliveIdleInterval) Level() int { return options[soKeepidle].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (ka KeepAliveIdleInterval) Name() int { return options[soKeepidle].name }
|
||||
|
||||
// KeepAliveProbeInterval is the interval between keepalive probes.
|
||||
//
|
||||
// OpenBSD doesn't support this option.
|
||||
// See TCP_KEEPINTVL for further information.
|
||||
type KeepAliveProbeInterval time.Duration
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (ka KeepAliveProbeInterval) Level() int { return options[soKeepintvl].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (ka KeepAliveProbeInterval) Name() int { return options[soKeepintvl].name }
|
||||
|
||||
// KeepAliveProbeCount is the number of keepalive probes should be
|
||||
// repeated when the peer is not responding.
|
||||
//
|
||||
// OpenBSD and Windows don't support this option.
|
||||
// See TCP_KEEPCNT for further information.
|
||||
type KeepAliveProbeCount int
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (ka KeepAliveProbeCount) Level() int { return options[soKeepcnt].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (ka KeepAliveProbeCount) Name() int { return options[soKeepcnt].name }
|
||||
|
||||
// Cork specifies the use of TCP_CORK or TCP_NOPUSH option.
|
||||
//
|
||||
// On DragonFly BSD, the caller may need to adjust the
|
||||
// net.inet.tcp.disable_nopush kernel state.
|
||||
// NetBSD and Windows don't support this option.
|
||||
type Cork bool
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (ck Cork) Level() int { return options[soCork].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (ck Cork) Name() int { return options[soCork].name }
|
||||
|
||||
// NotSentLowWMK specifies the amount of unsent bytes in transmission
|
||||
// queue. The network poller such as kqueue or epoll doesn't report
|
||||
// that the connection is writable while the amount of unsent data
|
||||
// size is greater than NotSentLowWMK.
|
||||
//
|
||||
// Only Darwin and Linux support this option.
|
||||
// See TCP_NOTSENT_LOWAT for further information.
|
||||
type NotSentLowWMK int
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (ns NotSentLowWMK) Level() int { return options[soNotsentLOWAT].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (ns NotSentLowWMK) Name() int { return options[soNotsentLOWAT].name }
|
||||
|
||||
// Error represents an error on the socket.
|
||||
type Error int
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (e Error) Level() int { return options[soError].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (e Error) Name() int { return options[soError].name }
|
||||
|
||||
// ECN specifies the use of ECN.
|
||||
//
|
||||
// Only Darwin supports this option.
|
||||
type ECN bool
|
||||
|
||||
// Level implements the Level method of Option interface.
|
||||
func (cn ECN) Level() int { return options[soECN].level }
|
||||
|
||||
// Name implements the Name method of Option interface.
|
||||
func (cn ECN) Name() int { return options[soECN].name }
|
||||
37
vendor/github.com/mikioh/tcpopt/parse.go
generated
vendored
Normal file
37
vendor/github.com/mikioh/tcpopt/parse.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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 tcpopt
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var parserMu sync.RWMutex
|
||||
|
||||
// Register registers a socket option parser.
|
||||
func Register(level, name int, fn func([]byte) (Option, error)) {
|
||||
parserMu.Lock()
|
||||
parsers[int64(level)<<32|int64(name)] = fn
|
||||
parserMu.Unlock()
|
||||
}
|
||||
|
||||
// Unregister unregisters a socket option parser.
|
||||
func Unregister(level, name int) {
|
||||
parserMu.Lock()
|
||||
delete(parsers, int64(level)<<32|int64(name))
|
||||
parserMu.Unlock()
|
||||
}
|
||||
|
||||
// Parse parses a socket option.
|
||||
func Parse(level, name int, b []byte) (Option, error) {
|
||||
parserMu.RLock()
|
||||
defer parserMu.RUnlock()
|
||||
fn, ok := parsers[int64(level)<<32|int64(name)]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("parser for level=%#x name=%#x not found", level, name)
|
||||
}
|
||||
return fn(b)
|
||||
}
|
||||
66
vendor/github.com/mikioh/tcpopt/sys.go
generated
vendored
Normal file
66
vendor/github.com/mikioh/tcpopt/sys.go
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
// 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 tcpopt
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"time"
|
||||
"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
|
||||
}
|
||||
}
|
||||
|
||||
func boolint32(b bool) int32 {
|
||||
if b {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func uint32bool(n uint32) bool {
|
||||
if n != 0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const (
|
||||
ianaProtocolIP = 0x0
|
||||
ianaProtocolTCP = 0x6
|
||||
ianaProtocolIPv6 = 0x29
|
||||
)
|
||||
|
||||
const (
|
||||
soNodelay = iota
|
||||
soSndbuf
|
||||
soRcvbuf
|
||||
soKeepalive
|
||||
soKeepidle
|
||||
soKeepintvl
|
||||
soKeepcnt
|
||||
soCork
|
||||
soNotsentLOWAT
|
||||
soError
|
||||
soECN
|
||||
soMaxseg
|
||||
soMax
|
||||
)
|
||||
|
||||
// An option represents a binding for socket option.
|
||||
type option struct {
|
||||
level int // option level
|
||||
name int // option name, must be equal or greater than 1
|
||||
uot time.Duration // unit of time
|
||||
}
|
||||
37
vendor/github.com/mikioh/tcpopt/sys_darwin.go
generated
vendored
Normal file
37
vendor/github.com/mikioh/tcpopt/sys_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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 tcpopt
|
||||
|
||||
import "time"
|
||||
|
||||
var options = [soMax]option{
|
||||
soNodelay: {ianaProtocolTCP, sysTCP_NODELAY, 0},
|
||||
soMaxseg: {ianaProtocolTCP, sysTCP_MAXSEG, 0},
|
||||
soSndbuf: {sysSOL_SOCKET, sysSO_SNDBUF, 0},
|
||||
soRcvbuf: {sysSOL_SOCKET, sysSO_RCVBUF, 0},
|
||||
soKeepalive: {sysSOL_SOCKET, sysSO_KEEPALIVE, 0},
|
||||
soKeepidle: {ianaProtocolTCP, sysTCP_KEEPALIVE, time.Second},
|
||||
soKeepintvl: {ianaProtocolTCP, sysTCP_KEEPINTVL, time.Second},
|
||||
soKeepcnt: {ianaProtocolTCP, sysTCP_KEEPCNT, 0},
|
||||
soCork: {ianaProtocolTCP, sysTCP_NOPUSH, 0},
|
||||
soNotsentLOWAT: {ianaProtocolTCP, sysTCP_NOTSENT_LOWAT, 0},
|
||||
soError: {sysSOL_SOCKET, sysSO_ERROR, 0},
|
||||
soECN: {ianaProtocolTCP, sysTCP_ENABLE_ECN, 0},
|
||||
}
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){
|
||||
ianaProtocolTCP<<32 | sysTCP_NODELAY: parseNoDelay,
|
||||
ianaProtocolTCP<<32 | sysTCP_MAXSEG: parseMSS,
|
||||
sysSOL_SOCKET<<32 | sysSO_SNDBUF: parseSendBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_RCVBUF: parseReceiveBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_KEEPALIVE: parseKeepAlive,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPALIVE: parseKeepAliveIdleInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPINTVL: parseKeepAliveProbeInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPCNT: parseKeepAliveProbeCount,
|
||||
ianaProtocolTCP<<32 | sysTCP_NOPUSH: parseCork,
|
||||
ianaProtocolTCP<<32 | sysTCP_NOTSENT_LOWAT: parseNotSentLowWMK,
|
||||
sysSOL_SOCKET<<32 | sysSO_ERROR: parseError,
|
||||
ianaProtocolTCP<<32 | sysTCP_ENABLE_ECN: parseECN,
|
||||
}
|
||||
35
vendor/github.com/mikioh/tcpopt/sys_dragonfly.go
generated
vendored
Normal file
35
vendor/github.com/mikioh/tcpopt/sys_dragonfly.go
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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 dragonfly
|
||||
|
||||
package tcpopt
|
||||
|
||||
import "time"
|
||||
|
||||
var options = [soMax]option{
|
||||
soNodelay: {ianaProtocolTCP, sysTCP_NODELAY, 0},
|
||||
soMaxseg: {ianaProtocolTCP, sysTCP_MAXSEG, 0},
|
||||
soSndbuf: {sysSOL_SOCKET, sysSO_SNDBUF, 0},
|
||||
soRcvbuf: {sysSOL_SOCKET, sysSO_RCVBUF, 0},
|
||||
soKeepalive: {sysSOL_SOCKET, sysSO_KEEPALIVE, 0},
|
||||
soKeepidle: {ianaProtocolTCP, sysTCP_KEEPIDLE, time.Millisecond},
|
||||
soKeepintvl: {ianaProtocolTCP, sysTCP_KEEPINTVL, time.Millisecond},
|
||||
soKeepcnt: {ianaProtocolTCP, sysTCP_KEEPCNT, 0},
|
||||
soCork: {ianaProtocolTCP, sysTCP_NOPUSH, 0},
|
||||
soError: {sysSOL_SOCKET, sysSO_ERROR, 0},
|
||||
}
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){
|
||||
ianaProtocolTCP<<32 | sysTCP_NODELAY: parseNoDelay,
|
||||
ianaProtocolTCP<<32 | sysTCP_MAXSEG: parseMSS,
|
||||
sysSOL_SOCKET<<32 | sysSO_SNDBUF: parseSendBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_RCVBUF: parseReceiveBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_KEEPALIVE: parseKeepAlive,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPIDLE: parseKeepAliveIdleInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPINTVL: parseKeepAliveProbeInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPCNT: parseKeepAliveProbeCount,
|
||||
ianaProtocolTCP<<32 | sysTCP_NOPUSH: parseCork,
|
||||
sysSOL_SOCKET<<32 | sysSO_ERROR: parseError,
|
||||
}
|
||||
33
vendor/github.com/mikioh/tcpopt/sys_freebsd.go
generated
vendored
Normal file
33
vendor/github.com/mikioh/tcpopt/sys_freebsd.go
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// 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 tcpopt
|
||||
|
||||
import "time"
|
||||
|
||||
var options = [soMax]option{
|
||||
soNodelay: {ianaProtocolTCP, sysTCP_NODELAY, 0},
|
||||
soMaxseg: {ianaProtocolTCP, sysTCP_MAXSEG, 0},
|
||||
soSndbuf: {sysSOL_SOCKET, sysSO_SNDBUF, 0},
|
||||
soRcvbuf: {sysSOL_SOCKET, sysSO_RCVBUF, 0},
|
||||
soKeepalive: {sysSOL_SOCKET, sysSO_KEEPALIVE, 0},
|
||||
soKeepidle: {ianaProtocolTCP, sysTCP_KEEPIDLE, time.Second},
|
||||
soKeepintvl: {ianaProtocolTCP, sysTCP_KEEPINTVL, time.Second},
|
||||
soKeepcnt: {ianaProtocolTCP, sysTCP_KEEPCNT, 0},
|
||||
soCork: {ianaProtocolTCP, sysTCP_NOPUSH, 0},
|
||||
soError: {sysSOL_SOCKET, sysSO_ERROR, 0},
|
||||
}
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){
|
||||
ianaProtocolTCP<<32 | sysTCP_NODELAY: parseNoDelay,
|
||||
ianaProtocolTCP<<32 | sysTCP_MAXSEG: parseMSS,
|
||||
sysSOL_SOCKET<<32 | sysSO_SNDBUF: parseSendBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_RCVBUF: parseReceiveBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_KEEPALIVE: parseKeepAlive,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPIDLE: parseKeepAliveIdleInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPINTVL: parseKeepAliveProbeInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPCNT: parseKeepAliveProbeCount,
|
||||
ianaProtocolTCP<<32 | sysTCP_NOPUSH: parseCork,
|
||||
sysSOL_SOCKET<<32 | sysSO_ERROR: parseError,
|
||||
}
|
||||
35
vendor/github.com/mikioh/tcpopt/sys_linux.go
generated
vendored
Normal file
35
vendor/github.com/mikioh/tcpopt/sys_linux.go
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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 tcpopt
|
||||
|
||||
import "time"
|
||||
|
||||
var options = [soMax]option{
|
||||
soNodelay: {ianaProtocolTCP, sysTCP_NODELAY, 0},
|
||||
soMaxseg: {ianaProtocolTCP, sysTCP_MAXSEG, 0},
|
||||
soSndbuf: {sysSOL_SOCKET, sysSO_SNDBUF, 0},
|
||||
soRcvbuf: {sysSOL_SOCKET, sysSO_RCVBUF, 0},
|
||||
soKeepalive: {sysSOL_SOCKET, sysSO_KEEPALIVE, 0},
|
||||
soKeepidle: {ianaProtocolTCP, sysTCP_KEEPIDLE, time.Second},
|
||||
soKeepintvl: {ianaProtocolTCP, sysTCP_KEEPINTVL, time.Second},
|
||||
soKeepcnt: {ianaProtocolTCP, sysTCP_KEEPCNT, 0},
|
||||
soCork: {ianaProtocolTCP, sysTCP_CORK, 0},
|
||||
soNotsentLOWAT: {ianaProtocolTCP, sysTCP_NOTSENT_LOWAT, 0},
|
||||
soError: {sysSOL_SOCKET, sysSO_ERROR, 0},
|
||||
}
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){
|
||||
ianaProtocolTCP<<32 | sysTCP_NODELAY: parseNoDelay,
|
||||
ianaProtocolTCP<<32 | sysTCP_MAXSEG: parseMSS,
|
||||
sysSOL_SOCKET<<32 | sysSO_SNDBUF: parseSendBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_RCVBUF: parseReceiveBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_KEEPALIVE: parseKeepAlive,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPIDLE: parseKeepAliveIdleInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPINTVL: parseKeepAliveProbeInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPCNT: parseKeepAliveProbeCount,
|
||||
ianaProtocolTCP<<32 | sysTCP_CORK: parseCork,
|
||||
ianaProtocolTCP<<32 | sysTCP_NOTSENT_LOWAT: parseNotSentLowWMK,
|
||||
sysSOL_SOCKET<<32 | sysSO_ERROR: parseError,
|
||||
}
|
||||
31
vendor/github.com/mikioh/tcpopt/sys_netbsd.go
generated
vendored
Normal file
31
vendor/github.com/mikioh/tcpopt/sys_netbsd.go
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// 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 tcpopt
|
||||
|
||||
import "time"
|
||||
|
||||
var options = [soMax]option{
|
||||
soNodelay: {ianaProtocolTCP, sysTCP_NODELAY, 0},
|
||||
soMaxseg: {ianaProtocolTCP, sysTCP_MAXSEG, 0},
|
||||
soSndbuf: {sysSOL_SOCKET, sysSO_SNDBUF, 0},
|
||||
soRcvbuf: {sysSOL_SOCKET, sysSO_RCVBUF, 0},
|
||||
soKeepalive: {sysSOL_SOCKET, sysSO_KEEPALIVE, 0},
|
||||
soKeepidle: {ianaProtocolTCP, sysTCP_KEEPIDLE, time.Second},
|
||||
soKeepintvl: {ianaProtocolTCP, sysTCP_KEEPINTVL, time.Second},
|
||||
soKeepcnt: {ianaProtocolTCP, sysTCP_KEEPCNT, 0},
|
||||
soError: {sysSOL_SOCKET, sysSO_ERROR, 0},
|
||||
}
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){
|
||||
ianaProtocolTCP<<32 | sysTCP_NODELAY: parseNoDelay,
|
||||
ianaProtocolTCP<<32 | sysTCP_MAXSEG: parseMSS,
|
||||
sysSOL_SOCKET<<32 | sysSO_SNDBUF: parseSendBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_RCVBUF: parseReceiveBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_KEEPALIVE: parseKeepAlive,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPIDLE: parseKeepAliveIdleInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPINTVL: parseKeepAliveProbeInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPCNT: parseKeepAliveProbeCount,
|
||||
sysSOL_SOCKET<<32 | sysSO_ERROR: parseError,
|
||||
}
|
||||
25
vendor/github.com/mikioh/tcpopt/sys_openbsd.go
generated
vendored
Normal file
25
vendor/github.com/mikioh/tcpopt/sys_openbsd.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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 tcpopt
|
||||
|
||||
var options = [soMax]option{
|
||||
soNodelay: {ianaProtocolTCP, sysTCP_NODELAY, 0},
|
||||
soMaxseg: {ianaProtocolTCP, sysTCP_MAXSEG, 0},
|
||||
soSndbuf: {sysSOL_SOCKET, sysSO_SNDBUF, 0},
|
||||
soRcvbuf: {sysSOL_SOCKET, sysSO_RCVBUF, 0},
|
||||
soKeepalive: {sysSOL_SOCKET, sysSO_KEEPALIVE, 0},
|
||||
soCork: {ianaProtocolTCP, sysTCP_NOPUSH, 0},
|
||||
soError: {sysSOL_SOCKET, sysSO_ERROR, 0},
|
||||
}
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){
|
||||
ianaProtocolTCP<<32 | sysTCP_NODELAY: parseNoDelay,
|
||||
ianaProtocolTCP<<32 | sysTCP_MAXSEG: parseMSS,
|
||||
sysSOL_SOCKET<<32 | sysSO_SNDBUF: parseSendBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_RCVBUF: parseReceiveBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_KEEPALIVE: parseKeepAlive,
|
||||
ianaProtocolTCP<<32 | sysTCP_NOPUSH: parseCork,
|
||||
sysSOL_SOCKET<<32 | sysSO_ERROR: parseError,
|
||||
}
|
||||
54
vendor/github.com/mikioh/tcpopt/sys_solaris.go
generated
vendored
Normal file
54
vendor/github.com/mikioh/tcpopt/sys_solaris.go
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
// 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 solaris
|
||||
|
||||
package tcpopt
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0xffff
|
||||
|
||||
sysSO_SNDBUF = 0x1001
|
||||
sysSO_RCVBUF = 0x1002
|
||||
sysSO_KEEPALIVE = 0x8
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
sysTCP_MAXSEG = 0x2
|
||||
sysTCP_KEEPALIVE = 0x8
|
||||
sysTCP_KEEPALIVE_THRESHOLD = 0x16
|
||||
sysTCP_KEEPALIVE_ABORT_THRESHOLD = 0x17
|
||||
sysTCP_KEEPIDLE = 0x22
|
||||
sysTCP_KEEPCNT = 0x23
|
||||
sysTCP_KEEPINTVL = 0x24
|
||||
sysTCP_CORK = 0x18
|
||||
sysSO_ERROR = 0x1007
|
||||
)
|
||||
|
||||
var options = [soMax]option{
|
||||
soNodelay: {ianaProtocolTCP, sysTCP_NODELAY, 0},
|
||||
soMaxseg: {ianaProtocolTCP, sysTCP_MAXSEG, 0},
|
||||
soSndbuf: {sysSOL_SOCKET, sysSO_SNDBUF, 0},
|
||||
soRcvbuf: {sysSOL_SOCKET, sysSO_RCVBUF, 0},
|
||||
soKeepalive: {sysSOL_SOCKET, sysSO_KEEPALIVE, 0},
|
||||
soKeepidle: {ianaProtocolTCP, sysTCP_KEEPIDLE, time.Second},
|
||||
soKeepintvl: {ianaProtocolTCP, sysTCP_KEEPINTVL, time.Second},
|
||||
soKeepcnt: {ianaProtocolTCP, sysTCP_KEEPCNT, 0},
|
||||
soCork: {ianaProtocolTCP, sysTCP_CORK, 0},
|
||||
soError: {sysSOL_SOCKET, sysSO_ERROR, 0},
|
||||
}
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){
|
||||
ianaProtocolTCP<<32 | sysTCP_NODELAY: parseNoDelay,
|
||||
ianaProtocolTCP<<32 | sysTCP_MAXSEG: parseMSS,
|
||||
sysSOL_SOCKET<<32 | sysSO_SNDBUF: parseSendBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_RCVBUF: parseReceiveBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_KEEPALIVE: parseKeepAlive,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPIDLE: parseKeepAliveIdleInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPINTVL: parseKeepAliveProbeInterval,
|
||||
ianaProtocolTCP<<32 | sysTCP_KEEPCNT: parseKeepAliveProbeCount,
|
||||
ianaProtocolTCP<<32 | sysTCP_CORK: parseCork,
|
||||
sysSOL_SOCKET<<32 | sysSO_ERROR: parseError,
|
||||
}
|
||||
73
vendor/github.com/mikioh/tcpopt/sys_stub.go
generated
vendored
Normal file
73
vendor/github.com/mikioh/tcpopt/sys_stub.go
generated
vendored
Normal 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.
|
||||
|
||||
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
|
||||
|
||||
package tcpopt
|
||||
|
||||
import "errors"
|
||||
|
||||
var options [soMax]option
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (nd NoDelay) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (mss MSS) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (sb SendBuffer) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (rb ReceiveBuffer) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAlive) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveIdleInterval) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveProbeInterval) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveProbeCount) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ck Cork) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ns NotSentLowWMK) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (e Error) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (cn ECN) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
173
vendor/github.com/mikioh/tcpopt/sys_unix.go
generated
vendored
Normal file
173
vendor/github.com/mikioh/tcpopt/sys_unix.go
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
// 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 netbsd openbsd solaris
|
||||
|
||||
package tcpopt
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (nd NoDelay) Marshal() ([]byte, error) {
|
||||
v := boolint32(bool(nd))
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (mss MSS) Marshal() ([]byte, error) {
|
||||
v := int32(mss)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (sb SendBuffer) Marshal() ([]byte, error) {
|
||||
v := int32(sb)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (rb ReceiveBuffer) Marshal() ([]byte, error) {
|
||||
v := int32(rb)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAlive) Marshal() ([]byte, error) {
|
||||
v := boolint32(bool(ka))
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveIdleInterval) Marshal() ([]byte, error) {
|
||||
ka += KeepAliveIdleInterval(options[soKeepidle].uot - time.Nanosecond)
|
||||
v := int32(time.Duration(ka) / options[soKeepidle].uot)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveProbeInterval) Marshal() ([]byte, error) {
|
||||
ka += KeepAliveProbeInterval(options[soKeepintvl].uot - time.Nanosecond)
|
||||
v := int32(time.Duration(ka) / options[soKeepintvl].uot)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveProbeCount) Marshal() ([]byte, error) {
|
||||
v := int32(ka)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ck Cork) Marshal() ([]byte, error) {
|
||||
v := boolint32(bool(ck))
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ns NotSentLowWMK) Marshal() ([]byte, error) {
|
||||
v := int32(ns)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (e Error) Marshal() ([]byte, error) {
|
||||
v := int32(e)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (cn ECN) Marshal() ([]byte, error) {
|
||||
v := boolint32(bool(cn))
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
func parseNoDelay(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return NoDelay(uint32bool(nativeEndian.Uint32(b))), nil
|
||||
}
|
||||
|
||||
func parseMSS(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return MSS(nativeEndian.Uint32(b)), nil
|
||||
}
|
||||
|
||||
func parseSendBuffer(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return SendBuffer(nativeEndian.Uint32(b)), nil
|
||||
}
|
||||
|
||||
func parseReceiveBuffer(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return ReceiveBuffer(nativeEndian.Uint32(b)), nil
|
||||
}
|
||||
|
||||
func parseKeepAlive(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return KeepAlive(uint32bool(nativeEndian.Uint32(b))), nil
|
||||
}
|
||||
|
||||
func parseKeepAliveIdleInterval(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
v := time.Duration(nativeEndian.Uint32(b)) * options[soKeepidle].uot
|
||||
return KeepAliveIdleInterval(v), nil
|
||||
}
|
||||
|
||||
func parseKeepAliveProbeInterval(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
v := time.Duration(nativeEndian.Uint32(b)) * options[soKeepintvl].uot
|
||||
return KeepAliveProbeInterval(v), nil
|
||||
}
|
||||
|
||||
func parseKeepAliveProbeCount(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return KeepAliveProbeCount(nativeEndian.Uint32(b)), nil
|
||||
}
|
||||
|
||||
func parseCork(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return Cork(uint32bool(nativeEndian.Uint32(b))), nil
|
||||
}
|
||||
|
||||
func parseNotSentLowWMK(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return NotSentLowWMK(nativeEndian.Uint32(b)), nil
|
||||
}
|
||||
|
||||
func parseError(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return Error(nativeEndian.Uint32(b)), nil
|
||||
}
|
||||
|
||||
func parseECN(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return ECN(uint32bool(nativeEndian.Uint32(b))), nil
|
||||
}
|
||||
144
vendor/github.com/mikioh/tcpopt/sys_windows.go
generated
vendored
Normal file
144
vendor/github.com/mikioh/tcpopt/sys_windows.go
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
// 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 tcpopt
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0xffff
|
||||
|
||||
sysSO_SNDBUF = 0x1001
|
||||
sysSO_RCVBUF = 0x1002
|
||||
sysSO_KEEPALIVE = 0x8
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
|
||||
sysIOC_OUT = 0x40000000
|
||||
sysIOC_IN = 0x80000000
|
||||
sysIOC_VENDOR = 0x18000000
|
||||
)
|
||||
|
||||
var sysSIO_KEEPALIVE_VALS uint = sysIOC_IN | sysIOC_VENDOR | 4
|
||||
|
||||
var options = [soMax]option{
|
||||
soNodelay: {ianaProtocolTCP, sysTCP_NODELAY, 0},
|
||||
soSndbuf: {sysSOL_SOCKET, sysSO_SNDBUF, 0},
|
||||
soRcvbuf: {sysSOL_SOCKET, sysSO_RCVBUF, 0},
|
||||
soKeepalive: {sysSOL_SOCKET, sysSO_KEEPALIVE, 0},
|
||||
soKeepidle: {ianaProtocolTCP, int(sysSIO_KEEPALIVE_VALS), time.Millisecond},
|
||||
soKeepintvl: {ianaProtocolTCP, int(sysSIO_KEEPALIVE_VALS), time.Millisecond},
|
||||
}
|
||||
|
||||
var parsers = map[int64]func([]byte) (Option, error){
|
||||
ianaProtocolTCP<<32 | sysTCP_NODELAY: parseNoDelay,
|
||||
sysSOL_SOCKET<<32 | sysSO_SNDBUF: parseSendBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_RCVBUF: parseReceiveBuffer,
|
||||
sysSOL_SOCKET<<32 | sysSO_KEEPALIVE: parseKeepAlive,
|
||||
ianaProtocolTCP<<32 | int64(sysSIO_KEEPALIVE_VALS): parseKeepAliveValues,
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (nd NoDelay) Marshal() ([]byte, error) {
|
||||
v := boolint32(bool(nd))
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (mss MSS) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (sb SendBuffer) Marshal() ([]byte, error) {
|
||||
v := int32(sb)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (rb ReceiveBuffer) Marshal() ([]byte, error) {
|
||||
v := int32(rb)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAlive) Marshal() ([]byte, error) {
|
||||
v := boolint32(bool(ka))
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveIdleInterval) Marshal() ([]byte, error) {
|
||||
ka += KeepAliveIdleInterval(options[soKeepidle].uot - time.Nanosecond)
|
||||
v := uint32(time.Duration(ka) / options[soKeepidle].uot)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveProbeInterval) Marshal() ([]byte, error) {
|
||||
ka += KeepAliveProbeInterval(options[soKeepintvl].uot - time.Nanosecond)
|
||||
v := uint32(time.Duration(ka) / options[soKeepintvl].uot)
|
||||
return (*[4]byte)(unsafe.Pointer(&v))[:], nil
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ka KeepAliveProbeCount) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ck Cork) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (ns NotSentLowWMK) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (e Error) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
// Marshal implements the Marshal method of Option interface.
|
||||
func (cn ECN) Marshal() ([]byte, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
|
||||
func parseNoDelay(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return NoDelay(uint32bool(nativeEndian.Uint32(b))), nil
|
||||
}
|
||||
|
||||
func parseSendBuffer(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return SendBuffer(nativeEndian.Uint32(b)), nil
|
||||
}
|
||||
|
||||
func parseReceiveBuffer(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return ReceiveBuffer(nativeEndian.Uint32(b)), nil
|
||||
}
|
||||
|
||||
func parseKeepAlive(b []byte) (Option, error) {
|
||||
if len(b) < 4 {
|
||||
return nil, errors.New("short buffer")
|
||||
}
|
||||
return KeepAlive(uint32bool(nativeEndian.Uint32(b))), nil
|
||||
}
|
||||
|
||||
func parseKeepAliveValues(b []byte) (Option, error) {
|
||||
return nil, errors.New("operation not supported")
|
||||
}
|
||||
22
vendor/github.com/mikioh/tcpopt/zsys_darwin.go
generated
vendored
Normal file
22
vendor/github.com/mikioh/tcpopt/zsys_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_darwin.go
|
||||
|
||||
package tcpopt
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0xffff
|
||||
|
||||
sysSO_KEEPALIVE = 0x8
|
||||
sysSO_SNDBUF = 0x1001
|
||||
sysSO_RCVBUF = 0x1002
|
||||
sysSO_ERROR = 0x1007
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
sysTCP_MAXSEG = 0x2
|
||||
sysTCP_KEEPALIVE = 0x10
|
||||
sysTCP_KEEPINTVL = 0x101
|
||||
sysTCP_KEEPCNT = 0x102
|
||||
sysTCP_NOPUSH = 0x4
|
||||
sysTCP_ENABLE_ECN = 0x104
|
||||
sysTCP_NOTSENT_LOWAT = 0x201
|
||||
)
|
||||
20
vendor/github.com/mikioh/tcpopt/zsys_dragonfly.go
generated
vendored
Normal file
20
vendor/github.com/mikioh/tcpopt/zsys_dragonfly.go
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_dragonfly.go
|
||||
|
||||
package tcpopt
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0xffff
|
||||
|
||||
sysSO_KEEPALIVE = 0x8
|
||||
sysSO_SNDBUF = 0x1001
|
||||
sysSO_RCVBUF = 0x1002
|
||||
sysSO_ERROR = 0x1007
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
sysTCP_MAXSEG = 0x2
|
||||
sysTCP_KEEPIDLE = 0x100
|
||||
sysTCP_KEEPINTVL = 0x200
|
||||
sysTCP_KEEPCNT = 0x400
|
||||
sysTCP_NOPUSH = 0x4
|
||||
)
|
||||
20
vendor/github.com/mikioh/tcpopt/zsys_freebsd.go
generated
vendored
Normal file
20
vendor/github.com/mikioh/tcpopt/zsys_freebsd.go
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_freebsd.go
|
||||
|
||||
package tcpopt
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0xffff
|
||||
|
||||
sysSO_KEEPALIVE = 0x8
|
||||
sysSO_SNDBUF = 0x1001
|
||||
sysSO_RCVBUF = 0x1002
|
||||
sysSO_ERROR = 0x1007
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
sysTCP_MAXSEG = 0x2
|
||||
sysTCP_KEEPIDLE = 0x100
|
||||
sysTCP_KEEPINTVL = 0x200
|
||||
sysTCP_KEEPCNT = 0x400
|
||||
sysTCP_NOPUSH = 0x4
|
||||
)
|
||||
25
vendor/github.com/mikioh/tcpopt/zsys_linux_generic.go
generated
vendored
Normal file
25
vendor/github.com/mikioh/tcpopt/zsys_linux_generic.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build !mips64
|
||||
// +build !mips64le
|
||||
// +build linux
|
||||
|
||||
package tcpopt
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
|
||||
sysSO_KEEPALIVE = 0x9
|
||||
sysSO_SNDBUF = 0x7
|
||||
sysSO_RCVBUF = 0x8
|
||||
sysSO_ERROR = 0x4
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
sysTCP_MAXSEG = 0x2
|
||||
sysTCP_KEEPIDLE = 0x4
|
||||
sysTCP_KEEPINTVL = 0x5
|
||||
sysTCP_KEEPCNT = 0x6
|
||||
sysTCP_CORK = 0x3
|
||||
sysTCP_NOTSENT_LOWAT = 0x19
|
||||
)
|
||||
24
vendor/github.com/mikioh/tcpopt/zsys_linux_mips64x.go
generated
vendored
Normal file
24
vendor/github.com/mikioh/tcpopt/zsys_linux_mips64x.go
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_linux.go
|
||||
|
||||
// +build mips64 mips64le
|
||||
// +build linux
|
||||
|
||||
package tcpopt
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0x1
|
||||
|
||||
sysSO_KEEPALIVE = 0x8
|
||||
sysSO_SNDBUF = 0x1001
|
||||
sysSO_RCVBUF = 0x1002
|
||||
sysSO_ERROR = 0x1007
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
sysTCP_MAXSEG = 0x2
|
||||
sysTCP_KEEPIDLE = 0x4
|
||||
sysTCP_KEEPINTVL = 0x5
|
||||
sysTCP_KEEPCNT = 0x6
|
||||
sysTCP_CORK = 0x3
|
||||
sysTCP_NOTSENT_LOWAT = 0x19
|
||||
)
|
||||
19
vendor/github.com/mikioh/tcpopt/zsys_netbsd.go
generated
vendored
Normal file
19
vendor/github.com/mikioh/tcpopt/zsys_netbsd.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_netbsd.go
|
||||
|
||||
package tcpopt
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0xffff
|
||||
|
||||
sysSO_KEEPALIVE = 0x8
|
||||
sysSO_SNDBUF = 0x1001
|
||||
sysSO_RCVBUF = 0x1002
|
||||
sysSO_ERROR = 0x1007
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
sysTCP_MAXSEG = 0x2
|
||||
sysTCP_KEEPIDLE = 0x3
|
||||
sysTCP_KEEPINTVL = 0x5
|
||||
sysTCP_KEEPCNT = 0x6
|
||||
)
|
||||
17
vendor/github.com/mikioh/tcpopt/zsys_openbsd.go
generated
vendored
Normal file
17
vendor/github.com/mikioh/tcpopt/zsys_openbsd.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Created by cgo -godefs - DO NOT EDIT
|
||||
// cgo -godefs defs_openbsd.go
|
||||
|
||||
package tcpopt
|
||||
|
||||
const (
|
||||
sysSOL_SOCKET = 0xffff
|
||||
|
||||
sysSO_KEEPALIVE = 0x8
|
||||
sysSO_SNDBUF = 0x1001
|
||||
sysSO_RCVBUF = 0x1002
|
||||
sysSO_ERROR = 0x1007
|
||||
|
||||
sysTCP_NODELAY = 0x1
|
||||
sysTCP_MAXSEG = 0x2
|
||||
sysTCP_NOPUSH = 0x10
|
||||
)
|
||||
Reference in New Issue
Block a user