Package socket provides a low-level network connection type which integrates with Go's runtime network poller to provide asynchronous I/O and deadline support. MIT Licensed.

socket Test Status Go Reference Go Report Card

Package socket provides a low-level network connection type which integrates with Go's runtime network poller to provide asynchronous I/O and deadline support. MIT Licensed.

This package focuses on UNIX-like operating systems which make use of BSD sockets system call APIs. It is meant to be used as a foundation for the creation of operating system-specific socket packages, for socket families such as Linux's AF_NETLINK, AF_PACKET, or AF_VSOCK. This package should not be used directly in end user applications.

Any use of package socket should be guarded by build tags, as one would also use when importing the syscall or golang.org/x/sys packages.

Owner
Matt Layher
Software Engineer. Go, Linux, and open source software enthusiast. On and ever upward.
Matt Layher
Similar Resources

wire protocol for multiplexing connections or streams into a single connection, based on a subset of the SSH Connection Protocol

qmux qmux is a wire protocol for multiplexing connections or streams into a single connection. It is based on the SSH Connection Protocol, which is th

Dec 26, 2022

A go module supply Java-Like generic stream programming (while do type check at runtime)

gostream A go module supplying Java-Like generic stream programming (while do type check at runtime) Using Get a Stream To get a Stream, using SliceSt

Jan 16, 2022

CoreRAD is an extensible and observable IPv6 Neighbor Discovery Protocol router advertisement daemon. Apache 2.0 Licensed.

CoreRAD is an extensible and observable IPv6 Neighbor Discovery Protocol router advertisement daemon. Apache 2.0 Licensed.

CoreRAD CoreRAD is an extensible and observable IPv6 Neighbor Discovery Protocol router advertisement daemon. Apache 2.0 Licensed. To get started with

Nov 14, 2022

Gsshrun - Running commands via ssh on the server/hosting (if ssh support) specified in the connection file

Gsshrun - Running commands via ssh on the server/hosting (if ssh support) specified in the connection file

Sep 8, 2022

Make TCP connection storm between server and client for benchmarking network stuff

Make TCP connection storm between server and client for benchmarking network stuff

Nov 14, 2021

Send network packets over a TCP or UDP connection.

Packet is the main class representing a single network message. It has a byte code indicating the type of the message and a []byte type payload.

Nov 28, 2022

This package helps establish a websocket connection to the bilibili streaming server.

biliStreamClient This package helps establish a websocket connection to the bilibili streaming server. bilibili直播弹幕的WebSocket协议分析请参考:https://blog.csdn

Oct 25, 2022

Zero Trust Network Communication Sentinel provides peer-to-peer, multi-protocol, automatic networking, cross-CDN and other features for network communication.

Zero Trust Network Communication Sentinel provides peer-to-peer, multi-protocol, automatic networking, cross-CDN and other features for network communication.

Thank you for your interest in ZASentinel ZASentinel helps organizations improve information security by providing a better and simpler way to protect

Nov 1, 2022

Netkit - A type parameter(generics) net kit, support tcp kcp, customize packet

Netkit Netkit is a type parameter(generics) golang package Get Started Need Go i

Jan 12, 2022
Comments
  • TestLinuxDialVsockNoListener test failure

    TestLinuxDialVsockNoListener test failure

    OS: Debian sid/amd64 golang: go1.17.8 linux/amd64 github.com/mdlayher/socket: v0.2.2

    I am working on updating the version of this library that's packaged for Debian, but the TestLinuxDialVsockNoListener test always fails. I see this failure via go test (below), well as in the schroot environment that is created when building the Debian package. My build setup is a minimal Debian sid install that is running within a privileged LXD container.

    gibmat@build:~/golang-github-mdlayher-socket$ go test
    go: downloading golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c
    go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
    go: downloading golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7
    go: downloading github.com/google/go-cmp v0.5.7
    --- FAIL: TestLinuxDialVsockNoListener (0.00s)
        conn_linux_test.go:149: unexpected connect error (-want +got):
              any(
            - 	e"connect: connection reset by peer",
              )
    FAIL
    exit status 1
    FAIL	github.com/mdlayher/socket	0.445s
    
  • Missing error check in socket fallback path

    Missing error check in socket fallback path

    The unix.Socket call in EINVAL or EPROTONOSUPPORT fallback path in socket is missing the error check:

    https://github.com/mdlayher/socket/blob/7c9fcbcebf504a63e5d002868c514b6bb97708ba/conn.go#L197-L204

    That means if unix.Socket fails with EINVAL or EPROTONOSUPPORT and then fails again, a *Conn will be returned referencing fd=0 / /dev/stdin.

  • socket: use generics to simplify closure value returns

    socket: use generics to simplify closure value returns

    I started experimenting with this in https://github.com/mdlayher/socket/commit/247e85df156379823e7f10b96c503a87f79a452b.

    Eventually we can make a lot of calls return (T, error) from closures to simplify the need to pass variables in and out, and to remove the hassle of dealing with multiple error scopes.

    However, since this is a very foundational library and generics are very new, it probably isn't feasible to do this for some time. It'd be possible to add Go 1.18+ shims and duplicate the code, but that doesn't seem great either.

Related tags
Package ethernet implements marshaling and unmarshaling of IEEE 802.3 Ethernet II frames and IEEE 802.1Q VLAN tags. MIT Licensed.

ethernet Package ethernet implements marshaling and unmarshaling of IEEE 802.3 Ethernet II frames and IEEE 802.1Q VLAN tags. MIT Licensed. For more in

Dec 29, 2022
Package arp implements the ARP protocol, as described in RFC 826. MIT Licensed.

arp Package arp implements the ARP protocol, as described in RFC 826. MIT Licensed. Portions of this code are taken from the Go standard library. The

Dec 20, 2022
Package dhcp6 implements a DHCPv6 server, as described in RFC 3315. MIT Licensed.

dhcp6 Package dhcp6 implements a DHCPv6 server, as described in IETF RFC 3315. MIT Licensed. At this time, the API is not stable, and may change over

Sep 27, 2022
GOWS is GoLang web-socket module Provides you with ease of handling web socket connections with a few lines

GOWS GOWS is GoLang web-socket module Provides you with ease of handling web socket connections with a few lines, it supports multi-connection on one

Apr 4, 2022
Gos: Armed Golang 💪 ( solutions for go module, goproxy, cross compilation, etc.)
Gos: Armed Golang 💪 ( solutions for go module, goproxy, cross compilation, etc.)

The current gos is still an alpha version, welcome more heroes to comment and improve it ?? , you can add more commands to it, or modify something to make it perform better.

Sep 15, 2022
May 8, 2022
Simple Relay between a Unix socket and a TCP socket, and vice versa.
Simple Relay between a Unix socket and a TCP socket, and vice versa.

Simple TCP <-> Unix Relay simpletcpunixrelay is a program which exposes a TCP endpoint as a Unix socket and vice versa. Usecase Let's say you are runn

Nov 23, 2022
Glue - Robust Go and Javascript Socket Library (Alternative to Socket.io)

Glue - Robust Go and Javascript Socket Library Glue is a real-time bidirectional socket library. It is a clean, robust and efficient alternative to so

Nov 25, 2022
Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces
Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces

Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces。The key is the transport layer, application layer protocol has nothing to do

Nov 7, 2022