Git Product home page Git Product logo

go-sockaddr's Introduction

libp2p is a modular networking framework bundled together as a full stack of protocols for peer-to-peer systems.

libp2p is the product of a long and arduous quest into the internet's network stack and all of the plentiful peer-to-peer protocols of the past. Building large-scale peer-to-peer systems has been complex and challenging in the last fifteen years, and libp2p is a way to fix that. It is a "network stack" -- a protocol suite -- that cleanly separates concerns and enables sophisticated applications to only use the protocols they need without giving up interoperability and upgradeability. libp2p grew out of IPFS but is built so that many people can use it for many different projects.

Learn more about libp2p at libp2p.io and docs.libp2p.io.

Specifications

View the formal specifications of libp2p on the specifications repository.

Implementations

Follow the latest libp2p implementations at libp2p.io/implementations.

Community Discussion

Please visit our discussion forums at discuss.libp2p.io to get help, ask questions about the past, present, and future of libp2p, and more.

go-sockaddr's People

Contributors

jbenet avatar kerwinkoo avatar kevina avatar marten-seemann avatar raulk avatar stebalien avatar web3-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-sockaddr's Issues

Build failed in windows

client.go

package main

import (
	"github.com/astaxie/beego"
	udt "github.com/Lupus/go-udtwrapper"
	"time"
)

func main() {
	d := udt.Dialer{
		LocalAddr: nil,
	}

	c, err := d.Dial("udt", "127.0.0.1:8888")
	if err != nil {
		beego.Error("Dial error:", err.Error())
		return
	}

	defer c.Close()

	for {
		var buf = make([]byte, 1024)
		n, err := c.Read(buf)
		if err != nil {
			beego.Info("Read error:", err.Error())
			return
		}

		beego.Info("Read:", string(buf[:n]))

		time.Sleep(time.Second)
	}
}

I build client.go failed in windows.
Detail error info:

# github.com/jbenet/go-sockaddr/net
..\..\..\..\github.com\jbenet\go-sockaddr\net\net_windows.go:14: undefined: syscall.IPPROTO_IPV4
# github.com/jbenet/go-sockaddr
..\..\..\..\github.com\jbenet\go-sockaddr\sockaddr_windows.go:26: cannot use int32(unsafe.Sizeof(raw)) (type int32) as type Socklen in return argument
..\..\..\..\github.com\jbenet\go-sockaddr\sockaddr_windows.go:41: cannot use int32(unsafe.Sizeof(raw)) (type int32) as type Socklen in return argument
..\..\..\..\github.com\jbenet\go-sockaddr\sockaddr_windows.go:51: too many arguments to return
        have (nil, number, syscall.Errno)
        want (syscall.Sockaddr, error)

? soacceptqueue errantly set to 128 ?

This is an exploratory bug, because I don't know enough about go to answer this myself and file a better bug. I've been asked to file it on behalf of IPFS.

They, apparently, use go-sockaddr.

As an IPFS user, I noticed that one of the TCP sockets bound with a 128 depth soacceptqueue. My operating system is freebsd, and as such has a kernel tunable kern.ipc.soacceptqueue. It's set to 4096, not 128. An IPFS person suggests this socket is bound or managed by go-sockaddr.

Any idea why it would not respect my OS settings? Or perhaps I should bark up golang's tree?

Windows - converted pointer straddles multiple allocations

Ran into an error fatal error: checkptr: converted pointer straddles multiple allocations running go test -race in go-namesys (https://github.com/ipfs/go-namesys) using Go 1.16 and Go 1.15.

The error appears is reported for

return (*windows.RawSockaddrAny)(unsafe.Pointer(&raw)), Socklen(unsafe.Sizeof(raw)), nil

but is likely in more places as well.

``` โฏ go test -v -race ./... === RUN TestRepublish fatal error: checkptr: converted pointer straddles multiple allocations

goroutine 15 [running]:
runtime.throw(0x1278495, 0x3a)
C:/Go/go1.16.2/src/runtime/panic.go:1117 +0x79 fp=0xc000090d88 sp=0xc000090d58 pc=0x6da719
runtime.checkptrAlignment(0xc000724af0, 0x10dfe20, 0x1)
C:/Go/go1.16.2/src/runtime/checkptr.go:20 +0xc9 fp=0xc000090db8 sp=0xc000090d88 pc=0x6a4f49
github.com/libp2p/go-sockaddr.sockaddrToAny(0x14931c0, 0xc000280280, 0x0, 0x0, 0x0, 0x14931c0)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/sockaddr_windows.go:28 +0x565 fp=0xc000090e10 sp=0xc000090db8 pc=0xe47ba5
github.com/libp2p/go-sockaddr.SockaddrToAny(...)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/sockaddr.go:13
github.com/libp2p/go-netroute.callBestRoute(0x0, 0x0, 0x0, 0xc0001282c0, 0x10, 0x10, 0x0, 0x0, 0x0, 0x0, ...)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/netroute_windows.go:56 +0x9d fp=0xc000090f70 sp=0xc000090e10 pc=0xe47cbd
github.com/libp2p/go-netroute.(*winRouter).RouteWithSrc(0xc000091198, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0001282c0, 0x10, 0x10, ...)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/netroute_windows.go:217 +0x99 fp=0xc000091040 sp=0xc000090f70 pc=0xe4a3d9
github.com/libp2p/go-netroute.(*winRouter).Route(0xc000091198, 0xc0001282c0, 0x10, 0x10, 0x0, 0xc000200120, 0x90, 0x100c000091208, 0x90, 0x1370485b9f0, ...)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/netroute_windows.go:213 +0x91 fp=0xc000091130 sp=0xc000091040 pc=0xe4a211
github.com/libp2p/go-libp2p/p2p/host/basic.(*BasicHost).updateLocalIpAddr(0xc00007c160)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/p2p/host/basic/basic_host.go:271 +0x186 fp=0xc000091368 sp=0xc000091130 pc=0xfc3966
github.com/libp2p/go-libp2p/p2p/host/basic.NewHost(0x14a0a38, 0xc00021d040, 0x14a88a8, 0xc0005ce780, 0xc000091830, 0x0, 0xc000079aa0, 0xc000079ac0)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/p2p/host/basic/basic_host.go:173 +0x525 fp=0xc000091608 sp=0xc000091368 pc=0xfc2045
github.com/libp2p/go-libp2p/config.(*Config).NewNode(0xc000282f00, 0x14a0a38, 0xc00021d040, 0x4, 0x0, 0x0, 0xc000706bf0)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/config/config.go:188 +0x1f8 fp=0xc000091a00 sp=0xc000091608 pc=0x1011038
github.com/libp2p/go-libp2p.NewWithoutDefaults(0x14a0a38, 0xc00021d040, 0xc000727200, 0x3, 0x4, 0xc000727200, 0x2, 0x4, 0x67d750)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/libp2p.go:71 +0x145 fp=0xc000091a78 sp=0xc000091a00 pc=0x1018d65
github.com/libp2p/go-libp2p.New(...)
C:/Users/adin/go/pkg/mod/github.com/libp2p/[email protected]/libp2p.go:57
github.com/ipfs/go-namesys/republisher_test.getMockNode(0xc000282c00, 0x14a0a38, 0xc00021d040, 0xc00021d040)
C:/Users/adin/go/src/github.com/ipfs/go-namesys/republisher/repub_test.go:44 +0x3e5 fp=0xc000091c08 sp=0xc000091a78 pc=0x101c0a5
github.com/ipfs/go-namesys/republisher_test.TestRepublish(0xc000282c00)
C:/Users/adin/go/src/github.com/ipfs/go-namesys/republisher/repub_test.go:76 +0x17f fp=0xc000091ed0 sp=0xc000091c08 pc=0x101c7ff
testing.tRunner(0xc000282c00, 0x13a79d8)
C:/Go/go1.16.2/src/testing/testing.go:1194 +0x203 fp=0xc000091fd0 sp=0xc000091ed0 pc=0x8312e3
runtime.goexit()
C:/Go/go1.16.2/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc000091fd8 sp=0xc000091fd0 pc=0x715081
created by testing.(*T).Run
C:/Go/go1.16.2/src/testing/testing.go:1239 +0x5d8

</details>

GCC required for compilation

When compiling the latest version of IPFS master branch on win10.

...
go: downloading github.com/marten-seemann/qtls v0.9.1
go: extracting golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5
go: extracting github.com/marten-seemann/qtls v0.9.1
# github.com/libp2p/go-sockaddr
exec: "gcc": executable file not found in %PATH%

net_linux.go error

os: centos

[root@test-212 ~]# go get github.com/libp2p/go-reuseport
# github.com/libp2p/go-sockaddr/net
/workspace/go/src/github.com/libp2p/go-sockaddr/net/net_linux.go:24: syntax error: unexpected = in type declaration
/workspace/go/src/github.com/libp2p/go-sockaddr/net/net_linux.go:25: syntax error: unexpected = in type declaration
/workspace/go/src/github.com/libp2p/go-sockaddr/net/net_linux.go:26: syntax error: unexpected = in type declaration
/workspace/go/src/github.com/libp2p/go-sockaddr/net/net_linux.go:27: syntax error: unexpected = in type declaration
/workspace/go/src/github.com/libp2p/go-sockaddr/net/net_linux.go:28: syntax error: unexpected = in type declaration

how to solve this problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.