Commit Graph

30 Commits

Author SHA1 Message Date
Lee Clagett 4978f69d7a Fix byte_stream::put_n 2020-12-14 14:45:24 -05:00
Lee Clagett 08eb0949f3 Change to more efficient allocation strategy in byte_stream 2020-10-13 15:10:54 +00:00
Lee Clagett b641e0a2c0 Add clear method to byte_stream 2020-08-17 21:30:34 -04:00
luigi1111 35e2520115
Merge pull request #6559
15538f7 ByteSlice: Fix persisting ptr to std::moved SSO buffer (Doy-lee)
2020-07-08 17:07:50 -05:00
Doyle 15538f7e3f ByteSlice: Fix persisting ptr to std::moved SSO buffer
The Bug:
1. Construct `byte_slice.portion_` with `epee::span(buffer)` which copies a pointer to the SSO buffer to `byte_slice.portion_`
2. It constructs `byte_slice.storage_` with `std::move(buffer)` (normally this swap pointers, but SSO means a memcpy and clear on the original SSO buffer)
3. `slice.data()` returns a pointer from `slice.portion_` that points to the original SSO cleared buffer, `slice.storage_` has the actual string.
2020-05-20 10:13:58 +10:00
Lee Clagett 29e563bb1e Fixed bugs for take_slice and byte_stream->byte_slice 2020-05-12 01:26:37 -04:00
Lee Clagett c26c93019a Add byte_stream for zero-copy serialization, and add support in ZMQ-JSON. 2020-04-11 04:12:11 +00:00
Lee Clagett f9441c5759 Fixed string_ref usage bug in epee::from_hex::vector 2020-03-30 16:53:34 +00:00
luigi1111 cfc0f4a7fa
Merge pull request #6351
81c5943 Remove temporary std::string creation in some hex->bin calls (vtnerd)
5fcc23a Move hex->bin conversion to monero copyright files and with less includes (vtnerd)
3387f0e Reduce template bloat in hex->bin for ZMQ json (vtnerd)
2020-04-04 12:55:02 -05:00
Aaron Hook aa93e38862 p2p: remove old debug commands 2020-03-20 22:09:44 -07:00
Lee Clagett 5fcc23ae0a Move hex->bin conversion to monero copyright files and with less includes 2020-03-09 05:23:59 +00:00
Lee Clagett 0f78b06e8c Various improvements to the ZMQ JSON-RPC handling:
- Finding handling function in ZMQ JSON-RPC now uses binary search
  - Temporary `std::vector`s in JSON output now use `epee::span` to
    prevent allocations.
  - Binary -> hex in JSON output no longer allocates temporary buffer
  - C++ structs -> JSON skips intermediate DOM creation, and instead
    write directly to an output stream.
2020-03-05 14:20:56 +00:00
Lee Clagett bdfc63ae4d Add ref-counted buffer byte_slice. Currently used for sending TCP data. 2019-07-16 16:30:35 +00:00
luigi1111 a8e99198bf
Merge pull request #5748
b350726 boost: update obsolete usage of endian API (moneromooo-monero)
2019-08-21 15:18:38 -05:00
moneromooo-monero eeca5ca0c8
epee: support unicode in parsed strings 2019-08-16 17:06:03 +00:00
moneromooo-monero b350726a5a
boost: update obsolete usage of endian API 2019-07-09 15:07:13 +00:00
binaryFate 1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
Martijn Otto 057c279cb4
epee: add SSL support
RPC connections now have optional tranparent SSL.

An optional private key and certificate file can be passed,
using the --{rpc,daemon}-ssl-private-key and
--{rpc,daemon}-ssl-certificate options. Those have as
argument a path to a PEM format private private key and
certificate, respectively.
If not given, a temporary self signed certificate will be used.

SSL can be enabled or disabled using --{rpc}-ssl, which
accepts autodetect (default), disabled or enabled.

Access can be restricted to particular certificates using the
--rpc-ssl-allowed-certificates, which takes a list of
paths to PEM encoded certificates. This can allow a wallet to
connect to only the daemon they think they're connected to,
by forcing SSL and listing the paths to the known good
certificates.

To generate long term certificates:

openssl genrsa -out /tmp/KEY 4096
openssl req -new -key /tmp/KEY -out /tmp/REQ
openssl x509 -req -days 999999 -sha256 -in /tmp/REQ -signkey /tmp/KEY -out /tmp/CERT

/tmp/KEY is the private key, and /tmp/CERT is the certificate,
both in PEM format. /tmp/REQ can be removed. Adjust the last
command to set expiration date, etc, as needed. It doesn't
make a whole lot of sense for monero anyway, since most servers
will run with one time temporary self signed certificates anyway.

SSL support is transparent, so all communication is done on the
existing ports, with SSL autodetection. This means you can start
using an SSL daemon now, but you should not enforce SSL yet or
nothing will talk to you.
2019-03-05 14:16:08 +01:00
Lee Clagett 973403bc9f Adding initial support for broadcasting transactions over Tor
- Support for ".onion" in --add-exclusive-node and --add-peer
  - Add --anonymizing-proxy for outbound Tor connections
  - Add --anonymous-inbounds for inbound Tor connections
  - Support for sharing ".onion" addresses over Tor connections
  - Support for broadcasting transactions received over RPC exclusively
    over Tor (else broadcast over public IP when Tor not enabled).
2019-01-28 23:56:33 +00:00
moneromooo-monero 21777daf6e
epee: speedup word/number matching
Number matching semantics are slightly changed: since this is used
as a filter to check whether a number is signed and/or floating
point, we can speed this up further. strto* functions are called
afterwards and will error out where necessary. We now also accept
numbers like .4 which were not accepted before.

The strto* calls on a boost::string_ref will not access unallocated
memory since the parsers always stop at the first bad character,
and the original string is zero terminated.

in arbitrary time measurement units for some arbitrary test case:

match_number2: 235 -> 70
match_word2: 330 -> 108
2019-01-16 19:59:40 +00:00
moneromooo-monero 85665003a7
epee: better network buffer data structure
avoids pointless allocs and memcpy
2018-12-23 16:46:07 +00:00
xiphon b36353e268
unit_tests: add some hex parsing test for non hex input 2018-11-15 23:34:15 +00:00
moneromooo-monero 6671110ca3
unit_tests: add a test for parse_hexstr_to_binbuff 2018-11-15 23:34:15 +00:00
Lee Clagett 26a42fe54a Added features to epee::span<T> :
- Support for classes
  - Added `remove_prefix` function
  - Added `to_mut_span` and `as_mut_byte_span`
2018-08-03 20:33:07 -04:00
moneromooo-monero 5db9e3c28e
unit_tests: add tests for local IP range detection 2018-06-01 21:47:25 +01:00
xmr-eric 18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
iDunk5400 44c1d160c8
unit_tests: fix compiling on Windows 2017-10-08 23:59:08 +02:00
Lee Clagett 8b00687735 Upgrades to epee::net_utils::network_address
- internal nullptr checks
  - prevent modifications to network_address (shallow copy issues)
  - automagically works with any type containing interface functions
  - removed fnv1a hashing
  - ipv4_network_address now flattened with no base class
2017-10-05 11:57:09 -04:00
Lee Clagett 4a8f96f95d Improvements for epee binary to hex functions:
- Performance improvements
  - Added `span` for zero-copy pointer+length arguments
  - Added `std::ostream` overload for direct writing to output buffers
  - Removal of unused `string_tools::buff_to_hex`
2017-04-11 16:35:00 -04:00
Lee Clagett 50cd179a60 Removed boost/asio.hpp include from epee/string_tools.h 2017-03-18 22:05:14 -04:00