Skip to content

Commit 014cd90

Browse files
committed
Squashed 'compattest/internal/prev/' content from commit 37363a0
git-subtree-dir: compattest/internal/prev git-subtree-split: 37363a0
0 parents  commit 014cd90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+6468
-0
lines changed

Diff for: .github/workflows/go-check.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Go Checks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ["master"]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
go-check:
18+
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected]

Diff for: .github/workflows/go-test.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Go Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ["master"]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
go-test:
18+
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected]
19+
secrets:
20+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Diff for: .github/workflows/release-check.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release Checker
2+
3+
on:
4+
pull_request_target:
5+
paths: [ 'version.json' ]
6+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
release-check:
19+
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected]

Diff for: .github/workflows/releaser.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Releaser
2+
3+
on:
4+
push:
5+
paths: [ 'version.json' ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.sha }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
releaser:
17+
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected]

Diff for: .github/workflows/tagpush.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Tag Push Checker
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
permissions:
9+
contents: read
10+
issues: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
releaser:
18+
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected]

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vscode/
2+
multiaddr/multiaddr
3+
tmp/

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Juan Batiz-Benet
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Diff for: README.md

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# go-multiaddr
2+
3+
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
4+
[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats)
5+
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs)
6+
[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
7+
[![GoDoc](https://godoc.org/github.com/multiformats/go-multiaddr?status.svg)](https://godoc.org/github.com/multiformats/go-multiaddr)
8+
[![Travis CI](https://img.shields.io/travis/multiformats/go-multiaddr.svg?style=flat-square&branch=master)](https://travis-ci.org/multiformats/go-multiaddr)
9+
[![codecov.io](https://img.shields.io/codecov/c/github/multiformats/go-multiaddr.svg?style=flat-square&branch=master)](https://codecov.io/github/multiformats/go-multiaddr?branch=master)
10+
11+
> [multiaddr](https://github.com/multiformats/multiaddr) implementation in go
12+
13+
Multiaddr is a standard way to represent addresses that:
14+
15+
- Support any standard network protocols.
16+
- Self-describe (include protocols).
17+
- Have a binary packed format.
18+
- Have a nice string representation.
19+
- Encapsulate well.
20+
21+
## Table of Contents
22+
23+
- [Install](#install)
24+
- [Usage](#usage)
25+
- [Example](#example)
26+
- [Simple](#simple)
27+
- [Protocols](#protocols)
28+
- [En/decapsulate](#endecapsulate)
29+
- [Tunneling](#tunneling)
30+
- [Maintainers](#maintainers)
31+
- [Contribute](#contribute)
32+
- [License](#license)
33+
34+
## Install
35+
36+
```sh
37+
go get github.com/multiformats/go-multiaddr
38+
```
39+
40+
## Usage
41+
42+
### Example
43+
44+
#### Simple
45+
46+
```go
47+
import ma "github.com/multiformats/go-multiaddr"
48+
49+
// construct from a string (err signals parse failure)
50+
m1, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234")
51+
52+
// construct from bytes (err signals parse failure)
53+
m2, err := ma.NewMultiaddrBytes(m1.Bytes())
54+
55+
// true
56+
strings.Equal(m1.String(), "/ip4/127.0.0.1/udp/1234")
57+
strings.Equal(m1.String(), m2.String())
58+
bytes.Equal(m1.Bytes(), m2.Bytes())
59+
m1.Equal(m2)
60+
m2.Equal(m1)
61+
```
62+
63+
#### Protocols
64+
65+
```go
66+
// get the multiaddr protocol description objects
67+
m1.Protocols()
68+
// []Protocol{
69+
// Protocol{ Code: 4, Name: 'ip4', Size: 32},
70+
// Protocol{ Code: 17, Name: 'udp', Size: 16},
71+
// }
72+
```
73+
74+
#### En/decapsulate
75+
76+
```go
77+
import ma "github.com/multiformats/go-multiaddr"
78+
79+
m, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234")
80+
// <Multiaddr /ip4/127.0.0.1/udp/1234>
81+
82+
sctpMA, err := ma.NewMultiaddr("/sctp/5678")
83+
84+
m.Encapsulate(sctpMA)
85+
// <Multiaddr /ip4/127.0.0.1/udp/1234/sctp/5678>
86+
87+
udpMA, err := ma.NewMultiaddr("/udp/1234")
88+
89+
m.Decapsulate(udpMA) // up to + inc last occurrence of subaddr
90+
// <Multiaddr /ip4/127.0.0.1>
91+
```
92+
93+
#### Tunneling
94+
95+
Multiaddr allows expressing tunnels very nicely.
96+
97+
```js
98+
printer, _ := ma.NewMultiaddr("/ip4/192.168.0.13/tcp/80")
99+
proxy, _ := ma.NewMultiaddr("/ip4/10.20.30.40/tcp/443")
100+
printerOverProxy := proxy.Encapsulate(printer)
101+
// /ip4/10.20.30.40/tcp/443/ip4/192.168.0.13/tcp/80
102+
103+
proxyAgain := printerOverProxy.Decapsulate(printer)
104+
// /ip4/10.20.30.40/tcp/443
105+
```
106+
107+
## Contribute
108+
109+
Contributions welcome. Please check out [the issues](https://github.com/multiformats/go-multiaddr/issues).
110+
111+
Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
112+
113+
Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
114+
115+
## License
116+
117+
[MIT](LICENSE) © 2014 Juan Batiz-Benet

0 commit comments

Comments
 (0)