网络模块的:
- 启动
- 停止
P2P_Init
外部调用入口之一
// Initialize P2P subsystem
GetPeerID 种子节点
load_ban_list
load_peer_list
maintain_seed_node_connection
P2P_Server_v2 // start accepting connections
P2P_engine // start outgoing engine
syncroniser // start sync engine
clean_up_propagation // clean up propagation map
P2P_engine
maintain_outgoing_priority_connection
maintain_connection_to_peers
maintain_seed_node_connection
find_peer_to_connect
connect_with_endpoint
connect_with_endpoint
网络部分重要方法
支持 SSL/TLS
tcpc := conn.(*net.TCPConn)
conn = tls.Client(conn, &tls.Config{InsecureSkipVerify: true})
Handle_Connection
maintain_seed_node_connection
// this will maintain connection to 1 seed node randomly
maintain_connection_to_peers
// keep building connections to network, we are talking outgoing connections
P2P_Server_v2
启动本地 P2P 服务!
default_address
P2P_Port
generate_random_tls_cert
tls.Config
net.Listen
l.Accept
net.TCPConn
tcpc.SetKeepAlive
tcpc.SetKeepAlivePeriod
tcpc.SetLinger
tls.Server
Handle_Connection // 这是重点,开始从外部网络切换到内核
P2P_Shutdown
外部调用入口之一
// shutdown the p2p component