WO2021175036A1 - 在p2p网络中避免客户端节点长时间无效占用连接资源和引导客户端节点合理选择节点带宽 - Google Patents

在p2p网络中避免客户端节点长时间无效占用连接资源和引导客户端节点合理选择节点带宽 Download PDF

Info

Publication number
WO2021175036A1
WO2021175036A1 PCT/CN2021/073099 CN2021073099W WO2021175036A1 WO 2021175036 A1 WO2021175036 A1 WO 2021175036A1 CN 2021073099 W CN2021073099 W CN 2021073099W WO 2021175036 A1 WO2021175036 A1 WO 2021175036A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
proof
session
workload
client node
Prior art date
Application number
PCT/CN2021/073099
Other languages
English (en)
French (fr)
Inventor
杜晓楠
Original Assignee
杜晓楠
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN202010155205.2A external-priority patent/CN111541732B/zh
Priority claimed from CN202010154981.0A external-priority patent/CN111555900B/zh
Application filed by 杜晓楠 filed Critical 杜晓楠
Publication of WO2021175036A1 publication Critical patent/WO2021175036A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications

Definitions

  • the present invention relates to the field of P2P networks, and more specifically, to a method for preventing a client node from occupying connection resources for a long time in a P2P network, a method for guiding a client node in a P2P network to reasonably select node bandwidth, and corresponding The computer readable storage medium and P2P network.
  • Peer-to-peer network that is, a peer-to-peer network. Participants of the network share part of the hardware resources they own. These shared resources provide services and content through the network and can be directly accessed by other peer nodes without the need Go through intermediate entities. Participants in this network are not only providers of resources, services, and content, but also acquirers of resources, services, and content.
  • P2P networks are widely used in scenarios that require high availability. Since there are no centralized nodes, the failure of any node in the network will not affect the normal operation of other nodes. P2P networks are often used to store large file data. When uploading large files to the P2P network, the file is first divided into pieces, and at the same time, each file piece is divided into Hash, and then each piece and Hash are stored separately Above each P2P node. Therefore, the client nodes of the P2P network need to use the multi-threaded multi-connection mode to download the files in the P2P network.
  • P2P network is sometimes compatible with different business scenarios.
  • Some business scenarios have very high bandwidth requirements and require P2P nodes to limit the number of connections to provide high-quality bandwidth to only a few clients.
  • Some business scenarios do not require high bandwidth, and short-term network jitter and delay will not affect the business experience.
  • One P2P node can provide services for many nodes.
  • the traditional P2P network protocol does not limit the number of user connections, nor does it limit the length of time that the client node can occupy the connection, which creates the possibility of the node being attacked.
  • the client node can establish multiple TCP connections with the P2P node, and at the same time, it can download the resources on the node at a very low speed, so that the node cannot determine whether the client node is a malicious node.
  • a client node can even imitate different identities to establish multiple long connections to many nodes in the P2P, and always download files on the nodes at a low speed, which greatly reduces the performance of the entire P2P network.
  • nodes In the traditional P2P protocol, nodes only need to connect to the nearest nodes according to the KAD distance algorithm to start business. This will cause the network bandwidth resources to be unable to be allocated in a planned way, resulting in many nodes with high-quality bandwidth. Occupied by a large number of nodes that do not require high-quality bandwidth.
  • the first aspect of the present invention is to provide a method, computer-readable storage medium, and P2P network for preventing a client node from occupying connection resources for a long time in a P2P network, which can prevent nodes from doing evil, avoid waste of network bandwidth resources, and optimize the network Use bandwidth resources to improve P2P network performance.
  • the present invention provides a method for preventing a client node from occupying connection resources for a long time in a P2P network, including:
  • the client node discovers multiple P2P nodes and asks the key parameters of each P2P node one by one, and selects a P2P node for session communication;
  • the client node generates a first random nonce, calculates a proof of work until the proof of work meets the difficulty of the session keep-alive, and then generates a proof of session work message and sends it to the selected P2P node;
  • the selected P2P node verifies the workload proof, and allows the client node to perform data communication when the verification passes.
  • the step S1 further includes:
  • Configure key parameters for each P2P node where the key parameters include: session timeout period, session keep-alive difficulty, and submission workload proof function;
  • the client node discovers multiple P2P nodes according to the DHT algorithm, and asks the key parameters of each P2P node;
  • the client node selects a P2P node to establish a session, and the selected P2P node returns session initialization information.
  • the session initialization information includes: session ID, proof of work initial hash value, session timeout period, session keep-alive difficulty, submission Proof of work function.
  • the step S2 further includes:
  • the client node continuously generates a first random nonce based on the initial hash value of the proof of work, and adopts the first random nonce based on the session ID, the initial hash value of the proof of work, and the first random nonce.
  • the submitted proof-of-work function calculates the proof-of-work;
  • step S22 Repeat step S21 until the leading 0 of the obtained workload proof meets the difficulty of keeping the session alive;
  • the session workload certification message includes: the session ID, the initial hash value of the workload certification, and the first A random nonce and proof of the workload.
  • the step S3 further includes:
  • step S31 The selected P2P node verifies the proof of work in the session proof of work message, and if the verification passes, executes step S32, otherwise, it refuses to communicate with the client node;
  • the selected P2P node sends a session establishment success message to the client node, and the client node performs data communication with the selected P2P node based on the session establishment success message.
  • the session establishment success message includes: session ID, next session timeout, and next session timeout. Submit the hash value of the proof of work.
  • the step S32 further includes:
  • the client node performs data communication with the selected P2P node, and continuously generates a second random nonce according to the hash value of the next submission of the workload proof, and based on the session ID and the download
  • the hash value of the second submission of the proof of work and the second random nonce calculate the next proof of work according to the submitted work proof function
  • step S322 Repeat step S321 until the obtained leading 0 of the next workload proof meets the difficulty of keeping the session alive.
  • next session workload proof message includes: Session ID, the hash value of the next submission of the proof of work, the second random nonce, and the next proof of work;
  • the selected P2P node verifies the next workload proof in the next session workload proof message, and if the verification passes, executes step S325; otherwise, it refuses to perform data communication with the client node;
  • S325 Determine whether the data communication is over, if it is to disconnect the selected P2P node and the client node, otherwise return to step S31.
  • step S325 the selected P2P node sends a session end message to the client node to disconnect The connection between the selected P2P node and the client node.
  • the client node sends a session end message to the client node to disconnect all connections.
  • the connection between the selected P2P node and the client node is not limited to the client node.
  • the present invention provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned avoiding the client node's long-term invalidation in the P2P network is realized.
  • the present invention provides a P2P network, including a client node and a plurality of P2P nodes, the client node and/or the P2P node stores a computer program and the program is processed by the processor. During execution, the described method for preventing the client node from occupying connection resources invalidly for a long time in the P2P network is realized.
  • the method, computer-readable storage medium, and P2P network for preventing a client node from occupying connection resources for a long time in a P2P network of the present invention can prevent the node from doing evil by verifying the difficulty of the workload of the client node during connection , Avoid waste of network bandwidth resources, optimize the use of network bandwidth resources, and improve P2P network performance. Furthermore, during the data communication process, the workload difficulty test can be performed at an interval set time, which further wastes network bandwidth resources, optimizes the use of network bandwidth resources, and improves P2P network performance.
  • the second aspect of the present invention is to provide a method for guiding a client node in a P2P network to reasonably select a node bandwidth, a computer-readable storage medium and a P2P network, which can guide the client node to select a node according to its own business, so as to allocate it reasonably Node bandwidth effectively prevents high-quality bandwidth resources from being wasted by services that do not require high-quality.
  • the present invention provides a method for guiding a client node in a P2P network to reasonably select node bandwidth, including:
  • the client node discovers the server node and obtains the business type, workload certification requirements, and workload certification parameters of each discovered server node.
  • the workload certification parameters include: universal unique identification code, workload certification initial hash value, Difficulty of session keep-alive, submission of workload proof function;
  • the client node selects a server node according to its own service type and generates a workload certificate according to the workload certification parameter, and then submits the workload certificate and sends a session request to the server node;
  • the server node verifies the workload proof and determines whether to establish a connection with the client node based on the verification result;
  • the step S3 further includes:
  • the client node selects at least one server node according to its own service type, and continuously generates a first random nonce based on the initial hash value of the server node’s workload proof, and based on the universal unique identification code, The initial hash value of the proof of work and the first random nonce, and the proof of work is calculated using the submitted proof of work function;
  • step S32 Repeat step S31 until the leading 0 of the obtained proof of work meets the difficulty of keeping the session alive;
  • the service type includes a conversation service type and a communication service type
  • the workload certification requirement includes a session workload certification requirement and a communication workload Proof requirements.
  • the step S1 includes:
  • the step S2 further includes: the client node discovers multiple server nodes according to the DHT algorithm, and obtains each server node found The type of business, proof of work, and proof of work parameters.
  • the step S4 further includes:
  • the server node verifies the workload proof and determines whether to establish a connection with the client node based on the verification result, if it is to execute step S42, otherwise it refuses to establish a connection with the client node;
  • the server node returns a session establishment success message to the client node, where the session establishment success message includes: a session ID, a session timeout period, and a hash value for the next submission of the workload proof;
  • the client node performs data communication with the server node, and continuously generates a second random nonce according to the hash value of the next submission of the workload proof, and based on the session ID and the next submission
  • the hash value of the proof of work and the second random nonce calculate the next proof of work according to the submitted work proof function;
  • step S44 Repeat step S43 until the leading 0 of the obtained next workload proof meets the difficulty of keeping the session alive;
  • next session workload proof message includes: the session ID, State the hash value of the next submission of the proof of work, the second random nonce, and the next proof of work;
  • the server node verifies the next workload proof, and determines whether to continue communicating with the client node based on the verification result and the progress of the session.
  • the step S46 further includes:
  • step S461 The server node verifies the next workload proof, and if the verification passes, step S462 is executed; otherwise, data communication with the client is interrupted and a notification of communication rejection is returned;
  • S462 Determine whether the data communication ends, if it is to disconnect the server node and the client, and return a notification of the end of the communication, otherwise return to step S43.
  • the present invention provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the client node in the P2P network is guided to select the node bandwidth reasonably.
  • the present invention provides a P2P network, including a client node and a server node, and computer programs are stored on the client node and the server node, and the program is executed by a processor to realize the The method of guiding the client node in the P2P network to select the node bandwidth reasonably.
  • the method for guiding the client node in the P2P network to reasonably select the node bandwidth, the computer-readable storage medium, and the P2P network of the present invention can guide the client node to select the node according to its own business, so as to allocate the node bandwidth reasonably and effectively avoid high-quality Bandwidth resources are wasted by services that do not require high-quality services. Further, by verifying the difficulty of the workload of the client node during the connection, it is possible to prevent the node from doing evil, avoid the waste of network bandwidth resources, optimize the use of network bandwidth resources, and improve the performance of the P2P network. Furthermore, in the data communication process, the workload difficulty test can be carried out at an interval set time, which further wastes network bandwidth resources, optimizes the use of network bandwidth resources, and improves the performance of the P2P network.
  • Fig. 1 is a schematic flowchart of a first preferred embodiment of the method for avoiding a long-term invalid occupation of connection resources by a client node in a P2P network according to the present invention
  • FIG. 2 is a schematic diagram of node discovery in another preferred embodiment of the method for preventing a client node from occupying connection resources for a long time in a P2P network according to the present invention
  • FIG. 3 is a schematic diagram of session establishment in another preferred embodiment of the method for preventing a client node from occupying connection resources for a long time in a P2P network according to the present invention
  • FIG. 4 is a schematic diagram of the end of a session in another preferred embodiment of the method for preventing a client node from occupying connection resources for a long time in a P2P network according to the present invention
  • Fig. 5 is a schematic flowchart of a first preferred embodiment of a method for guiding a client node in a P2P network to reasonably select a node bandwidth according to the present invention.
  • the present invention provides a method for preventing a client node from occupying connection resources ineffectively for a long time in a P2P network and a method for guiding a client node in a P2P network to select a node bandwidth reasonably, which respectively prove the first generation of initial hash generation through workload.
  • the random nonce is combined with the session ID or the unique identification code of the universally selected server node, and the workload proof function is used to calculate the workload proof until the leading 0 of the workload proof meets the difficulty of keeping the session alive, thereby avoiding the client node for a long time Ineffectively occupy connection resources or guide customers to select node bandwidth reasonably.
  • the present invention relates to a method for preventing a client node from occupying connection resources for a long time in a P2P network, including: S1, the client node discovers multiple P2P nodes and queries each P2P node one by one for the key Parameters, and select a P2P node for session communication; S2, the client node generates the first random nonce, and calculates the proof of work until the proof of work meets the difficulty of the session keep-alive, and then generates a session work proof message and sends it to the selection S3, the selected P2P node verifies the workload proof, and allows the client node to perform data communication when the verification passes.
  • the present invention can prevent nodes from doing evil, avoid waste of network bandwidth resources, optimize the use of network bandwidth resources, and improve P2P network performance.
  • the present invention relates to a method for guiding a client node in a P2P network to reasonably select node bandwidth, including: S1, respectively configuring service types and workload certification requirements for server nodes in the P2P network; S2 The client node discovers the server node and obtains the business type, workload certification requirements, and workload certification parameters of each discovered server node.
  • the workload certification parameters include: universal unique identification code, workload certification initial hash value, session security Live difficulty, submit the workload proof function; S3, the client node selects the server node according to its own business type and generates the workload proof according to the workload proof parameters, then submits the workload proof and sends the session request to the Server node; S4, the server node verifies the workload proof and determines whether to establish a connection with the client node based on the verification result.
  • the present invention creates a method for guiding client nodes to select server nodes according to business requirements during the operation of the decentralized network.
  • the present invention does not force the client to select the server node, but the server node requires the client to provide the corresponding workload certificate according to its own bandwidth situation and the type of QoS that it hopes to provide to the client, so as to allocate the node bandwidth reasonably and effectively avoid high-quality Bandwidth resources are wasted by services that do not require high-quality services.
  • Fig. 1 is a schematic flowchart of a first preferred embodiment of a method for avoiding a long-term invalid occupation of connection resources by a client node in a P2P network according to the present invention.
  • the client node discovers multiple P2P nodes and inquires the key parameters of each P2P node one by one, and selects one P2P node for session communication.
  • the step S1 further includes: S11, configuring key parameters for each P2P node, the key parameters including: session timeout, session keep-alive difficulty, and submission of workload proof function; S12 The client node discovers multiple P2P nodes according to the DHT algorithm, and asks the key parameters of each P2P node; S13, the client node selects a P2P node to establish a session, and the selected P2P node returns session initialization information,
  • the session initialization information includes: session ID, initial hash value of proof of work, session timeout period, difficulty of keeping the session alive, and function of submitting proof of work.
  • the client node in the step S2, the client node generates a first random nonce, and calculates the proof of work until the proof of work meets the difficulty of keeping the session alive, and then generates a proof of session work message and sends it to the selected P2P node.
  • the step S2 further includes: S21, the client node continuously generates a first random nonce based on the initial hash value of the proof of work, and based on the session ID, The initial hash value of the proof of work and the first random nonce are used to calculate the proof of work using the submitted proof of work function; S22. Repeat step S21 until the leading 0 of the obtained proof of work satisfies the session Keep-alive difficulty; S23. Generate a session workload proof message based on the workload proof and send it to the selected P2P node, the session workload certification message includes: the session ID and the workload proof initial hash value , The first random nonce and the proof of workload.
  • the selected P2P node verifies the workload proof, and allows the client node to perform data communication when the verification passes.
  • the step S3 further includes: S31.
  • the selected P2P node verifies the workload proof in the session workload proof message, and if the verification is passed, execute step S32, Otherwise, data communication with the client node is refused;
  • S32 the selected P2P node sends a session establishment success message to the client node, and the client node is based on the session establishment success message and the selected P2P
  • the nodes carry out data communication.
  • the verification of the workload proof is only performed when the session is established. Therefore, after the verification in step S31 is passed, the selected P2P node sends a session establishment success message to the client node, and the client node performs data communication with the selected P2P node based on the session establishment success message until Data communication ends. When the verification fails, the selected P2P node will not communicate with the client node, that is, it will not establish a network connection.
  • the proof-of-work verification runs through the entire data communication process.
  • the selected P2P node sends a session establishment success message to the client node.
  • the session establishment success message includes: the session ID, the next session timeout time, and the hash value of the next submission of the workload proof.
  • step S32 further includes: S321, the client node performs data communication with the selected P2P node, and continuously generates a second random nonce according to the hash value of the next submission of the workload proof, And based on the session ID, the hash value of the next submission of the proof of work and the second random nonce according to the submission of the proof of work function to calculate the next proof of work; S322, repeat step S321 until the obtained The leading 0 of the next workload proof meets the difficulty of keeping the session alive; S323, generating a next session workload proof message based on the next workload proof before the next session timeout and sending it to the selected P2P node, the next session proof of work message includes: the session ID, the hash value of the next submission of the proof of work, the second random nonce, and the next proof of work; S324, the The selected P2P node verifies the next workload proof in the next session workload proof message, and if the verification passes, executes step S325, otherwise it refuses to communicate with the client node;
  • the method for preventing the client node from occupying connection resources for a long time in a P2P network of the present invention can prevent the node from doing evil by verifying the difficulty of the client node's workload during the connection, avoiding the waste of network bandwidth resources, and optimizing the network.
  • the workload difficulty test can be carried out at a set time interval, which further wastes network bandwidth resources, optimizes the use of network bandwidth resources, and improves the performance of the P2P network.
  • Figures 2-4 are schematic diagrams of node discovery, session establishment, and session termination in another preferred embodiment of the method for preventing a client node from occupying connection resources for a long time in a P2P network according to the present invention, where C represents the client node, and S Represents the server, that is, the selected P2P node for data communication with the client node.
  • the method for preventing a client node from occupying connection resources for a long time in a P2P network according to the present invention will be further described below with reference to FIGS. 2-4.
  • the client node discovers multiple P2P nodes according to the DHT algorithm, and asks the key parameters of each P2P node.
  • the key parameters that are asked may include the aforementioned session timeout time T s ; the session keep-alive difficulty D k ; submit The proof-of-work function F().
  • the client node selects a P2P node to establish a session, and the selected P2P node returns session initialization information.
  • the session initialization information includes: session ID S; proof of work initial hash value h 0 ; session timeout time T s ; session Keep-alive difficulty D k .
  • it may also include a timeout period T c for submitting the proof of work.
  • the session workload certification message includes the following key parameters: session ID S; workload proof initial hash value h 0 ; the first random nonce value; the work Proof of quantity P 0 .
  • the server receives the session workload certification message, verifies whether the workload certification P 0 meets the requirements, and returns a session establishment success message to the client node if it meets the requirements.
  • the session establishment success message includes: session ID S, The next session timeout time T s1 , the hash value h 1 of the next submission of the proof of work.
  • the client node After receiving the session establishment success message, the client node starts data communication, and at the same time uses the hash value h 1 of the next submission of the proof of work to continuously generate a second random nonce, and use the submitted proof of work
  • the proof message is sent to the selected P2P node, and at the same time, it is judged whether the data communication is over. If it is to disconnect the connection between the selected P2P node and the client node, otherwise return to step 5 and repeat steps 5-6 It is disconnected until the data communication is over or the workload verification does not meet the requirements.
  • the message types are defined as follows.
  • the client node finds that the message type of multiple P2P nodes is 0, which is represented as GET_NODE_INFO_REQ, which is mainly used to obtain information of other nodes in the P2P network, and includes the following fields: t message type.
  • the reply message type of the discovery node is 1, which is expressed as GET_NODE_INFO_RSP; it is mainly used to return the information of other nodes in the P2P network, including the following fields: 1. type message type; 2. node information list.
  • the node information includes the following information: node IP, node PORT, session timeout time T s ; session keep-alive difficulty D k ; submission of workload proof function F().
  • the message type for initiating a session is 2, denoted as START_SESSION_REQ, which is mainly used for the client node to establish a session with the P2P node and then perform data interaction.
  • the fields are as follows: 1. type message type; 2. Workload proof function supported by the client node F() list.
  • the message type of the session reply message is 3, which is represented as START_SESSION_RSP, which is used by the P2P node to display the workload requirement parameters for initiating the session to the client node.
  • the fields are as follows: 1. Message type, 2. Session ID S, 3. Work proof Initial hash value h 0 ; 4. Session timeout time T s ; 5 Session keep-alive difficulty D k , 6. Submit work proof parameters.
  • the message type of the session proof of work submission message is 4, represented as COMMIT_POW_REQ; it is used to keep alive client nodes and P2P nodes; it contains the following fields: 1. message type, 2. session ID S, 3. proof of work P 0 , 4. Random nonce value, 5. Proof of work parameters (returned from P2P node).
  • the message type of the session establishment success message is 5, which means that the COMMIT_POW_RSP proof reply is used to reply whether the proof of work of the client node is sufficient, and the other is to give the hash value h n required for the next (n) proof of work; contains The fields are as follows: 1. Message type, 2. Session ID S, 3. Result of proof of work, 4. Hash value of next submission of proof of work.
  • the message type of the session rejection message is 6, which is represented as START_SESSION_REJ, which is used to reject the client node's initiating session request. It contains the following fields: 1. Message type, 2. Session ID S, 3. Reject willingness.
  • the message type of the session end message is 7, which is represented as TERMINAL_SESSION.
  • the end of the session can be initiated by the P2P node or the client node. It is mainly used to end the session and contains the following fields: 1. Message type, 2. Session ID.
  • the method for preventing the client node from occupying connection resources for a long time in a P2P network of the present invention can prevent the node from doing evil by verifying the difficulty of the client node's workload during the connection, avoiding the waste of network bandwidth resources, and optimizing the network.
  • the workload difficulty test can be carried out at a set time interval, which further wastes network bandwidth resources, optimizes the use of network bandwidth resources, and improves the performance of the P2P network.
  • the present invention also relates to a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method for preventing a client node from occupying connection resources for a long time in a P2P network is realized.
  • the present invention also relates to a P2P network, including a client node and a plurality of P2P nodes.
  • the client node and/or the P2P node stores a computer program, and when the program is executed by a processor, the A method in P2P network to prevent client nodes from occupying connection resources ineffectively for a long time.
  • the computer-readable storage medium and the P2P network that implement the present invention to prevent the client node from occupying connection resources for a long time in a P2P network can prevent the node from doing evil by verifying the difficulty of the client node’s workload during the connection.
  • Network bandwidth resources are wasted, optimize the use of network bandwidth resources, and improve P2P network performance.
  • the workload difficulty test can be carried out at a set time interval, which further wastes network bandwidth resources, optimizes the use of network bandwidth resources, and improves the performance of the P2P network.
  • Fig. 5 is a schematic flowchart of a first preferred embodiment of a method for guiding a client node in a P2P network to reasonably select a node bandwidth according to the present invention.
  • the service type and workload certification requirements are respectively configured for the server nodes in the P2P network.
  • the service types include session service types and communication service types
  • the workload certification requirements include session workload certification requirements and communication workload certification requirements
  • the step S1 includes: S11, Configure session service types and session workload certification requirements for some server nodes in the P2P network; S12. Configure communication service types and communication workload certification requirements for some server nodes in the P2P network.
  • the service types configured on the server node include the session service type (Session type) and the communication service type (Traffic type), where the session service type indicates that the bandwidth needs to be occupied for a long time and the bandwidth must be maintained at least a certain value.
  • the services on the Internet for example, are usually used for services such as voice and video.
  • the communication service type is mainly used for services that have low bandwidth requirements and do not need to be connected to maintain a stable bandwidth for a long time, such as ordinary text chat, small file transfer and other services. Of course, in other preferred embodiments of the present invention, other service types can also be set.
  • the server node configures workload proof requirements for each business type.
  • the proof-of-work requirements include proof-of-work requirements for starting a business.
  • the workload certification requirement may also include a workload certification requirement for maintaining a business. The start and maintenance of the conversation service type requires a higher workload certification requirement, while the communication service type requires a lower workload certification requirement for the start and maintenance service.
  • the client node discovers the server node and obtains the service type, workload certification requirements, and workload certification parameters of each discovered server node.
  • the client node discovers multiple server nodes according to the DHT algorithm, and obtains the service type, workload certification, and workload certification parameters of each server node discovered.
  • the workload proof parameters include: a universal unique identification code, an initial hash value of the workload proof, the difficulty of the session keep alive, and the submitted workload proof function.
  • a proof-of-work parameter expiration time is also included.
  • step S3 the client node selects the server node according to its own business type and generates a proof of work according to the proof of work parameters, then submits the proof of work and sends a session request to the Server node.
  • the step S3 further includes: S31.
  • the client node selects at least one server node according to its own service type, and proves that the initial hash value is continuously based on the workload of the server node.
  • a first random nonce is generated, and based on the universal unique identification code, the initial hash value of the proof of work and the first random nonce, the proof of work is calculated using the submitted proof of work function; S32, repeat steps S31 until the leading 0 of the obtained proof of workload satisfies the difficulty of keeping the session alive; S33.
  • the universal unique identification code, the initial hash value of the proof of work, the first random nonce and the workload The proof is submitted to the server node, and a session request is submitted to the server node.
  • the workload certification parameters of each server node include: universal unique identification code S, workload certification initial hash value h 0 , session keep-alive difficulty D k , submission workload certification function F().
  • it may further include a session timeout time T s , which is used to limit the time for submitting the proof of work, and of course it may not be limited.
  • the client node After the client node selects at least one server node according to its own business type, it continuously generates the first random nonce according to the workload proof initial hash value h 0 given by the server node, and uses the submitted workload given by the server
  • the session workload certification message includes the following key parameters: universal unique identification code S; workload proof initial hash value h 0 ; the first random nonce value; The workload proof P 0 .
  • step S4 the server node verifies the workload proof and determines whether to establish a connection with the client node based on the verification result.
  • the step S4 further includes: S41.
  • the server node verifies the workload proof and judges whether to establish a connection with the client node based on the verification result, and if it is to perform step S42 , Otherwise refuse to establish a connection with the client node;
  • S42 the server node returns a session establishment success message to the client node, the session establishment success message includes: session ID, session timeout period, next submission workload The hash value of the proof; S43.
  • the client node performs data communication with the server node, and continuously generates a second random nonce according to the hash value of the next submission of the workload proof, and based on the session ID, The hash value of the next proof of work submitted and the second random nonce calculate the next proof of work according to the submitted proof of work function; S44, repeat step S43 until the predecessor of the next proof of work is obtained 0 Satisfies the difficulty of the session keep-alive; S45.
  • next session workload proof message based on the next workload proof before the session timeout period and send it to the server node, and the next session workload proof message
  • the message includes: the session ID, the hash value of the next workload proof, the second random nonce, and the next workload proof; S46, the server node verifies the next workload proof, And based on the verification result and the progress of the session, it is determined whether to continue communicating with the client node.
  • the server node receives the following key parameters: the universal unique identification code S, the initial hash value of the proof of work h 0 , the first random nonce value, and the work of the conversation of the proof of work P 0
  • the server node After the amount proof message, verify whether the workload proof P 0 meets the requirements, and if so, return a session establishment success message to the client.
  • the session establishment success message includes: session IDS 1 , session timeout time T s1 , next submission The hash value h 1 of the proof of work.
  • the amount proof message is sent to the server node, and the server node verifies the next workload proof. If the verification passes, it determines whether the data communication is over, otherwise it interrupts the data communication with the client and returns a refusal to communicate. announcement of.
  • the connection between the server node and the client is disconnected and a notification of the end of the communication is returned. If the data communication is still over, continue to propagate the communication data, and repeat the generation and verification of the aforementioned next workload proof until the end of the communication or the verification fails.
  • the message type is defined as follows.
  • the client node discovers that the message type of the server node is 0, which is represented as GET_NODE_INFO_REQ, which is mainly used to obtain information about other nodes in the P2P network, and includes the following fields: t message type.
  • the message type for the client to obtain the server node is 1, expressed as GET_NODE_INFO_RSP, which is mainly used to return the information of the server node in the P2P network.
  • the message contains the following fields: t message type; i-node information, where the node information includes: node IP, node PORT , The node supports the session type [s1, s2], namely the session service type (Session type) and the communication service type (Traffic type).
  • the message type of session establishment is 2, denoted as SESSION_INFO_REQ, which is mainly used for the client node to establish a session with the server node and then exchange data, including the following fields: t message type; s session type [s1
  • the message type of the server node is 3, represented as SESSION_INFO_RSP, which is used by the server node to display to the client node the service type, workload certification requirements, and workload certification parameters for initiating the session, including the following fields: t message type; u workload certification parameters; o Workload proof parameter expiration time.
  • the message type of the session initiated by the client node is 4, which is represented as START_SESSION_REQ.
  • After receiving the message from the server node it starts to calculate the proof of work based on the proof of work parameters. After the proof of work is calculated, it initiates a session request, including The fields are as follows: t message type, u universal unique identification code; p proof of work; n nonce value for generating proof of work.
  • the message type of the server's reply to the session is 5, which is represented as START_SESSION_RSP: t. message type, s session ID, r reason for rejecting the session (if not rejected, this field is not included).
  • the message type of data communication is 6, denoted as SESSION_DATA, and contains the following fields: t message type, s session ID, d data payload.
  • the implementation of the method for guiding the client node in the P2P network to reasonably select the node bandwidth can guide the client node to select the node according to its own business, so as to allocate the node bandwidth reasonably, and effectively avoid the high-quality bandwidth resources from being unnecessary for high-quality services. What a waste. Further, by verifying the difficulty of the client's workload during connection, it is possible to prevent nodes from doing evil, avoid waste of network bandwidth resources, optimize the use of network bandwidth resources, and improve P2P network performance. Furthermore, in the data communication process, the workload difficulty test can be carried out at an interval set time, which further wastes network bandwidth resources, optimizes the use of network bandwidth resources, and improves the performance of the P2P network.
  • the present invention also relates to a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method for guiding a client node in a P2P network to reasonably select a node bandwidth is realized.
  • the present invention also relates to a P2P network, which includes a client node and a server node, and computer programs are stored on the client node and the server node.
  • the client node in the P2P network is guided Reasonably choose the method of node bandwidth.
  • the implementation of the present invention guides the client node in the P2P network to reasonably select the computer-readable storage medium of the node bandwidth and the P2P network, which can guide the client node to select the node according to its own business, thereby reasonably assigning the node bandwidth and effectively avoiding high-quality bandwidth resources Being wasted by businesses that do not require high quality. Further, by verifying the difficulty of the client's workload during connection, it is possible to prevent nodes from doing evil, avoid waste of network bandwidth resources, optimize the use of network bandwidth resources, and improve P2P network performance. Furthermore, in the data communication process, the workload difficulty test can be carried out at an interval set time, which further wastes network bandwidth resources, optimizes the use of network bandwidth resources, and improves the performance of the P2P network.
  • the present invention can be implemented by hardware, software or a combination of software and hardware.
  • the present invention can be implemented in a centralized manner in at least one computer system, or implemented in a decentralized manner by different parts distributed in several interconnected computer systems. Any computer system or other equipment that can implement the method of the present invention is applicable.
  • the combination of commonly used software and hardware can be a general computer system with a computer program installed, and the computer system is controlled by installing and executing the program to make it run according to the method of the present invention.
  • the present invention can also be implemented by a computer program product.
  • the program contains all the features that can implement the method of the present invention, and when it is installed in a computer system, the method of the present invention can be implemented.
  • the computer program in this document refers to any expression of a set of instructions that can be written in any programming language, code, or symbol. After one or two steps, a specific function is realized: a) conversion into other languages, codes or symbols; b) reproduction in a different format.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明涉及一种在P2P网络中避免客户端节点长时间无效占用连接资源的方法和一种引导P2P网络中客户端节点合理选择节点带宽的方法,其分别通过工作量证明初始hash生成的第一随机nonce结合会话ID或通用选择的服务器节点的唯一识别码,采用提交工作量证明函数计算工作量证明,直至所述工作量证明的前导0满足会话保活难度,从而避免客户端节点长时间无效占用连接资源或引导客户点节点合理选择节点带宽。本发明还涉及计算机可读存储介质和P2P网络。

Description

在P2P网络中避免客户端节点长时间无效占用连接资源和引导客户端节点合理选择节点带宽 技术领域
本发明涉及P2P网络领域,更具体地说,涉及一种在P2P网络中避免客户端节点长时间无效占用连接资源的方法、一种引导P2P网络中客户端节点合理选择节点带宽的方法,以及对应的计算机可读存储介质和P2P网络。
背景技术
P2P网络(Peer-to-peer networking),即对等网络,该网络的参与者共享他们所拥有的一部分硬件资源,这些共享资源通过网络提供服务和内容,能被其它对等节点直接访问而无需经过中间实体。在此网络中的参与者既是资源、服务和内容的提供者,又是资源、服务和内容的获取者。
P2P网络被广泛的使用于需要高可用的场景,由于没有中心化节点,网络当中的任意一个节点发生故障都不会影响到其他节点的正常工作。P2P网络常用来存储大文件数据,上传大文件到P2P网络的时候,首先会将文件进行分片,与此同时将每一个文件分片都生成Hash,然后将每个分片和Hash分别存放在各个P2P节点上面。因此,P2P网络的客户端节点都需要使用多线程多连接的模式来下载P2P网络的当中的文件。
此外,同一个P2P网络有时会兼容不同的业务场景,有些业务场景对带宽的要求十分高,需要P2P节点限制连接数仅为少数几个客户端提供高质量的带宽。但是有些业务场景对带宽要求并不高,短暂的网络抖动和延迟不会影响业务的体验,一个P2P节点可以为很多节点提供服务。
传统的P2P网络协议没有限制用户的连接数,也没有限制客户端节点占用连接的时间长短,这就造成了节点被攻击的可能。客户端节点可以跟P2P节点建立多个TCP连接,与此同时可以用很低的速度来下载节点上面的资源, 使得节点无法判断客户端节点到底是否是作恶节点。一个客户端节点甚至可以模拟不同的身份向P2P当中很多个节点建立多个长连接,并一直以低速下载节点上的文件,让整个P2P网络的性能大幅下降。
传统的P2P协议里面节点只需要根据KAD的距离算法连接上离自己最近的若干个节点就可以开始业务,这样做会导致网络带宽资源无法得到有规划的分配,从而导致许多有优质带宽的节点被大量不需要优质带宽的节点所占用。
发明内容
本发明的第一方面在于,提供一种在P2P网络中避免客户端节点长时间无效占用连接资源的方法、计算机可读存储介质和P2P网络,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。
根据本发明的第一方面,本发明提供了一种在P2P网络中避免客户端节点长时间无效占用连接资源的方法,包括:
S1、客户端节点发现多个P2P节点并逐一询问每个P2P节点的关键参数,并选择一个P2P节点进行会话通信;
S2、所述客户端节点生成第一随机nonce,并计算工作量证明直至所述工作证明满足会话保活难度,然后生成会话工作量证明消息发送给选择的P2P节点;
S3、所述选择的P2P节点验证所述工作量证明,并在验证通过时允许所述客户端节点进行数据通信。
在本发明所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法中,所述步骤S1进一步包括:
S11、为每个P2P节点配置关键参数,所述关键参数包括:会话超时时间、会话保活难度、提交工作量证明函数;
S12、所述客户端节点根据DHT算法发现多个P2P节点,并询问每个P2P节点的所述关键参数;
S13、所述客户端节点选择一个P2P节点建立会话,选择的P2P节点返回会话初始化信息,所述会话初始化信息包括:会话ID、工作量证明初始hash 值、会话超时时间、会话保活难度、提交工作量证明函数。
在本发明所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法中,所述步骤S2进一步包括:
S21、所述客户端节点基于所述工作量证明初始hash值不停地生成第一随机nonce,并基于所述会话ID、所述工作量证明初始hash值和所述第一随机nonce,采用所述提交工作量证明函数计算所述工作量证明;
S22、重复步骤S21直至获得的所述工作量证明的前导0满足所述会话保活难度;
S23、基于所述工作量证明生成会话工作量证明消息并发送给所述选择的P2P节点,所述会话工作量证明消息包括:所述会话ID、所述工作量证明初始hash值、所述第一随机nonce和所述工作量证明。
在本发明所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法中,所述步骤S3进一步包括:
S31、所述选择的P2P节点验证所述会话工作量证明消息中的所述工作量证明,如果验证通过则执行步骤S32,否则拒绝与所述客户端节点进行数据通信;
S32、所述选择的P2P节点向所述客户端节点发送会话建立成功消息,所述客户端节点基于所述会话建立成功消息与所述选择的P2P节点进行数据通信。
在本发明所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法中,在所述步骤S32中,所述会话建立成功消息包括:会话ID、下次会话超时时间、下次提交工作量证明的hash值。
在本发明所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法中,所述步骤S32进一步包括:
S321、所述客户端节点与所述选择的P2P节点进行数据通信,并根据所述下次提交工作量证明的hash值不停地生成第二随机nonce,并基于所述会话ID、所述下次提交工作量证明的hash值和所述第二随机nonce根据所述提交工作量证明函数计算下次工作量证明;
S322、重复步骤S321直至获得的所述下次工作量证明的前导0满足所述会话保活难度;
S323、在所述下次会话超时时间之前基于所述下次工作量证明生成下次会话工作量证明消息并发送给所述选择的P2P节点,所述下次会话工作量证明消息包括:所述会话ID、所述下次提交工作量证明的hash值、所述第二随机nonce和所述下次工作量证明;
S324、所述选择的P2P节点验证所述下次会话工作量证明消息中的所述下次工作量证明,如果验证通过则执行步骤S325,否则拒绝与所述客户端节点进行数据通信;
S325、判断数据通信是否结束,如果是断开所述选择的P2P节点与所述客户端节点的连接,否则返回步骤S31。
在本发明所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法中,在所述步骤S325中,所述选择的P2P节点发送会话结束消息给所述客户端节点以断开所述选择的P2P节点与所述客户端节点的连接。
在本发明所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法中,在所述步骤S325中,所述客户端节点发送会话结束消息给所述客户端节点以断开所述选择的P2P节点与所述客户端节点的连接。
根据本发明的第一方面,本发明提供了一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法。
根据本发明的第一方面,本发明提供了一种P2P网络,包括客户端节点和多个P2P节点,所述客户端节点和/或所述P2P节点上存储有计算机程序所述程序被处理器执行时实现所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法。
实施本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法、计算机可读存储介质和P2P网络,其通过在连接时对客户端节点的工作量难度进行验证,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。进一步地,还可以进一步在数据通信过程 中,间隔设定时间就进行工作量难度检验,进而进一步网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。
本发明的第二方面在于,提供一种引导P2P网络中客户端节点合理选择节点带宽的方法、计算机可读存储介质和P2P网络,能够引导客户端节点根据自身业务来进行节点选择,从而合理分配节点带宽,有效避免优质的带宽资源被不需要高质量的业务所端浪费。
根据本发明的第二方面,本发明提供了一种引导P2P网络中客户端节点合理选择节点带宽的方法,包括:
S1、为P2P网络中的服务器节点分别配置业务类型和工作量证明要求;
S2、客户端节点发现服务器节点并获取每个发现的服务器节点的业务类型、工作量证明要求以及工作量证明参数,所述工作量证明参数包括:通用唯一识别码、工作量证明初始hash值、会话保活难度、提交工作量证明函数;
S3、所述客户端节点根据自身业务类型选择服务器节点并根据所述工作量证明参数生成工作量证明,然后提交所述工作量证明并发送会话要求到所述服务器节点;
S4、所述服务器节点验证所述工作量证明并基于验证结果判断是否与所述客户端节点建立连接;
所述步骤S3进一步包括:
S31、所述客户端节点根据自身的业务类型选择至少一个服务器节点,并基于所述服务器节点的工作量证明初始hash值不停地生成第一随机nonce,并基于所述通用唯一识别码、所述工作量证明初始hash值和所述第一随机nonce,采用所述提交工作量证明函数计算所述工作量证明;
S32、重复步骤S31直至获得的所述工作量证明的前导0满足所述会话保活难度;
S33、将所述通用唯一识别码、所述工作量证明初始hash值、所述第一随机nonce和所述工作量证明提交到所述服务器节点,并提交会话请求给所述服务器节点。
在本发明所述的引导P2P网络中客户端节点合理选择节点带宽的方法中, 所述业务类型包括会话业务类型和通信业务类型,所述工作量证明要求包括会话工作量证明要求和通信工作量证明要求。
在本发明所述的引导P2P网络中客户端节点合理选择节点带宽的方法中,所述步骤S1包括:
S11、为P2P网络中的部分服务器节点配置会话业务类型和会话工作量证明要求;
S12、为P2P网络中的部分服务器节点配置通信业务类型和通信工作量证明要求。
在本发明所述的引导P2P网络中客户端节点合理选择节点带宽的方法中,所述步骤S2进一步包括:所述客户端节点根据DHT算法发现多个服务器节点,并获取发现的每个服务器节点的业务类型、工作量证明和工作量证明参数。
在本发明所述的引导P2P网络中客户端节点合理选择节点带宽的方法中,所述步骤S4进一步包括:
S41、所述服务器节点验证所述工作量证明并基于验证结果判断是否与所述客户端节点建立连接,如果是执行步骤S42,否则拒绝与所述客户端节点建立连接;
S42、所述服务器节点返回会话建立成功消息给所述客户端节点,所述会话建立成功消息包括:会话ID、会话超时时间、下次提交工作量证明的hash值;
S43、所述客户端节点与所述服务器节点进行数据通信,并根据所述下次提交工作量证明的hash值不停地生成第二随机nonce,并基于所述会话ID、所述下次提交工作量证明的hash值和所述第二随机nonce根据所述提交工作量证明函数计算下次工作量证明;
S44、重复步骤S43直至获得的所述下次工作量证明的前导0满足所述会话保活难度;
S45、在所述会话超时时间之前基于所述下次工作量证明生成下次会话工作量证明消息并发送给所述服务器节点,所述下次会话工作量证明消息包括:所述会话ID、所述下次提交工作量证明的hash值、所述第二随机nonce和所 述下次工作量证明;
S46、所述服务器节点验证所述下次工作量证明,并基于验证结果和会话进行情况判定是否继续与所述客户端节点进行通信。
在本发明所述的引导P2P网络中客户端节点合理选择节点带宽的方法中,所述步骤S46进一步包括:
S461、所述服务器节点验证所述下次工作量证明,如果验证通过则执行步骤S462,否则中断与所述客户端进行数据通信并返回拒绝通信的通知;
S462、判断所述数据通信是否结束,如果是断开所述服务器节点与所述客户端的连接并返回通信结束的通知,否则返回步骤S43。
根据本发明的第二方面,本发明提供了一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现所述的引导P2P网络中客户端节点合理选择节点带宽的方法。
根据本发明的第一方面,本发明提供了一种P2P网络,包括客户端节点和服务器节点,所述客户端节点和服务器节点上存储有计算机程序,所述程序被处理器执行时实现所述的引导P2P网络中客户端节点合理选择节点带宽的方法。
实施本发明的引导P2P网络中客户端节点合理选择节点带宽的方法、计算机可读存储介质和P2P网络,能够引导客户端节点根据自身业务来进行节点选择,从而合理分配节点带宽,有效避免优质的带宽资源被不需要高质量的业务所端浪费。进一步地通过在连接时对客户端节点的工作量难度进行验证,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。再进一步地,还可以进一步在数据通信过程中,间隔设定时间就进行工作量难度检验,进而进一步网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。
附图说明
下面将结合附图及实施例对本发明作进一步说明,附图中:
图1是本发明的在P2P网络中避免客户端节点长时间无效占用连接资源 的方法的第一优选实施例的流程示意图;
图2是本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法的另一优选实施例的节点发现的示意图;
图3是本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法的另一优选实施例的会话建立的示意图;
图4是本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法的另一优选实施例的会话结束的示意图;
图5是本发明的引导P2P网络中客户端节点合理选择节点带宽的方法的第一优选实施例的流程示意图。
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明的一种在P2P网络中避免客户端节点长时间无效占用连接资源的方法和一种引导P2P网络中客户端节点合理选择节点带宽的方法,其分别通过工作量证明初始hash生成的第一随机nonce结合会话ID或通用选择的服务器节点的唯一识别码,采用提交工作量证明函数计算工作量证明,直至所述工作量证明的前导0满足会话保活难度或,从而避免客户端节点长时间无效占用连接资源或引导客户点节点合理选择节点带宽。
根据本发明的一个方面,本发明涉及一种在P2P网络中避免客户端节点长时间无效占用连接资源的方法,包括:S1、客户端节点发现多个P2P节点并逐一询问每个P2P节点的关键参数,并选择一个P2P节点进行会话通信;S2、所述客户端节点生成第一随机nonce,并计算工作量证明直至所述工作证明满足会话保活难度,然后生成会话工作量证明消息发送给选择的P2P节点;S3、所述选择的P2P节点验证所述工作量证明,并在验证通过时允许所述客户端节点进行数据通信。本发明通过在连接时对客户端节点的工作量难度进行验证,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用, 改善P2P网络性能。
根据本发明的另一个方面,本发明涉及一种引导P2P网络中客户端节点合理选择节点带宽的方法,包括:S1、为P2P网络中的服务器节点分别配置业务类型和工作量证明要求;S2、客户端节点发现服务器节点并获取每个发现的服务器节点的业务类型、工作量证明要求以及工作量证明参数,所述工作量证明参数包括:通用唯一识别码、工作量证明初始hash值、会话保活难度、提交工作量证明函数;S3、所述客户端节点根据自身业务类型选择服务器节点并根据所述工作量证明参数生成工作量证明,然后提交所述工作量证明并发送会话要求到所述服务器节点;S4、所述服务器节点验证所述工作量证明并基于验证结果判断是否与所述客户端节点建立连接。本发明创建一种去中心化网络运行过程当中,引导客户端节点根据业务需求来进行服务器节点选择的方法。本发明不强制客户端选择服务器节点,而是服务器节点根据自身的带宽情况以及希望向客户端提供的QoS类型来要求客户端给出相应的工作量证明,从而合理分配节点带宽,有效避免优质的带宽资源被不需要高质量的业务所端浪费。
图1是本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法的第一优选实施例的流程示意图。如图1所示,在步骤S1中,客户端节点发现多个P2P节点并逐一询问每个P2P节点的关键参数,并选择一个P2P节点进行会话通信。在本发明的一个优选实施例中,所述步骤S1进一步包括:S11、为每个P2P节点配置关键参数,所述关键参数包括:会话超时时间、会话保活难度、提交工作量证明函数;S12、所述客户端节点根据DHT算法发现多个P2P节点,并询问每个P2P节点的所述关键参数;S13、所述客户端节点选择一个P2P节点建立会话,选择的P2P节点返回会话初始化信息,所述会话初始化信息包括:会话ID、工作量证明初始hash值、会话超时时间、会话保活难度、提交工作量证明函数。
进一步参照图1,在所述步骤S2中,所述客户端节点生成第一随机nonce,并计算工作量证明直至所述工作证明满足会话保活难度,然后生成会话工作量证明消息发送给选择的P2P节点。在本发明的一个优选实施例中,所述步骤S2进一步包括:S21、所述客户端节点基于所述工作量证明初始hash值不停 地生成第一随机nonce,并基于所述会话ID、所述工作量证明初始hash值和所述第一随机nonce,采用所述提交工作量证明函数计算所述工作量证明;S22、重复步骤S21直至获得的所述工作量证明的前导0满足所述会话保活难度;S23、基于所述工作量证明生成会话工作量证明消息并发送给所述选择的P2P节点,所述会话工作量证明消息包括:所述会话ID、所述工作量证明初始hash值、所述第一随机nonce和所述工作量证明。
进一步参照图1,在所述步骤S3中,S3、所述选择的P2P节点验证所述工作量证明,并在验证通过时允许所述客户端节点进行数据通信。在本发明的进一步的优选实施例中,所述步骤S3进一步包括:S31、所述选择的P2P节点验证所述会话工作量证明消息中的所述工作量证明,如果验证通过则执行步骤S32,否则拒绝与所述客户端节点进行数据通信;S32、所述选择的P2P节点向所述客户端节点发送会话建立成功消息,所述客户端节点基于所述会话建立成功消息与所述选择的P2P节点进行数据通信。
优选地,一种情况,是仅仅在会话建立的时候,进行工作量证明的验证。因此在步骤S31验证通过之后,所述选择的P2P节点向所述客户端节点发送会话建立成功消息,所述客户端节点基于所述会话建立成功消息与所述选择的P2P节点进行数据通信,直至数据通信结束。而验证不通过时,所述选择的P2P节点不会与所述客户端节点进行通信,也就是说,其不会建立网络连接。
而在本发明的另一优选情况中,工作量证明验证贯穿整个数据通信过程。在该优选实施例中,在步骤S31验证通过之后,在步骤S32中,所述选择的P2P节点向所述客户端节点发送会话建立成功消息。所述会话建立成功消息包括:会话ID、下次会话超时时间、下次提交工作量证明的hash值。进一步地,所述步骤S32进一步包括:S321、所述客户端节点与所述选择的P2P节点进行数据通信,并根据所述下次提交工作量证明的hash值不停地生成第二随机nonce,并基于所述会话ID、所述下次提交工作量证明的hash值和所述第二随机nonce根据所述提交工作量证明函数计算下次工作量证明;S322、重复步骤S321直至获得的所述下次工作量证明的前导0满足所述会话保活难度;S323、在所述下次会话超时时间之前基于所述下次工作量证明生成下次会话工作量 证明消息并发送给所述选择的P2P节点,所述下次会话工作量证明消息包括:所述会话ID、所述下次提交工作量证明的hash值、所述第二随机nonce和所述下次工作量证明;S324、所述选择的P2P节点验证所述下次会话工作量证明消息中的所述下次工作量证明,如果验证通过则执行步骤S325,否则拒绝与所述客户端节点进行数据通信;S325、判断数据通信是否结束,如果是断开所述选择的P2P节点与所述客户端节点的连接,否则返回步骤S31。
实施本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其通过在连接时对客户端节点的工作量难度进行验证,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。进一步地,还可以进一步在数据通信过程中,间隔设定时间就进行工作量难度检验,进而进一步网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。
图2-4是本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法的另一优选实施例的节点发现、会话建立和会话结束的示意图,其中C表示客户端节点,S表示服务器,即选择的与客户端节点进行数据通信的P2P节点。下面结合图2-4对本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法进一步说明如下。
1.首先对P2P网络中的每个P2P节点在启动前配置如下几个参数:会话超时时间T s;会话保活难度D k;提交工作量证明函数F()。优选地,还可以进一步设置最多激活会话数量N m;最多等待激活会话数量N w;同一IP地址最多可建立会话数量N e
2.然后所述客户端节点根据DHT算法发现多个P2P节点,并询问每个P2P节点的关键参数,这些被询问的关键参数可以包括前述会话超时时间T s;会话保活难度D k;提交工作量证明函数F()。
3.随后,客户端节点选择一个P2P节点建立会话,选择的P2P节点返回会话初始化信息,所述会话初始化信息包括:会话ID S;工作量证明初始hash值h 0;会话超时时间T s;会话保活难度D k。优选地,还可以包括提交工作量证明超时时间T c
4.所述客户端节点收到会话初始化信息之后,根据服务器给的所述工作量证明初始hash值h 0不停的生成第一随机nonce,同时使用服务器给的所述提交工作量证明函数根据会话ID S;工作量证明初始hash值h 0,第一随机nonce计算所述工作量证明P 0:P 0=F(S+h 0+nonce);直到所述工作量证明P 0的前导0满足会话保活难度D k为止。然后提交会话工作量证明消息给服务器建立会话,所述会话工作量证明消息包括如下几个关键参数:会话ID S;工作量证明初始hash值h 0;所述第一随机nonce值;所述工作量证明P 0
5.服务器收到所述会话工作量证明消息,验证所述工作量证明P 0是否符合要求,如果符合则返回会话建立成功消息给客户端节点,所述会话建立成功消息包括:会话ID S、下次会话超时时间T s1、下次提交工作量证明的hash值h 1
6.客户端节点收到所述会话建立成功消息之后,开始进行数据通信,与此同时使用下次提交工作量证明的hash值h 1不停地生成第二随机nonce,并使用提交工作量证明函数F()计算下次工作量证明P 1:P 1=F(S+h 1+nonce),并且在所述下次会话超时时间之前基于所述下次工作量证明生成下次会话工作量证明消息并发送给所述选择的P2P节点,同时判断数据通信是否结束,如果是断开所述选择的P2P节点与所述客户端节点的连接,否则返回步骤5,并且重复执行步骤5-6直到数据通信是否结束或者工作量验证不满足要求被断开。
在本优选实施例中,如图2-4所示,其消息类型定义如下。在步骤S1中,客户端节点发现多个P2P节点的消息的类型为0,表示为GET_NODE_INFO_REQ,其主要用来获取P2P网络里面其他节点的信息,包含字段如下:t消息类型。
发现节点的回复消息类型为1,表示为GET_NODE_INFO_RSP;主要用来返回P2P网络里面其他节点的信息,包含字段如下:1.type消息类型;2.节点信息列表。所述节点信息包含如下信息:节点IP,节点PORT,会话超时时间T s;会话保活难度D k;提交工作量证明函数F()。
发起会话的消息类型为2,表示为START_SESSION_REQ,主要用于客户端节点跟P2P节点建立会话然后进行数据交互,包含字段如下:1.type消息 类型;2.客户端节点支持的提交工作量证明函数F()列表。
会话回复消息的消息类型为3,表示为START_SESSION_RSP,用于P2P节点向客户端节点展示发起会话的工作量要求参数,包含字段如下:1.消息类型,2.会话ID S,3.工作量证明初始hash值h 0;4.会话超时时间T s;5会话保活难度D k,6.提交工作证明参数。
会话工作量证明提交消息的消息类型为4,表示为COMMIT_POW_REQ;用于保活客户端节点和P2P节点;包含字段如下:1.消息类型,2.会话ID S,3.工作量证明P 0,4.随机nonce值,5.工作证明参数(从P2P节点返回)。
会话建立成功消息的消息类型为5,表示为COMMIT_POW_RSP证明回复用来回复客户端节点的工作量证明是否足够,另外就是给出下一次(n)工作量证明所需要的哈希值h n;包含字段如下:1.消息类型,2.会话ID S,3.工作量证明结果,4.下次提交工作量证明的hash值。
会话拒绝消息的消息类型为6,表示为START_SESSION_REJ,用于拒绝客户端节点的发起会话请求,包含字段如下:1.消息类型,2.会话ID S,3.拒绝愿意。
会话结束消息的消息类型为7,表示为TERMINAL_SESSION,结束会话可以由P2P节点发起,也可以由客户端节点发起,主要用于结束会话,包含字段如下:1.消息类型,2.会话ID。
实施本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其通过在连接时对客户端节点的工作量难度进行验证,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。进一步地,还可以进一步在数据通信过程中,间隔设定时间就进行工作量难度检验,进而进一步网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。
本发明还涉及一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法。
本发明还涉及一种P2P网络,包括客户端节点和多个P2P节点,所述客 户端节点和/或所述P2P节点上存储有计算机程序,所述程序被处理器执行时实现所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法。
实施本发明的在P2P网络中避免客户端节点长时间无效占用连接资源的计算机可读存储介质和P2P网络,其通过在连接时对客户端节点的工作量难度进行验证,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。进一步地,还可以进一步在数据通信过程中,间隔设定时间就进行工作量难度检验,进而进一步网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。
图5是本发明的引导P2P网络中客户端节点合理选择节点带宽的方法的第一优选实施例的流程示意图。如图5所示,在步骤S1中,为P2P网络中的服务器节点分别配置业务类型和工作量证明要求。在本发明的优选实施例中,所述业务类型包括会话业务类型和通信业务类型,所述工作量证明要求包括会话工作量证明要求和通信工作量证明要求,因此所述步骤S1包括:S11、为P2P网络中的部分服务器节点配置会话业务类型和会话工作量证明要求;S12、为P2P网络中的部分服务器节点配置通信业务类型和通信工作量证明要求。
具体说明如下:在服务器节点配置的业务类型包括会话业务类型(Session类型)和通信业务类型(Traffic类型),其中会话业务类型表示需要占用较长时间的带宽并且要带宽保持在至少某个值之上的业务,例如:通常用于语音和视频等业务。而通信业务类型主要用于带宽需求不高,同时不需要连接长时间保持稳定带宽的业务,例如:普通的文字聊天,小文件传输等服务。当然,在本发明的其他优选实施例中,还可以设置其他的业务类型。同时,服务器节点为每种业务类型配置工作量证明要求。在本发明的有个优选实施例中,工作量证明要求包括开始业务需要的工作量证明要求。在本发明的进一步的优选实施中,所述工作量证明要求还可以包括维持业务的工作量证明要求。会话业务类型的开始和维持业务需要的工作量证明要求较高,而通信业务类型开始和维持业务需要的工作量证明要求较低。
现回到图5,在步骤S2中,客户端节点发现服务器节点并获取每个发现的服务器节点的业务类型、工作量证明要求以及工作量证明参数。在本发明的 优选实施例中,所述客户端节点根据DHT算法发现多个服务器节点,并获取发现的每个服务器节点的业务类型、工作量证明和工作量证明参数。优选地,所述工作量证明参数包括:通用唯一识别码、工作量证明初始hash值、会话保活难度、提交工作量证明函数。在本发明的进一步的优选实施例中还包括工作量证明参数失效时间。
现回到图5,在步骤S3中,所述客户端节点根据自身业务类型选择服务器节点并根据所述工作量证明参数生成工作量证明,然后提交所述工作量证明并发送会话要求到所述服务器节点。在本发明的优选实施例中,所述步骤S3进一步包括:S31、所述客户端节点根据自身的业务类型选择至少一个服务器节点,并基于所述服务器节点的工作量证明初始hash值不停地生成第一随机nonce,并基于所述通用唯一识别码、所述工作量证明初始hash值和所述第一随机nonce,采用所述提交工作量证明函数计算所述工作量证明;S32、重复步骤S31直至获得的所述工作量证明的前导0满足所述会话保活难度;S33、将所述通用唯一识别码、所述工作量证明初始hash值、所述第一随机nonce和所述工作量证明提交到所述服务器节点,并提交会话请求给所述服务器节点。
具体实施例说明如下:每个服务器节点的工作量证明参数包括:通用唯一识别码S、工作量证明初始hash值h 0;会话保活难度D k,提交工作量证明函数F()。优选地,还可以进一步包括会话超时时间T s,用来限制提交所述工作量证明的时间,当然也可以不对其进行限制。
客户端节点在根据自身的业务类型选择至少一个服务器节点之后,根据服务器节点给的所述工作量证明初始hash值h 0不停的生成第一随机nonce,同时使用服务器给的所述提交工作量证明函数根据通用唯一识别码S;工作量证明初始hash值h 0,第一随机nonce计算所述工作量证明P 0:P 0=F(S+h 0+nonce);直到所述工作量证明P 0的前导0满足会话保活难度D k为止。然后提交会话工作量证明消息给服务器建立会话,所述会话工作量证明消息包括如下几个关键参数:通用唯一识别码S;工作量证明初始hash值h 0;所述第一随机nonce值;所述工作量证明P 0
现回到图5,在步骤S4中,所述服务器节点验证所述工作量证明并基于 验证结果判断是否与所述客户端节点建立连接。在本发明的进一步的优选实施例中,所述步骤S4进一步包括:S41、所述服务器节点验证所述工作量证明并基于验证结果判断是否与所述客户端节点建立连接,如果是执行步骤S42,否则拒绝与所述客户端节点建立连接;S42、所述服务器节点返回会话建立成功消息给所述客户端节点,所述会话建立成功消息包括:会话ID、会话超时时间、下次提交工作量证明的hash值;S43、所述客户端节点与所述服务器节点进行数据通信,并根据所述下次提交工作量证明的hash值不停地生成第二随机nonce,并基于所述会话ID、所述下次提交工作量证明的hash值和所述第二随机nonce根据所述提交工作量证明函数计算下次工作量证明;S44、重复步骤S43直至获得的所述下次工作量证明的前导0满足所述会话保活难度;S45、在所述会话超时时间之前基于所述下次工作量证明生成下次会话工作量证明消息并发送给所述服务器节点,所述下次会话工作量证明消息包括:所述会话ID、所述下次提交工作量证明的hash值、所述第二随机nonce和所述下次工作量证明;S46、所述服务器节点验证所述下次工作量证明,并基于验证结果和会话进行情况判定是否继续与所述客户端节点进行通信。
具体实施例说明如下:服务器节点收到包括如下几个关键参数:通用唯一识别码S、工作量证明初始hash值h 0、所述第一随机nonce值、所述工作量证明P 0的会话工作量证明消息之后,验证所述工作量证明P 0是否符合要求,如果符合则返回会话建立成功消息给客户端,所述会话建立成功消息包括:会话IDS 1、会话超时时间T s1、下次提交工作量证明的hash值h 1
客户端节点收到所述会话建立成功消息之后,开始进行数据通信,与此同时使用下次提交工作量证明的hash值h 1不停地生成第二随机nonce,并使用提交工作量证明函数F()计算下次工作量证明P 1:P 1=F(S 1+h 1+nonce),并且在所述会话超时时间T s1之前基于所述下次工作量证明P 1生成下次会话工作量证明消息并发送给所述服务器节点,所述服务器节点验证所述下次工作量证明,如果验证通过则判断所述数据通信是否结束,否则中断与所述客户端进行数据通信并返回拒绝通信的通知。如果数据通信已经结束,那么断开所述服务器节点与所述客户端的连接并返回通信结束的通知。如果数据通信还为结束, 那么继续传播通信数据,并且重复执行前述下次工作量证明的生成和验证,直至通信结束或验证不通过。
在本优选实施例中,其消息类型定义如下。
客户端节点发现服务器节点的消息类型为0,表示为GET_NODE_INFO_REQ,主要用来获取P2P网络里面其他节点的信息,包含字段如下:t消息类型。
客户端获取服务器节点的消息类型为1,表示为GET_NODE_INFO_RSP,主要用来返回P2P网络里面服务器节点的信息,消息包含字段如下:t消息类型;i节点信息,其中节点信息包含:节点IP,节点PORT,节点支持会话类型[s1,s2],即会话业务类型(Session类型)和通信业务类型(Traffic类型)。
会话建立的消息类型为2,表示为SESSION_INFO_REQ,主要用于客户端节点跟服务器节点建立会话然后进行数据交互,包含字段如下:t消息类型;s会话类型[s1|s2]。
服务器节点的消息类型为3,表示为SESSION_INFO_RSP,用于服务器节点向客户端节点展示发起会话的业务类型、工作量证明要求以及工作量证明参数,包含字段如下t消息类型;u工作量证明参数;o工作量证明参数失效时间。
客户端节点发起会话的消息类型为4,表示为START_SESSION_REQ,在收到服务器节点的消息之后,则开始基于工作量证明参数进行工作量证明计算,计算完工作量证明之后,则发起会话请求,包含字段如下:t消息类型,u通用唯一识别码;p工作量证明;n生成工作量证明的nonce值。
服务器对会话的回复的消息类型为5,表示为START_SESSION_RSP:t.消息类型,s会话ID,r拒绝会话原因(如果不拒绝,则不包含该字段)。
数据通信的消息类型为6,表示为SESSION_DATA,包含字段如下:t消息类型,s会话ID,d数据净载。
实施本发明的引导P2P网络中客户端节点合理选择节点带宽的方法,能够引导客户端节点根据自身业务来进行节点选择,从而合理分配节点带宽,有效避免优质的带宽资源被不需要高质量的业务所端浪费。进一步地通过在连接 时对客户端的工作量难度进行验证,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。再进一步地,还可以进一步在数据通信过程中,间隔设定时间就进行工作量难度检验,进而进一步网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。
本发明还涉及一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现所述的引导P2P网络中客户端节点合理选择节点带宽的方法。
本发明还涉及一种P2P网络,包括客户端节点和服务器节点,所述客户端节点和服务器节点上存储有计算机程序,所述程序被处理器执行时实现所述的引导P2P网络中客户端节点合理选择节点带宽的方法。
实施本发明的引导P2P网络中客户端节点合理选择节点带宽的计算机可读存储介质和P2P网络,能够引导客户端节点根据自身业务来进行节点选择,从而合理分配节点带宽,有效避免优质的带宽资源被不需要高质量的业务所端浪费。进一步地通过在连接时对客户端的工作量难度进行验证,能够防止节点作恶,避免网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。再进一步地,还可以进一步在数据通信过程中,间隔设定时间就进行工作量难度检验,进而进一步网络带宽资源浪费,优化网络带宽资源使用,改善P2P网络性能。
因此,本发明可以通过硬件、软件或者软、硬件结合来实现。本发明可以在至少一个计算机系统中以集中方式实现,或者由分布在几个互连的计算机系统中的不同部分以分散方式实现。任何可以实现本发明方法的计算机系统或其它设备都是可适用的。常用软硬件的结合可以是安装有计算机程序的通用计算机系统,通过安装和执行程序控制计算机系统,使其按本发明方法运行。
本发明还可以通过计算机程序产品进行实施,程序包含能够实现本发明方法的全部特征,当其安装到计算机系统中时,可以实现本发明的方法。本文件中的计算机程序所指的是:可以采用任何程序语言、代码或符号编写的一组指令的任何表达式,该指令组使系统具有信息处理能力,以直接实现特定功能,或在进行下述一个或两个步骤之后实现特定功能:a)转换成其它语言、编码或 符号;b)以不同的格式再现。
虽然本发明是通过具体实施例进行说明的,本领域技术人员应当明白,在不脱离本发明范围的情况下,还可以对本发明进行各种变换及等同替代。另外,针对特定情形或材料,可以对本发明做各种修改,而不脱离本发明的范围。因此,本发明不局限于所公开的具体实施例,而应当包括落入本发明权利要求范围内的全部实施方式。
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。

Claims (18)

  1. 一种在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其特征在于,包括:
    S1、客户端节点发现多个P2P节点并逐一询问每个P2P节点的关键参数,并选择一个P2P节点进行会话通信;
    S2、所述客户端节点生成第一随机nonce,并计算工作量证明直至所述工作证明满足会话保活难度,然后生成会话工作量证明消息发送给选择的P2P节点;
    S3、所述选择的P2P节点验证所述工作量证明,并在验证通过时允许所述客户端节点进行数据通信。
  2. 根据权利要求1所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其特征在于,所述步骤S1进一步包括:
    S11、为每个P2P节点配置关键参数,所述关键参数包括:会话超时时间、会话保活难度、提交工作量证明函数;
    S12、所述客户端节点根据DHT算法发现多个P2P节点,并询问每个P2P节点的所述关键参数;
    S13、所述客户端节点选择一个P2P节点建立会话,选择的P2P节点返回会话初始化信息,所述会话初始化信息包括:会话ID、工作量证明初始hash值、会话超时时间、会话保活难度、提交工作量证明函数。
  3. 根据权利要求2所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其特征在于,所述步骤S2进一步包括:
    S21、所述客户端节点基于所述工作量证明初始hash值不停地生成第一随机nonce,并基于所述会话ID、所述工作量证明初始hash值和所述第一随机nonce,采用所述提交工作量证明函数计算所述工作量证明;
    S22、重复步骤S21直至获得的所述工作量证明的前导0满足所述会话保活难度;
    S23、基于所述工作量证明生成会话工作量证明消息并发送给所述选择的 P2P节点,所述会话工作量证明消息包括:所述会话ID、所述工作量证明初始hash值、所述第一随机nonce和所述工作量证明。
  4. 根据权利要求3所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其特征在于,所述步骤S3进一步包括:
    S31、所述选择的P2P节点验证所述会话工作量证明消息中的所述工作量证明,如果验证通过则执行步骤S32,否则拒绝与所述客户端节点进行数据通信;
    S32、所述选择的P2P节点向所述客户端节点发送会话建立成功消息,所述客户端节点基于所述会话建立成功消息与所述选择的P2P节点进行数据通信。
  5. 根据权利要求4所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其特征在于,在所述步骤S32中,所述会话建立成功消息包括:会话ID、下次会话超时时间、下次提交工作量证明的hash值。
  6. 根据权利要求5所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其特征在于,所述步骤S32进一步包括:
    S321、所述客户端节点与所述选择的P2P节点进行数据通信,并根据所述下次提交工作量证明的hash值不停地生成第二随机nonce,并基于所述会话ID、所述下次提交工作量证明的hash值和所述第二随机nonce根据所述提交工作量证明函数计算下次工作量证明;
    S322、重复步骤S321直至获得的所述下次工作量证明的前导0满足所述会话保活难度;
    S323、在所述下次会话超时时间之前基于所述下次工作量证明生成下次会话工作量证明消息并发送给所述选择的P2P节点,所述下次会话工作量证明消息包括:所述会话ID、所述下次提交工作量证明的hash值、所述第二随机nonce和所述下次工作量证明;
    S324、所述选择的P2P节点验证所述下次会话工作量证明消息中的所述下次工作量证明,如果验证通过则执行步骤S325,否则拒绝与所述客户端节点进行数据通信;
    S325、判断数据通信是否结束,如果是断开所述选择的P2P节点与所述客户端节点的连接,否则返回步骤S31。
  7. 根据权利要求6所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其特征在于,在所述步骤S325中,所述选择的P2P节点发送会话结束消息给所述客户端节点以断开所述选择的P2P节点与所述客户端节点的连接。
  8. 根据权利要求6所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法,其特征在于,在所述步骤S325中,所述客户端节点发送会话结束消息给所述客户端节点以断开所述选择的P2P节点与所述客户端节点的连接。
  9. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现根据权利要求1-8中任意一项权利要求所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法。
  10. 一种P2P网络,包括客户端节点和多个P2P节点,所述客户端节点和/或所述P2P节点上存储有计算机程序,其特征在于,所述程序被处理器执行时实现根据权利要求1-8中任意一项权利要求所述的在P2P网络中避免客户端节点长时间无效占用连接资源的方法。
  11. 一种引导P2P网络中客户端节点合理选择节点带宽的方法,其特征在于,包括:
    S1、为P2P网络中的服务器节点分别配置业务类型和工作量证明要求;
    S2、客户端节点发现服务器节点并获取每个发现的服务器节点的业务类型、工作量证明要求以及工作量证明参数,所述工作量证明参数包括:通用唯一识别码、工作量证明初始hash值、会话保活难度、提交工作量证明函数;
    S3、所述客户端节点根据自身业务类型选择服务器节点并根据所述工作量证明参数生成工作量证明,然后提交所述工作量证明并发送会话要求到所述服务器节点;
    S4、所述服务器节点验证所述工作量证明并基于验证结果判断是否与所述客户端节点建立连接;
    所述步骤S3进一步包括:
    S31、所述客户端节点根据自身的业务类型选择至少一个服务器节点,并基于所述服务器节点的工作量证明初始hash值不停地生成第一随机nonce,并基于所述通用唯一识别码、所述工作量证明初始hash值和所述第一随机nonce,采用所述提交工作量证明函数计算所述工作量证明;
    S32、重复步骤S31直至获得的所述工作量证明的前导0满足所述会话保活难度;
    S33、将所述通用唯一识别码、所述工作量证明初始hash值、所述第一随机nonce和所述工作量证明提交到所述服务器节点,并提交会话请求给所述服务器节点。
  12. 根据权利要求11所述的引导P2P网络中客户端节点合理选择节点带宽的方法,其特征在于,所述业务类型包括会话业务类型和通信业务类型,所述工作量证明要求包括会话工作量证明要求和通信工作量证明要求。
  13. 根据权利要求12所述的引导P2P网络中客户端节点合理选择节点带宽的方法,其特征在于,所述步骤S1包括:
    S11、为P2P网络中的部分服务器节点配置会话业务类型和会话工作量证明要求;
    S12、为P2P网络中的部分服务器节点配置通信业务类型和通信工作量证明要求。
  14. 根据权利要求13所述的引导P2P网络中客户端节点合理选择节点带宽的方法,其特征在于,所述步骤S2进一步包括:所述客户端节点根据DHT算法发现多个服务器节点,并获取发现的每个服务器节点的业务类型、工作量证明和工作量证明参数。
  15. 根据权利要求11所述的引导P2P网络中客户端节点合理选择节点带宽的方法,其特征在于,所述步骤S4进一步包括:
    S41、所述服务器节点验证所述工作量证明并基于验证结果判断是否与所述客户端节点建立连接,如果是执行步骤S42,否则拒绝与所述客户端节点建立连接;
    S42、所述服务器节点返回会话建立成功消息给所述客户端节点,所述会话建立成功消息包括:会话ID、会话超时时间、下次提交工作量证明的hash值;
    S43、所述客户端节点与所述服务器节点进行数据通信,并根据所述下次提交工作量证明的hash值不停地生成第二随机nonce,并基于所述会话ID、所述下次提交工作量证明的hash值和所述第二随机nonce根据所述提交工作量证明函数计算下次工作量证明;
    S44、重复步骤S43直至获得的所述下次工作量证明的前导0满足所述会话保活难度;
    S45、在所述会话超时时间之前基于所述下次工作量证明生成下次会话工作量证明消息并发送给所述服务器节点,所述下次会话工作量证明消息包括:所述会话ID、所述下次提交工作量证明的hash值、所述第二随机nonce和所述下次工作量证明;
    S46、所述服务器节点验证所述下次工作量证明,并基于验证结果和会话进行情况判定是否继续与所述客户端节点进行通信。
  16. 根据权利要求15所述的引导P2P网络中客户端节点合理选择节点带宽的方法,其特征在于,所述步骤S46进一步包括:
    S461、所述服务器节点验证所述下次工作量证明,如果验证通过则执行步骤S462,否则中断与所述客户端进行数据通信并返回拒绝通信的通知;
    S462、判断所述数据通信是否结束,如果是断开所述服务器节点与所述客户端的连接并返回通信结束的通知,否则返回步骤S43。
  17. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现根据权利要求11-16中任意一项权利要求所述的引导P2P网络中客户端节点合理选择节点带宽的方法。
  18. 一种P2P网络,包括客户端节点和服务器节点,所述客户端节点和服务器节点上存储有计算机程序,其特征在于,所述程序被处理器执行时实现根据权利要求11-16中任意一项权利要求所述的引导P2P网络中客户端节点合理选择节点带宽的方法。
PCT/CN2021/073099 2020-03-06 2021-01-21 在p2p网络中避免客户端节点长时间无效占用连接资源和引导客户端节点合理选择节点带宽 WO2021175036A1 (zh)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202010154981.0 2020-03-06
CN202010155205.2A CN111541732B (zh) 2020-03-06 2020-03-06 在p2p网络中避免客户端无效占用连接资源的方法、计算机可读存储介质和p2p网络
CN202010155205.2 2020-03-06
CN202010154981.0A CN111555900B (zh) 2020-03-06 2020-03-06 引导p2p网络中客户端节点合理选择节点带宽的方法、计算机可读存储介质和p2p网络

Publications (1)

Publication Number Publication Date
WO2021175036A1 true WO2021175036A1 (zh) 2021-09-10

Family

ID=77614325

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/073099 WO2021175036A1 (zh) 2020-03-06 2021-01-21 在p2p网络中避免客户端节点长时间无效占用连接资源和引导客户端节点合理选择节点带宽

Country Status (1)

Country Link
WO (1) WO2021175036A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107688733A (zh) * 2017-07-25 2018-02-13 上海壹账通金融科技有限公司 业务接口调用方法、装置、用户终端和可读存储介质
CN110178340A (zh) * 2018-12-13 2019-08-27 阿里巴巴集团控股有限公司 在分布式系统中进行网络节点的恢复处理
US20190279172A1 (en) * 2018-03-06 2019-09-12 Dash Core Group, Inc. Methods and Systems for Object Validated Blockchain Accounts
CN111541732A (zh) * 2020-03-06 2020-08-14 杜晓楠 在p2p网络中避免客户端无效占用连接资源的方法、计算机可读存储介质和p2p网络
CN111555900A (zh) * 2020-03-06 2020-08-18 杜晓楠 引导p2p网络中客户端节点合理选择节点带宽的方法、计算机可读存储介质和p2p网络

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107688733A (zh) * 2017-07-25 2018-02-13 上海壹账通金融科技有限公司 业务接口调用方法、装置、用户终端和可读存储介质
US20190279172A1 (en) * 2018-03-06 2019-09-12 Dash Core Group, Inc. Methods and Systems for Object Validated Blockchain Accounts
CN110178340A (zh) * 2018-12-13 2019-08-27 阿里巴巴集团控股有限公司 在分布式系统中进行网络节点的恢复处理
CN111541732A (zh) * 2020-03-06 2020-08-14 杜晓楠 在p2p网络中避免客户端无效占用连接资源的方法、计算机可读存储介质和p2p网络
CN111555900A (zh) * 2020-03-06 2020-08-18 杜晓楠 引导p2p网络中客户端节点合理选择节点带宽的方法、计算机可读存储介质和p2p网络

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YIN LIE, XIANG CUI, BINXING FANG, LONGHAO YI, FANGJIAO ZHANG: "A Pollution-resilient Hybrid P2P Botnet", JOURNAL OF CYBER SECURITY, INSTITUTE OF INFORMATION ENGINEERING, CHINESE ACADEMY OF SCIENCES; CHINA SCIENCE AND TECHNOLOGY, CN, vol. 3, no. 1, 1 January 2018 (2018-01-01), CN, pages 68 - 82, XP055843062, ISSN: 2096-1146, DOI: 10.19363/j.cnki.cn10-1380/tn.2018.01.005 *

Similar Documents

Publication Publication Date Title
JP6014297B2 (ja) 異なる端末のアプリケーション間の通信
KR101560601B1 (ko) Stun을 사용하여 생성된 세션의 정책 서비스 시스템 아키텍처
WO2023000935A1 (zh) 一种数据处理方法、网元设备以及可读存储介质
JP2005158068A (ja) P2pプロトコルを用いてアプリケーションを共有する方法及び装置
WO2023000940A1 (zh) 数据处理方法、装置、网元设备、存储介质及程序产品
CN107528891B (zh) 一种基于WebSocket的自动集群方法及其系统
US10979360B2 (en) Resource obtaining method and apparatus
EP3095229B1 (en) Method and nodes for configuring a communication path for a media service
US20070053363A1 (en) Method of providing reliable transmission quality of service in a communication network
WO2023000936A1 (zh) 一种数据处理方法、网元设备以及可读存储介质
EP1902570B1 (en) System and method for providing registration-coupled subscriptions in a session initiation protocol (sip) environment
WO2009076840A1 (zh) 一种实现媒体协商的方法、系统和装置
WO2014183657A1 (zh) 一种确定下一跳、发布路由信息的方法和装置
JP2012529190A (ja) マルチキャスティングの要求、マルチキャスティング要求の処理、および前記プロセスの補助のための、方法およびデバイス
CN111555900B (zh) 引导p2p网络中客户端节点合理选择节点带宽的方法、计算机可读存储介质和p2p网络
CN111541732B (zh) 在p2p网络中避免客户端无效占用连接资源的方法、计算机可读存储介质和p2p网络
WO2021175036A1 (zh) 在p2p网络中避免客户端节点长时间无效占用连接资源和引导客户端节点合理选择节点带宽
WO2012100560A1 (zh) 一种实现会话中数据迁移的方法和节点
CN114025005B (zh) 一种数据通讯方法、系统、电子设备及存储介质
US10382274B2 (en) System and method for wide area zero-configuration network auto configuration
Prnjat et al. Policy-based management for ALAN-enabled networks
WO2022135207A1 (zh) 能力协商的方法、装置、系统及存储介质
US20220400229A1 (en) Conference creation method, terminal, server end, and storage medium
US8627505B2 (en) Technique for controlling access by a client entity to a service
CN115103004A (zh) 一种会话建立方法、装置、设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21764964

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21764964

Country of ref document: EP

Kind code of ref document: A1