CN114363167A - Network segment information processing method, device, electronic equipment and storage medium - Google Patents

Network segment information processing method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114363167A
CN114363167A CN202111565171.5A CN202111565171A CN114363167A CN 114363167 A CN114363167 A CN 114363167A CN 202111565171 A CN202111565171 A CN 202111565171A CN 114363167 A CN114363167 A CN 114363167A
Authority
CN
China
Prior art keywords
mask
network address
character string
value
string
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.)
Granted
Application number
CN202111565171.5A
Other languages
Chinese (zh)
Other versions
CN114363167B (en
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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202111565171.5A priority Critical patent/CN114363167B/en
Publication of CN114363167A publication Critical patent/CN114363167A/en
Application granted granted Critical
Publication of CN114363167B publication Critical patent/CN114363167B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The disclosure provides a network segment information processing method, a network segment information processing device, electronic equipment and a storage medium, and relates to the technical field of computers, in particular to the fields of cloud computing and the like. The method comprises the following steps: in response to acquiring a first mask, determining fillable ranges respectively corresponding to the N segmented input areas based on the first mask; n is an integer greater than or equal to 1; respectively displaying the corresponding fillable ranges in the N segmented input areas; and in response to acquiring N pieces of input information in the N segmented input areas, generating a first network address based on the N pieces of input information, and determining first network segment information based on the first network address and the first mask. By the method, the correctness of the input network segment information and the overall processing efficiency can be improved.

Description

Network segment information processing method, device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technology, and more particularly, to cloud computing and other fields.
Background
Network configuration is a very important component in cloud computing products. The user can configure the network segment information through the console, and if the configured network segment information is incorrect, the whole service of the user can be unavailable. Therefore, how to ensure the correctness of the input network segment information and thus the overall processing efficiency becomes a problem to be solved.
Disclosure of Invention
The disclosure provides a network segment information processing method, a network segment information processing device, an electronic device and a storage medium.
According to a first aspect of the present disclosure, a network segment information processing method is provided, including:
in response to acquiring a first mask, determining fillable ranges respectively corresponding to the N segmented input areas based on the first mask; n is an integer greater than or equal to 1;
respectively displaying the corresponding fillable ranges in the N segmented input areas;
and in response to acquiring N pieces of input information in the N segmented input areas, generating a first network address based on the N pieces of input information, and determining first network segment information based on the first network address and the first mask.
According to a second aspect of the present disclosure, there is provided a network segment information processing apparatus including:
the range determining module is used for determining fillable ranges corresponding to the N segmented input areas respectively based on a first mask in response to the acquisition of the first mask; n is an integer greater than or equal to 1;
the display module is used for respectively displaying the corresponding fillable ranges in the N segmented input areas;
and the network segment information determining module is used for responding to N pieces of input information acquired in the N segmented input areas, generating a first network address based on the N pieces of input information, and determining first network segment information based on the first network address and the first mask.
According to a third aspect of the present disclosure, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of the first aspect described above.
According to a fifth aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method according to the first aspect described above.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
By adopting the scheme, the fillable ranges respectively corresponding to the segment input areas can be determined according to the acquired first mask code and displayed, then the first network address is generated according to the input information acquired by acquiring the segment input areas, and the first network segment information is determined based on the first network address and the first mask code. Therefore, the correctness of the input network segment information and the overall processing efficiency can be improved.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a process flow diagram of a network segment information processing method according to an embodiment of the present disclosure;
fig. 2a is a schematic diagram of determining a fillable area based on a first mask and a second mask according to an embodiment of the present disclosure;
FIG. 2b is a schematic diagram of a presentation interface according to an embodiment of the present disclosure;
fig. 3a is a schematic processing flow diagram of a mask validity mask in a network segment information processing method according to an embodiment of the present disclosure;
FIG. 3b is a process flow diagram of network address translation according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a first network address translation binary string in a first network segment information according to an embodiment of the present disclosure;
FIG. 5 is a flowchart illustrating a process of determining whether network addresses are in the same network segment according to another embodiment of the present disclosure;
FIG. 6 is a flowchart illustrating a process of determining whether two network segment information overlap according to another embodiment of the disclosure;
FIG. 7a is a schematic diagram of a network segment information processing apparatus according to an embodiment of the present disclosure;
FIG. 7b is another schematic diagram of a network segment information processing apparatus according to an embodiment of the present disclosure;
fig. 8 is a block diagram of an electronic device for implementing a network segment information processing method according to an embodiment of the disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
An embodiment of a first aspect of the present disclosure provides a network segment information processing method, as shown in fig. 1, including:
s101: in response to acquiring a first mask, determining fillable ranges respectively corresponding to the N segmented input areas based on the first mask; n is an integer greater than or equal to 1;
s102: respectively displaying the corresponding fillable ranges in the N segmented input areas;
s103: and in response to acquiring N pieces of input information in the N segmented input areas, generating a first network address based on the N pieces of input information, and determining first network segment information based on the first network address and the first mask.
The embodiment can be applied to terminal equipment, and particularly can be applied to a client installed in the terminal equipment. By adopting the scheme, the fillable ranges respectively corresponding to the segment input areas can be determined according to the acquired first mask code and displayed, then the first network address is generated according to the input information acquired by acquiring the segment input areas, and the first network segment information is determined based on the first network address and the first mask code. Therefore, the problem that the processing efficiency is influenced because the information is invalid and is revised again due to the filling error can be solved, the probability of the filling error can be reduced, and the correctness of the input network segment information and the overall processing efficiency are improved.
The maximum value of the first mask may be related to a type of a currently selected or determined network address, for example, if the type of the currently selected or determined network address is Internet Protocol version 4(IPv4, Internet Protocol version 4), the maximum value of the first mask is 32; if the type of the currently selected or determined network address is Internet Protocol version 6(IPv6, Internet Protocol version 6), the maximum value of the first mask is 128.
The obtaining of the first mask may be: responding to a mask input area in a display interface to acquire an input numerical value, and taking the input numerical value as the first mask;
or, in response to an operation of selecting a target numerical value from at least one candidate numerical value displayed in the mask input area in the display interface, the target numerical value is used as the first mask.
The display interface may further include the N segment input areas in addition to the mask input area. Each of the N segment input areas is for obtaining an address segment of the first network address. N may be an integer of 1 or more, preferably N is 4.
Each of the N segment input regions may include two sub-regions, which are a first sub-region and a second sub-region, respectively; the first sub-area may be configured to show a fillable area corresponding to each segmented input area; the second sub-area may be configured to obtain input information, that is, the second sub-area may fill in the corresponding input information; the relative position relationship between the first sub-area and the second sub-area may be: the first sub-region is below the second sub-region.
The displaying the fillable ranges in the N segment input areas may specifically be: displaying, at the first sub-region of the each segmented input region of the N segmented input regions, the fillable extents corresponding to the each segmented input region. The fillable range may be a numerical value area, for example, the fillable range is 0 to 255; alternatively, the fillable range may be one or more specific numerical values, such as a fillable range of 0, or a fillable range of 127 or 255.
As described above, in the first sub-area of each segment input area, there may be a plurality of ways to display the fillable area corresponding to each segment input area:
first, regardless of the input area at which the value is to be input, the fillable ranges corresponding to each of the N segmented input areas are maintained exposed in each of the N segmented input areas.
In response to a third operation on the second sub-region of the ith segmented input region of the N segmented input regions, presenting a corresponding fillable extent at the first sub-region of the ith segmented input region and not presenting the corresponding fillable extent at the first sub-regions of the segmented input regions other than the ith segmented input region; i is an integer of 1 or more and N or less.
Wherein the third operation may refer to an operation of clicking the second sub-region of the ith segment input region; or the position of the mouse is located in the second sub-area of the ith segmented input area.
The second sub-regions corresponding to the N segment input regions may all be in an editable state; or, according to the fillable range corresponding to each segmented input area, the second sub-area of different segmented input areas is controlled to be in different states, for example, if the fillable range corresponding to the jth segmented input area only includes 1 numerical value (for example, 0), the second sub-area of the jth segmented input area may be controlled to be in an uneditable state, and the input information of the second sub-area of the jth segmented input area is directly set to 0; if the fillable range corresponding to the jth segmented input area contains a plurality of numerical values, the second sub-area of the jth segmented input area can be controlled to be in an editable state; j is an integer of 1 or more and N or less.
The generating the first network address based on the N input information may specifically be: determining the arrangement sequence of the N pieces of input information based on the positions of the segmented input areas corresponding to the N pieces of input information; and combining the N input information according to the arrangement sequence by adopting a preset identifier to obtain the first network address.
The preset identifier may be determined according to the type of the currently selected or determined network address, for example, the type of the currently selected or determined network address is Internet Protocol version 4(IPv4, Internet Protocol version 4), and the preset identifier is "; the type of the currently selected or determined network address is Internet Protocol version 6(IPv6, Internet Protocol version 6), and the preset identifier is ":".
For example, taking the type of the currently selected or determined network address as IPv4 as an example, the input information in the 1 st segment input area is 192, the input information in the 2 nd segment input area is xxx, and the input information in the 3 rd and 4 th segment input areas are both 0; setting the sequence from the 1 st input area to the 4 th input area as the arrangement sequence of the 4 input information; and combining the 4 input information according to the arrangement sequence by using the preset identifier to obtain the first network address of 192. xxx.0.0.
Based on the first network address and the first mask, determining first network segment information may be: and combining the first network address and the first mask into the first network segment information based on a preset format. The preset format may be preset according to an actual situation, and the preset format adopted in this embodiment is a format of "network address/mask". Assuming that the first mask is 16 and the first network address is 192.xxx.0.0 ", determining that the first network segment information is represented as 192. xxx.0.0/16" according to the preset format.
The first network segment information may specifically be Classless Inter-Domain Routing (CIDR) information.
In addition, it should be noted that, in the presentation interface, other operation areas may also be presented for the user to input or select other information. For example, a type selection area may be further displayed on the display interface, and there may be multiple candidate network address types in the type selection area, such as IPv4, IPv6, or more candidate network address types; in response to a selection operation for a target network address type of the plurality of candidate network address types, determining the currently selected or determined network address type as the target network address type.
By adopting the scheme, the fillable ranges corresponding to the segment input areas can be determined and displayed according to the acquired first mask, then the first network address is generated according to the input information acquired by acquiring the segment input areas, and the first network segment information is determined based on the first network address and the first mask. Therefore, the problem that the processing efficiency is influenced because the information is invalid and is revised again due to the filling error can be solved, the probability of the filling error can be reduced, and the correctness of the input network segment information and the overall processing efficiency are improved.
In an embodiment, the determining fillable ranges corresponding to the N segment input areas based on the first mask specifically includes:
determining a first character string based on the first mask; the first character string comprises a first type of characters and a second type of characters, wherein the value of the first type of characters is a first value, and the value of the second type of characters is a second value;
dividing the first character string to obtain N character string groups;
and determining the fillable ranges respectively corresponding to the N segmented input areas based on the first type of characters and/or the second type of characters respectively contained in the N character string groups.
The value of the first mask is a decimal integer value, and the maximum value of the first mask is related to the type of the currently selected or determined network address, for example, if the type of the currently selected or determined network address is IPv4, the maximum value of the first mask is 32; if the type of the currently selected or determined network address is IPv6, the maximum value of the first mask is 128.
The first character string may specifically be a binary character string; the total number of digits contained in the first string is also related to the type of the currently selected or determined network address. For example, the type of the currently selected or determined network address is an IPv4 type network address, and the total number of bits of the first character string is 32 bits; the type of the currently selected or determined network address is an IPv6 type network address, and the total number of digits of the first character string is 128.
The number and position of the first type of characters in the first character string may be: the first M characters in the first character string are the first type characters. Wherein M is equal to the first mask; the first M characters refer to continuous M-bit binary characters from the highest order in the first character string. The value of the first type of character is a first value, and the first value is 1, that is to say, the first type of character is 1.
The number and the position of the second type of characters in the first character string are specifically as follows: and the M +1 th character and all the characters after the M +1 th character in the first character string are the second type characters. The M +1 th character refers to the M +1 th binary character from the highest bit in the first character string. The value of the second type of character is a first value, the first value is 0, that is, the second type of character is 0.
For example, assuming that the currently selected or determined network address is a network address of IPv4 type, the length of the first string is equal to 32; assuming that the first mask is 8, M is equal to 8, the first 8 bits in the first string are the first type of character, i.e., 1, and the remaining 24 bits are the second type of character, i.e., 0, and the first string is represented as "11111111000000000000000000000000".
The dividing the first character string to obtain N character string groups may specifically be: and sequentially selecting a preset number of characters from the highest position of the first character string, and grouping each preset number of characters as a character string. The value of N may be 4, and the preset number may be 8 or 32. Taking the currently selected or determined network address with the type of IPv4 as an example, the first character string corresponding to the first mask is divided into 4 character string groups, and each character string group includes 8-bit characters. Taking the currently selected or determined network address with the type of IPv6 as an example, the first character string corresponding to the first mask is divided into 4 character string groups, and each character string group includes 32-bit characters.
The determining the fillable ranges corresponding to the N segment input areas based on the first type of characters and/or the second type of characters included in the N character string groups, specifically, may include:
judging whether the first-class character is contained in the r character string packet in the N character string packets or not; if the first-class character is not contained in the r character string grouping, the fillable range of the r subsection input area corresponding to the r character string grouping is 0; r is an integer of 1 or more and N or less;
if the r character string group contains x first-class characters, the first x character bits of the r character string group are respectively taken as first values, and the rest character bits are all taken as second values, and x numerical values of a target system are obtained through calculation; respectively combining and adding the numerical values of the x target systems to obtain at least one value, and determining a fillable range corresponding to the r-th segmented input area based on the at least one value; x is an integer of 1 or more.
The target system is related to the type of the currently selected or determined network address, for example, if the type of the currently selected or determined network address is an IPv4 type network address, the target system is decimal, and if the type of the currently selected or determined network address is an IPv6 type network address, the target system is hexadecimal.
Wherein, the step of calculating the first x character bits of the r-th character string group to obtain x target system values may include:
taking 1 as the 1 st character bit and 0 as the rest character bits of the r character string grouping, and calculating to obtain a numerical value of the 1 st target system;
and repeating the steps until the x character bit of the r character string group is 1 and the rest character bits are 0, and calculating to obtain the value of the x target system.
The at least one value obtained by respectively combining and adding the numerical values of the x target systems may be: and combining and adding any one or more of the values of the x target systems respectively to obtain the at least one value. Wherein the specific number of the at least one value may be equal to 2x-1. For example, x is 2, the 1 st character bit and the 2 nd character bit of the highest bit in the 8 bit binary character string in the r character string group are respectively valued as 1, and 2 is obtained by calculation7、26Two values, which are combined and added to each other to obtain 3 values.
The determining the fillable extent corresponding to the r-th segmented input area based on the at least one value may include: and taking the at least one value and 0 as the fillable range of the r-th segmented input area.
The description will be given by taking the currently selected or determined network address with the type of IPv4 as an example:
assuming that the first mask is 18, that is, the first 18 bits of the first character string take a value of 1, and the rest take a value of 0; dividing the first character string into 4 character string groups, wherein the 1 st character string group is '11111111', and 27、26~20Any one or more of the values are combined and added to obtain 281 number of values, the final fillable range of the 1 st segmented input field contains 0 and 2 as described above81 number, i.e. 0 to 255. The result obtained by the 2 nd character string grouping and the 1 st character string grouping is the same. The 3 rd string is grouped as "11000000", and 2 is grouped7、26Any one or more of which are combined and added to obtain 221 number of values, and finally the fillable area of the 3 rd segmented input area contains 0 and the above 3 numbers. The 4 th string is grouped as "00000000" and the fillable range of the corresponding 4 th segment network address is 0.
It can be seen that, by adopting the above scheme, a first type of character whose value is a first value and a second type of character whose value is a second value included in a first character string can be determined based on a specific value M of the first mask, N character string groups are obtained after the first character string is divided, and fillable ranges respectively corresponding to the N segment input areas are determined based on the first type of character and/or the second type of character included in each character string group. Therefore, the fillable range in each segment input area can be more accurately determined, so that invalid network addresses caused by errors during filling in any segment input area are avoided, the correctness and accuracy of the input network segment information can be improved, and the overall processing efficiency is improved.
In another embodiment, when the first segment information to be filled in this time is segment information of a subnet, that is, when the first mask is a subnet mask, the fillable ranges corresponding to the N segment input areas are also limited by a second mask, that is, limited by a mask of a current private network. The determining fillable ranges corresponding to the N segment input areas based on the first mask may specifically include:
determining a first character string according to the first mask and the second mask; the first character string comprises a first type of character and a second type of character, the value of the first type of character is a first value, and the value of the second type of character is a second value; the number of the first type characters is the difference value of the first mask and the second mask; the second mask is a mask in network segment information of a private network to which the first mask belongs;
determining at least one adjusting value corresponding to each of the N segmented input areas based on the first type of characters and/or the second type of characters contained in the N character string groups obtained by dividing the first character string;
and determining the fillable ranges respectively corresponding to the N segmented input areas based on the N segmented initial values and the at least one adjusting value respectively corresponding to the N segmented input areas.
The first mask code and the second mask code are decimal integer values, the maximum values of the first mask code and the second mask code are related to the type of the currently selected or determined network address, for example, the type of the currently selected or determined network address is an IPv4 type network address, and the maximum values of the first mask code and the second mask code are 32; the maximum value of the first mask and the second mask is 128, where the currently selected or determined network address is a network address of type IPv 6.
Determining the first character string according to the first mask and the second mask may include:
determining a first initial character string according to the first mask; the first M characters in the first initial character string are first characters, the second characters are after the (M + 1) th character, the value of the first characters is a first value, and the value of the second characters is a second value; m is equal to the first mask;
based on the second mask, adjusting the first initial character string to obtain the first character string; the number of the first type characters contained in the first character string is the difference value of the first mask and the second mask; the second mask is a mask in network segment information of a private network to which the first mask belongs.
The number and position of the first type of characters in the first initial character may be: the first M characters in the first initial character are the first type characters. Wherein M is equal to the first mask; the first M characters refer to the consecutive M binary characters from the highest order in the first initial character. The value of the first type of character is a first value, and the first value is 1, that is to say, the first type of character is 1.
The number and the position of the second type of characters in the first initial character are specifically as follows: and the M +1 th character and all the characters after the M +1 th character in the first initial character are the second type characters. The M +1 th character refers to the M +1 th binary character from the highest order in the first initial character. The value of the second type of character is a first value, the first value is 0, that is, the second type of character is 0.
Wherein the adjusting the first initial character string to obtain the first character string based on the second mask includes: based on the second mask, adjusting the first L characters in the first initial character string into second characters, and keeping the rest characters unchanged to obtain the first character string; l is equal to the second mask, L being an integer less than or equal to M. That is, the first character in the first character string is adjusted to be the L +1 th character to the M th character, the continuous L-bit characters from the highest bit in the first character string are the second character, and all characters are the second character from the M +1 th character.
The first character string may specifically be a binary character string; the total digits contained in the first character string are also related to the type of the currently selected or determined network address, for example, the type of the currently selected or determined network address is an IPv4 type network address, and the total digits of the first character string are 32 digits; the currently selected or determined network address is a network address of type IPv6, and the total number of bits of the first character string is 128.
For example, assuming that the currently selected or determined network address is a network address of IPv4 type, the length of the first string is equal to 32; assuming that the first mask is 15 and the second mask is 13, bits 14 and 15 in the first string are 1, and the remaining bits are 0, that is, the first string is "00000000000001100000000000000000".
The determining, based on first-type characters and/or second-type characters respectively included in N character string packets obtained by dividing the first character string, at least one adjustment value respectively corresponding to the N segment input areas may include: dividing the first character string into N character string groups, and determining at least one adjusting value corresponding to each of the N segmented input areas based on first-class characters and/or second-class characters contained in the N character string groups.
The dividing the first character string to obtain N character string groups may specifically be: and sequentially selecting a preset number of characters from the highest position of the first character string, and grouping each preset number of characters as a character string. The value of N may be 4, and the preset number may be 8 or 32. Taking the currently selected or determined network address with the type of IPv4 as an example, the first character string corresponding to the first mask is divided into 4 character string groups, and each character string group includes 8-bit characters.
The determining, based on the first type of character and/or the second type of character included in the N character string groups, at least one adjustment value corresponding to each of the N segment input areas may specifically include:
judging whether the p character string packet in the N character string packets contains the first type of characters or not; if the pth character string group does not contain the first type of characters, the adjustment value of the pth segmented input area corresponding to the pth character string group is 0; p is an integer of 1 or more and N or less;
if the p character string group contains f first characters, respectively taking first values for the f first characters of the p character string group and taking second values for the rest character bits, and calculating to obtain f numerical values of a target system; respectively combining and adding the numerical values of the f target systems to obtain at least one adjusting value; f is an integer of 1 or more.
The target system is related to the type of the currently selected or determined network address, for example, if the type of the currently selected or determined network address is an IPv4 type network address, the target system is decimal, and if the type of the currently selected or determined network address is an IPv6 type network address, the target system is hexadecimal.
Wherein, the step of calculating f numerical values of the target system by taking the f first characters of the p-th character string grouping as first values and the rest of character bits as second values may include:
taking 1 as the 1 st character bit and 0 as the rest character bits in the f first characters of the p character string grouping, and calculating to obtain a numerical value of the 1 st target system;
and repeating the steps until the f character bit in the f first characters of the p character string group is 1, and the rest character bits are 0, and calculating to obtain the f target system numerical value.
The at least one adjustment value obtained by respectively combining and adding the values of the f target systems may be: and any one or more of the f target system numerical values are respectively combined and added to obtain the at least one adjusting value. Wherein a specific number of the at least one adjustment value may be equal to 2f-1. For example, f is 2, the positions of the first type characters are 14 th and 15 th bits, the positions of the first type characters are 2 nd and 3 rd bits counted from the right to the left in the 2 nd character string group, the two character bits are respectively taken as 1, and the rest character bits are all taken as 0, and 2 is obtained by calculation2、23Two values, which are combined and added to each other to obtain 3 adjustment values.
The determining the fillable ranges corresponding to the N segment input areas based on the N segment initial values and the at least one adjustment value corresponding to the N segment input areas, respectively, includes:
obtaining N segmentation initial values based on the second network address division; the second network address is a network address in network segment information of a private network to which the first mask belongs;
and determining the fillable ranges respectively corresponding to the N segmented input areas based on the N segmented initial values and the at least one adjusting value respectively corresponding to the N segmented input areas.
Wherein, the determining the fillable ranges corresponding to the N segment input areas based on the N segment initial values and the at least one adjustment value corresponding to the N segment input areas respectively may specifically be:
adding the y-th segmentation initial value and the at least one adjusting value corresponding to the y-th segmentation input area respectively to obtain at least one numerical value; taking the at least one numerical value and the y-th segmentation initial value as fillable ranges of the y-th segmentation input area; y is an integer of 1 or more and N or less.
For example, if the initial value of the y-th segment is xxx and the adjustment value of the y-th segment input area is 0, the fillable range of the y-th segment input area is still 168; the initial value of the y segment is xxx, and the adjustment value of the y segment input area is 0, 1, 2, 3, then the fillable range of the y segment input area includes: xxx, xxx +1, xxx +2, xxx + 3.
With reference to fig. 2a, the description will be made by taking the currently selected or determined network address with the IPv4 type as an example:
assuming that the first mask is 18 and the second mask is 16, that is, bits 17 and 18 of the first character string take values of 1, and the rest take values of 0; dividing the first character string into 4 character string groups, wherein the 1 st character string group is '00000000', the adjustment value is 0, and assuming that the 1 st segment initial is determined based on the second network addressThe value is 192 and the fillable area of the final 1 st segmented input field contains 192, one value. The 2 nd string is grouped as "00000000" and the adjustment value is 0, assuming that the 2 nd segment initial value is xxx based on the second network address, the fillable range of the 2 nd segment input area finally contains xxx. The 3 rd string is grouped as "11000000", and 2 is grouped7、26And adding any one or more of the combinations to obtain 3 values and 0 as an adjustment value, and assuming that the 3 rd segment initial value is determined to be 0 based on the second network address, the fillable range of the 3 rd segment network address is 0 and the 3 values.
It can be seen that, by adopting the above-mentioned scheme, when the first mask is a subnet mask, the fillable ranges corresponding to the N segment input areas are determined based on the first mask and the second mask in the private network to which the first mask belongs. Therefore, more information can be combined to ensure that the fillable range in each segment input area is more accurately determined, so that the network address invalidation caused by errors when filling any segment input area is avoided, the correctness and the accuracy of the input network segment information can be improved, and the overall processing efficiency is improved.
In one embodiment, the first mask is obtained by the following two obtaining methods:
the method comprises the steps of responding to the fact that an input numerical value is obtained in a mask input area in a display interface in a first obtaining mode, and taking the input numerical value as the obtained first mask.
Responding to the first operation at the mask input area and displaying candidate numerical values in an acquisition mode II; in response to a second operation on a target value of the candidate values, treat the target value as the first mask.
The mask input area may be at a first position of the presentation interface, and the first position may be set according to actual situations, such as may be at the right side of the presentation interface, or below the presentation interface, and so on; in addition, the mask input region and the N segment input regions also have a relative position relationship, for example, the mask input region is located on the right side or below the N segment input regions, and the like, which is not exhaustive.
Such as the mask input area 202 shown in fig. 2b, on the rightmost side of the N segment input areas 201 in the presentation interface.
The first operation may be: and clicking the selected key in the mask input area.
The selection key in the mask input area may be a virtual key, and the selection key may be a preset pattern, for example, the downward arrow 2021 of the mask input area in fig. 2b may be the selection key. Accordingly, the first operation is detected at the mask input region when the downward arrow 2021 in fig. 2b is detected.
The candidate value may be one or more, the largest candidate value may be associated with the type of the currently selected or determined network address, for example, if the type of the currently selected or determined network address is IPv4 type, the largest candidate value may be 32, and if the type of the currently selected or determined network address is IPv6 type, the largest candidate value may be 128.
The second operation on the target value of the candidate values may be: a click operation on the target one of the candidate values.
The taking the target value as the first mask may refer to taking the target value as a value of the first mask.
Therefore, by adopting the scheme, the input can be edited without an editing frame, the first mask code can be determined directly through selection, the input correctness is ensured to a certain extent, the operation is convenient, and the correctness of the input network segment information and the overall processing efficiency are improved.
As already explained in the foregoing embodiment, in the case of a subnet mask, the first mask is also limited by the limitation of the second mask of the private network to which the first mask belongs, and therefore, in an embodiment, the determining the candidate value may include:
and under the condition that the mask input area is a selected area of the subnet mask, determining at least partial numerical values from all numerical values as the candidate numerical values based on the second mask of the current private network.
Since the mask input area is a selected area of the subnet mask, that is, the first mask input by the user this time is the subnet mask, the mask input area is limited by the second mask of the CIDR of the private network to which the user belongs.
Determining at least a part of the numerical values from all the numerical values as the candidate numerical values may specifically be: and taking the value which is larger than the second mask in the all values as the candidate value.
For example, the second mask of the private network is 25, the subnet mask, i.e. the selectable range of the first mask, is only 26-32, i.e. the candidate value is 26-32.
In this case, the manner of presenting the candidate values may include: displaying only the candidate values; or, all the values are displayed in different selected states, for example, the values except the candidate value are displayed in a non-selectable state, and the candidate value is displayed in a selectable state.
The display effect of the non-selectable state is different from the display effect of the selectable state, the click operation is not responded in the non-selectable state, and the click operation is responded in the selectable state. The display effect of the non-selectable state may be: background gray, font color graying, etc.; the display effect of the selectable state can be as follows: the background is transparent and the font color is black.
Under the condition that the first mask to be selected at present is a subnet mask, the range of the candidate value can be determined based on the second mask of the private network to which the first mask belongs, so that the correctness of the input network segment information is improved, the time consumption problem caused by input error and modification can be avoided, and the overall processing efficiency is improved.
Fig. 3a is a schematic diagram of a network segment information processing method according to a second embodiment of the disclosure, including:
s301: converting the first network address to obtain a binary character string of the first network address;
s302: determining a validation string in the binary string of the first network address based on the first mask;
s303: and verifying the first mask based on the verification character string to obtain a validity verification result of the first mask.
With reference to fig. 3b, the first network address is converted in S301 to obtain a binary string of the first network address:
s3011: splitting the first network address into N segments based on the preset identifier to obtain N segments of sub information;
the preset identifier may be associated with a network address type of the first network address; for example, the preset identifier of the IPv4 type network address is ".", and the preset identifier of the IPv6 type network address is ":".
Where N is an integer greater than or equal to 1, for example, N is 4, that is, the first network address may be split into 4 segments, so as to obtain 4 segments of sub information.
It is assumed that the first network address is "192. xxx.0.0", which can split the first network address into 4 pieces of sub-information 192, xxx, 0 according to the preset identifier ". The code used may be "partarry" · cidr (') where "partarry" denotes split 4 pieces of sub information, "cidr" denotes first network segment information, where the first network segment information is network segment information including the first network address, and "split (') denotes splitting the first network address using the preset identifier" · ".
Since the first network address may use numbers with different systems in the case of different types of network addresses, for example, the first network address is an IPv4 type network address, and each piece of sub information of the first network address is a 10-system number; the first network address is an IPv6 type network address, and each piece of sub information of the first network address is a 16-system number. Therefore, the step may further include: and converting the N pieces of sub information into decimal. The adopted code may be "part ═ part (part, 10)", where part on the left of the equal sign indicates a number after any one of the N pieces of sub information is converted into 10 systems, "part ()" in "part (part, 10)" indicates a function parsing character string and returns an integer, and (part,10) indicates an integer that converts any one of the N pieces of sub information into 10 systems.
S3012: and converting the current segment sub information in the N segments of sub information into a binary system to obtain an initial binary character string of the current segment sub information.
At this time, each piece of sub information in the N pieces of sub information is decimal number of 0-255, so that the current piece of sub information can be directly converted into a corresponding binary character string by using a toString (2) method of JavaScript.
S3013: judging whether the length of the initial binary string of the current segment of sub information is equal to a preset length, if so, taking the initial binary string of the current segment of sub information as the binary string of the current segment of sub information, and then executing S3015; otherwise, S3014 is performed.
Wherein the preset length is related to a network address type of the first network address, for example, the first network address is an IPv4 type network address, and the preset length is 8; the first network address is an IPv6 type network address, and the preset length is 32.
Assuming that the first network address is a network address of IPv4 type, which is divided into 4 pieces of sub information including 192, xxx, 0 and 0, the current piece of sub information is "192", 192 can be processed into an initial binary string "11000000", and the length of the initial binary string is 8, then it can be directly used as the binary string of the current piece of sub information.
S3014: and supplementing 0 in front of the initial binary character string of the current segment of sub information to obtain the binary character string of the current segment of sub information.
S3015: judging whether the N sections of sub information are processed completely, if not, returning to execute S3012; and if the network address is finished, merging the binary character strings respectively corresponding to the N sections of sub information to obtain the binary character string of the first network address.
Illustratively, as shown in fig. 4, the first segment information 192.xxx.0.0/16, the first mask is 16, and the first network address is an IPv4 type network address: 192. xxx.0.0; the first network address is split into 4 segments of 192, xxx, 0 according to ". this first network address is then respectively binary-converted, for example, 192 is directly processed into binary character strings in 8-bit 01 format, wherein if less than 8 bits are complemented by 0, 192 can be processed into 110000000000, and the whole network address can be processed into 32-bit 01 character strings, specifically, as shown in fig. 4, the binary character string" 11000000 yyyyyyyyyyyy 0000000000000000 "of the first network address 192.xxx.0.0, wherein the first segment 192 corresponds to 11000000, the second segment xxx corresponds to yyyyyyyy, the third segment 0 corresponds to 0000000000000000, and the fourth segment 0 corresponds to 000000000000.
The determining of the authentication string in the binary string of the first network address based on the first mask may be extracting a portion of characters in the binary string of the first network address as an authentication string based on the first mask.
The validity verification result of the first mask may include valid or invalid.
Therefore, by adopting the scheme, the first network address can be converted to obtain the corresponding binary character string, the verification character string is further extracted from the first network address based on the first mask, and the first mask is verified based on the verification character string. Therefore, under the condition that the first network address and the first mask are obtained, the first mask can be verified based on the first network address, the problem that the mask validity cannot be verified only by verifying the mask format is solved, the accuracy of the input first network address and the input first mask is improved, and the overall processing efficiency is further improved.
In one embodiment, the determining a validation string of the binary string of the first network address based on the first mask includes:
based on the first mask, remaining binary characters except consecutive M-bit binary characters from a highest bit in the binary character string of the first network address as the verification character string; m is equal to the first mask, and M is an integer greater than or equal to 1.
As shown in fig. 4, the binary string of the first network address 192.xxx.0.0 is "11000000 yyyyyyyyy000000000000", and assuming that the first mask is 16, the verification string is "0000000000000000".
According to the processing, the binary string of the first network address is obtained through binary conversion after the first network address is obtained, and the subsequent verification processing by adopting the binary string can be simpler and quicker, so that the validity of the first mask code can be verified accurately in real time, invalid network segment information is prevented from being submitted, and the overall processing efficiency is improved.
The verifying the first mask based on the verification character string to obtain a validity verification result of the first mask, including: determining that a validity verification result of the first mask is invalid if the verification string contains a first value; and determining that the validity verification result of the first mask is valid when the verification string does not contain the first value.
Wherein the first value is 1.
That is, if the first network address is filled correctly, characters with a value of 1 should not exist in binary characters other than the M-bit binary character corresponding to the first mask, and if the characters exist, it is determined that the validity verification result of the first mask is invalid.
Further, the method can also comprise the following steps: displaying a verification result that the first mask is invalid; and responding to the modification instruction, returning to execute the processing of the foregoing S101, that is, when the user checks that the first mask of the first network segment information input this time is invalid, the user may select to input the first network segment information again.
In the related art, the client can only perform format check on the network segment information at the client, and cannot check the content correctness of the network segment information filled by the user if the network segment information is invalid and prompt the user immediately. According to the embodiment of the disclosure, after the first network address is obtained, the binary string of the first network address is obtained through binary conversion, the verification string is extracted from the binary string of the first network address based on the first mask, and the validity verification result of the first mask is determined based on whether the verification string contains a first value, so that the validity of the first mask can be verified in real time and effectively, the problem that processing effect is affected due to error rediscovery after invalid network segment information is submitted is avoided, and the overall processing efficiency is improved.
In one embodiment, as shown in fig. 5, the method further includes:
s501: converting the third network address to a binary string of the third network address, and converting the first network address to a binary string of the first network address.
S502: obtaining a first string to be compared from the binary string of the third network address based on the first mask, and obtaining a reference string from the binary string of the first network address.
S503: and under the condition that the first character string to be compared is the same as the reference character string, determining that the third network address and the first network address are in the same network segment.
Before executing S501, the third network address needs to be acquired first; the manner of acquiring the third network address may include: by way of user input, user selection, or user pre-setting. That is, the third network address may be any one of a network address input by a user or a network address selected by a user.
In particular, the third network address may be an IP address; in addition, the type of the third network address and the type of the first network address in the first network segment information can be the same or different. For example, the type of the third network address and the first network address are both IPv4 type network addresses or both IPv6 type network addresses.
The obtaining a first character string to be aligned from the binary string of the third network address based on the first mask and obtaining a reference character string from the binary string of the first network address may include: acquiring continuous M-bit binary characters from the binary character string of the third network address as the first character string to be compared based on the first mask, and acquiring continuous M-bit binary characters from the highest bit of the binary character string of the first network address as the reference character string; m is equal to the first mask.
For example, the first network address 192.xxx.0.0 is converted into a binary string "11000000 yyyyyyyyy 000000000000", and the bit number "11000000 yyyyyyyy" corresponding to the first mask 16 is a reference string. The manner of determining the first to-be-compared character string of the third network address is similar to that of the first to-be-compared character string of the third network address and is not repeated.
Determining that the third network address and the first network address are in the same network segment under the condition that the first to-be-compared character string is the same as the reference character string may specifically include:
judging whether the value of each binary character in the first character string to be compared and the reference character string is the same or not;
under the condition that the value of each binary character in the first character string to be compared and the reference character string is the same, determining that the third network address and the first network address are in the same network segment;
otherwise, determining that the third network address and the first network address are in different network segments.
It should be noted that the third network address is different from the first network address, for example, the first network address refers to a network address in the first network segment information; the third network address may be a network address plus a host address. According to the embodiment of the present disclosure, assuming that the first mask in the first segment information is 10, it may be determined that the third network address is in the first segment under the condition that the reference character string and the first to-be-compared character string are the same.
The method comprises the steps of converting two network addresses into binary character strings, acquiring the reference character string by adopting a first mask and judging whether the two network addresses are in the same network segment by adopting the first character string to be compared, so that the judgment efficiency and the judgment accuracy can be ensured, thereby providing reliable reference for subsequent processing and improving the overall processing efficiency.
In one embodiment, as shown in fig. 6, the method may further include:
s601: converting a fourth network address in fourth network segment information into a binary character string of the fourth network address, and converting the first network address into a binary character string of the first network address;
s602: taking the minimum value of the first mask and a fourth mask of the fourth network segment information as a target mask;
s603: acquiring a second character string to be compared from the binary character string of the fourth network address based on the target mask, and acquiring a third character string to be compared from the binary character string of the first network address based on the target mask;
s604: and determining that the fourth network segment information is overlapped with the first network segment information under the condition that the second character string to be compared is the same as the third character string to be compared.
Before S601 is executed, fourth segment information needs to be acquired. The fourth network segment information may be obtained through user input or user preset. That is, the fourth segment information may be any segment information input by a user.
Specifically, binary conversion is performed on the fourth network address and the first network address respectively to obtain a binary character string of the fourth network address and a binary character string of the first network address.
The fourth mask may be different from the first mask. Taking a minimum value of the first mask and a fourth mask of the fourth network segment information as a target mask, where the minimum value may be obtained by comparing a size between the first mask and the fourth mask, and if the first mask is smaller than the fourth mask, the target mask is the first mask; otherwise, the target mask is the fourth mask.
If the masks in the two network segment information are the same, the network addresses can be directly seen to be the same, and the processing method is not needed to be adopted to determine whether the two network segment information are overlapped. The present embodiment mainly aims at that the masks are different, and at this time, the network address information in the two network segment information cannot simply determine whether the same prefix exists, so that by adopting the scheme provided by the present embodiment, based on the minimum mask in the two network segment information as the target mask, the character strings to be compared are respectively extracted from the binary character strings of the two network addresses based on the target mask, and based on whether the extracted two character strings to be compared are completely the same, whether the two network segment information are overlapped is determined.
In addition, if it is determined that the fourth segment information overlaps with the first segment information, it may be determined which of the fourth segment information and the first segment information is the segment information of the subnet and which is the segment information of the private network to which the fourth segment information and the first segment information belong based on whether the first mask is larger than the fourth mask.
For example, if the first mask is larger than the four masks, the first segment information is segment information of a subnet, and the fourth segment information is segment information of a private network to which the first segment belongs.
The obtaining a second to-be-aligned character string from the binary string of the fourth network address based on the target mask, and obtaining a third to-be-aligned character string from the binary string of the first network address based on the target mask may include: acquiring continuous K-bit binary characters from the binary character string of the fourth network address based on the target mask as the second character string to be compared, and acquiring continuous K-bit binary characters from the highest bit of the binary character string of the first network address as the third character string to be compared; k is an integer greater than or equal to 1, K being equal to the target mask.
Determining that the fourth network segment information overlaps with the first network segment information under the condition that the second to-be-compared character string is the same as the third to-be-compared character string may specifically include:
judging whether the value of each binary character in the second character string to be compared is the same as that of each binary character in the third character string to be compared;
determining that the fourth network segment information is overlapped with the first network segment information under the condition that the value of each binary character in the second character string to be compared is the same as that of each binary character in the third character string to be compared;
otherwise, determining that the fourth network segment information is not overlapped with the first network segment information.
Therefore, by adopting the scheme, different network segment information can be converted into the binary string which is easy to process, and the prefixes corresponding to the binary strings of the network addresses are extracted through the mask contained in each network segment information respectively, so that the two network segment information are judged and determined to be overlapped. Therefore, the relationship between the two network segment information can be rapidly determined, and more reliable reference information can be provided for subsequent related processing, so that the overall processing efficiency is improved.
An embodiment of a second aspect of the present disclosure provides a network segment information processing apparatus, as shown in fig. 7a, including:
a range determining module 701, configured to, in response to acquiring a first mask, determine fillable ranges corresponding to the N segment input areas, respectively, based on the first mask; n is an integer greater than or equal to 1;
a display module 702, configured to display the fillable ranges in the N segment input areas respectively;
a network segment information determining module 703, configured to, in response to acquiring N pieces of input information in the N segment input areas, generate a first network address based on the N pieces of input information, and determine first network segment information based on the first network address and the first mask.
The range determining module 701 is configured to determine a first character string based on the first mask; the first character string comprises a first type of characters and a second type of characters, wherein the value of the first type of characters is a first value, and the value of the second type of characters is a second value; dividing the first character string to obtain N character string groups; and determining the fillable ranges respectively corresponding to the N segmented input areas based on the first type of characters and/or the second type of characters respectively contained in the N character string groups.
The range determining module 701 is configured to determine a first character string according to the first mask and the second mask; the first character string comprises a first type of character and a second type of character, the value of the first type of character is a first value, and the value of the second type of character is a second value; the number of the first type characters is the difference value of the first mask and the second mask; the second mask is a mask in network segment information of a private network to which the first mask belongs; determining at least one adjusting value corresponding to each of the N segmented input areas based on the first type of characters and/or the second type of characters contained in the N character string groups obtained by dividing the first character string; and determining the fillable ranges respectively corresponding to the N segmented input areas based on the N segmented initial values and the at least one adjusting value respectively corresponding to the N segmented input areas.
On the basis of fig. 7a, the present embodiment further provides that the apparatus shown in fig. 7b further includes:
a mask obtaining module 704, configured to expose candidate values in response to a first operation at a mask input area; in response to a second operation on a target value of the candidate values, treat the target value as the first mask.
The mask obtaining module 704 is configured to, when the mask input area is a selected area of a subnet mask, determine at least a part of numerical values from all numerical values as the candidate numerical values based on a second mask included in second segment information of the private network to which the mask belongs.
The device, still include:
a mask validity verification module 705, configured to convert the first network address to obtain a binary string of the first network address; determining a validation string in the binary string of the first network address based on the first mask; and verifying the first mask based on the verification character string to obtain a validity verification result of the first mask.
The mask validity verification module 705 is configured to use, as the verification string, the remaining binary characters except the consecutive M-bit binary characters from the highest bit in the binary character string of the first network address based on the first mask; m is an integer greater than or equal to 1, M being equal to the first mask.
The mask validity verifying module 705 is configured to determine that a validity verifying result of the first mask is invalid when the verification string includes a first value; and determining that the validity verification result of the first mask is valid when the verification string does not contain the first value.
The device, still include:
a first comparison module 706 for converting a third network address into a binary string of the third network address and converting the first network address into a binary string of the first network address; obtaining a first string to be compared from the binary string of the third network address based on the first mask, and obtaining a reference string from the binary string of the first network address; and under the condition that the first character string to be compared is the same as the reference character string, determining that the third network address and the first network address are in the same network segment.
The device, still include:
a second comparing module 707, configured to convert a fourth network address in fourth network segment information into a binary string of the fourth network address, and convert the first network address into a binary string of the first network address; taking the minimum value of the first mask and a fourth mask of the fourth network segment information as a target mask; acquiring a second character string to be compared from the binary character string of the fourth network address based on the target mask, and acquiring a third character string to be compared from the binary character string of the first network address based on the target mask; and determining that the fourth network segment information is overlapped with the first network segment information under the condition that the second character string to be compared is the same as the third character string to be compared.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the personal information of the related user all accord with the regulations of related laws and regulations, and do not violate the good customs of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 8 illustrates a schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 8, the apparatus 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)802 or a computer program loaded from a storage unit 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The calculation unit 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
A number of components in the device 800 are connected to the I/O interface 805, including: an input unit 806, such as a keyboard, a mouse, or the like; an output unit 807 such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, optical disk, or the like; and a communication unit 809 such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Computing unit 801 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and the like. The calculation unit 801 executes the respective methods and processes described above, such as the network segment information processing method. For example, in some embodiments, the network segment information processing method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and/or installed onto device 800 via ROM 802 and/or communications unit 809. When loaded into RAM 803 and executed by computing unit 801, a computer program may perform one or more of the steps of the network segment information processing method described above. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the network segment information processing method in any other suitable manner (e.g., by way of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server with a combined blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel or sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (23)

1. A network segment information processing method comprises the following steps:
in response to acquiring a first mask, determining fillable ranges respectively corresponding to the N segmented input areas based on the first mask; n is an integer greater than or equal to 1;
respectively displaying the corresponding fillable ranges in the N segmented input areas;
and in response to acquiring N pieces of input information in the N segmented input areas, generating a first network address based on the N pieces of input information, and determining first network segment information based on the first network address and the first mask.
2. The method of claim 1, wherein said determining fillable extents for each of the N segmented input areas based on the first mask comprises:
determining a first character string based on the first mask; the first character string comprises a first type of characters and a second type of characters, wherein the value of the first type of characters is a first value, and the value of the second type of characters is a second value;
dividing the first character string to obtain N character string groups;
and determining the fillable ranges respectively corresponding to the N segmented input areas based on the first type of characters and/or the second type of characters respectively contained in the N character string groups.
3. The method of claim 1, wherein said determining fillable extents for each of the N segmented input areas based on the first mask comprises:
determining a first character string according to the first mask and the second mask; the first character string comprises a first type of character and a second type of character, the value of the first type of character is a first value, and the value of the second type of character is a second value; the number of the first type characters is the difference value of the first mask and the second mask; the second mask is a mask in network segment information of a private network to which the first mask belongs;
determining at least one adjusting value corresponding to each of the N segmented input areas based on the first type of characters and/or the second type of characters contained in the N character string groups obtained by dividing the first character string;
and determining the fillable ranges respectively corresponding to the N segmented input areas based on the N segmented initial values and the at least one adjusting value respectively corresponding to the N segmented input areas.
4. The method of claim 1, further comprising:
presenting the candidate value in response to a first operation at the mask input region;
in response to a second operation on a target value of the candidate values, treat the target value as the first mask.
5. The method of claim 4, further comprising:
and under the condition that the mask input area is a selected area of the subnet mask, determining at least part of numerical values from all numerical values as the candidate numerical values based on a second mask contained in second network segment information of the private network.
6. The method of any of claims 1-5, further comprising:
converting the first network address to obtain a binary character string of the first network address;
determining a validation string in the binary string of the first network address based on the first mask;
and verifying the first mask based on the verification character string to obtain a validity verification result of the first mask.
7. The method of claim 6, wherein the determining a validation string of the binary string of the first network address based on the first mask comprises:
based on the first mask, remaining binary characters except consecutive M-bit binary characters from a highest bit in the binary character string of the first network address as the verification character string; m is an integer greater than or equal to 1, M being equal to the first mask.
8. The method of claim 6, wherein the verifying the first mask based on the verification string to obtain a validity verification result of the first mask comprises:
determining that a validity verification result of the first mask is invalid if the verification string contains a first value;
and determining that the validity verification result of the first mask is valid when the verification string does not contain the first value.
9. The method of any of claims 1-5, further comprising:
converting a third network address to a binary string of the third network address, converting the first network address to a binary string of the first network address;
obtaining a first string to be compared from the binary string of the third network address based on the first mask, and obtaining a reference string from the binary string of the first network address;
and under the condition that the first character string to be compared is the same as the reference character string, determining that the third network address and the first network address are in the same network segment.
10. The method of any of claims 1-5, further comprising:
converting a fourth network address in fourth network segment information into a binary character string of the fourth network address, and converting the first network address into a binary character string of the first network address;
taking the minimum value of the first mask and a fourth mask of the fourth network segment information as a target mask;
acquiring a second character string to be compared from the binary character string of the fourth network address based on the target mask, and acquiring a third character string to be compared from the binary character string of the first network address based on the target mask;
and determining that the fourth network segment information is overlapped with the first network segment information under the condition that the second character string to be compared is the same as the third character string to be compared.
11. A network segment information processing apparatus comprising:
the range determining module is used for determining fillable ranges corresponding to the N segmented input areas respectively based on a first mask in response to the acquisition of the first mask; n is an integer greater than or equal to 1;
the display module is used for respectively displaying the corresponding fillable ranges in the N segmented input areas;
and the network segment information determining module is used for responding to N pieces of input information acquired in the N segmented input areas, generating a first network address based on the N pieces of input information, and determining first network segment information based on the first network address and the first mask.
12. The apparatus of claim 11, wherein the range determination module is to determine a first string based on the first mask; the first character string comprises a first type of characters and a second type of characters, wherein the value of the first type of characters is a first value, and the value of the second type of characters is a second value; dividing the first character string to obtain N character string groups; and determining the fillable ranges respectively corresponding to the N segmented input areas based on the first type of characters and/or the second type of characters respectively contained in the N character string groups.
13. The apparatus of claim 11, wherein the range determination module is configured to determine a first string according to the first mask and a second mask; the first character string comprises a first type of character and a second type of character, the value of the first type of character is a first value, and the value of the second type of character is a second value; the number of the first type characters is the difference value of the first mask and the second mask; the second mask is a mask in network segment information of a private network to which the first mask belongs; determining at least one adjusting value corresponding to each of the N segmented input areas based on the first type of characters and/or the second type of characters contained in the N character string groups obtained by dividing the first character string; and determining the fillable ranges respectively corresponding to the N segmented input areas based on the N segmented initial values and the at least one adjusting value respectively corresponding to the N segmented input areas.
14. The apparatus of claim 11, further comprising:
a mask obtaining module for presenting candidate values in response to a first operation at a mask input region; in response to a second operation on a target value of the candidate values, treat the target value as the first mask.
15. The apparatus according to claim 14, wherein the mask obtaining module is configured to, when the mask input area is a selected area of a subnet mask, determine at least a part of the total values as the candidate values based on a second mask included in second segment information of the private network.
16. The apparatus of any of claims 11-15, further comprising:
the mask validity verification module is used for converting the first network address to obtain a binary character string of the first network address; determining a validation string in the binary string of the first network address based on the first mask; and verifying the first mask based on the verification character string to obtain a validity verification result of the first mask.
17. The apparatus of claim 16, wherein the mask validity verification module is to determine, based on the first mask, remaining binary characters, other than consecutive M-bit binary characters from a highest order bit in the binary character string of the first network address, as the verification character string; m is an integer greater than or equal to 1, M being equal to the first mask.
18. The apparatus according to claim 16, wherein the mask validity verification module is configured to determine that the validity verification result of the first mask is invalid if the verification string contains a first value; and determining that the validity verification result of the first mask is valid when the verification string does not contain the first value.
19. The apparatus of any of claims 11-15, further comprising:
the first comparison module is used for converting a third network address into a binary character string of the third network address and converting the first network address into a binary character string of the first network address; obtaining a first string to be compared from the binary string of the third network address based on the first mask, and obtaining a reference string from the binary string of the first network address; and under the condition that the first character string to be compared is the same as the reference character string, determining that the third network address and the first network address are in the same network segment.
20. The apparatus of any of claims 11-15, further comprising:
the second comparison module is used for converting a fourth network address in fourth network segment information into a binary character string of the fourth network address and converting the first network address into the binary character string of the first network address; taking the minimum value of the first mask and a fourth mask of the fourth network segment information as a target mask; acquiring a second character string to be compared from the binary character string of the fourth network address based on the target mask, and acquiring a third character string to be compared from the binary character string of the first network address based on the target mask; and determining that the fourth network segment information is overlapped with the first network segment information under the condition that the second character string to be compared is the same as the third character string to be compared.
21. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10.
22. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-10.
23. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-10.
CN202111565171.5A 2021-12-20 2021-12-20 Network segment information processing method and device, electronic equipment and storage medium Active CN114363167B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111565171.5A CN114363167B (en) 2021-12-20 2021-12-20 Network segment information processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111565171.5A CN114363167B (en) 2021-12-20 2021-12-20 Network segment information processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114363167A true CN114363167A (en) 2022-04-15
CN114363167B CN114363167B (en) 2024-03-19

Family

ID=81101989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111565171.5A Active CN114363167B (en) 2021-12-20 2021-12-20 Network segment information processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114363167B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115460173A (en) * 2022-07-21 2022-12-09 浪潮通信技术有限公司 Method and device for generating subnet network address of virtual private cloud network

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060072601A1 (en) * 2003-09-15 2006-04-06 Zhidan Cheng Virtual IP interface
CN104168295A (en) * 2014-09-11 2014-11-26 东南大学 System and processing method based on IPSec hardware firewall in IPv6
CN106487939A (en) * 2015-08-26 2017-03-08 阿里巴巴集团控股有限公司 A kind of method and apparatus determining User IP subnet, a kind of electronic equipment
CN107682471A (en) * 2017-10-17 2018-02-09 新华三云计算技术有限公司 A kind of method and apparatus being adjusted to network address
CN108319589A (en) * 2018-03-14 2018-07-24 腾讯科技(深圳)有限公司 Parameter string processing method, apparatus, computer readable storage medium and equipment
CN111107173A (en) * 2018-10-29 2020-05-05 中国移动通信集团浙江有限公司 IP address planning method and system of IP bearing network
CN111586202A (en) * 2020-05-09 2020-08-25 北京首都在线科技股份有限公司 Network mask checking method and device, electronic equipment and storage medium
US20200314058A1 (en) * 2019-04-01 2020-10-01 International Business Machines Corporation Automatic ip range selection
CN112600954A (en) * 2021-03-04 2021-04-02 城云科技(中国)有限公司 IPv4 address matching method, electronic device and storage medium
CN112787938A (en) * 2021-01-14 2021-05-11 北京星网锐捷网络技术有限公司 Routing table item configuration method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060072601A1 (en) * 2003-09-15 2006-04-06 Zhidan Cheng Virtual IP interface
CN104168295A (en) * 2014-09-11 2014-11-26 东南大学 System and processing method based on IPSec hardware firewall in IPv6
CN106487939A (en) * 2015-08-26 2017-03-08 阿里巴巴集团控股有限公司 A kind of method and apparatus determining User IP subnet, a kind of electronic equipment
CN107682471A (en) * 2017-10-17 2018-02-09 新华三云计算技术有限公司 A kind of method and apparatus being adjusted to network address
CN108319589A (en) * 2018-03-14 2018-07-24 腾讯科技(深圳)有限公司 Parameter string processing method, apparatus, computer readable storage medium and equipment
CN111107173A (en) * 2018-10-29 2020-05-05 中国移动通信集团浙江有限公司 IP address planning method and system of IP bearing network
US20200314058A1 (en) * 2019-04-01 2020-10-01 International Business Machines Corporation Automatic ip range selection
CN111586202A (en) * 2020-05-09 2020-08-25 北京首都在线科技股份有限公司 Network mask checking method and device, electronic equipment and storage medium
CN112787938A (en) * 2021-01-14 2021-05-11 北京星网锐捷网络技术有限公司 Routing table item configuration method and device
CN112600954A (en) * 2021-03-04 2021-04-02 城云科技(中国)有限公司 IPv4 address matching method, electronic device and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
孙杰挺;: "快速划分子网方法探究", no. 12 *
王恒青;宋如敏;: "在TCP/IP网络模型下IP地址与子网掩码的计算解析", no. 32 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115460173A (en) * 2022-07-21 2022-12-09 浪潮通信技术有限公司 Method and device for generating subnet network address of virtual private cloud network
CN115460173B (en) * 2022-07-21 2023-09-26 浪潮通信技术有限公司 Virtual private cloud network subnet network address generation method and device

Also Published As

Publication number Publication date
CN114363167B (en) 2024-03-19

Similar Documents

Publication Publication Date Title
CN106919555B (en) System and method for field extraction of data contained within a log stream
CN110008045A (en) Polymerization, device, equipment and the storage medium of micro services
CN112597754A (en) Text error correction method and device, electronic equipment and readable storage medium
EP3896595A1 (en) Text key information extracting method, apparatus, electronic device, storage medium, and computer program product
CN108243154B (en) verification code data processing method and device
US20220147498A1 (en) Generation of schemas with error resolve
CN114363167A (en) Network segment information processing method, device, electronic equipment and storage medium
JP2021168190A (en) Method, apparatus, electronic device, and storage medium for providing applet service capability
CN112949290B (en) Text error correction method and device and communication equipment
CN113656124A (en) Login page generation method and device
CN115344315A (en) Skin switching method and device of applet page and electronic equipment
CN113312560A (en) Group detection method and device and electronic equipment
CN112818387A (en) Method, apparatus, storage medium, and program product for model parameter adjustment
CN111737534A (en) File processing method, device and equipment
CN113313806B (en) Shadow effect rendering method and device, storage medium and electronic device
JP7135142B2 (en) Code reuse processing method, device, electronic device, storage medium and computer program product
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN112822302B (en) Data normalization method and device, electronic equipment and storage medium
CN113691403A (en) Topological node configuration method, related device and computer program product
CN108170557B (en) Method and apparatus for outputting information
CN111444535A (en) Method, apparatus, and computer storage medium for generating aggregated data tags
CN112925482B (en) Data processing method, device, system, electronic equipment and computer storage medium
CN113312549B (en) Domain name processing method and device
US10755031B2 (en) Cognitive glyph building
CN114553787A (en) Flow distribution method, 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
GR01 Patent grant
GR01 Patent grant