Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move go-nat to internal package #3154

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
605978b
e3x: working on channel implementation
fd Aug 28, 2014
d827c54
Moving to github
fd Oct 27, 2014
83bf98d
Vendored dependencies
fd Oct 27, 2014
4dbe9af
WIP go vet and golint
fd Oct 30, 2014
c0902fb
Extracted from gogotelehash
fd Nov 5, 2014
50e7633
Fixed the example
fd Nov 5, 2014
dcaf501
Using github.com/jackpal/gateway to discover NAT-PMP/PCP gateways
fd May 8, 2015
bad65a4
Added go.mod file
fd May 25, 2018
66a3ad4
Fix test
cannium Sep 13, 2018
3fa58ce
Try to map external port the same as internal port
cannium Sep 13, 2018
329756a
gx import
Stebalien Sep 17, 2018
c30beee
Merge pull request #1 from cannium/port-mapping-update
Stebalien Sep 17, 2018
78a6e61
finish fd -> libp2p migration
Stebalien Sep 17, 2018
ab584c7
gx release 1.0.2
Stebalien Sep 17, 2018
2d37539
Bump github.com/jackpal/gateway from 1.0.4 to 1.0.5
dependabot-support Feb 12, 2019
e3ba0d8
Merge pull request #6 from fd/dependabot/go_modules/github.com/jackpa…
fd Feb 12, 2019
06c184b
Added method to generically discover IG Devices
ryanskidmore Mar 1, 2019
305b4cf
merge changes from upstream master (fd/go-nat).
raulk Mar 1, 2019
900ec35
add gomod support // tag v0.0.1.
raulk Mar 1, 2019
b1008fb
Merge pull request #3 from libp2p/gomod
raulk Mar 1, 2019
5172223
Merge pull request #7 from ryanskidmore/master
fd Mar 2, 2019
943d7b3
expose all discovered NATs
Stebalien Mar 6, 2019
c8594db
try to pick the best NAT when multiple NATs are discovered
Stebalien Mar 6, 2019
034a635
Merge remote-tracking branch 'fd/master'
Stebalien Mar 12, 2019
e426ef9
gx import go-ssdp
Stebalien Mar 12, 2019
5b3e757
Merge pull request #4 from libp2p/merge/upstream
Stebalien Mar 12, 2019
2c696e8
Merge pull request #5 from Stebalien/multi-nat
Stebalien Mar 12, 2019
ab32e61
gx release 1.0.3
Stebalien Mar 12, 2019
4a84cb4
farewell gx; thanks for serving us well.
raulk Apr 11, 2019
3f647da
fix detection of GenIG NATs
Stebalien Apr 12, 2019
523cb01
Revert "Try to map external port the same as internal port"
Stebalien Apr 12, 2019
c6e34f0
Merge pull request #7 from libp2p/fix/6
Stebalien Apr 12, 2019
d13fdef
Merge pull request #8 from libp2p/fix/random-port
Stebalien Apr 12, 2019
0938e5d
don't mask context
Stebalien May 3, 2019
02f8b1e
Merge pull request #10 from libp2p/fix/dont-mask-context
May 3, 2019
93d0ace
updated go.mod and go.sum to the latest version of github.com/koron/g…
iulianpascalau Nov 21, 2019
4b355d4
Merge pull request #12 from ElrondNetwork/master
vyzo Nov 21, 2019
199acda
fix: really obey the context
Stebalien Nov 22, 2019
5d5bd18
Merge pull request #13 from libp2p/fix/really-obey-context
Stebalien Nov 22, 2019
c437f7a
Bump github.com/jackpal/go-nat-pmp from 1.0.1 to 1.0.2
dependabot-preview[bot] Dec 6, 2019
4b6e89e
ci: bump to go 1.13
Stebalien Dec 6, 2019
6c4ff07
Merge branch 'ci/go-1.13'
Stebalien Dec 6, 2019
06a02ce
Merge pull request #14 from libp2p/dependabot/go_modules/github.com/j…
Stebalien Dec 7, 2019
d4146fb
feat: switch to go-netroute
Stebalien Mar 30, 2020
e0453a8
Merge pull request #19 from libp2p/feat/netroute
Stebalien Mar 31, 2020
c7e6c5b
sync: update CI config files (#20)
web3-bot Apr 22, 2021
18d1053
sync: update CI config files (#21)
web3-bot Jun 1, 2021
558869f
sync: update CI config files (#22)
web3-bot Aug 17, 2021
d0d64ea
pass a context to DiscoverGateway
marten-seemann Sep 19, 2021
73b4c1e
Merge pull request #23 from libp2p/context-discover-gateway
marten-seemann Sep 19, 2021
763460e
sync: update CI config files (#24)
web3-bot Dec 10, 2021
f775be1
sync: update CI config files (#25)
web3-bot Apr 4, 2022
afac959
sync: update CI config files (#26)
web3-bot Aug 23, 2022
5b1afd6
chore: Update .github/workflows/stale.yml [skip ci]
libp2p-mgmt-read-write[bot] Sep 19, 2022
dc44869
sync: update CI config files (#28)
web3-bot Apr 8, 2023
25823d7
update deps, use contexts on UPnP functions (#29)
marten-seemann Jun 1, 2023
2366bb0
chore: update deps (#31)
marten-seemann Jun 1, 2023
14ce74b
release v0.2.0 (#30)
marten-seemann Jun 1, 2023
29fad80
chore: Update .github/workflows/stale.yml [skip ci]
web-flow Jun 14, 2023
5cc65f9
chore: Update .github/workflows/stale.yml [skip ci]
web-flow Jun 28, 2023
da1dc6d
chore: delete templates [skip ci] (#32)
web3-bot Aug 13, 2023
90336fa
ci: uci/copy-templates (#33)
web3-bot Aug 14, 2023
0024259
chore: bump go.mod to Go 1.20 and run go fix (#34)
web3-bot Aug 14, 2023
07ada58
chore: Update .github/workflows/stale.yml [skip ci]
web-flow Jan 31, 2024
7083c1c
ci: uci/update-go (#36)
web3-bot Mar 14, 2024
01a3d99
ci: uci/copy-templates (#37)
web3-bot Mar 22, 2024
2fac909
chore: bump go.mod to Go 1.22 and run go fix (#38)
web3-bot Aug 26, 2024
d5b0d8f
Add 'p2p/net/nat/internal/nat/' from commit '2fac9092f3fc908fb38bc52f…
MarcoPolo Jan 24, 2025
f8bd11c
Make changes to internal nat library
MarcoPolo Jan 24, 2025
a740446
Merge branch 'master' into marco/bring-go-nat-home
MarcoPolo Jan 28, 2025
92a5d91
use buffered chan
MarcoPolo Jan 30, 2025
33a5f73
PR comments
MarcoPolo Jan 30, 2025
027bdd8
fix for loop condition
MarcoPolo Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@ require (
github.com/gorilla/websocket v1.5.3
github.com/hashicorp/golang-lru/arc/v2 v2.0.7
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/huin/goupnp v1.3.0
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-datastore v0.6.0
github.com/ipfs/go-ds-badger v0.3.0
github.com/ipfs/go-ds-leveldb v0.5.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/jackpal/go-nat-pmp v1.0.2
github.com/jbenet/go-temp-err-catcher v0.1.0
github.com/klauspost/compress v1.17.11
github.com/koron/go-ssdp v0.0.4
github.com/libp2p/go-buffer-pool v0.1.0
github.com/libp2p/go-flow-metrics v0.2.0
github.com/libp2p/go-libp2p-asn-util v0.4.1
github.com/libp2p/go-libp2p-testing v0.12.0
github.com/libp2p/go-msgio v0.3.0
github.com/libp2p/go-nat v0.2.0
github.com/libp2p/go-netroute v0.2.2
github.com/libp2p/go-reuseport v0.4.0
github.com/libp2p/go-yamux/v4 v4.0.1
Expand Down Expand Up @@ -90,11 +92,8 @@ require (
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUI
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0=
github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM=
github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk=
github.com/libp2p/go-nat v0.2.0/go.mod h1:3MJr+GRpRkyT65EpVPBstXLvOlAPzUVlG6Pwg9ohLJk=
github.com/libp2p/go-netroute v0.2.2 h1:Dejd8cQ47Qx2kRABg6lPwknU7+nBnFRpko45/fFPuZ8=
github.com/libp2p/go-netroute v0.2.2/go.mod h1:Rntq6jUAH0l9Gg17w5bFGhcC9a+vk4KNXs6s7IljKYE=
github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s=
Expand Down
191 changes: 191 additions & 0 deletions p2p/net/nat/internal/nat/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.

"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.

"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.

2. Grant of Copyright License.

Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.

3. Grant of Patent License.

Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.

4. Redistribution.

You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:

You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.

5. Submission of Contributions.

Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.

6. Trademarks.

This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.

7. Disclaimer of Warranty.

Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.

8. Limitation of Liability.

In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability.

While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work

To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1 change: 1 addition & 0 deletions p2p/net/nat/internal/nat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Originally forked from: [fd/go-nat](https://github.com/fd/go-nat).
Loading
Loading