Commit Graph

14 Commits

Author SHA1 Message Date
Neil Booth
b993bd8f8e Rename protocol_version_string to version_string 2018-06-05 00:07:16 +09:00
Neil Booth
4707e97ab7 Update ssl_port and tcp_port to what peer advertises
Fixes #413
2018-03-14 08:46:50 +08:00
Neil Booth
2f69aaa487 Remove dead code 2017-09-09 10:39:13 +09:00
Neil Booth
f4cc1e2926 Fix protocol version reported in server.peers.subscribe
- new library function protocol_version_string() with tests
- remove ad-hoc class functions

Fixes #251
2017-09-08 10:54:56 +09:00
Neil Booth
2c43e89b05 Only set last_good if successfully verified
Rename last_connect to last_good
2017-04-03 21:37:51 +09:00
Neil Booth
9f27ea875c Fix peer replacement logic
- drop the IP address peer
- update the remaining peer with fresh info
2017-04-03 20:07:46 +09:00
Neil Booth
8236aaf234 Be more strict on form of features dictionary 2017-03-25 13:28:42 +09:00
Neil Booth
be5397a853 Validate hostnames before accepting a new peer
Don't retain non-public addresses

Closes #157
2017-03-25 11:58:54 +09:00
Neil Booth
9238fe397d Drop ports from top level of features 2017-03-25 11:35:54 +09:00
Neil Booth
30bb832ef8 Prepare 1.0 2017-03-05 13:22:09 +09:00
Neil Booth
d36d222489 Maintain more than one self-identity
Rather than just retaining our clearnet identity from the environment,
maintain any tor one as well.  This is a little cleaner and avoids
confusion over port assignment when converting to real names.

Fixes #136
2017-02-26 10:22:22 +09:00
Neil Booth
9d6b353eec Fix typo pointed out by hsmiths, thanks 2017-02-18 23:42:24 +09:00
Neil Booth
3f35bc0298 More PEP8 stuff 2017-02-18 13:05:26 +09:00
Neil Booth
151da40d5b Implement peer discovery protocol
Closes #104

DEFAULT_PORTS now a coin property
A Peer object maintains peer information
Revamp LocalRPC "peers" call to show a lot more information
Have lib/jsonrpc.py take care of handling request timeouts
Save and restore peers to a file
Loosen JSON RPC rules so we work with electrum-server and beancurd which don't follow the spec.
Handle incoming server.add_peer requests
Send server.add_peer registrations if peer doesn't have us or correct ports
Verify peers at regular intervals, forget stale peers, verify new peers or those with updated ports
If connecting via one port fails, try the other
Add socks.py for SOCKS4 and SOCKS5 proxying, so Tor servers can now be reached by TCP and SSL
Put full licence boilerplate in lib/ files
Disable IRC advertising on testnet
Serve a Tor banner file if it seems like a connection came from your tor proxy (see ENVIONMENT.rst)
Retry tor proxy hourly, and peers that are about to turn stale
Report more onion peers to a connection that seems to be combing from your tor proxy
Only report good peers to server.peers.subscribe; always report self if valid
Handle peers on the wrong network robustly
Default to 127.0.0.1 rather than localhost for Python <= 3.5.2 compatibility
Put peer name in logs of connections to it
Update docs
2017-02-18 12:43:45 +09:00