forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 714
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
[Net] Add NAT-PMP port forwarding support #2338
Merged
random-zebra
merged 19 commits into
PIVX-Project:master
from
Fuzzbawls:2021_net-add-natpmp
Jun 24, 2021
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c481f62
refactor: Move port mapping code to its own module
Fuzzbawls 7532090
refactor: Replace magic number with named constant
hebasto d2fa5c4
Make ThreadMapPort static
Fuzzbawls 2abea67
net: Keep trying to use UPnP when -upnp=1
hebasto 06dc0dd
net: Add flags for port mapping protocols
Fuzzbawls 266d322
scripted-diff: Rename UPnP stuff
Fuzzbawls faed148
gui: Apply port mapping changes on save
Fuzzbawls 84cd118
net: Add initial libnatpmp support
Fuzzbawls 9927296
net: Add NAT-PMP to port mapping loop
hebasto 9a4ba48
net: Add -natpmp command line option
Fuzzbawls 5a5e3cf
gui: Add NAT-PMP network option
Fuzzbawls cf992d0
ci: Add libnatpmp-dev package to some builds
Fuzzbawls 7886374
doc: Add libnatpmp stuff
Fuzzbawls d48ef00
doc: Add release notes
Fuzzbawls f1951b5
Add libnatpmp to nightly snapcraft builds
Fuzzbawls c4300c0
Clang-Tidy up mapport.cpp
Fuzzbawls 8143139
GUI: Re-work port mapping saving
Fuzzbawls f2b62a3
build: use newer source for libnatpmp
fanquake c198797
build: compile libnatpmp with -DNATPMP_STATICLIB on Windows
Fuzzbawls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# - Find NAT-PMP | ||
# This module defines | ||
# NAT-PMP_INCLUDE_DIR, where to find NAT-PMP headers | ||
# NAT-PMP_LIBRARY, NAT-PMP libraries | ||
# NAT-PMP_FOUND, If false, do not try to use NAT-PMP | ||
|
||
set(NAT-PMP_PREFIX "" CACHE PATH "path ") | ||
|
||
find_path(NAT-PMP_INCLUDE_DIR natpmp.h | ||
PATHS ${NAT-PMP_PREFIX}/include /usr/include /usr/local/include) | ||
|
||
find_library(NAT-PMP_LIBRARY NAMES natpmp libnatpmp | ||
PATHS ${NAT-PMP_PREFIX}/lib /usr/lib /usr/local/lib) | ||
|
||
if(NAT-PMP_INCLUDE_DIR AND NAT-PMP_LIBRARY) | ||
get_filename_component(NAT-PMP_LIBRARY_DIR ${NAT-PMP_LIBRARY} PATH) | ||
set(NAT-PMP_FOUND TRUE) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
NAT-PMP DEFAULT_MSG | ||
NAT-PMP_INCLUDE_DIR | ||
NAT-PMP_LIBRARY | ||
) | ||
|
||
if(NAT-PMP_FOUND) | ||
if(NOT NAT-PMP_FIND_QUIETLY) | ||
MESSAGE(STATUS "Found NAT-PMP: ${NAT-PMP_LIBRARY}") | ||
endif() | ||
else() | ||
if(NAT-PMP_FIND_REQUIRED) | ||
message(FATAL_ERROR "Could not find NAT-PMP") | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced( | ||
NAT-PMP_LIBRARY | ||
NAT-PMP_INCLUDE_DIR | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package=libnatpmp | ||
$(package)_version=4536032ae32268a45c073a4d5e91bbab4534773a | ||
$(package)_download_path=https://github.com/miniupnp/libnatpmp/archive | ||
$(package)_file_name=$($(package)_version).tar.gz | ||
$(package)_sha256_hash=543b460aab26acf91e11d15e17d8798f845304199eea2d76c2f444ec749c5383 | ||
|
||
define $(package)_set_vars | ||
$(package)_build_opts=CC="$($(package)_cc)" | ||
$(package)_build_opts_mingw32=CPPFLAGS=-DNATPMP_STATICLIB | ||
$(package)_build_opts_darwin=LIBTOOL="$($(package)_libtool)" | ||
$(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)" | ||
endef | ||
|
||
define $(package)_build_cmds | ||
$(MAKE) libnatpmp.a $($(package)_build_opts) | ||
endef | ||
|
||
define $(package)_stage_cmds | ||
mkdir -p $($(package)_staging_prefix_dir)/include $($(package)_staging_prefix_dir)/lib &&\ | ||
install *.h $($(package)_staging_prefix_dir)/include &&\ | ||
install libnatpmp.a $($(package)_staging_prefix_dir)/lib | ||
endef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future nit: miniupnpc and libnatpmp are optional.