Coder Social home page Coder Social logo

go-multiaddr's Introduction

multiformats

The main repository for discussing multiformats

Multiformats is a set of self-describing protocol values. These values are foundational in that they are low-level building blocks for both data and network layers of the composable protocols making up IPFS, IPLD, libp2p, and many other decentralized data systems. This repository's issues and pull requests are currently the primary venue for the coordination between the various registries making up the group, each of which is separately being hardened as specifications and public, formal registries over time.
See contributing.md for more details on governance and process.

Current Registries

Currently, we have the following formats, each of which corresponds to a specification and a registry. More formats are being discussed and may be added over time, but the following are the mature ones to date:

Repo Status Specification
multiaddr stable TBD
multibase stable W3C CCG
multicodec stable TBD
multihash stable W3C CCG

See the project directory, below, for implementations and other related repositories.

Table of Contents

Background

Every choice in computing has a tradeoff. This includes formats, algorithms, encodings, and so on. And even with a great deal of planning, decisions may lead to breaking changes down the road, or to solutions which are no longer optimal. Allowing systems to evolve and grow is important.

Multiformats is a collection of protocols which aim to future-proof systems, today. They do this mainly by allowing data to be self-describable. This allows interoperability, protocol agility, and helps us avoid various forms of lock-in. Currently, these interlocking protocols (both works in progress and implemented) cover the following areas:

Several of the multiformats are stable, and work on the others is ongoing. Implementers and refiners of the drafts of any one of these registries or their tooling are welcome to contribute, without needing to understand deeply or track progress on the others. Across these otherwise different use-cases and mechanisms, the self-describing aspects of the protocols have a few design goals in common:

  • the "prefixes" use to self-describe a value must be inline with the value (not passed out-of-band, in function calls, implicit choices, or documentation);
  • they must be compact and have a binary-packed representation (as opposed to a sparser encoding) or they will hinder performance;
  • they must have a human-readable representation.

A note on the word Multiformats

Multiformats is the name for the community (and the "organization" in GitHub's access control model), but multiformats can also be used to refer to protocols; for instance, in the sentence "Use one of the multiformats". Formats is interchangeable with protocols, here, as each format is designed in tandem with one or more protocols which handle those self-describing values centrally. We try to capitalize Multiformats when it refers to the organization.

Project Directory

Below, a list of all of the projects in the Multiformats organization is listed.

Maintainers are the active leads for each project, even if the specification is still under construction. Their responsibilities are to make sure that issues and pull requests are attended to in a timely manner, and general upkeep. If you have questions about a repository, or need feedback, please contact them as appropriate. If any of the specifications defining these formats are formalized in a standards body, these maintainers may continue on as Registrars of the table of entries which can keep growing after stabilizing the syntax and tooling interfaces.

Implementations

There are no official or maintained implementations of the entire set of multiformats specifications and registries. The readme file of each multiformat specification repository includes a list of known implementations, some of which are hosted in this GitHub organization.

Maintainers

Maintainers of the each multiformats specification are listed in the appropriate repositories. The external standardization of multiformats specifications and registries is currently managed and coordinated by @bumblefudge of learningProof UG.

Contribute

Check out our contributing document for more information on how we work, and about contributing in general.

License

This repository is only for documents. All of these are licensed under the CC-BY-SA 3.0 license © 2016 Protocol Labs Inc. Any code is under a MIT © 2016 Protocol Labs Inc.

go-multiaddr's People

Contributors

0xtylerholmes avatar aarshkshah1992 avatar anacrolix avatar aschmahmann avatar backkem avatar bigs avatar carpawell avatar cce avatar david415 avatar dependabot-preview[bot] avatar dependabot[bot] avatar eyedeekay avatar godcong avatar hsanjuan avatar jbenet avatar kubuxu avatar marcopolo avatar marten-seemann avatar overbool avatar raulk avatar richardlitt avatar rvagg avatar skillful-alex avatar stebalien avatar sukunrt avatar tabrath avatar vyzo avatar web3-bot avatar whyrusleeping avatar willscott avatar

Stargazers

 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  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  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  avatar  avatar  avatar  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-multiaddr's Issues

[DISCUSSION] Exposing the underlying struct

In my opinion, hiding the underlying multiaddr struct is a hinderance, particularly when working with serializations in golang (looking at flags and encoding/json). Is there any reason we couldn't simply expose the struct and keep its member hidden? This would enable us to implement interfaces that require zero values.

NewMultiaddrBytes is inefficient

NewMultiaddrBytes first casts the given bytes to a string, then calls NewMultiaddr on that which casts it back to bytes. I understand that this is 'validating' the input, but there has to be a better way. Its consuming a decently large chunk of cpu and memory in go-ipfs right now.

Implement flag.Value interface

The flag.Value interface allows different types to be parsed by the built in flag module. Even though said module isn't great, adding the Set method would make things easier for anyone wishing to parse mutliaddrs.

a Format method

It would be pretty cool to have a Format method on multiaddrs that allows the caller to express how they want to print the multiaddr. For example:

maddr := Multiaddr("/ip4/127.0.0.1/tcp/5001")
maddr.Format("${IP}:${TCP}")

would print 127.0.0.1:5001

Registering new multicodecs

You can see here a wonderful, not-exported singleton registry variable that is in this delightful in-between where it's deprecated but functionality has not been maintained:

https://github.com/multiformats/go-multiaddr/blob/master/net/registry.go#L17

I get these deprecated markups in my IDE because the only way to add new codecs to this is marked deprecated, and it directs you to two functions that depend on you first being able to address the aforementioned singleton registry variable.

I only learned about this by looking at an old, not-updated uTP transport implementation. If it were my repository that singleton would be exported already, and the deprecation warnings would have some actual meaning. Or at least, to maintain some semblance of extensibility.

It's not that it's not extensible, it's just marked deprecated where you would extend it.

I figure first start the conversation, I am probably missing something as dealing with multiformats and libp2p involves a lotta lotta individual repositories which can be quite tedious to trace back and forth.

I am here mainly because I want to add a new protocol, namely https://github.com/xtaci/kcp and to do this it really needs to have kcp in there (yes I have already submitted a PR to add it to the CSV). This is day 3 of me tackling this project, I'm starting to make sense of it all but it's tricky.

I don't mind what way it gets resolved, for now I am just gonna smile at the strikethroughs in my syntax highlighting.

ValueForProtocol() and multiple occurences of same protocol

There can be multiple occurences of the same protocol in one multiaddr. Example that's already happening: /ipfs/QmRelay/p2p-circuit/ipfs/QmRelay

Protocols() looks like it can handle it, but ValueForProtocol() will only return the first occurence.

Can listen support port reuse?

Sometimes I need to make the same port for dial and listen.
Used to penetrate the network.
net.Listen makes my Dial not working


May just need to change net.Listen => reuse.Listen

Update repo link + readme

Repo link in the "Code" still links to the jbenet version, and readme also contains reference to jbenet repo instead of multiformats. Could be confusing.

IPv6 support not working

Issue

Given the following program:

package main

import (
    "fmt"

    jma "github.com/jbenet/go-multiaddr"
)

func main() {
    var ips = []string{
        "/ip4/127.0.0.1/udp/1234",
        "/ip4/123.45.67.89/udp/5678",
        "/ip6/[::ffff:1.2.3.4]/udp/5678",
        "/ip6/::ffff:1.2.3.4/udp/5678",
        "/ip6/[::1]/udp/5678",
        "/ip6/::1/udp/5678",
        "/ip6/[2607:f8b0:4003:c00::6a]/udp/5678",
        "/ip6/2607:f8b0:4003:c00::6a/udp/5678",
    }

    for index, ip := range ips {
        fmt.Printf("input: %q\n", ip)
        var ma, err = jma.NewMultiaddr(ip)
        if err != nil {
            fmt.Printf("%d. NewMultiaddr error: %q\n", index+1, err)
            continue
        }

        var s, serr = ma.String()
        fmt.Printf("String: (%q, %q)\n", s, serr)
        fmt.Printf("Bytes: [% x]\n", ma.Bytes)
        var net, host, derr = ma.DialArgs()
        fmt.Printf("DialArgs: (%q, %q, %q)\n\n", net, host, derr)
    }
}

Upon running results are:

input: "/ip4/127.0.0.1/udp/1234"
String: ("/ip4/127.0.0.1/udp/1234", %!q(<nil>))
Bytes: [04 7f 00 00 01 11 04 d2]
DialArgs: ("udp", "127.0.0.1:1234", %!q(<nil>))

input: "/ip4/123.45.67.89/udp/5678"
String: ("/ip4/123.45.67.89/udp/5678", %!q(<nil>))
Bytes: [04 7b 2d 43 59 11 16 2e]
DialArgs: ("udp", "123.45.67.89:5678", %!q(<nil>))

input: "/ip6/[::ffff:1.2.3.4]/udp/5678"
String: ("", "runtime error: slice bounds out of range")
Bytes: [29 11 16 2e]
DialArgs: ("", "", "&{)\x11\x16.} is not a 'thin waist' address.")

input: "/ip6/::ffff:1.2.3.4/udp/5678"
String: ("", "runtime error: slice bounds out of range")
Bytes: [29 01 02 03 04 11 16 2e]
DialArgs: ("", "", "&{)\x01\x02\x03\x04\x11\x16.} is not a 'thin waist' address.")

input: "/ip6/[::1]/udp/5678"
String: ("", "runtime error: slice bounds out of range")
Bytes: [29 11 16 2e]
DialArgs: ("", "", "&{)\x11\x16.} is not a 'thin waist' address.")

input: "/ip6/::1/udp/5678"
String: ("", "runtime error: slice bounds out of range")
Bytes: [29 11 16 2e]
DialArgs: ("", "", "&{)\x11\x16.} is not a 'thin waist' address.")

input: "/ip6/[2607:f8b0:4003:c00::6a]/udp/5678"
String: ("", "runtime error: slice bounds out of range")
Bytes: [29 11 16 2e]
DialArgs: ("", "", "&{)\x11\x16.} is not a 'thin waist' address.")

input: "/ip6/2607:f8b0:4003:c00::6a/udp/5678"
String: ("", "runtime error: slice bounds out of range")
Bytes: [29 11 16 2e]
DialArgs: ("", "", "&{)\x11\x16.} is not a 'thin waist' address.")

Conclusion

Results reveal two things:

  1. IPv6 support for multiaddr isn't working, at all.
  2. IPv6 addresses must be pre-processed to remove brackets in order for net.ParseIP to parse them correctly.

How to fix?

https://github.com/jbenet/go-multiaddr/blob/99196c0d231f83eea7f6e47cf59cbb5a0b86b358/codec.go#L65-L67 instead of using IP.To4() for both IPv4 an IPv6 addresses each one should be handled in a different manner.

Reject empty multiaddrs

These are almost always useless and can cause bugs like ipfs/kubo#6354.

However, this would break the marshaling code as that expects to be able to construct these. It also removes the base-case for a recursive multiaddr definition...

cc @hsanjuan, @lgierth thoughts?

Multiaddr interface feels weird to work with

On IRC I mentioned that I would expect Push() and Pop() methods, and the idea came up to improve the general UX of the library.

22:34 < keks> is there a reason multiaddr doesn't have push() and pop()? push kind of is 
              Encapsulate, but decapsulate seems to be pop() except that it does the 
              opposite
22:34 < keks> you have to specify the ending and it gives you the beginning. aren't you 
              usually interested in the top of the protocol stack?
22:36 <@jbenet> keks: yeah, the multiaddr util funcs could be expanded.
22:52 <@whyrusleeping> keks: yeah... the multiaddr interface does feel a bit weird
22:53 <@whyrusleeping> should probably open an issue about improving the UX on that

Support DNS

Multiaddrs like these should work:

/dns/ipfs.io
/dns/foo.bar.com/http

error converting string into multiaddr

hello everybody,

I have a json file with the following format:
"peers": ["/ip4/192.168.1.65/tcp/9000"],

here is my function:

func (server *Server) connectToPeers(peers []string) {
	for _, addr := range peers {
		multiAddr, err := ma.NewMultiaddr(addr)
		if err != nil {
			log.Printf("invalid peer address %s: %s", addr, err)
			continue
		}
		fmt.Println(multiAddr)
		info, err := peer.AddrInfoFromP2pAddr(multiAddr)
		if err != nil {
			log.Printf("invalid peer address %s: %s", addr, err)
			continue
		}
		if err := server.host.Connect(context.Background(), *info); err != nil {
			log.Printf("failed to connect to peer %s: %s", addr, err)
			continue
		}
	}

}

Here is my error:

invalid peer address /ip4/192.168.1.65/tcp/9000: invalid p2p multiaddr

do you have any idea? I can reach both nodes using telnet.

README issues

There areoutdated and/or incorrect sections on the README.

  1. Simple section. Multiaddr.buffer doesn't exist, also if it existed we couldn't access it because of visibility. Solution:

    import "github.com/jbenet/go-multiaddr"
    
    m := multiaddr.NewMultiaddr("/ip4/127.0.0.1/udp/1234")
    // <Multiaddr /ip4/127.0.0.1/udp/1234>
    m.Bytes
    // <[]byte contents>
    m.String()
    // /ip4/127.0.0.1/udp/1234
    
    // construct with Buffer
    m = multiaddr.Multiaddr{ Bytes: m.Bytes }
    // <Multiaddr /ip4/127.0.0.1/udp/1234>
  2. Other formats section. NewUrl doesn't exist. Solution: remove entire section.

Dependabot can't parse your go.mod

Dependabot couldn't parse the go.mod found at /go.mod.

The error Dependabot encountered was:

go: github.com/multiformats/[email protected] requires
	golang.org/x/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /opt/go/gopath/pkg/mod/cache/vcs/f72f7a6f267d2fe79b1e174efab21a591b07c84ef53364f65b8281fda7000b49: exit status 128:
	error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Bad Gateway
	fatal: The remote end hung up unexpectedly

View the update logs.

json: cannot unmarshal string into Go value of type multiaddr.Multiaddr

I'm having trouble to unmarshal JSONs to structs that include Multiaddr fields.

json: cannot unmarshal string into Go struct field .a of type multiaddr.Multiaddr

var d struct {
	A ma.Multiaddr `json:"a"`
}
if err := json.Unmarshal([]byte(`{"a":"/ip4/64.227.126.216/tcp/4001"}`), &d); err != nil {
	panic(err)
}

Go Playground

I think it can be further minimized to unmarshaling only the string itself:

var a ma.Multiaddr
b := []byte(`"/ip4/64.227.126.216/tcp/4001"`)
if err := json.Unmarshal(b, &a); err != nil {
	panic(err)
}

Here I'm getting json: cannot unmarshal string into Go value of type multiaddr.Multiaddr.

I see implementations of json marshaling in ma.Multiaddr, so I wonder if I'm doing something wrong?

Panic in TestFuzzBytes

If I bump up the number of iterations to 10,000,000 I reliably get panics in (*multiaddr).String().

Correct IPv4-mapped syntax

We should be using /ip6/::ffff:xxx.xxx.xxx.xxx. Currently, we're just using /ip4/xxx.xxx.xxx.xxx which doesn't really make sense (it's not an IPv6 address).

Step 1: Output the correct format.
Step 2: Stop parsing /ip6/xxx.xxx.xxx.xxx.

0 port

In the test cases, 0 port is allowed for UDP, SCTP and TCP.

What's the reason for this? The 0 port is used for binding to a system allocated port, and it is also officially reserved by IANA and not be used for TCP or UDP messages.

If it this is allowed, then why does the onion test disallow a 0 port.

I'm writing a haskell version of this library, and seeing these 2 testcases means I would have to split the port logic to allow 0 for certain protocols and disallow 0 for other protocols.

In the broader case, why would 0 ever be used in a multiaddress? I would think it is intended for the binding on the server side, but never passed around as an actually addressable resource, since it doesn't make sense for the system to randomly allocate a connecting port on the client side.

remove dependency on go-multihash

This package depends on go-multihash because it parses ipfs peer IDs. We should extract that out and plug it in modularly (probably after #42 is merged). This will simplify the dependency tree significantly

Avoid int

We should be using uint32 or uint64 for codecs. int is platform dependent.

unix domain socket

would be neat if we could have multiaddrs to represent unix domain sockets

Encoding urls with http/https

I don't know if I'm missing something but is there a way to use the http/https codes to encode a url?
ex) dropbox.com/asdf/

I can use the AddProtocol function but it can't parse added protocols with a non zero length.

I'm able to hack around it but using /ipfs/<encoded url>/https/ but that seems a bit ugly.

En/decapsulate example is not working

The example code in README.md
m.Decapsulate(ma.NewMultiaddr("/udp"))
is result to fail in master/HEAD

I got two rocks; one is that he method NewMultiaddr returns multi values, but this is not the problem since I can go around this. The scond one is NewMultiaddr requires valid address, so calling ma.NewMultiaddr("/udp") will return error in runtime. I can’t find suitable walkaround yet.

implement a new multiaddress API

Problems with the current API

Major problems:

  • When receiving a multiaddress (e.g. from an address record in the DHT), we immediately try to parse it. If parsing fails, that multiaddress is discarded. Parsing fails if the multiaddress contains any unknown components: if a node hasn’t been updated to understand WebTransport addresses, it won’t be able to parse a WebTransport multiaddress, and won’t be able to forward it to other (WebTransport-enabled) nodes.

Related: multiformats/multiaddr#155

Minor problems:

  • Multiaddr is an interface, and therefore (almost always) allocated on the heap. This creates a lot of GC pressure.
  • Methods are split between packet-level functions (e.g. SplitLast) and methods on the interface (e.g. ValueForProtocol). There’s no (apparent) logic behind this, making use of the API confusing
  • The methods weren’t designed with allocations in mind. One of them (especially Protocols) is the major source of allocations in a Kubo node

Proposal for a new API

Wishlist

  • It is possible to handle multiaddresses with unsupported components
  • Multiaddr is not an interface any more, but a concrete type
  • maybe: Multiaddr can be entirely allocated on the stack
  • Multiaddr are comparable using the == operator. This means they can be used as map keys!
  • Component is a concrete type, also allocated on the stack, and == comparable

Type mismatch in multiaddr.go

Problem Description

When building my Go application that uses go-multiaddr as a dependency, I encountered a type mismatch error at line 223 of multiaddr.go.

The full error message is as follows:

# github.com/multiformats/go-multiaddr
../../../go/pkg/mod/github.com/multiformats/[email protected]/multiaddr.go:223:25: type func(a Multiaddr, b Multiaddr) bool of func(a, b Multiaddr) bool {…} does not match inferred type func(a Multiaddr, b Multiaddr) int for func(a E, b E) int

Steps to Reproduce

  1. I am using go-multiaddr version v0.10.1 in my Go application.
  2. When I build my application with go build, the above error is thrown.

Expected Behavior

I expected the application to build without any type mismatch errors.

System Information

  • Go version: go version go1.20.7 darwin/arm64
  • Operating system and version: Mac OS 13.5

Please let me know if you need any further information. I am currently blocked by this issue and would appreciate any assistance or guidance.

Thank you!

Unix path trailing slashes

It seems that a path like /unix/a/b/c/ is interpreted as /unix/a/b/c. Does this mean we cannot represent directory paths in multiaddr?

breaking changes to 'slices.SortFunc'

A breaking change have been made to slices package in golang.org/x/exp module (slices.SortFunc in particular).

slices: update to current standard library version
Update x/exp/slices to the current standard library slices package,
while retaining the ability to use it with Go 1.18 through Go 1.20.

Note that this changes some of the sorting functions to use a
comparison function rather than a less function. We don't promise
backward compatibility in x/exp packages. Being compatible with the
Go 1.21 package seems more useful for people not yet using 1.21,
as it will make the transition to 1.21 easier.

It is the comparison function, an argument of slices.SortFunc, that affects our package.
func(a, b E) bool vs func(a, b E) int.

- func SortFunc[E any](x []E, less func(a, b E) bool) {
+ func SortFunc[S ~[]E, E any](x S, cmp func(a, b E) int) {

Currently there are no problems, but when updating dependent modules the following error occurs:

How to reproduce error

$ cat version.json
{
  "version": "v0.10.1"
}

$ go test ./...
?       github.com/multiformats/go-multiaddr/multiaddr  [no test files]
ok      github.com/multiformats/go-multiaddr    0.262s
ok      github.com/multiformats/go-multiaddr/net        0.533s

$ go get -u golang.org/x/exp
go: upgraded golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df => v0.0.0-20230725093048-515e97ebf090

$ go test ./...
# github.com/multiformats/go-multiaddr
./multiaddr.go:223:25: type func(a Multiaddr, b Multiaddr) bool of func(a, b Multiaddr) bool {…} does not match inferred type func(a Multiaddr, b Multiaddr) int for func(a E, b E) int
FAIL    github.com/multiformats/go-multiaddr [build failed]
FAIL    github.com/multiformats/go-multiaddr/net [build failed]
FAIL

Proposed fix

slices.SortFunc(addrs, func(a, b Multiaddr) bool { return bytes.Compare(a.Bytes(), b.Bytes()) < 0 })

- slices.SortFunc(addrs, func(a, b Multiaddr) bool { return bytes.Compare(a.Bytes(), b.Bytes()) < 0 })
+ slices.SortFunc(addrs, func(a, b Multiaddr) int { return bytes.Compare(a.Bytes(), b.Bytes()) })

Note

Even if all other modules are updated, no further changes seem to be necessary at this stage.

$ go get -u ./...
go: upgraded github.com/ipfs/go-cid v0.0.7 => v0.4.1
go: added github.com/klauspost/cpuid/v2 v2.2.5
go: upgraded github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771 => v1.0.1
go: upgraded github.com/mr-tron/base58 v1.1.3 => v1.2.0
go: upgraded github.com/multiformats/go-base32 v0.0.3 => v0.1.0
go: upgraded github.com/multiformats/go-base36 v0.1.0 => v0.2.0
go: upgraded github.com/multiformats/go-multibase v0.0.3 => v0.2.0
go: upgraded github.com/multiformats/go-multihash v0.0.14 => v0.2.3
go: upgraded github.com/multiformats/go-varint v0.0.6 => v0.0.7
go: upgraded golang.org/x/crypto v0.1.0 => v0.11.0
go: upgraded golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df => v0.0.0-20230725093048-515e97ebf090
go: upgraded golang.org/x/sys v0.1.0 => v0.10.0
go: added lukechampine.com/blake3 v1.2.1

$ go test ./...
?       github.com/multiformats/go-multiaddr/multiaddr  [no test files]
ok      github.com/multiformats/go-multiaddr    0.727s
ok      github.com/multiformats/go-multiaddr/net        0.567s

Env info

$ go version
go version go1.20.6 darwin/amd64

$ # go-multiaddr ver
$ cat version.json
{
  "version": "v0.10.1"
}

DialArgs() panics when called on a 'valid' multiaddr

So, valid is a loose term here. but the following code behaves unexpectedly.

package main

import "fmt"
import "github.com/jbenet/go-multiaddr"

func main() {
    fmt.Println("Hello, playground")
    a, err := multiaddr.NewMultiaddr("hello.com:8080")
    if err != nil {
            // Expect it to fail here, since we passed a technically invalid multiaddr.
        fmt.Println(err)
        return
    }
    // Yet, no error is thrown
    fmt.Println(a)

    // Smash crash boom!
    a.DialArgs()
}

HTTP and HTTPS codes

As specified on https://github.com/jbenet/multiaddr:

Binary format:

(<1 byte proto><n byte addr>)+
<1 byte ipv4 code><4 byte ipv4 addr><1 byte udp code><2 byte udp port>
<1 byte ipv6 code><16 byte ipv6 addr><1 byte tcp code><2 byte tcp port>```

Using just 1 byte won't work for HTTP (code: 480) and HTTPS (code: 443) because they are out of bounds.

'Dial' and 'Listen' functionality

I think it would be great to be able to do something like:

con, err := multiaddr.Dial(maddr)

and

list, err := multiaddr.Listen(maddr)

to abstract away having to deal with all of the different protocols that multiaddr can represent.

Project LICENSE

I suppose this is MIT as multihash but there's no LICENSE file nor mention on README.

Could you please clarify it please?

What about releasing a new version?

I try to integrate https://github.com/ipfs/go-ipfs-api into a project. That repo depends on https://github.com/multiformats/go-multiaddr-net and that one on this.
I'm using dep as a package manager.
Installing all the dependencies results in code that does not compile.

It seems dep uses the latest release you have created, which is ~4 years old. Is there a reason why you haven't created a new release in all this time? If not, it would help to keep compatibility with other dependency management tools

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.