aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Typo fixes in commentsChris Wheeler2016-01-171-1/+1
|
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* [trivial] Reuse translation and cleanup DEFAULT_* valuesMarcoFalke2015-11-281-1/+1
| | | | | * DEFAULT_DISABLE_SAFEMODE = false * Use DEFAULT_* constants for extern bools
* Constrain constant values to a single location in codeLuke Dashjr2015-11-281-1/+1
|
* net: Automatically create hidden service, listen on TorWladimir J. van der Laan2015-11-101-4/+1
| | | | | | | | | | | | | | | | | | | | Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket API, to create and destroy 'ephemeral' hidden services programmatically. https://stem.torproject.org/api/control.html#stem.control.Controller.create_ephemeral_hidden_service This means that if Tor is running (and proper authorization is available), bitcoin automatically creates a hidden service to listen on, without user manual configuration. This will positively affect the number of available .onion nodes. - When the node is started, connect to Tor through control socket - Send `ADD_ONION` command - First time: - Make it create a hidden service key - Save the key in the data directory for later usage - Make it redirect port 8333 to the local port 8333 (or whatever port we're listening on). - Keep control socket connection open for as long node is running. The hidden service will (by default) automatically go away when the connection is closed.
* Set TCP_NODELAY on P2P sockets.Gregory Maxwell2015-10-221-1/+8
| | | | | | | | Nagle appears to be a significant contributor to latency now that the static sleeps are gone. Most of our messages are relatively large compared to IP + TCP so I do not expect this to create enormous overhead. This may also reduce traffic burstyness somewhat.
* net: Fix CIDR notation in ToString()Wladimir J. van der Laan2015-09-161-10/+48
| | | | Only use CIDR notation if the netmask can be represented as such.
* net: use CIDR notation in CSubNet::ToString()Jonas Schnelli2015-09-161-9/+11
|
* Merge pull request #6556Wladimir J. van der Laan2015-08-201-1/+1
|\ | | | | | | | | 1123cdb add unit test for CNetAddr::GetGroup. (Alex Morcos) bba3db1 Fix masking of irrelevant bits in address groups. (Alex Morcos)
| * Fix masking of irrelevant bits in address groups.Alex Morcos2015-08-141-1/+1
| |
* | typofixes (found by misspell_fixer)Veres Lajos2015-08-101-1/+1
|/
* Test whether created sockets are select()ablePieter Wuille2015-07-101-0/+3
|
* Adding CSubNet constructor over a single CNetAddrJonas Schnelli2015-07-021-0/+7
|
* fix CSubNet comparison operatorJonas Schnelli2015-06-171-1/+1
|
* [RPC] extend setban to allow subnetsJonas Schnelli2015-06-171-0/+5
|
* [net, trivial] remove using namespace std pollution in netbase.cppPhilip Kaufmann2015-05-311-4/+2
|
* Fix two problems in CSubNet parsingWladimir J. van der Laan2015-05-261-1/+5
| | | | | | | | | | | | | | | Fix two CSubNet constructor problems: - The use of `/x` where 8 does not divide x was broken, due to a bit-order issue - The use of e.g. `1.2.3.4/24` where the netmasked bits in the network are not 0 was broken. Fix this by explicitly normalizing the netwok according to the bitmask. Also add tests for these cases. Fixes #6179. Thanks to @jonasschnelli for reporting and initial fix.
* Simplify code for CSubnetWladimir J. van der Laan2015-05-261-8/+6
| | | | | Simplify the code by using CAddress.ip directly, instead of the reversed GetByte() semantics.
* use const reference as param in ConnectThroughProxy/Socks5Philip Kaufmann2015-04-281-2/+2
| | | | - also ensure code style conformance by replacing bool static with static bool
* privacy: Stream isolation for TorWladimir J. van der Laan2015-04-171-66/+104
| | | | | | | | | | | | | According to Tor's extensions to the SOCKS protocol (https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt) it is possible to perform stream isolation by providing authentication to the proxy. Each set of credentials will create a new circuit, which makes it harder to correlate connections. This patch adds an option, `-proxyrandomize` (on by default) that randomizes credentials for every outgoing connection, thus creating a new circuit. 2015-03-16 15:29:59 SOCKS5 Sending proxy authentication 3842137544:3256031132
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|
* Regard connection failures as attempt for addrmanWladimir J. van der Laan2014-12-021-4/+16
| | | | | | | This avoids connecting to them again too soon in ThreadOpenConnections. Make an exception for connection failures to the proxy as these shouldn't affect the status of specific nodes.
* Use complete path to include bitcoin-config.h.Pavel Janík2014-11-261-1/+1
|
* Add missing reserved address spaces.Matt Corallo2014-10-281-1/+18
|
* add -timeout default as constant and use themPhilip Kaufmann2014-10-061-1/+1
| | | | | - update help message text - simplify code in init to check for -timeout
* netbase: Make SOCKS5 negotiation interruptibleWladimir J. van der Laan2014-09-101-18/+70
| | | | | | | | | | | | Avoids that SOCKS5 negotiation will hold up the shutdown process. - Sockets can stay in non-blocking mode, no need to switch it on/off anymore - Adds a timeout (20 seconds) on SOCK5 negotiation. This should be enough for even Tor to get a connection to a hidden service, and avoids blocking the opencon thread indefinitely on a hanging proxy. Fixes #2954.
* netbase: Use .data() instead of .c_str() on binary stringWladimir J. van der Laan2014-09-081-1/+1
| | | | | `.c_str()` is only guaranteed to return the data up to the first NUL character.
* Split up util.cpp/hWladimir J. van der Laan2014-08-261-0/+2
| | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* Remove all other print() methodsWladimir J. van der Laan2014-08-201-10/+0
| | | | All unused.
* Merge pull request #4605Wladimir J. van der Laan2014-08-181-1/+11
|\ | | | | | | | | | | | | aa82795 Add detailed network info to getnetworkinfo RPC (Wladimir J. van der Laan) 075cf49 Add GetNetworkName function (Wladimir J. van der Laan) c91a947 Add IsReachable(net) function (Wladimir J. van der Laan) 60dc8e4 Allow -onlynet=onion to be used (Wladimir J. van der Laan)
| * Add GetNetworkName functionWladimir J. van der Laan2014-07-301-0/+10
| | | | | | | | Returns the network name for an Network enum.
| * Allow -onlynet=onion to be usedWladimir J. van der Laan2014-07-301-1/+1
| | | | | | | | | | Just an alias for onlynet=tor, but matches the new name of the proxy option -onion= better.
* | small net cleanupPhilip Kaufmann2014-08-081-0/+1
|/ | | | | | - add comment for disabling sigpipe - add closing comment in compat.h - remove redundant check in net.h
* net: add SetSocketNonBlocking() as OS independent wrapperPhilip Kaufmann2014-07-171-29/+41
|
* Convert closesocket 'compat wrapper' to function in netbaseWladimir J. van der Laan2014-07-171-20/+33
| | | | | | | | | | | Simpler alternative to #4348. The current setup with closesocket() is strange. It poses as a compatibility wrapper but adds functionality. Rename it and make it a documented utility function in netbase. Code movement only, zero effect on the functionality.
* Merge pull request #4479Wladimir J. van der Laan2014-07-081-1/+2
|\ | | | | | | 109849e Bugfix: strerror_r can return an error, and if it does, POSIX does not specify the content of the buffer (Luke Dashjr)
| * Bugfix: strerror_r can return an error, and if it does, POSIX does not ↵Luke Dashjr2014-07-071-1/+2
| | | | | | | | specify the content of the buffer
* | Fix the build for windowsWladimir J. van der Laan2014-07-071-4/+3
| | | | | | | | Problem introduced in caf6150. Thanks to @drak for noticing. Fixes #4473.
* | remove SOCKS4 support from core and GUIPhilip Kaufmann2014-07-071-93/+27
| | | | | | | | - now we support SOCKS5 only
* | Use async name resolving to improve net thread responsivenessHuang Le2014-06-271-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | In the LookupIntern(), things changed are: 1. Call getaddrinfo_a() instead of getaddrinfo() if available, the former is a sync version of the latter; 2. Try using inet_pton()/inet_addr() to convert the input text to a network addr structure at first, if success the extra name resolving thread inside getaddrinfo_a() could be avoided; 3. An interruption point added in the waiting loop for return from getaddrinfo_a(), which completes the improve for thread responsiveness. A easy way to see the effect is to kick off a 'bitcoind stop' immediately after 'bitcoind -daemon', before the change it would take several, or even tens of, minutes on a bad network situation to wait for the running bitcoind to exit, now it costs only seconds. Signed-off-by: Huang Le <[email protected]>
* | replace 3 separate calls to WSAGetLastError() with 1Philip Kaufmann2014-06-241-1/+2
| |
* | Merge pull request #4183Wladimir J. van der Laan2014-05-251-5/+0
|\ \ | |/ |/| | | | | | | | | | | | | f40dbee remove CPubKey::VerifyCompact( ) which is never used (Kamil Domanski) 28b6c1d remove GetMedianTime( ) which is never used (Kamil Domanski) 5bd4adc remove LookupHostNumeric( ) which is never used (Kamil Domanski) 595f691 remove LogException( ) which is never used (Kamil Domanski) f4057cb remove CTransaction::IsNewerThan which is never used (Kamil Domanski) 0e31e56 remove CWallet::AddReserveKey which is never used (Kamil Domanski)
| * remove LookupHostNumeric( ) which is never usedKamil Domanski2014-05-201-5/+0
| |
* | Replace non-threadsafe strerrorWladimir J. van der Laan2014-05-231-4/+37
|/ | | | | | | Log the name of the error as well as the error code if a network problem happens. This makes network troubleshooting more convenient. Use thread-safe strerror_r and the WIN32 equivalent FormatMessage.
* net: Add CSubNet class for subnet matchingWladimir J. van der Laan2014-05-091-3/+120
|
* Use new function parseint32 in SplitHostPortWladimir J. van der Laan2014-05-091-5/+3
| | | | | Use the new function parseint32 in SplitHostPort instead of calling strtol directly.
* Remove build-time no-IPv6 settingWladimir J. van der Laan2014-05-011-26/+0
| | | | | | | | | | | The year is 2014. All supported operating systems have IPv6 support, most certainly at build time (this doesn't mean that IPv6 is configured, of course). If noone is exercising the functionality to disable it, that means it doesn't get tested, and IMO it's better to get rid of it. (it's also not used consistently in RPC/boost and Net code...)
* Correct some proxy related socket leaks.Gregory Maxwell2014-04-091-2/+7
|
* Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron2014-02-091-1/+1
| | | | | | in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does.