CN115225646A - P2P node recommendation method, terminal, medium and computer equipment - Google Patents

P2P node recommendation method, terminal, medium and computer equipment Download PDF

Info

Publication number
CN115225646A
CN115225646A CN202110430245.8A CN202110430245A CN115225646A CN 115225646 A CN115225646 A CN 115225646A CN 202110430245 A CN202110430245 A CN 202110430245A CN 115225646 A CN115225646 A CN 115225646A
Authority
CN
China
Prior art keywords
node
target
nat type
server
address
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110430245.8A
Other languages
Chinese (zh)
Inventor
李超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
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
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN202110430245.8A priority Critical patent/CN115225646A/en
Publication of CN115225646A publication Critical patent/CN115225646A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a P2P node recommendation method, a terminal, a medium and computer equipment, wherein the method comprises the following steps: aiming at any target node, detecting the NAT type of the target node based on a detection period to obtain an NAT type detection result; reporting the NAT type detection result to a node recommendation server; the node recommendation server recommends a node alternative set for the target node based on the NAT type, wherein at least one alternative node capable of successfully punching holes with the target node is stored in the node alternative set; therefore, the target node firstly periodically detects the NAT type of the target node, the node recommendation server can delete the nodes which cannot be successfully punched with the target node from the node alternative set according to the NAT type of the target node, and at least one alternative node which can be successfully punched with the target node is stored in the node alternative set; when punching, the situation of failure of punching can be avoided, the success rate of punching of the node is ensured, and the sharing rate of the system is further improved.

Description

P2P node recommendation method, terminal, medium and computer equipment
Technical Field
The invention belongs to the technical field of peer-to-peer communication, and particularly relates to a P2P node recommendation method, a terminal, a medium and computer equipment.
Background
In the field of Content Delivery Networks (CDN), especially in scenes of mass data such as live audio and video broadcasts, on demand, etc., peer-to-Peer (P2P) technology is used to greatly reduce the bandwidth cost of a server.
The P2P technology refers to an available resource object as a P2P node, and can distribute data using a P2P node bandwidth. The more sufficient the data sharing among the nodes is, the higher the sharing rate of the P2P is, and the higher the bandwidth cost reduction amplitude of the server is; therefore, the P2P sharing rate is an important index for measuring a P2P system. The interoperability and the punching success rate of the nodes are key factors influencing the P2P sharing rate, and if the P2P nodes are not communicated, the punching fails, and the data sharing is not mentioned.
In the related technology, when P2P node punching is carried out, the NAT type of the node is not considered or cannot be effectively detected; especially for web end nodes, there is no corresponding NAT type probing scheme at all. Therefore, when holes are punched, as some node types can not be punched successfully at all, the punching efficiency of the nodes is seriously influenced, and the integral sharing rate of the whole P2P system is further influenced.
Disclosure of Invention
Aiming at the problems in the prior art, the embodiment of the invention provides a P2P node recommendation method, a terminal, a medium and computer equipment, which are used for solving the problems that in the prior art, when P2P node punching is carried out, the node punching efficiency is seriously influenced because the NAT type of a node to be punched cannot be obtained, and further the integral sharing rate of the whole P2P system cannot be ensured.
In a first aspect, the present invention provides a method for recommending a P2P node, where the method is applied in a webRTC terminal, and the method includes:
aiming at any target node, detecting the NAT type of the target node on the basis of a detection period to obtain an NAT type detection result;
reporting the NAT type detection result to a node recommendation server; and recommending a node alternative set for the target node based on the NAT type of the target node by the node recommending server, wherein at least one alternative node which can successfully punch a hole with the target node is stored in the node alternative set.
Optionally, the detecting the NAT type based on the detection period includes:
creating a target object for acquiring the external network address of the target node; the target object is configured with a corresponding target server, and the target object comprises: a first object and a second object; the target server includes: a first server and a second server;
in each detection period, acquiring attribute information of an address candidate by using the target object and the target server;
if the type of the address candidate is determined to be a server reflection type SRflx based on the attribute information, storing an external network address of the address candidate and a local address corresponding to the external network address into an address set srflxaddrSet;
and judging whether the local address corresponds to at least two external network addresses in the address set, and if the local address corresponds to at least two external network addresses, determining that the NAT type of the local address is a symmetrical type.
Optionally, the obtaining attribute information of the address candidate by using the target object and the target server includes:
when the target object is connected with the target server, calling an information acquisition method createOffer by using the target object, and acquiring a callback function of the information acquisition method;
obtaining SDP information from the callback function, wherein the SDP information carries the address candidate information;
and analyzing the SDP information to obtain the attribute information of the address candidate.
Optionally, the obtaining attribute information of the address candidate by using the target object and the target server includes:
when the target object is connected with the target server, calling an information acquisition method createOffer by using the target object;
acquiring an event iconedicate triggered by the information acquisition method;
and acquiring attribute information of the address candidate from event attribute information corresponding to the event oniccandidate.
Optionally, the reporting the NAT type detection result to the node recommendation server includes:
and reporting the NAT type detection result to the node recommendation server by using heartbeat messages.
Optionally, if it is determined that the local address does not correspond to at least two external network addresses, it is determined that the NAT type of the local address is asymmetric.
Optionally, the method further comprises:
and if the detection of the NAT type per se fails, recommending the NAT type detection result reported by the server to the node as the unknown NAT type.
In a second aspect, the present invention further provides a webRTC terminal, where the web terminal includes:
the detection unit is used for detecting the NAT type of any target node on the basis of a detection period to obtain an NAT type detection result;
a reporting unit, configured to report the NAT type detection result to a node recommendation server; and recommending a node alternative set for the target node based on the NAT type of the target node by the node recommending server, wherein at least one alternative node which can successfully punch a hole with the target node is stored in the node alternative set.
In a third aspect, the invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any of the first aspects.
In a fourth aspect, the invention provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of the first aspects when executing the program.
The embodiment of the invention provides a P2P node recommendation method, a terminal, a medium and computer equipment, wherein the method comprises the following steps: aiming at any target node, detecting the NAT type of the target node on the basis of a detection period to obtain an NAT type detection result; reporting the NAT type detection result to a node recommendation server; the node recommending server can update the NAT type of the target node based on the NAT type detection result, and recommend a node alternative set for the target node based on the NAT type of the target node, wherein at least one alternative node which can be successfully punched with the target node is stored in the node alternative set; therefore, for any target node, the target node firstly periodically detects the NAT type of the target node and reports the NAT type to the node recommendation server in real time, the node recommendation server can update the corresponding node alternative set according to the NAT type of the target node and delete the nodes which cannot be successfully punched with the target node from the node alternative set, so that at least one alternative node which can be successfully punched with the target node is stored in the node alternative set; therefore, when the target node and the alternative nodes in the node alternative set are punched, the situation of punching failure can be avoided, the success rate of punching the nodes is ensured, and the sharing rate of the whole P2P system is further improved.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic diagram of a P2P network structure corresponding to a live broadcast platform according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a P2P node recommendation method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a webRTC terminal according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer storage medium according to an embodiment of the present invention.
Detailed Description
The invention provides a P2P node recommendation method, a terminal, a medium and a computer device, and aims to solve the technical problems that when P2P node punching is carried out, the NAT type of a node to be punched cannot be known, the node punching efficiency is seriously influenced, and the whole sharing rate of a whole P2P system cannot be ensured.
In order to better understand the technical scheme of the embodiment of the invention, a P2P network system is introduced, and in the P2P network system, each P2P node can obtain service from other P2P nodes and can also provide service for other P2P nodes, so that rich resources of a terminal can be fully utilized, and the problems of overlarge pressure, single failure point and the like of a server end in the traditional architecture can be greatly relieved. The P2P network system mainly includes three topologies: ring structures, tree structures, and mesh structures. In different application scenes, the corresponding role of each user in the system is different.
In practical applications, it is often the case that a P2P node is located behind a Network Address Translation (NAT) gateway device, and therefore Network communication between nodes is obstructed by the NAT gateway device. The main reason why NAT hinders P2P communication by hosts is that NAT does not allow an extranet host to actively access an intranet host, but P2P technology requires both communication parties to actively initiate access, so a new solution, such as hole punching, must be adopted to perform effective P2P communication in NAT network environment. The hole punching is understood to mean that two P2P nodes which are both located behind the NAT gateway device want to punch a hole on their NAT gateway, so as to realize network communication between the two P2P nodes.
For example, if the P2P network is a ring structure in the audio/video live broadcast platform, referring to fig. 1, the anchor a may be a node in the P2P network system, and each of the audience nodes B1, B2, B3, etc. may also be a node in the P2P network system. If the anchor terminal and the audience terminal B1 are both located behind the NAT gateway device, the anchor terminal A needs to make a hole with the audience terminal B1 if the anchor terminal A wants to realize the communication with the audience terminal B1.
When any target node in the embodiment of the invention performs hole punching with the alternative nodes in the node alternative set, the alternative nodes are the nodes screened by the node recommendation server according to the NAT type, so that the success rate of node hole punching can be ensured, the delay caused by hole punching failure can be avoided, and the sharing rate of the whole P2P system is further improved. For example, in a live broadcast wheat-connecting scene, if the anchor terminal is a target node, the anchor terminal can make a hole with the alternative node through selection, and after the hole is made successfully, the anchor terminal can directly make an audio/video call with the alternative node without forwarding audio/video streaming data through a live broadcast server, so that the audio/video communication efficiency of the anchor terminal and audience terminals can be improved.
The technical solution of the present invention is further described in detail by the accompanying drawings and the specific embodiments.
The embodiment provides a P2P node recommendation method applied to a webRTC terminal, as shown in fig. 2, the method mainly includes the following steps:
s210, aiming at any target node, detecting the NAT type of the target node on the basis of a detection period to obtain an NAT type detection result;
here, if the P2P node performs hole punching, the hole punching success rate is low if the NAT type of the P2P node is not suitable for the NAT type of the candidate node. Such as: for a P2P node with a symmetric NAT type, if the NAT type of the candidate node is also a symmetric NAT type, the hole punching success rate between the two nodes is almost zero. In this embodiment, in order to avoid delay caused by a hole punching failure, a hole punching success rate is increased, and then a data sharing rate of the P2P network system is increased, and for any target node, the NAT type of the target node is detected based on a detection period, and an NAT type detection result is obtained. The target node is any P2P node in the P2P network.
In this embodiment, it is considered that, because the NAT type of the target node is always in a changing state in the communication process, the target node may detect the NAT type of the target node in real time based on a preset detection period, so as to ensure the detection accuracy of the NAT type. Wherein the preset detection period can be 3-5 min.
Here, since the target node is a webRTC terminal, it cannot be performed in a conventional NAT type detection manner, and therefore, in the embodiment of the present invention, the target node detects its own NAT type based on a detection period, including:
creating a target object for acquiring the external network address of the target node; the target object is configured with a corresponding target server, and the target object comprises: a first object pcA and a second object pcB, the target server comprising: a first server STUNA and a second server STUNB; the first server and the second server have different addresses;
here, since the target node generally has a web interface for communicating with the outside, the target object created as described above may also be understood as an object of the RTCPeerConnection interface (web interface), and the target object may interact with the external device through the RTCPeerConnection interface.
Then, in each detection period, acquiring attribute information of an address candidate by using the target server of the target object;
if the type of the address candidate is determined to be the server reflection type SRflx based on the attribute information of the address candidate, storing the external network address of the address candidate and the local address corresponding to the external network address into an address set srflxaddrSet; the local address is a local IP address and a port;
and judging whether the local address corresponds to at least two external network addresses or not in the address set, and if the local address corresponds to the at least two external network addresses, determining that the NAT type of the local address is a symmetrical type.
For example, if the target node has a network card, the target node has a local address. One local address may correspond to one external network address or a plurality of external network addresses. In this embodiment, when storing the external network address of the address candidate and the local address corresponding to the external network address, the address candidate is stored in the form of a map, where a key in the map is the local address and a value is the external network address, that is, one key may correspond to one value or multiple values.
And if the local address corresponds to two or more external network addresses in the address set, determining that the NAT type of the target node is a symmetrical type. Similarly, if the local address does not correspond to at least two external network addresses, that is, only one external network address, it is determined that the NAT type of the target node is asymmetric, for example, port-restricted.
In the embodiment of the present invention, acquiring attribute information of an address candidate by using a target object and a target server includes:
when the target object is connected with the target server, calling an information acquisition method createOffer by using the target object, and acquiring a callback function of the information acquisition method;
obtaining SDP information from the callback function, wherein the SDP information carries address candidate information;
and analyzing the SDP information to obtain the attribute information of the address candidate.
The attribute information of the address candidate carries the type of the address candidate; for example, if the attribute information is host, the address candidate is represented as a local address candidate; if the attribute information is Server Reflexive (SRflx), the address candidate is represented as an external network address candidate; if the attribute information is relay, it represents that the address candidate is a relay address candidate.
Since the address candidate information is obtained when the createOffer method is called, the nocardidate event is triggered to share the address candidate information to other nodes, and the address candidate information may be in event attribute information rtcpeerconnection. Then, the attribute information of the address candidate is obtained by using the target object and the target server, which includes:
when the target object is connected with the target server, calling an information acquisition method createOffer by using the target object;
acquiring an event iconedicate triggered by the information acquisition method;
the attribute information of the address candidate is acquired from event attribute information rtcpeerconnection.
Therefore, even if the target node is a web terminal, the NAT type of the target node can be detected through the NAT type detection method provided by the step, and the node recommendation server can recommend a mismatched alternative node set based on the NAT type, so that the hole punching success rate of the target node and the alternative node can be improved.
S211, reporting the NAT type detection result to a node recommendation server; and recommending a node alternative set for the target node based on the NAT type of the target node by the node recommending server based on the NAT type detection result, wherein at least one alternative node which can be successfully punched with the target node is stored in the node alternative set.
In order to enable the node recommendation server to recommend a suitable node alternative set for target nodes of different NAT types, in this embodiment, a long connection is established between the target node and the node recommendation server, and the target node and the node recommendation server keep alive through heartbeat messages. Therefore, when the target node detects the NAT type of the target node, the NAT type detection result is reported to the node recommendation server through the heartbeat message.
And if the target node does not detect the NAT type of the target node all the time or the NAT type of the target node fails to be detected, recommending the NAT type detection result reported by the server to the node to be the unknown NAT type. In order to improve the punching success rate, the node recommendation server sets the unknown NAT type of the target node as a symmetrical type.
For any target node, after receiving the NAT type detection result of the target node, the node recommendation server records and updates the NAT type of the target node, and recommends a node alternative set for the target node based on the NAT type of the target node, so that at least one alternative node capable of successfully punching holes with the target node is stored in the node alternative set; therefore, the situation that the node candidate set stores the candidate nodes failed in punching with the target node can be avoided.
It is to be noted that, in this embodiment, for nodes whose NAT types are IP-restricted and full-cone, when a hole is made with any alternative node of the NAT type, the hole can be successfully made, so that the present embodiment recommends a node alternative set mainly for target nodes whose NAT types are port-restricted and symmetric.
The node recommendation server recommends a node candidate set for the target node based on the NAT type of the target node, and the node recommendation method comprises the following steps:
if the NAT type of the target node is a symmetrical type, rejecting nodes of which the NAT type is a symmetrical type and a port limiting type from the node alternative set;
and if the NAT type of the target node is the port-restricted type, removing the node with the symmetric NAT type from the node alternative set.
In this step, when the NAT type of the target node is a symmetric type or a port-restricted type, the node recommendation server recommends a suitable node candidate set for the target node, so as to ensure a hole punching success rate between the target node and the candidate node.
In this embodiment, a target node first periodically detects its own NAT type and reports the detected NAT type to a node recommendation server in real time, and the node recommendation server may update a corresponding node candidate set according to the NAT type of the target node, and delete a node that cannot be successfully drilled with the target node from the node candidate set, so that at least one candidate node that can be successfully drilled with the target node is stored in the node candidate set; when the target node and the alternative nodes in the node alternative set are punched, the success rate of punching the node can be ensured, the time delay caused by the failure of punching can be avoided, and the sharing rate of the whole P2P system is further improved.
Based on the same inventive concept of the foregoing embodiment, this embodiment further provides a webRTC terminal, as shown in fig. 3, the terminal includes:
the detection unit 31 is configured to detect, for any target node, the NAT type of the target node based on the detection period, and obtain a detection result of the NAT type;
the reporting unit 32 element is used for reporting the NAT type detection result to the node recommendation server; the node recommending server is used for updating the NAT type of the target node based on the NAT type detection result, and recommending a node alternative set for the target node based on the NAT type of the target node, wherein at least one alternative node which can be successfully punched with the target node is stored in the node alternative set.
If the P2P node is performing hole punching, if the NAT type of the P2P node is not matched with that of the candidate node, the hole punching success rate is low. Such as: for a P2P node with a symmetric NAT type, if the alternative node NAT type is also symmetric, the punching success rate between the two nodes is almost zero. In this embodiment, in order to avoid delay caused by a punching failure, the punching success rate is increased, and then the data sharing rate of the P2P network system is increased, and for any target node, the NAT type of the target node is detected based on the detection period, and the NAT type detection result is obtained. The target node is any P2P node in the P2P network.
In this embodiment, it is considered that, in the communication process of the target node, the NAT type of the target node is always in a changing state, and therefore the target node may detect the NAT type of the target node in real time based on a preset detection period, so as to ensure the detection accuracy of the NAT type. Wherein the preset detection period can be 3-5 min.
Here, since the target node is a webRTC terminal, it cannot be performed by a conventional NAT type detection method, and therefore the detecting unit 31 in the embodiment of the present invention is specifically configured to:
creating a target object for acquiring the external network address of the target node; the target object is configured with a corresponding target server, and the target object comprises: a first object pcA and a second object pcB, the target server comprising: a first server STUNA and a second server STUNB; the first server and the second server have different addresses;
here, since the target node generally has a web interface for communicating with the outside, the target object created as described above may also be understood as an object of the RTCPeerConnection interface (web interface), and the target object may interact with the external device through the RTCPeerConnection interface.
Then, in each detection period, acquiring attribute information of an address candidate by using the target server of the target object;
if the type of the address candidate is determined to be the server reflection type SRflx based on the attribute information of the address candidate, storing the external network address of the address candidate and the local address corresponding to the external network address into an address set srflxAddrSet; the local address is a local IP address and a port;
and judging whether the local address corresponds to at least two external network addresses in the address set, and if the local address corresponds to at least two external network addresses, determining that the NAT type of the local address is symmetrical.
For example, if the target node has a network card, the target node has a local address. One local address may correspond to one external network address or a plurality of external network addresses. In this embodiment, when storing the external network address of the address candidate and the local address corresponding to the external network address, the address candidate is stored in the form of a map, where a key in the map is the local address and a value is the external network address, that is, one key may correspond to one value or may correspond to multiple values.
And if the local address corresponds to two or more external network addresses in the address set, determining that the NAT type of the target node is a symmetrical type. Similarly, if the local address does not correspond to at least two external network addresses, that is, only one external network address, it is determined that the NAT type of the target node is asymmetric, for example, port-restricted.
In the embodiment of the present invention, acquiring attribute information of candidate address by using a target object and a target server includes:
when the target object is connected with the target server, calling an information acquisition method createOffer by using the target object, and acquiring a callback function of the information acquisition method;
obtaining SDP information from the callback function, wherein the SDP information carries address candidate information;
and analyzing the SDP information to obtain the attribute information of the address candidate.
The attribute information of the address candidate carries the type of the address candidate; for example, if the attribute information is host, the address candidate is represented as a local address candidate; if the attribute information is Server Reflexive (SRflx), the address candidate is represented as an external network address candidate; if the attribute information is relay, it represents that the address candidate is a relay address candidate.
Since the address candidate information is obtained when the createOffer method is called, the nocardidate event is triggered to share the address candidate information to other nodes, and the address candidate information may be in event attribute information rtcpeerconnection. Then, the attribute information of the address candidate is obtained by using the target object and the target server, which includes:
when the target object is connected with the target server, calling an information acquisition method createOffer by using the target object;
acquiring an event iconedicate triggered by the information acquisition method;
attribute information of an address candidate is acquired from event attribute information rtcpeerconnection.
Therefore, even if the target node is a web terminal, the NAT type of the target node can be detected through the NAT type detection method provided by the step, and the node recommendation server can recommend a mismatched alternative node set based on the NAT type, so that the hole punching success rate of the target node and the alternative node can be improved.
In order to enable the node recommendation server to recommend a suitable node alternative set for target nodes of different NAT types, in this embodiment, a long connection is established between the target node and the node recommendation server, and the target node and the node recommendation server keep alive through heartbeat messages. In this way, when the target node detects its own NAT type, the reporting unit 32 reports the NAT type detection result to the node recommendation server through the heartbeat message.
If the target node has not detected its own NAT type, or the detection of its own NAT type fails, the reporting unit 32 recommends to the node that the NAT type detection result reported by the server is an unknown NAT type. In order to improve the punching success rate, the node recommendation server sets the unknown NAT type of the target node as a symmetrical type.
For any target node, after receiving the NAT type detection result of the target node, the node recommendation server records and updates the NAT type of the target node, and recommends a node alternative set for the target node based on the NAT type of the target node, so that at least one alternative node capable of successfully punching holes with the target node is stored in the node alternative set; therefore, the situation that the node candidate set stores the candidate nodes failed in punching with the target node can be avoided.
It is to be noted that, in this embodiment, for nodes whose NAT types are IP-restricted and full-cone, when a hole is made with any alternative node of the NAT type, the hole can be successfully made, so that the present embodiment recommends a node alternative set mainly for target nodes whose NAT types are port-restricted and symmetric.
The node recommendation server recommends a node candidate set for the target node based on the NAT type of the target node, and the node recommendation method comprises the following steps:
if the NAT type of the target node is a symmetrical type, rejecting nodes of which the NAT type is a symmetrical type and a port limiting type from the node alternative set;
and if the NAT type of the target node is the port-restricted type, removing the node with the symmetric NAT type from the node alternative set.
In this step, when the NAT type of the target node is a symmetric type or a port-restricted type, the node recommendation server recommends a suitable node candidate set for the target node, thereby ensuring the punching success rate between the target node and the candidate node.
The P2P node recommendation method, the terminal, the medium and the computer equipment provided by the embodiment of the invention have at least the following beneficial effects:
the embodiment of the invention provides a P2P node recommendation method, a terminal, a medium and computer equipment, wherein the method comprises the following steps: aiming at any target node, detecting the NAT type of the target node on the basis of a detection period to obtain an NAT type detection result; reporting the NAT type detection result to the node recommendation server; the node recommending server can update the NAT type of the target node based on the NAT type detection result, and recommend a node alternative set for the target node based on the NAT type of the target node, wherein at least one alternative node which can be successfully punched with the target node is stored in the node alternative set; therefore, for any target node, the target node firstly periodically detects the NAT type of the target node and reports the NAT type to the node recommendation server in real time, the node recommendation server can update a corresponding node alternative set according to the NAT type of the target node, and the nodes which cannot be successfully punched with the target node are deleted from the node alternative set, so that at least one alternative node which can be successfully punched with the target node is stored in the node alternative set; when the target node and the alternative nodes in the node alternative set are punched, the success rate of punching the node can be ensured, the time delay caused by the failure of punching can be avoided, and the sharing rate of the whole P2P system is further improved.
Based on the same inventive concept as the previous embodiment, the present embodiment provides a computer apparatus, as shown in fig. 4, including a memory 410, a processor 420, and a computer program 411 stored on the memory 410 and operable on the processor 420, wherein the processor 420 implements the following steps when executing the computer program 411:
aiming at any target node, detecting the NAT type of the target node on the basis of a detection period to obtain an NAT type detection result;
reporting the NAT type detection result to a node recommendation server; and recommending a node alternative set for the target node based on the NAT type of the target node by the node recommending server based on the NAT type detection result, wherein at least one alternative node which can be successfully punched with the target node is stored in the node alternative set.
In a specific implementation, when the process 420 executes the computer program 411, any one of the first embodiment may be implemented.
Since the computer device described in this embodiment is a device used for implementing the method for recommending a P2P node in the foregoing embodiment of the present invention, based on the method described in the foregoing embodiment of the present invention, a person skilled in the art can understand a specific implementation manner of the computer device in this embodiment and various variations thereof, and therefore, a detailed description of how the server implements the method in the embodiment of the present invention is not provided here. The equipment used by those skilled in the art to implement the method in the embodiments of the present invention is within the scope of the present invention.
Based on the same inventive concept as the previous embodiment, the present embodiment provides a computer-readable storage medium 500, as shown in fig. 5, on which a computer program 511 is stored, the computer program 511 implementing the following steps when being executed by a processor:
aiming at any target node, detecting the NAT type of the target node on the basis of a detection period to obtain an NAT type detection result;
reporting the NAT type detection result to a node recommendation server; and recommending a node alternative set for the target node based on the NAT type of the target node, wherein at least one alternative node capable of successfully punching the hole with the target node is stored in the node alternative set.
In a specific implementation, the computer program 511 may implement any of the above embodiments when executed by a processor.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
The above description is only exemplary of the present invention and should not be taken as limiting the scope of the present invention, and any modifications, equivalents, improvements, etc. that are within the spirit and principle of the present invention should be included in the present invention.

Claims (10)

1. A P2P node recommendation method is applied to a webRTC terminal, and the method comprises the following steps:
aiming at any target node, detecting the NAT type of the target node based on a detection period to obtain an NAT type detection result;
reporting the NAT type detection result to a node recommendation server; and recommending a node alternative set for the target node based on the NAT type of the target node by the node recommending server, wherein at least one alternative node which can successfully punch a hole with the target node is stored in the node alternative set.
2. The method of claim 1, wherein the probing for the NAT type of itself based on the probing period comprises:
creating a target object for acquiring the external network address of the target node; the target object is configured with a corresponding target server, and the target object comprises: a first object and a second object; the target server includes: a first server and a second server;
in each detection period, acquiring attribute information of an address candidate by using the target object and the target server;
if the type of the address candidate is determined to be the server reflection type SRflx based on the attribute information, storing the external network address of the address candidate and the local address corresponding to the external network address into an address set srflxAddrSet;
and judging whether the local address corresponds to at least two external network addresses in the address set, and if the local address corresponds to at least two external network addresses, determining that the NAT type of the local address is a symmetrical type.
3. The method as claimed in claim 2, wherein the obtaining attribute information of the address candidate using the target object and the target server comprises:
when the target object is connected with the target server, calling an information acquisition method createOffer by using the target object, and acquiring a callback function of the information acquisition method;
obtaining SDP information from the callback function, wherein the SDP information carries the address candidate information;
and analyzing the SDP information to obtain the attribute information of the address candidate.
4. The method as claimed in claim 2, wherein the obtaining attribute information of the address candidate using the target object and the target server comprises:
when the target object is connected with the target server, calling an information acquisition method createOffer by using the target object;
acquiring event oniccandidate triggered by the information acquisition method;
and acquiring attribute information of the address candidate from event attribute information corresponding to the event oniccandidate.
5. The method of claim 1, wherein reporting the NAT type probe result to a node recommendation server comprises:
and reporting the NAT type detection result to the node recommendation server by using a heartbeat message.
6. The method of claim 2, wherein if it is determined that the local address does not correspond to at least two external network addresses, determining that the NAT type is asymmetric.
7. The method of claim 2, wherein the method further comprises:
and if the detection of the NAT type per se fails, recommending the NAT type detection result reported by the server to the node as the unknown NAT type.
8. A webRTC terminal, the web terminal comprising:
the detection unit is used for detecting the NAT type of any target node on the basis of a detection period to obtain an NAT type detection result;
a reporting unit, configured to report the NAT type detection result to a node recommendation server; and recommending a node alternative set for the target node based on the NAT type of the target node by the node recommending server, wherein at least one alternative node which can successfully punch a hole with the target node is stored in the node alternative set.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 7 when executing the program.
CN202110430245.8A 2021-04-21 2021-04-21 P2P node recommendation method, terminal, medium and computer equipment Pending CN115225646A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110430245.8A CN115225646A (en) 2021-04-21 2021-04-21 P2P node recommendation method, terminal, medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110430245.8A CN115225646A (en) 2021-04-21 2021-04-21 P2P node recommendation method, terminal, medium and computer equipment

Publications (1)

Publication Number Publication Date
CN115225646A true CN115225646A (en) 2022-10-21

Family

ID=83605594

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110430245.8A Pending CN115225646A (en) 2021-04-21 2021-04-21 P2P node recommendation method, terminal, medium and computer equipment

Country Status (1)

Country Link
CN (1) CN115225646A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546105A (en) * 2011-12-28 2012-07-04 深圳市新为软件有限公司 Method and device for network resource transmission
CN102685268A (en) * 2012-05-22 2012-09-19 北京邮电大学 Fast private network traversal method based on ICE (Information and Content Exchange) protocol in VoIP (Voice over Internet Protocol)
US20150098471A1 (en) * 2011-12-14 2015-04-09 Koninklijke Kpn N.V. Methods and Systems for Enabling NAT Traversal
CN105187567A (en) * 2015-06-24 2015-12-23 东莞市南星电子有限公司 Audio-video communication method based on SIP and ICE
CN107124478A (en) * 2017-04-14 2017-09-01 上海小蚁科技有限公司 Network communication method, device and server
CN112637364A (en) * 2021-01-06 2021-04-09 上海哔哩哔哩科技有限公司 Method, client and system for establishing P2P connection

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150098471A1 (en) * 2011-12-14 2015-04-09 Koninklijke Kpn N.V. Methods and Systems for Enabling NAT Traversal
CN102546105A (en) * 2011-12-28 2012-07-04 深圳市新为软件有限公司 Method and device for network resource transmission
CN102685268A (en) * 2012-05-22 2012-09-19 北京邮电大学 Fast private network traversal method based on ICE (Information and Content Exchange) protocol in VoIP (Voice over Internet Protocol)
CN105187567A (en) * 2015-06-24 2015-12-23 东莞市南星电子有限公司 Audio-video communication method based on SIP and ICE
CN107124478A (en) * 2017-04-14 2017-09-01 上海小蚁科技有限公司 Network communication method, device and server
CN112637364A (en) * 2021-01-06 2021-04-09 上海哔哩哔哩科技有限公司 Method, client and system for establishing P2P connection

Similar Documents

Publication Publication Date Title
US20170169086A1 (en) Method and system for providing a synchronization service
EP1434144A2 (en) Peer-to-peer graphing interfaces and methods
CN108062243B (en) Execution plan generation method, task execution method and device
CN109618176B (en) Processing method, equipment and storage medium for live broadcast service
CN110611691A (en) Message pushing method, system and storage medium
CN107181780B (en) Communication channel processing method and system
CN113032223B (en) Server state detection method and device
CN113727464A (en) Method and device for establishing high-concurrency call of SIP streaming media server
US10498617B1 (en) System, method, and computer program for highly available and scalable application monitoring
CN112491609A (en) System application architecture discovery method and system based on business service
US20230006898A1 (en) A Method of Capturing Packets from a Container in a Cluster
CN110213073B (en) Data flow direction changing method, electronic device, computing node and storage medium
CN111064798B (en) Node network access method, device, client node and storage medium
CN115225646A (en) P2P node recommendation method, terminal, medium and computer equipment
WO2016131249A1 (en) Method and device for grouping contacts
CN109542981B (en) Data synchronization system and method, electronic device and storage medium
CN113810775B (en) Voice and video connection system and method
US20120150969A1 (en) Dynamically enabling user logging across distributed systems
CN107342981B (en) Sensor data transmission method and device and virtual reality head-mounted equipment
US20180352009A1 (en) Apparatus for setting up conference call and method thereof
CN114050960A (en) Distributed server cluster node management method and device
CN109889545B (en) Data communication method and device
CN110474807B (en) Log processing method and device
CN113890950A (en) VOIP terminal network detection method and device and VOIP terminal
CN106331270B (en) Method and device for managing numbers of contact persons

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
AD01 Patent right deemed abandoned

Effective date of abandoning: 20240614

AD01 Patent right deemed abandoned