[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN111131484A - Node mounting method, device, network node and storage medium - Google Patents

Node mounting method, device, network node and storage medium Download PDF

Info

Publication number
CN111131484A
CN111131484A CN201911395901.4A CN201911395901A CN111131484A CN 111131484 A CN111131484 A CN 111131484A CN 201911395901 A CN201911395901 A CN 201911395901A CN 111131484 A CN111131484 A CN 111131484A
Authority
CN
China
Prior art keywords
node
network node
external network
extranet
nodes
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
CN201911395901.4A
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.)
Shenzhen Onething Technology Co Ltd
Original Assignee
Shenzhen Onething 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 Shenzhen Onething Technology Co Ltd filed Critical Shenzhen Onething Technology Co Ltd
Priority to CN201911395901.4A priority Critical patent/CN111131484A/en
Publication of CN111131484A publication Critical patent/CN111131484A/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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management

Landscapes

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

Abstract

A node mounting method comprises the following steps: when the network node is started, judging whether the network node is an intranet node: if the network node is an intranet node, judging whether an alternative extranet node exists in an extranet node configuration list of the network node; if the alternative external network nodes exist in the external network node configuration list of the network node, selecting a first external network node from the alternative external network nodes in the external network node configuration list; mounting the network node on the first external network node. The invention also provides a node mounting device, a network node and a storage medium. The invention can improve the mounting efficiency of the network node.

Description

Node mounting method, device, network node and storage medium
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a node mounting method and apparatus, a network node, and a storage medium.
Background
Currently, in decentralized networks, a P2P peer-to-peer network is formed between network nodes, which requires the network nodes to communicate with each other.
Most network nodes are deployed in the intranet environment of a user, and due to the limitation of a local area network, an extranet node cannot access the intranet node anytime and anywhere, so that the mounting efficiency of the intranet node is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a node mounting method, device, network node and storage medium, which can improve mounting efficiency of the network node.
A first aspect of the present invention provides a node mounting method, where the method includes:
when a network node is started, judging whether the network node is an intranet node or not;
if the network node is an intranet node, judging whether an alternative extranet node exists in an extranet node configuration list of the network node;
if the alternative external network nodes exist in the external network node configuration list of the network node, selecting a first external network node from the alternative external network nodes in the external network node configuration list, wherein the alternative external network nodes in the external network node configuration list are external network nodes which are successfully mounted in history;
mounting the network node on the first external network node.
In one possible implementation, the method further includes:
if the network node fails to mount on the first external network node, selecting a second external network node from the external network node configuration list;
mounting the network node on the second external network node;
and deleting the node information of the first external network node from the external network node configuration list.
In one possible implementation, the method further includes:
sending a first connection request to each alternative external network node in the external network node configuration list every other preset period;
for each alternative external network node, judging whether the network node and the alternative external network node successfully establish connection;
and if the connection between the network node and the alternative external network node fails, deleting the node information of the alternative external network node in the external network node configuration list.
In one possible implementation, the method further includes:
if the network node is successfully mounted on the first external network node, judging whether the number of the alternative external network nodes in the current external network node configuration list reaches a first preset number threshold value;
if the number of the alternative external network nodes in the current external network node configuration list does not reach a first preset number threshold value, detecting the external network nodes in the DHT network;
and if the external network nodes meeting the preset requirements are detected, storing the node information of the external network nodes meeting the preset requirements into the external network node configuration list.
In one possible implementation, the method further includes:
if the alternative external network nodes do not exist in the external network node configuration list of the network node, detecting the external network nodes in the DHT network;
when a target external network node is detected, establishing short connection with the target external network node;
if the short connection is successfully established, inquiring whether the number of the intranet nodes currently mounted by the target extranet node reaches a second preset number threshold;
and if the number of the currently mounted intranet nodes of the target extranet node does not reach a preset number threshold value, mounting the network nodes on the target extranet node.
In one possible implementation, the method further includes:
and storing the node information of the target external network node into the external network node configuration list.
In a possible implementation manner, the determining whether the network node is an intranet node includes:
acquiring an Internet Protocol (IP) address of the network node; judging whether the address type of the IP address is the IP address of a local area network or not, and if the address type of the IP address is the IP address of the local area network, determining that the network node is an intranet node; or
Sending a second connection request to the server; and if the connection between the network node and the server fails, determining that the network node is an intranet node.
A second aspect of the present invention provides a node mounting apparatus, including:
the first judgment module is used for judging whether the network node is an intranet node or not when the network node is started;
the second judgment module is used for judging whether an alternative extranet node exists in an extranet node configuration list of the network node if the network node is an intranet node;
a selection module, configured to select a first external network node from the alternative external network nodes in the external network node configuration list if the alternative external network nodes exist in the external network node configuration list of the network node;
a mounting module, configured to mount the network node on the first external network node.
A third aspect of the invention provides a network node comprising a processor and a memory, the processor being configured to implement the node mounting method when executing a computer program stored in the memory.
A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the node mounting method.
By the above technical solution, in the present invention, when any network node in the DHT network is started, if the network node is an intranet node, the network node may directly select any extranet node (i.e. the first extranet node) from an extranet node configuration list in which alternative extranet nodes are stored, and since the alternative extranet nodes in the extranet node configuration list are all the extranet nodes on which the network node has been successfully mounted in the history, the network node can be quickly and efficiently mounted on any alternative extranet node in the extranet node configuration list, so that the mounting efficiency of the network node can be improved.
Drawings
Fig. 1 is a schematic diagram of a DHT network architecture disclosed in the present invention.
Fig. 2 is a flowchart of a node mounting method according to a preferred embodiment of the present invention.
Fig. 3 is a functional block diagram of a node mounting apparatus according to a preferred embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of a network node according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first" and "second" in the description and claims of the present application and the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order, nor should they be construed to indicate or imply the relative importance thereof or the number of technical features indicated. It will be appreciated that the data so used are interchangeable under appropriate circumstances such that the embodiments described herein are capable of operation in sequences other than those illustrated or otherwise described herein, and that the features defined as "first" and "second" may explicitly or implicitly include at least one such feature.
Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a DHT network architecture according to the disclosure. As shown in fig. 1, the DHT (Distributed Hash Table) network architecture includes a server, a plurality of external network nodes, a router, and a plurality of internal network nodes. It should be noted that the number of the extranet nodes and the intranet nodes shown in fig. 1 is only an example, and the DHT network architecture may include more or less extranet nodes and intranet nodes than those shown in fig. 1, and the present invention is not limited thereto. Wherein, the extranet node and the intranet node both belong to network nodes in a DHT network architecture.
The server is a computer system capable of providing services to other devices (such as an extranet node and an intranet node) in a network. The server stores some information of the external network nodes, such as node identification ID, IP address and port, whether the external network nodes are external network nodes, etc. When a new node needs to join the DHT network, the new node can access the server to acquire some information of the external network nodes, then communicates with the external network nodes according to the information, and then does not need to communicate with the server any more.
The outer network node is not provided with a router, has an outer network IP and can also be an inner network node which is successfully punched.
The intranet nodes are network nodes which are not successful in punching and provided with routers, and are usually mounted in an intranet environment of a user, such as a guest playing cloud, a P2P Content Delivery Network (CDN) client, and the like. Due to the limitation of the local area network, the intranet nodes can directly access the extranet nodes, but the extranet nodes cannot directly access the intranet nodes anytime and anywhere.
In the DHT network, an intranet node can establish a TCP long connection and is connected to an extranet node, and after the intranet node is successfully mounted to the extranet node, the extranet node can communicate with the intranet node at any time and any place.
Referring to fig. 2, fig. 2 is a flowchart illustrating a node mounting method according to a preferred embodiment of the present invention. The order of the steps in the flowchart may be changed, and some steps may be omitted.
And S11, when the network node is started, the network node judges whether the network node is an intranet node, if so, the step S12 is executed, and if not, the process is ended.
In the invention, whether the network node is an intranet node can be judged in various ways.
Specifically, the determining whether the network node is an intranet node includes:
acquiring an Internet Protocol (IP) address of the network node;
judging whether the address type of the IP address is the IP address of a local area network or not;
if the address type of the IP address is the IP address of a local area network, determining that the network node is an intranet node; or the like, or, alternatively,
and if the address type of the IP address is the IP address of the public network, determining that the network node is an external network node.
In this embodiment, typically, the network nodes of the IP address of the local network belong to intranet nodes, while the network nodes of the IP address of the public network belong to extranet nodes.
Specifically, the determining whether the network node is an intranet node includes:
sending a second connection request to the server;
if the connection between the network node and the server fails, determining that the network node is an intranet node; or
And if the network node is successfully connected with the server, determining that the network node is an external network node.
In this embodiment, a server (such as a reverse probe server) is deployed on the extranet. When the network node is started, a second connection request can be sent to the server to request for communication with the server, the server tries to establish a new connection with the network node after receiving the second connection request, and if the connection between the network node and the server fails, the network node is determined to be an intranet node; or, if the network node is successfully connected with the server, determining that the network node is an external network node.
After the network node judges the internal and external network attributes of the network node, the network node carries the internal and external network attribute information when communicating with other network nodes subsequently.
In the invention, because the external network node does not need to be mounted, when the network node judges that the network node is the external network node, the external network node can be directly skipped over.
And S12, the network node judges whether the external network node configuration list of the network node has the alternative external network node, if so, the step S13 is executed, and if not, the process is ended.
In the invention, an extranet node configuration list can be created for each intranet node in advance. If a certain intranet node is started for the first time, the configuration list of the extranet nodes of the intranet node is null, that is, there is no any alternative extranet node, and if a certain intranet node is not started for the first time, at least one alternative extranet node is stored in the configuration list of the extranet nodes of the intranet node. Usually, the alternative extranet nodes in the extranet node configuration list are extranet nodes on which the intranet node is successfully mounted in history.
As an optional implementation, the method further comprises:
if the alternative external network nodes do not exist in the external network node configuration list of the network node, detecting the external network nodes in the DHT network;
when a target external network node is detected, establishing short connection with the target external network node;
if the short connection is successfully established, inquiring whether the number of the intranet nodes currently mounted by the target extranet node reaches a second preset number threshold;
and if the number of the currently mounted intranet nodes of the target extranet node does not reach a preset number threshold value, mounting the network nodes on the target extranet node.
In this embodiment, if there is no alternative external network node in the external network node configuration list of the network node, indicating that the network node is first started, it is necessary to detect the external network node in a distributed Hash table (dht) (distributed Hash table) network. When a target extranet node is detected, the network node tries to establish short connection with the target extranet node, if the short connection is established successfully, whether the number of the intranet nodes currently mounted by the target extranet node reaches a second preset number threshold value or not is inquired, and if the number of the intranet nodes currently mounted by the target extranet node does not reach the preset number threshold value, the number of the intranet nodes currently mounted by the target extranet node is not saturated, and the network node can be mounted on the target extranet node.
As an optional implementation, the method further comprises:
and storing the node information of the target external network node into the external network node configuration list.
In this embodiment, since the network node is first started, and there is no candidate extranet node in the extranet node configuration list, the node information of the target extranet node needs to be stored in the extranet node configuration list, so that the node can be subsequently and quickly mounted.
S13, the network node selects a first external network node from the alternative external network nodes in the external network node configuration list.
In the invention, because the alternative external network nodes in the external network node configuration list are external network nodes which are successfully mounted in history, the network node can directly select the first external network node from the alternative external network nodes in the external network node configuration list.
Optionally, the first external network node may be selected according to the priority from the candidate external network nodes in the external network node configuration list according to the priority order of the node update time. Generally, the closer the node update time is to the current time, the higher the priority of the network node, whereas the farther the node update time is from the current time, the lower the priority of the network node.
S14, the network node mounts the network node on the first external network node.
Specifically, a network node may attempt to establish a TCP long connection with the first external network node to mount the network node on the first external network node. Wherein the network node may be successfully mounted or may be unsuccessfully mounted.
As an optional implementation, the method further comprises:
if the network node fails to mount on the first external network node, selecting a second external network node from the external network node configuration list;
mounting the network node on the second external network node;
and deleting the node information of the first external network node from the external network node configuration list.
In this embodiment, a network node may attempt to establish a TCP long connection with the first external network node multiple times (for example, 3 times), each time at an interval of 3N seconds, and if all the multiple attempts fail to mount, it is determined that the network node fails to mount on the first external network node, the first external network node is discarded, and node information of the first external network node may be deleted from the external network node configuration list.
Meanwhile, a second extranet node may be selected from the extranet node configuration list according to priority, and attempt to establish a connection with the second extranet node, and mount the network node on the second extranet node.
As an optional implementation, the method further comprises:
sending a first connection request to each alternative external network node in the external network node configuration list every other preset period;
for each alternative external network node, judging whether the network node and the alternative external network node successfully establish connection;
and if the connection between the network node and the alternative external network node fails, deleting the node information of the alternative external network node in the external network node configuration list.
In this embodiment, due to a change in a network environment or a network node, a situation that some candidate extranet nodes in the extranet node configuration list may be normally connected in a history, but cannot be normally connected currently may be caused, so that validity of the candidate extranet nodes in the extranet node configuration list needs to be detected and updated every preset period (for example, every hour), and once a candidate extranet node that does not satisfy a condition is found, node information of the candidate extranet node needs to be deleted.
Specifically, a first connection request may be sent to each of the candidate extranet nodes in the extranet node configuration list, after each of the candidate extranet nodes receives the first connection request, if the candidate extranet node belongs to a valid node that can be normally connected, the candidate extranet node may attempt to establish a long connection with the network node, and mount the connection, otherwise, if the candidate extranet node belongs to an invalid node that cannot be normally connected, the candidate extranet node may not communicate with the network node, and the network node may not be mounted on the candidate extranet node. Therefore, for each alternative extranet node, it may be determined whether the network node and the alternative extranet node are successfully connected, and if the connection between the network node and the alternative extranet node fails, indicating that the alternative extranet node belongs to an invalid node, the node information of the alternative extranet node may be deleted from the extranet node configuration list, thereby implementing update and maintenance of the extranet node configuration list, and ensuring that the alternative extranet node in the extranet node configuration list is a valid node that can be normally connected.
As an optional implementation, the method further comprises:
if the network node is successfully mounted on the first external network node, judging whether the number of the alternative external network nodes in the current external network node configuration list reaches a first preset number threshold value;
if the number of the alternative external network nodes in the current external network node configuration list does not reach a first preset number threshold value, detecting the external network nodes in the DHT network;
and if the external network nodes meeting the preset requirements are detected, storing the node information of the external network nodes meeting the preset requirements into the external network node configuration list.
In this embodiment, the maximum storage number of the alternative extranet nodes in the extranet node configuration list may be set to a first preset number threshold, such as 20. When the network node is successfully mounted on the first extranet node, the network node may further determine whether the number of the candidate extranet nodes in the current extranet node configuration list reaches a first preset number threshold, if the number of the candidate extranet nodes in the current extranet node configuration list does not reach the first preset number threshold, the network node needs to continue to detect the extranet node in the DHT network, and if an extranet node meeting preset requirements is detected, it indicates that the detected extranet node belongs to an available node, the node information of the extranet node meeting the preset requirements needs to be stored in the extranet node configuration list. On the contrary, if the number of the alternative external network nodes in the external network node configuration list reaches the first preset number threshold, then continuous detection is not needed, and subsequently, the validity of the alternative external network nodes in the external network node configuration list only needs to be detected every preset period so as to update and maintain the external network node configuration list.
Specifically, when a certain outer network node is detected, a short connection can be established with the certain outer network node, if the short connection is successfully established, whether the number of inner network nodes currently mounted by the certain outer network node reaches a second preset number threshold is inquired, and if the number of inner network nodes currently mounted by the certain outer network node does not reach the preset number threshold, it is determined that the certain outer network node meets the preset requirement.
In the method flow described in fig. 2, when any network node in the DHT network is started, if the network node is an intranet node, the network node may directly select any extranet node (i.e., the first extranet node) from an extranet node configuration list in which candidate extranet nodes are stored, and since the candidate extranet nodes in the extranet node configuration list are all the extranet nodes on which the network node has been successfully mounted in the history, the network node can be quickly and efficiently mounted on any candidate extranet node in the extranet node configuration list, so that the mounting efficiency of the network node can be improved.
The above description is only a specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and it will be apparent to those skilled in the art that modifications may be made without departing from the inventive concept of the present invention, and these modifications are within the scope of the present invention.
Referring to fig. 3, fig. 3 is a functional block diagram of a node mounting apparatus according to a preferred embodiment of the present invention.
In some embodiments, the node mounting means operates in a network node. The node mounting means may comprise a plurality of functional modules consisting of program code segments. Program code of various program segments in the node mounting device may be stored in the memory and executed by the at least one processor to perform some or all of the steps of the node mounting method described in fig. 2.
In this embodiment, the node mounting apparatus may be divided into a plurality of functional modules according to the functions performed by the node mounting apparatus. The functional module may include: a first judging module 301, a second judging module 302, a selecting module 303 and a mounting module 304. The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory. In some embodiments, the functions of the modules will be described in detail in this embodiment.
The first determining module 301 is configured to determine whether a network node is an intranet node when the network node is started.
Whether the network node is an intranet node can be judged in various modes.
A second determining module 302, configured to determine whether an alternative extranet node exists in an extranet node configuration list of the network node if the network node is an intranet node.
In the invention, an extranet node configuration list can be created for each intranet node in advance. If a certain intranet node is started for the first time, the configuration list of the extranet nodes of the intranet node is null, that is, there is no any alternative extranet node, and if a certain intranet node is not started for the first time, at least one alternative extranet node is stored in the configuration list of the extranet nodes of the intranet node. Usually, the alternative extranet nodes in the extranet node configuration list are extranet nodes on which the intranet node is successfully mounted in history.
A selecting module 303, configured to select a first extranet node from the candidate extranet nodes in the extranet node configuration list if the candidate extranet nodes exist in the extranet node configuration list of the network node.
In the invention, because the alternative external network nodes in the external network node configuration list are external network nodes which are successfully mounted in history, the network node can directly select the first external network node from the alternative external network nodes in the external network node configuration list.
Optionally, the first external network node may be selected according to the priority from the candidate external network nodes in the external network node configuration list according to the priority order of the node update time. Generally, the closer the node update time is to the current time, the higher the priority of the network node, whereas the farther the node update time is from the current time, the lower the priority of the network node.
A mounting module 304, configured to mount the network node on the first external network node.
Specifically, a network node may attempt to establish a TCP long connection with the first external network node to mount the network node on the first external network node. Wherein the network node may be successfully mounted or may be unsuccessfully mounted.
Optionally, the selecting module 303 is further configured to select a second extranet node from the extranet node configuration list if the network node fails to mount on the first extranet node;
the mounting module 304 is further configured to mount the network node on the second external network node;
the node mounting apparatus further includes:
and the deleting module is used for deleting the node information of the first external network node from the external network node configuration list.
In this embodiment, a network node may attempt to establish a TCP long connection with the first external network node multiple times (for example, 3 times), each time at an interval of 3N seconds, and if all the multiple attempts fail to mount, it is determined that the network node fails to mount on the first external network node, the first external network node is discarded, and node information of the first external network node may be deleted from the external network node configuration list.
Meanwhile, a second extranet node may be selected from the extranet node configuration list according to priority, and attempt to establish a connection with the second extranet node, and mount the network node on the second extranet node.
Optionally, the node mounting apparatus further includes:
a sending module, configured to send a first connection request to each alternative external network node in the external network node configuration list every preset period;
the second determining module 302 is further configured to determine, for each alternative external network node, whether the network node and the alternative external network node successfully establish a connection;
the deleting module is further configured to delete the node information of the alternative external network node from the external network node configuration list if the connection between the network node and the alternative external network node fails.
In this embodiment, due to a change in a network environment or a network node, a situation that some candidate extranet nodes in the extranet node configuration list may be normally connected in a history, but cannot be normally connected currently may be caused, so that validity of the candidate extranet nodes in the extranet node configuration list needs to be detected and updated every preset period (for example, every hour), and once a candidate extranet node that does not satisfy a condition is found, node information of the candidate extranet node needs to be deleted.
Specifically, a first connection request may be sent to each of the candidate extranet nodes in the extranet node configuration list, after each of the candidate extranet nodes receives the first connection request, if the candidate extranet node belongs to a valid node that can be normally connected, the candidate extranet node may attempt to establish a long connection with the network node, and mount the connection, otherwise, if the candidate extranet node belongs to an invalid node that cannot be normally connected, the candidate extranet node may not communicate with the network node, and the network node may not be mounted on the candidate extranet node. Therefore, for each alternative extranet node, it may be determined whether the network node and the alternative extranet node are successfully connected, and if the connection between the network node and the alternative extranet node fails, indicating that the alternative extranet node belongs to an invalid node, the node information of the alternative extranet node may be deleted from the extranet node configuration list, thereby implementing update and maintenance of the extranet node configuration list, and ensuring that the alternative extranet node in the extranet node configuration list is a valid node that can be normally connected.
Optionally, the second determining module 302 is further configured to determine, if the network node is successfully mounted on the first extranet node, whether the number of the candidate extranet nodes in the current extranet node configuration list reaches a first preset number threshold;
the node mounting apparatus further includes:
the detection module is used for detecting the external network nodes in the DHT if the number of the alternative external network nodes in the current external network node configuration list does not reach a first preset number threshold;
and the storage module is used for storing the node information of the external network nodes meeting the preset requirements into the external network node configuration list if the external network nodes meeting the preset requirements are detected.
In this embodiment, the maximum storage number of the alternative extranet nodes in the extranet node configuration list may be set to a first preset number threshold, such as 20. When the network node is successfully mounted on the first extranet node, the network node may further determine whether the number of the candidate extranet nodes in the current extranet node configuration list reaches a first preset number threshold, if the number of the candidate extranet nodes in the current extranet node configuration list does not reach the first preset number threshold, the network node needs to continue to detect the extranet node in a distributed hash table dht (distributed hash table) network, and if an extranet node meeting preset requirements is detected, it is indicated that the detected extranet node belongs to an available node, and the node information of the extranet node meeting the preset requirements needs to be stored in the extranet node configuration list. On the contrary, if the number of the alternative external network nodes in the external network node configuration list reaches the first preset number threshold, then continuous detection is not needed, and subsequently, the validity of the alternative external network nodes in the external network node configuration list only needs to be detected every preset period so as to update and maintain the external network node configuration list.
Specifically, when a certain outer network node is detected, a short connection can be established with the certain outer network node, if the short connection is successfully established, whether the number of inner network nodes currently mounted by the certain outer network node reaches a second preset number threshold is inquired, and if the number of inner network nodes currently mounted by the certain outer network node does not reach the preset number threshold, it is determined that the certain outer network node meets the preset requirement.
Optionally, the detecting module is further configured to detect an external network node in the DHT network if there is no alternative external network node in the external network node configuration list of the network node;
the node mounting apparatus further includes:
the establishing module is used for establishing short connection with the target external network node when the target external network node is detected;
the query module is used for querying whether the number of the intranet nodes currently mounted by the target extranet node reaches a second preset number threshold value or not if the short connection is successfully established;
the mounting module 304 is further configured to mount the network node on the target extranet node if the number of currently mounted intranet nodes of the target extranet node does not reach a preset number threshold.
In this embodiment, if there is no alternative extranet node in the extranet node configuration list of the network node, indicating that the network node is first started, it is necessary to detect the extranet node in the DHT network. When a target extranet node is detected, the network node tries to establish short connection with the target extranet node, if the short connection is established successfully, whether the number of the intranet nodes currently mounted by the target extranet node reaches a second preset number threshold value or not is inquired, and if the number of the intranet nodes currently mounted by the target extranet node does not reach the preset number threshold value, the number of the intranet nodes currently mounted by the target extranet node is not saturated, and the network node can be mounted on the target extranet node.
Optionally, the storage module is further configured to store the node information of the target extranet node into the extranet node configuration list.
In this embodiment, since the network node is first started, and there is no candidate extranet node in the extranet node configuration list, the node information of the target extranet node needs to be stored in the extranet node configuration list, so that the node can be subsequently and quickly mounted.
The first determining module 301 determining whether the network node is an intranet node includes:
acquiring an Internet Protocol (IP) address of the network node; judging whether the address type of the IP address is the IP address of a local area network or not, and if the address type of the IP address is the IP address of the local area network, determining that the network node is an intranet node; or
Sending a second connection request to the server; and if the connection between the network node and the server fails, determining that the network node is an intranet node.
In this embodiment, typically, the network nodes of the IP address of the local network belong to intranet nodes, while the network nodes of the IP address of the public network belong to extranet nodes.
A server (such as a reverse probe server) is deployed on the extranet. When the network node is started, a second connection request can be sent to the server to request for communication with the server, the server tries to establish a new connection with the network node after receiving the second connection request, and if the connection between the network node and the server fails, the network node is determined to be an intranet node; or, if the network node is successfully connected with the server, determining that the network node is an external network node.
After the network node judges the internal and external network attributes of the network node, the network node carries the internal and external network attribute information when communicating with other network nodes subsequently.
In the node mounting apparatus described in fig. 3, when any network node in the DHT network is started, if the network node is an intranet node, the network node may directly select any extranet node (i.e., the first extranet node) from an extranet node configuration list in which candidate extranet nodes are stored, and since the candidate extranet nodes in the extranet node configuration list are all the extranet nodes on which the network node has been successfully mounted in the history, the network node can be quickly and efficiently mounted on any candidate extranet node in the extranet node configuration list, and thus the mounting efficiency of the network node can be improved.
As shown in fig. 4, fig. 4 is a schematic structural diagram of a network node according to a preferred embodiment of the present invention. The network node 4 comprises a memory 41, at least one processor 42, a computer program 43 stored in the memory 41 and executable on the at least one processor 42, and at least one communication bus 44.
Those skilled in the art will appreciate that the schematic diagram shown in fig. 4 is merely an example of the network node 4 and does not constitute a limitation of the network node 4 and may include more or less components than those shown, or combine certain components, or different components, e.g., the network node 4 may also include input-output devices, network access devices, etc.
The at least one Processor 42 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The processor 42 may be a microprocessor or the processor 42 may be any conventional processor or the like, said processor 42 being the control center of said network node 4, the various parts of the entire network node 4 being connected by various interfaces and lines.
The memory 41 may be used for storing the computer program 43 and/or the module/unit, and the processor 42 may implement various functions of the network node 4 by running or executing the computer program and/or the module/unit stored in the memory 41 and calling data stored in the memory 41. The memory 41 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data) created according to the use of the network node 4, and the like. Further, the memory 41 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other non-volatile solid state storage device.
With reference to fig. 1 and 2, the memory 41 in the network node 4 stores a plurality of instructions to implement a node mount method, and the processor 42 executes the plurality of instructions to implement:
when a network node is started, judging whether the network node is an intranet node or not;
if the network node is an intranet node, judging whether an alternative extranet node exists in an extranet node configuration list of the network node;
if the alternative external network nodes exist in the external network node configuration list of the network node, selecting a first external network node from the alternative external network nodes in the external network node configuration list, wherein the alternative external network nodes in the external network node configuration list are external network nodes which are successfully mounted in history;
mounting the network node on the first external network node.
In an alternative embodiment, the processor 42 may execute the plurality of instructions to implement:
if the network node fails to mount on the first external network node, selecting a second external network node from the external network node configuration list;
mounting the network node on the second external network node;
and deleting the node information of the first external network node from the external network node configuration list.
In an alternative embodiment, the processor 42 may execute the plurality of instructions to implement:
sending a first connection request to each alternative external network node in the external network node configuration list every other preset period;
for each alternative external network node, judging whether the network node and the alternative external network node successfully establish connection;
and if the connection between the network node and the alternative external network node fails, deleting the node information of the alternative external network node in the external network node configuration list.
In an alternative embodiment, the processor 42 may execute the plurality of instructions to implement:
if the network node is successfully mounted on the first external network node, judging whether the number of the alternative external network nodes in the current external network node configuration list reaches a first preset number threshold value;
if the number of the alternative external network nodes in the current external network node configuration list does not reach a first preset number threshold value, detecting the external network nodes in the DHT network;
and if the external network nodes meeting the preset requirements are detected, storing the node information of the external network nodes meeting the preset requirements into the external network node configuration list.
In an alternative embodiment, the processor 42 may execute the plurality of instructions to implement:
if the alternative external network nodes do not exist in the external network node configuration list of the network node, detecting the external network nodes in the DHT network;
when a target external network node is detected, establishing short connection with the target external network node;
if the short connection is successfully established, inquiring whether the number of the intranet nodes currently mounted by the target extranet node reaches a second preset number threshold;
and if the number of the currently mounted intranet nodes of the target extranet node does not reach a preset number threshold value, mounting the network nodes on the target extranet node.
In an alternative embodiment, the processor 42 may execute the plurality of instructions to implement:
and storing the node information of the target external network node into the external network node configuration list.
In an optional implementation manner, the determining, by the processor, whether the network node is an intranet node includes:
acquiring an Internet Protocol (IP) address of the network node; judging whether the address type of the IP address is the IP address of a local area network or not, and if the address type of the IP address is the IP address of the local area network, determining that the network node is an intranet node; or
Sending a second connection request to the server; and if the connection between the network node and the server fails, determining that the network node is an intranet node.
Specifically, the processor 42 may refer to the description of the relevant steps in the embodiment corresponding to fig. 2, and details thereof are not repeated herein.
In the network node 4 described in fig. 4, when any network node in the DHT network is started, if the network node is an intranet node, the network node may directly select any extranet node (i.e., the first extranet node) from an extranet node configuration list in which candidate extranet nodes are stored, and since the candidate extranet nodes in the extranet node configuration list are all the extranet nodes on which the network node has been successfully mounted in the history, the network node can be quickly and efficiently mounted on any candidate extranet node in the extranet node configuration list, and thus the mounting efficiency of the network node can be improved.
The modules/units integrated by the network node 4 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, and Read-Only Memory (ROM).
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for node mounting, the method comprising:
when a network node is started, judging whether the network node is an intranet node or not;
if the network node is an intranet node, judging whether an alternative extranet node exists in an extranet node configuration list of the network node;
if the alternative external network nodes exist in the external network node configuration list of the network node, selecting a first external network node from the alternative external network nodes in the external network node configuration list, wherein the alternative external network nodes in the external network node configuration list are external network nodes which are successfully mounted in history;
mounting the network node on the first external network node.
2. The method of claim 1, further comprising:
if the network node fails to mount on the first external network node, selecting a second external network node from the external network node configuration list;
mounting the network node on the second external network node;
and deleting the node information of the first external network node from the external network node configuration list.
3. The method of claim 1, further comprising:
sending a first connection request to each alternative external network node in the external network node configuration list every other preset period;
for each alternative external network node, judging whether the network node and the alternative external network node successfully establish connection;
and if the connection between the network node and the alternative external network node fails, deleting the node information of the alternative external network node in the external network node configuration list.
4. The method of claim 1, further comprising:
if the network node is successfully mounted on the first external network node, judging whether the number of the alternative external network nodes in the current external network node configuration list reaches a first preset number threshold value;
if the number of the alternative external network nodes in the current external network node configuration list does not reach a first preset number threshold value, detecting the external network nodes in the DHT network;
and if the external network nodes meeting the preset requirements are detected, storing the node information of the external network nodes meeting the preset requirements into the external network node configuration list.
5. The method according to any one of claims 1 to 4, further comprising:
if the alternative external network nodes do not exist in the external network node configuration list of the network node, detecting the external network nodes in the DHT network;
when a target external network node is detected, establishing short connection with the target external network node;
if the short connection is successfully established, inquiring whether the number of the intranet nodes currently mounted by the target extranet node reaches a second preset number threshold;
and if the number of the currently mounted intranet nodes of the target extranet node does not reach a preset number threshold value, mounting the network nodes on the target extranet node.
6. The method of claim 5, further comprising:
and storing the node information of the target external network node into the external network node configuration list.
7. The method according to any one of claims 1 to 4, wherein the determining whether the network node is an intranet node comprises:
acquiring an Internet Protocol (IP) address of the network node; judging whether the address type of the IP address is the IP address of a local area network or not, and if the address type of the IP address is the IP address of the local area network, determining that the network node is an intranet node; or
Sending a second connection request to the server; and if the connection between the network node and the server fails, determining that the network node is an intranet node.
8. A node mounting apparatus, characterized in that the node mounting apparatus comprises:
the first judgment module is used for judging whether the network node is an intranet node or not when the network node is started;
the second judgment module is used for judging whether an alternative extranet node exists in an extranet node configuration list of the network node if the network node is an intranet node;
a selection module, configured to select a first external network node from the alternative external network nodes in the external network node configuration list if the alternative external network nodes exist in the external network node configuration list of the network node;
a mounting module, configured to mount the network node on the first external network node.
9. A network node, characterized in that the network node comprises a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the node mounting method according to any of claims 1 to 7.
10. A computer-readable storage medium storing at least one instruction which, when executed by a processor, implements a node mounting method according to any one of claims 1 to 7.
CN201911395901.4A 2019-12-30 2019-12-30 Node mounting method, device, network node and storage medium Pending CN111131484A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911395901.4A CN111131484A (en) 2019-12-30 2019-12-30 Node mounting method, device, network node and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911395901.4A CN111131484A (en) 2019-12-30 2019-12-30 Node mounting method, device, network node and storage medium

Publications (1)

Publication Number Publication Date
CN111131484A true CN111131484A (en) 2020-05-08

Family

ID=70505196

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911395901.4A Pending CN111131484A (en) 2019-12-30 2019-12-30 Node mounting method, device, network node and storage medium

Country Status (1)

Country Link
CN (1) CN111131484A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111600763A (en) * 2020-06-03 2020-08-28 深圳市网心科技有限公司 Method, system and related equipment for updating network access configuration information in DHT network
CN114244744A (en) * 2021-12-22 2022-03-25 上海摩联信息技术有限公司 Node discovery method and device based on Internet of things equipment
CN114285745A (en) * 2021-12-22 2022-04-05 上海摩联信息技术有限公司 Node updating method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008119214A1 (en) * 2007-04-02 2008-10-09 Beijing Hitea Technologies Ltd. A method for accessing the internal network web service of the internet
CN101841484A (en) * 2010-05-12 2010-09-22 中国科学院计算技术研究所 Method and system for realizing NAT traversal in structured P2P network
CN110191204A (en) * 2019-05-30 2019-08-30 深圳市网心科技有限公司 A kind of Intranet communication between devices method, system, device and computer storage medium
CN110430587A (en) * 2019-08-13 2019-11-08 北京百佑科技有限公司 Rapid networking method, internet-of-things terminal and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008119214A1 (en) * 2007-04-02 2008-10-09 Beijing Hitea Technologies Ltd. A method for accessing the internal network web service of the internet
CN101841484A (en) * 2010-05-12 2010-09-22 中国科学院计算技术研究所 Method and system for realizing NAT traversal in structured P2P network
CN110191204A (en) * 2019-05-30 2019-08-30 深圳市网心科技有限公司 A kind of Intranet communication between devices method, system, device and computer storage medium
CN110430587A (en) * 2019-08-13 2019-11-08 北京百佑科技有限公司 Rapid networking method, internet-of-things terminal and computer readable storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111600763A (en) * 2020-06-03 2020-08-28 深圳市网心科技有限公司 Method, system and related equipment for updating network access configuration information in DHT network
CN114244744A (en) * 2021-12-22 2022-03-25 上海摩联信息技术有限公司 Node discovery method and device based on Internet of things equipment
CN114285745A (en) * 2021-12-22 2022-04-05 上海摩联信息技术有限公司 Node updating method and device
CN114244744B (en) * 2021-12-22 2024-04-05 上海摩联信息技术有限公司 Node discovery method and device based on Internet of things equipment

Similar Documents

Publication Publication Date Title
CN111131484A (en) Node mounting method, device, network node and storage medium
CN110597918B (en) Account management method, account management device and computer readable storage medium
CN106210155B (en) Method and device for connecting application server
CN108494755B (en) Method and device for transmitting Application Programming Interface (API) request
CN113473576B (en) Roaming networking processing method and device, mobile terminal and readable storage medium
CN110784549A (en) Network node selection method and device, first network node and storage medium
CN110636068B (en) Method and device for identifying unknown CDN node in CC attack protection
CN111698189A (en) BGP route identification method, device and equipment
CN112615784B (en) Method, device, storage medium and electronic equipment for forwarding message
CN112333289A (en) Reverse proxy access method, device, electronic equipment and storage medium
CN112039718B (en) Upgrade state detection method, server, equipment and storage medium
CN111064798B (en) Node network access method, device, client node and storage medium
CN111353136B (en) Method and device for processing operation request
CN111064729B (en) Message processing method and device, storage medium and electronic device
CN111010362B (en) Monitoring method and device for abnormal host
CN112769635A (en) Service identification method and device for multi-granularity feature analysis
CN112153173B (en) IPv6 address rapid deployment and distribution method and device
CN112583627A (en) Networking topology structure display method and device
CN106790269B (en) Recovery method and device for overtime login of application program
CN106412018B (en) Message pushing method and device
CN102201951B (en) Source address repeatability detection method and equipment
US20210328993A1 (en) Access to a service in a network
CN109862135B (en) Group communication method based on domain name block chain, block chain link point and medium
CN109756349B (en) Group communication method based on domain name block chain, block chain link point and medium
CN114338794A (en) Service message pushing method and device, electronic equipment and storage medium

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200508