10 Commits

Author SHA1 Message Date
Juan Batiz-Benet
2a572df05c ignore trailing slashes 2014-10-10 20:40:51 -07:00
Juan Batiz-Benet
c90ef4472f New Multiaddr interface
This commit changes the struct to a new Multiaddr interface:

```Go
type Multiaddr interface {
  Equal(Multiaddr) bool
  Bytes() []byte
  String() string
  Protocols() []*Protocol
  Encapsulate(Multiaddr) Multiaddr
  Decapsulate(Multiaddr) Multiaddr
}
```

This means a few things have changed:

- use Multiaddr interface, struct not exported
- Bytes returns a copy of the internal bytes
- Some methods no longer return errors (catch errors in NewMultiaddr)
  - String (panics if malformed)
  - Protocols (panics if malformed)
  - Decapsulate (no-op if not prefix)
- Moved net-specific functions to package
  - Multiaddr.DialArgs() -> DialArgs(Multiaddr)
  - Multiaddr.IsThinWaist() -> IsThinWaist(Multiaddr)

cc @whyrusleeping @perfmode
2014-10-06 03:27:29 -07:00
Juan Batiz-Benet
bd30912d08 Multiaddr.String no error
The error in String should not actually ocurr, as the multiaddr
should have been valid to be constructed successfully, and thus
should be encoded back to its string rep correctly.

This will be bolstered by creating an interface (to prevent messing
with the internal bytes)
2014-10-06 02:39:00 -07:00
Juan Batiz-Benet
74443fca31 Added Equal func 2014-09-16 06:08:48 -07:00
Juan Batiz-Benet
b90678896b go lint + unexporting some funcs 2014-09-11 10:47:56 -07:00
Juan Batiz-Benet
99196c0d23 dialing + consts 2014-07-07 01:25:20 -07:00
Juan Batiz-Benet
9033141fca gofmt 2014-07-04 11:21:39 -07:00
Juan Batiz-Benet
3855a29d4e en/decapsulation 2014-07-04 00:48:33 -07:00
Juan Batiz-Benet
e20c5b9d3b protocols 2014-07-04 00:12:33 -07:00
Juan Batiz-Benet
c5510ff4b8 string <> []byte 2014-07-03 23:42:24 -07:00