Commit graph

184 commits

Author SHA1 Message Date
moneromooo-monero 216f062eb8
util: add a SHA256 function 2017-02-20 22:58:33 +00:00
moneromooo-monero f640512c53
Optionally query moneropulse DNS records to check for updates
It just checks and prints a message if there is a new version
for now.
2017-02-20 22:58:16 +00:00
moneromooo-monero 969ad710ba
dns_utils: fix first checked DNS entry being ignored 2017-02-20 22:58:08 +00:00
moneromooo-monero 08c3f38031
util: add a vercmp function to compare version numbers
It is simple, supports simple x.y.z type numeric versions,
and does not attempt any kind of validation
2017-02-20 22:58:04 +00:00
moneromooo-monero e8a7525ceb
dns_utils: factor TXT record loading code from checkpoint code 2017-02-20 22:57:57 +00:00
moneromooo-monero 422ecc98e4
Fixup choice of easylogging++ vs libunwind stack trace code 2017-02-12 13:59:21 +00:00
Riccardo Spagni eacf2124b6 Merge pull request #1689
ce7fcbb4 Add server auth to monerod, and client auth to wallet-cli and wallet-rpc (Lee Clagett)
2017-02-11 00:35:25 +02:00
kenshi84 8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09:00
Riccardo Spagni d30b64f457
Merge pull request #1674
92978b2c common: fix link error on at least one platform (no clue which one) (moneromooo-monero)
2017-02-08 12:51:11 +02:00
Lee Clagett ce7fcbb4ae Add server auth to monerod, and client auth to wallet-cli and wallet-rpc 2017-02-06 01:15:41 -05:00
moneromooo-monero 92978b2c0f
common: fix link error on at least one platform (no clue which one)
Bug and fix reported by tdprime
2017-02-05 10:55:55 +00:00
moneromooo-monero cd34fc655d
Use easylogging++'s stack trace facility where possible
This avoids using libunwind, which often causes trouble.
2017-02-04 12:33:03 +00:00
Riccardo Spagni 10b625079b
Merge pull request #1645
9bd9906e Factor is_address_local code into a tools function (moneromooo-monero)
2017-02-02 21:27:45 +02:00
Riccardo Spagni 5fb3f97a55
Merge pull request #1629
c02e1cb9 Updates to epee HTTP client code   - http_simple_client now uses std::chrono for timeouts   - http_simple_client accepts timeouts per connect / invoke call   - shortened names of epee http invoke functions   - invoke command functions only take relative path, connection     is not automatically performed (Lee Clagett)
2017-02-02 19:32:01 +02:00
Riccardo Spagni ca2e2c2453 Merge pull request #1627
55a8e982 moved get_account_address_from_str_or_url from libcommon to libcryptonote_core (kenshi84)
2017-02-02 18:24:08 +02:00
moneromooo-monero 9bd9906e8f
Factor is_address_local code into a tools function 2017-01-28 14:57:47 +00:00
Lee Clagett c02e1cb943 Updates to epee HTTP client code
- http_simple_client now uses std::chrono for timeouts
  - http_simple_client accepts timeouts per connect / invoke call
  - shortened names of epee http invoke functions
  - invoke command functions only take relative path, connection
    is not automatically performed
2017-01-25 15:39:32 -05:00
kenshi84 55a8e982c0 moved get_account_address_from_str_or_url from libcommon to libcryptonote_core 2017-01-24 20:31:03 +09:00
Miguel Herranz 629e3101ab Replace BOOST_FOREACH with C++11 ranged for 2017-01-22 21:38:10 +01:00
moneromooo-monero a854cec3ba
Make stack trace show up in log file with default settings 2017-01-21 20:28:18 +00:00
moneromooo-monero 5833d66f65
Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00
Riccardo Spagni 006bb0e957
Merge pull request #1538
aff28178 Remove db-auto-remove-logs (Miguel Herranz)
1229c685 Remove berkeley from db_type initialization (Miguel Herranz)
e3090558 Show available types for db-type command (Miguel Herranz)
046ab33d Remove berkeley from blockchain_db_types (Miguel Herranz)
2017-01-13 14:33:59 -05:00
Miguel Herranz aff28178e6 Remove db-auto-remove-logs 2017-01-10 11:49:45 +01:00
Miguel Herranz e309055819 Show available types for db-type command 2017-01-10 11:44:01 +01:00
Riccardo Spagni 2a996f492f
Merge pull request #1510
80abc3bc Build wallet with Android NDK (MoroccanMalinois)
2017-01-08 16:40:02 -08:00
MoroccanMalinois 80abc3bc4a Build wallet with Android NDK 2017-01-05 01:11:05 +00:00
kenshi84 99580adf66 make openalias also available for solo miner; introduce namespace tools::dns_utils; support integrated address with dns lookup 2016-12-21 23:12:15 +09:00
moneromooo-monero 1976eddd89
common: add missing #include <system_error> for std::error_code 2016-12-20 18:53:58 +00:00
Riccardo Spagni b9b9028e50
Merge pull request #1462
07b9138c support importing unportable outputs (kenshi84)
2ac80075 also use portable serializer for boost_serialization_helper.h and net_node.inl, completely adandon boost/archive/binary_oarchive.hpp (kenshi84)
d1d6e27a moved boost cpp into hpp since they're supposed to be header only (kenshi84)
66e6af89 added experimental boost::archive::portable_binary_{i|o}archive (kenshi84)
2016-12-20 17:40:11 +02:00
kenshi84 2ac8007544 also use portable serializer for boost_serialization_helper.h and net_node.inl, completely adandon boost/archive/binary_oarchive.hpp 2016-12-20 13:04:19 +09:00
Lee Clagett 427054c3d5 Enabled HTTP auth support for monero-wallet-rpc 2016-12-16 23:59:46 -05:00
moneromooo-monero 81c6bb9a40
thread_group: fix build on older GCC
vtnerd (original author) confirmed this is the Right Way.
2016-12-11 13:59:42 +00:00
Riccardo Spagni f2ea2afb77
Merge pull request #1398
f4772bae Fix a few minor typos (Pierre Boyer)
2016-12-04 22:28:22 +02:00
Pierre Boyer f4772bae81 Fix a few minor typos 2016-12-04 14:13:54 +01:00
Lee Clagett 91ffb61c25 Added command_line::is_yes 2016-11-25 21:57:27 -05:00
Lee Clagett f025198f19 Added task_region - a fork/join task implementation 2016-11-23 14:41:25 -05:00
moneromooo-monero acf908c834
thread_group: fix build with asserts enabled
See https://github.com/monero-project/monero/pull/1291
2016-11-09 11:29:06 +00:00
Lee Clagett 64094e5f4e adding thread_group for managing async tasks 2016-11-02 19:21:55 -04:00
moneromooo-monero 12d861694d
perf_timer: format string fix for 32 bits 2016-10-20 18:43:33 +01:00
moneromooo-monero 74dfdb0b30
perf_timer: new class and macros to make performance logs easier
Call PERF_TIMER(name), which is scoped.
2016-10-10 21:24:15 +01:00
Riccardo Spagni 4cb1348548
Merge pull request #1139
01ec195 Update CMakeLists.txt (codehalo)
446ebbc Update CMakeLists.txt (codehalo)
bd773e7 Update CMakeLists.txt (codehalo)
3627cea Cleanup. Dropped "bit" from bitmonero. (Randi Joseph)
2a51396 Dropped "bit" from bitmonero. (Randi Joseph)
78b13d6 Cleanup. Dropped "bit" from bitmonero. (Randi Joseph)
1e6aedb Cleanup. Dropped "bit" from bitmonero. (Randi Joseph)
9e54616 Dropped "bit" from bitmonero. (Randi Joseph)
2016-10-04 12:11:03 +02:00
Randi Joseph 9e54616924 Dropped "bit" from bitmonero. 2016-09-26 17:22:30 -04:00
moneromooo-monero 5e3e362c85
core: make the sync chunk block count overridable 2016-09-24 17:00:19 +01:00
moneromooo-monero eeb2bbc0fc
epee: optionally restrict HTTP service to a configurable user agent
This is intended to catch traffic coming from a web browser,
so we avoid issues with a web page sending a transfer RPC to
the wallet. Requiring a particular user agent can act as a
simple password scheme, while we wait for 0MQ and proper
authentication to be merged.
2016-09-18 20:32:02 +01:00
redfish e1c7af35d4 cmake: transitive deps and remove deprecated LINK_*
Keep the immediate direct deps at the library that depends on them,
declare deps as PUBLIC so that targets that link against that library
get the library's deps as transitive deps.

Break dep cycle between blockchain_db <-> crytonote_core.
No code refactoring, just hide cycle from cmake so that
it doesn't complain (cycles are allowed only between
static libs, not shared libs).

This is in preparation for supproting BUILD_SHARED_LIBS cmake
built-in option for building internal libs as shared.
2016-09-18 02:56:26 -04:00
Howard Chu 5bba2fdbb0
More for PR#999 2016-08-29 15:58:56 +01:00
moneromooo-monero fbd7c359ee
wallet: fix some "may be used uninitialized" warnings
The compiler can't always work out the _found booleans are
set iff the value is initialized.
2016-08-28 21:30:44 +01:00
redfish 0f990d0183 cmake,common: flag for stack trace
By default the flag is enabled whenever libunwind is found on the
system, with the exception of static build on OSX (for which we can't
install the throw hook #932 due to lack of support for --wrap in OSX
ld64 linker).
2016-07-27 01:52:33 -04:00
redfish fa85cd845f common: stack trace: make clang happy with func ptrs
Tested that it builds with:
gcc 6.1.1, STATIC=OFF,i686
gcc 6.1.1, STATIC=OFF,armv7h
clang 3.8, STATIC=OFF,i686
clang 3.8, STATIC=OFF,armv7h

gcc 6.1.1, STATIC=ON,i686
clang 3.8, STATIC=ON,i686

Also tested that stack trace is generated fine on exception on:
i686, gcc 6.1.1, STATIC=OFF
(didn't bother testing all the other platforms/configs)

This should fix the build problem on OSX (#871, #901), but
I don't have OSX, so I could only test Clang on Linux.
2016-07-10 21:26:11 -04:00
luigi1111 d7189600ae
remove POSIX_C_SOURCE and remove dlfcn.h for static builds
The former was a faulty "fix" for gmtime_r not existing on Windows. The latter is needed only for dynamic builds, and is not included with msys2, which ends up fine because Windows is only built static at this time.
2016-06-21 11:16:25 -05:00
Riccardo Spagni 03477063ba
Merge pull request #868
15c2b69 common: fix build without libunwind (moneromooo-monero)
f72388c CMakeLists: fix build without libunwind (moneromooo-monero)
2016-06-21 09:30:56 +02:00
moneromooo-monero 15c2b69db7
common: fix build without libunwind 2016-06-20 19:23:32 +01:00
Riccardo Spagni e97d96ccfb
Merge pull request #775
e409e59 Print stack trace on exceptions (moneromooo-monero)
ef4ff42 connection_basic: avoid gratuitous exception (moneromooo-monero)
2016-06-19 21:14:11 +02:00
moneromooo-monero e409e59d29
Print stack trace on exceptions
if libunwind is found.

Useful for debugging logs.
2016-04-28 23:34:51 +01:00
moneromooo-monero 513a658c87
add a --max-concurrency flag
It sets the max number of threads to use for a parallel job.
This is different that the number of total threads, since monero
binaries typically start a lot of them.
2016-04-28 20:33:59 +01:00
moneromooo-monero 7385c036bd
util: add a function to set umask to 077
Useful to ensure files are written without group/other read rights.
2016-04-06 19:59:34 +01:00
moneromooo-monero f8d05f3cd9
common: new json_util.h
With code to help factor out reading typed fields from JSON
2016-03-27 23:35:32 +01:00
moneromooo-monero f7301c3563
Revert "Print stack trace upon exceptions"
Ain't nobody got time for link/cmake skullduggery.

This reverts commit fff238ec94.
2016-03-21 10:12:23 +00:00
moneromooo-monero fff238ec94
Print stack trace upon exceptions
Useful for debugging users' logs
2016-03-19 21:48:36 +00:00
Howard Chu b937a2c915 Use boost::thread instead of std::thread
and all other associated IPC
2016-03-11 15:09:50 +00:00
moneromooo-monero 283894d8ff
dns_utils: const compatibility with older libunbound
https://www.nlnetlabs.nl/bugs-script/show_bug.cgi?id=515
2016-02-23 19:02:05 +00:00
Howard Chu 014f8868f2 std::condvar is broken on Win32 with gcc/g++ 4.8 too
Use boost...
2016-02-18 21:31:21 +00:00
moneromooo-monero a333c42cde
core_tests: add tests for hard fork behaviors (MRL-0004)
We also replace the --fakechain option with an optional structure
containing details about configuration for the core/blockchain,
for test purposes. This seems more future friendly.
2016-02-08 18:52:00 +00:00
Riccardo Spagni 153fe0cb75
Merge pull request #622
e514f0a even more typos (Henning Kopp)
9abc4b8 more typos fixed (Henning Kopp)
0693f3c fixed typo (Henning Kopp)
2016-01-25 19:39:07 +02:00
Henning Kopp 9abc4b831b more typos fixed 2016-01-25 13:42:44 +01:00
me0wmix 28f95eb001 OpenBSD support for Monero. 2016-01-21 11:18:26 -07:00
Riccardo Spagni de03926850
updated copyright year 2015-12-31 08:39:56 +02:00
moneromooo-monero 3f2970fadb
Add missing semicolons after log statements 2015-12-19 14:47:37 +00:00
warptangent 5131b263ed Replace tabs and remove trailing whitespace 2015-12-15 10:13:24 -08:00
warptangent 0d40de48c2
Optionally restrict DNS queries to TCP
Sample use:
DNS_PUBLIC=tcp torsocks bin/bitmonerod --p2p-bind-ip 127.0.0.1

Test:
Run above with --log-level 4 with and without DNS_PUBLIC environment
variable set.

DNS debugging info should show successful DNS lookups only when
DNS_PUBLIC is set to "tcp":

  DNS lookup for seeds.moneroseeds.se: 17 results
  DNS lookup for seeds.moneroseeds.ae.org: 17 results
  DNS lookup for seeds.moneroseeds.ch: 12 results
  DNS lookup for seeds.moneroseeds.li: 12 results
2015-12-15 10:13:16 -08:00
moneromooo-monero 10da0a0b7c
add a --fakechain argument for tests
The core tests use the blockchain, and reset it to be able
to add test data to it. This does not play nice with the
databases, since those will save that data without an explicit
save call.
We add a fakechain flag that the tests will set, which tells
the core and blockchain code to use a separate database, as
well as skip a few things like checkpoints and fixup, which
only make sense for real data.
2015-12-13 11:38:37 +00:00
moneromooo-monero 336b37580f
Register daemon command line arguments to core if they're used in core
This fixes coretests, which does not register daemon specific arguments,
but uses core, which uses those arguments. Also gets rid of an unwanted
dependency on daemon code from core.
2015-12-08 23:06:29 +00:00
Riccardo Spagni 2bed53cb6b
Merge pull request #515
0921f5b util: use putenv instead of setenv for mingw (moneromooo-monero)
2015-11-30 18:33:43 +02:00
moneromooo-monero d68a63e404
wallet: cancellable refresh
^C while in manual refresh will cancel the refresh, since that's
often an annoying thing to have to wait for. Also, a manual refresh
command will interrupt any running background refresh and take
over, rather than wait for the background refresh to be done, and
look to be hanging.
2015-11-29 23:24:56 +00:00
moneromooo-monero 0921f5b4d7
util: use putenv instead of setenv for mingw 2015-11-25 21:38:10 +00:00
moneromooo-monero f3724aef88
Fix startup crash when using a locale boost does not like
There are various locale related bugs in various versions of boost,
where exceptions are thrown in boost::filesystem APIs when the
current locale is not to boost's liking. It's not clear what "not
to boost's liking" means in detail, though "en" and "en_US.UTF-8"
are not to its liking.

Fix it by running a test function that's known to throw in such
a case, and resetting LANG and LC_ALL to C if an exception is
thrown. In simplewallet, the locale is queried before that so the
correct translations will still be used.
2015-11-21 10:13:10 +00:00
moneromooo-monero 0c1dae32b4
i18n: allow language to be passed as a parameter
If empty, it will still be fetched from the environment
2015-11-21 10:11:50 +00:00
moneromooo-monero e70d2e5be8
common: const and init list pedantry 2015-10-27 09:36:38 +00:00
moneromooo-monero 151c32d5c4
dns_utils: fix wrong asserts
Braino.
2015-09-27 17:42:32 +01:00
moneromooo-monero 4e138a02df
dns_utils: remove unnecessary string conversion 2015-08-30 15:04:18 +01:00
moneromooo-monero f928468b9b
dns_utils: factor the fetching code for different DNS record types 2015-08-30 15:04:09 +01:00
moneromooo-monero 4ef0da184d
dns_utils: simplify string handling and fix leak 2015-08-30 15:03:59 +01:00
moneromooo-monero ae5f28cb51
dns_utils: add a const where possible 2015-08-27 21:08:55 +01:00
moneromooo-monero f43d465da2
dns_utils: lock access to the singleton
This avoids races which could result in two objects being created
2015-08-27 21:08:03 +01:00
moneromooo-monero 5990344cb0
dns: make ctor private
This ensures one can't instanciate a DNSResolver object by
mistake, but uses the singleton. A separate create static
function is added for cases where a new object is explicitely
needed.
2015-08-27 21:06:09 +01:00
moneromooo-monero ea58576cf6
Add missing file - i18n.cpp 2015-07-15 00:01:05 +01:00
moneromooo-monero 78b2eabc87 Translatable strings for simplewallet
The system is mostly the Qt system, but we don't use Qt to avoid
the dependencies.

See README.i18n for details.
2015-07-14 20:28:25 +01:00
Rostislav 3ade396406 Set dnssec_valid value correctly in dns_utils; fix address_from_url test 2015-06-20 20:02:13 +00:00
moneromooo-monero a9b1f7eb05
dns_utils: simpify smart pointer use, and use for url strings too
OK, I admit I wanted to template this struct for fun too.
2015-06-07 16:58:49 +01:00
Riccardo Spagni e01d32e52d
cleaning up, removing redundant files, renaming, fixing incorrect licenses 2015-05-31 13:40:18 +02:00
warptangent fee8424938
Allow name@domain.tld for OpenAlias lookups
Based on tewinget's update.
Make OpenAlias address format independent of existing DNS functions.

Add tests.

Test:

make debug-test
cd build/debug/tests/unit_tests
# test that regular DNS functions work, including IPv4 lookups.
# also test function that converts OpenAlias address format
make && ./unit_tests --gtest_filter=DNSResolver*
# test that OpenAlias addresses like donate@getmonero.org work from
# wallet tools
make && ./unit_tests --gtest_filter=AddressFromURL.Success
2015-05-19 02:56:04 -07:00
warptangent a0fe18f63a
Revert "Allow name@domain.tld for OpenAlias lookups"
This reverts commit b18368b635.
2015-05-19 02:49:39 -07:00
Thomas Winget b18368b635
Allow name@domain.tld for OpenAlias lookups 2015-04-29 21:31:34 -04:00
rfree2monero 32c19c6c3d
[fix] log level change. compilation: dns, tests
old unbound #warning does not block compilation
unit tests build fine. Even though the RPC/P2P network type is required again
2015-04-10 16:54:21 +02:00
Riccardo Spagni 6f0d93097e
Merge pull request #252
618f20c Network 1.7; Quieted the debug a bit. (rfree2monero)
391c7f9 Utils: use const, document dbg. Less default debug (rfree2monero)
44f4234 [fix] mac os x includes std::random... (rfree2monero)
162c993 Network 1.6: network limits, logging, +doxy (rfree2monero)
a3b2226 my changelog (rfree2monero)
2900b1e doxygen files (rfree2monero)
1489310 doxygen related tool (rfree2monero)
f9dba47 added windows_stream.* console colors (rfree2monero)
c511abf remerged; commands JSON. logging upgrade. doxygen (rfree2monero)
f79821a fix locking in count-peers thread (2) (rfree2monero)
0198ffb 2014 network limit 1.3 fix log/path/data +utils (rfree2monero)
ae2a506 2014 network limit 1.2 +utils +toc -doc -drmonero (rfree2monero)
0f06dca fixed size_t on windows (rfree2monero)
39fc63f removed not needed <netinet/in.h> (rfree2monero)
5ce4256 2014 network limit 1.1 +utils +toc -doc -drmonero (rfree2monero)
eabb519 2014 network limit 1.0a +utils +toc -doc -drmonero (rfree2monero)
2015-04-02 17:43:43 +02:00
Thomas Winget c0de96f8bd
Fixed DNS resolution bug in Windows
Due to a bug in unbound, we were passing a string containing a null
character to ub_ctx_resolvconf and ub_ctx_hosts rather than a NULL
pointer.  On *nix this wasn't causing headache, but on Windows this was
causing unbound to not correctly load DNS settings from the OS.

Note on the bug: in a Windows-specific code branch in the function
ub_ctx_hosts(), if the hosts file specified was a NULL pointer, a call
to getenv() was stored in a local char* and later freed.  This is
incorrect, as we do not own that data, and caused the program to crash.
2015-04-02 09:22:31 -04:00
rfree2monero c511abf005 remerged; commands JSON. logging upgrade. doxygen 2015-04-01 19:00:45 +02:00
Thomas Winget dbf46a721a
DNSSEC added (hardcoded key)
DNSSEC is now implemented with the hardcoded key from unbound.
This will need to be not hardcoded in the future, but is okay for now.

Unit tests updated for DNSSEC (as well as for the fact that, contrary to
previous assumption, example.com does not have a static IP address).
2015-03-24 06:34:15 -04:00
Thomas Winget 2b0583b2c6
Hopefully fixes build on Windows 2015-03-20 16:40:54 -04:00
Thomas Winget 9193d6fb5b
Daemonize changes pulled in -- daemon builds
many RPC functions added by the daemonize changes
(and related changes on the upstream dev branch that were not merged)
were commented out (apart from return).  Other than that, this *should*
work...at any rate, it builds, and that's something.
2015-02-24 00:05:19 -05:00