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

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

Info

Publication number
CN114363167B
CN114363167B CN202111565171.5A CN202111565171A CN114363167B CN 114363167 B CN114363167 B CN 114363167B CN 202111565171 A CN202111565171 A CN 202111565171A CN 114363167 B CN114363167 B CN 114363167B
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.)
Active
Application number
CN202111565171.5A
Other languages
Chinese (zh)
Other versions
CN114363167A (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

Abstract

The disclosure provides a network segment information processing method, a 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 corresponding to the N segmentation input regions respectively based on the first mask; n is an integer greater than or equal to 1; respectively displaying the corresponding fillable ranges in the N segmentation input areas; in response to acquiring N pieces of input information in the N segmented input regions, a first network address is generated based on the N pieces of input information, and first segment information is determined based on the first network address and the first mask. By the method provided by the disclosure, the accuracy of the input network segment information and the overall processing efficiency can be improved.

Description

Network segment information processing method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to the field of cloud computing.
Background
Network configuration is a very important component in cloud computing products. The user may configure the segment information through the console, which may result in the user's entire service being unavailable if the configured segment information is incorrect. Therefore, how to ensure the correctness of the input network segment information and thus the overall processing efficiency is a problem to be solved.
Disclosure of Invention
The disclosure provides a network segment information processing method, a network segment information processing device, electronic equipment and a storage medium.
According to a first aspect of the present disclosure, there is provided a network segment information processing method, including:
in response to acquiring a first mask, determining fillable ranges corresponding to the N segmentation input regions respectively based on the first mask; n is an integer greater than or equal to 1;
respectively displaying the corresponding fillable ranges in the N segmentation input areas;
in response to acquiring N pieces of input information in the N segmented input regions, a first network address is generated based on the N pieces of input information, and first segment information is determined 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 segmentation input areas respectively based on the first mask in response to the first mask; n is an integer greater than or equal to 1;
the display module is used for displaying the corresponding fillable ranges in the N segmentation input areas respectively;
and the network segment information determining module is used for responding to N pieces of input information acquired in the N pieces of 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 described above.
According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing 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 a method according to the first aspect described above.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
By adopting the scheme, the fillable range corresponding to each segmented input area can be determined according to the obtained first mask and displayed, then a first network address is generated according to the input information obtained by obtaining each segmented input area, and the first network segment information is determined based on the first network address and the first mask. Thus, the accuracy of the input network segment information and the overall processing efficiency can be improved.
Drawings
The drawings are for 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 range 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 diagram of a process flow of masking validity masks in a segment information processing method according to an embodiment of the present disclosure;
FIG. 3b is a flow chart illustrating a process 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 first segment information according to an embodiment of the present disclosure;
FIG. 5 is a flow chart of a process for determining whether a network address is within the same network segment according to another embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a process flow for determining whether two pieces of segment information overlap according to another embodiment of the present disclosure;
FIG. 7a is a schematic diagram of a segment information processing device according to an embodiment of the present disclosure;
FIG. 7b is another schematic diagram of a segment information processing device 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 of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one 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 corresponding to the N segmentation input regions respectively 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 segmentation input areas;
s103: in response to acquiring N pieces of input information in the N segmented input regions, a first network address is generated based on the N pieces of input information, and first segment information is determined 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 range corresponding to each segmented input area can be determined according to the obtained first mask and displayed, then a first network address is generated according to the input information obtained by obtaining each segmented input area, 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 affected due to the fact that the information is invalid and is modified again due to filling errors can be avoided, the probability of filling errors can be reduced, and the accuracy of the input network segment information and the overall processing efficiency are improved.
Wherein the maximum value of the first mask may be related to a 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 (IPv 4, internet Protocol version 4), and the maximum value of the first mask is 32; the currently selected or determined network address is of the type internet protocol version 6 (IPv 6, internet Protocol version 6), the maximum value of the first mask is 128.
The obtaining the first mask may be: in response to acquiring an input numerical value in a mask input area in a presentation interface, taking the input numerical value as the first mask;
or, in response to an operation of selecting a target value from at least one candidate value presented in the mask input area in the presentation interface, the target value is taken as the first mask.
The display interface may further include the N segmentation input regions in addition to the mask input regions. Each of the N segment input regions is for retrieving an address segment of the first network address. N may be an integer greater than or equal to 1, preferably N is equal to 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-region may be used for displaying a fillable range corresponding to each segment input region; the second sub-area may be used to obtain input information, that is, the second sub-area may fill in the corresponding input information; the relative positional relationship of the first sub-region and the second sub-region may be: the first sub-region is below the second sub-region.
The displaying the fillable range in the N segment input areas may specifically be: and displaying the fillable range corresponding to each segmented input region at the first subarea of each segmented input region of the N segmented input regions. Wherein, the fillable range can be a numerical value area, for example, the fillable range is 0-255; alternatively, the fillable range may be one or more specific values, such as a fillable range of 0, or a fillable range of 127 or 255.
The displaying the fillable range corresponding to each segment input area at the first sub-area of each segment input area can be performed in various ways:
in the first aspect, no matter at which input region a numerical value is to be input, the fillable range corresponding to each of the N segmented input regions is kept displayed.
In a second mode, in response to a third operation for the second sub-region of the i-th segment input region of the N segment input regions, displaying a corresponding fillable range at the first sub-region of the i-th segment input region, and not displaying the corresponding fillable range at the first sub-region of other segment input regions than the i-th segment 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 i-th segment input region; or the position of the mouse is positioned in the second subarea of the ith segmented input area.
The second sub-areas corresponding to the N segmented input areas respectively may be all editable states; or, according to the fillable range corresponding to each segment input area, controlling the second sub-area of the different segment input areas to be in different states, for example, if the fillable range corresponding to the j-th segment input area only includes 1 numerical value (such as 0), the second sub-area of the j-th segment input area may be controlled to be in a non-editable state, and the input information of the second sub-area of the j-th segment input area may be directly set to be 0; if the fillable range corresponding to the jth segment input area contains a plurality of values, the second sub-area of the jth segment 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 pieces of 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 (IPv 4, internet Protocol version 4), and the preset identifier is ""; the type of the currently selected or determined network address is internet protocol version 6 (IPv 6, 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; the order from the 1 st input area to the 4 th input area is used as the arrangement order of the 4 input information; and combining the 4 input information according to the arrangement sequence by adopting the preset identifier "," so as to obtain the first network address as 192.xxx.0.0".
Based on the first network address and the first mask, determining the 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 actual situations, 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", the first network segment information is determined to be "192.Xxx.0.0/16" according to the preset format.
The first network segment information may specifically be class-free Inter-Domain Routing (CIDR) information.
In addition, it should be noted that other operation areas may be displayed in the display interface for the user to input or select other information. For example, a type selection area may also be displayed in the display interface, where there may be multiple candidate network address types, 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 that the currently selected or determined network address type is the target network address type.
By adopting the scheme, the fillable range corresponding to each segmented input area can be determined according to the obtained first mask, the fillable range is displayed, the first network address is generated according to the input information obtained by obtaining each segmented input area, 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 affected due to the fact that the information is invalid and is modified again due to filling errors can be avoided, the probability of filling errors can be reduced, and the accuracy of the input network segment information and the overall processing efficiency are improved.
In an embodiment, the determining, based on the first mask, the fillable ranges corresponding to the N segment input areas respectively may specifically include:
determining a first string based on the first mask; the first character string comprises a first type character and a second type character, the value of the first type character is a first value, and the value of the second type character is a second value;
dividing the first character string to obtain N character string groups;
and determining the fillable ranges corresponding to the N segmentation input areas respectively based on the first type characters and/or the second type characters respectively contained in the N character string groups.
Wherein 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, the type of the currently selected or determined network address is IPv4, and the maximum value of the first mask is 32; and 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 be a binary character string; the first string contains a total number of bits that is also related to the type of currently selected or determined network address. For example, the currently selected or determined network address is an IPv4 type network address, and the total number of bits of the first 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 bits of the first string is 128.
The number and the positions 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 consecutive M-bit binary characters from the most significant bit in the first string. The first type character has a first value of 1, that is to say the first type character has a value of 1.
The number and the positions of the second type of characters in the first character string are specifically as follows: and the M+1st character and all the following characters 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 most significant bit in the first character string. The value of the second type character is a first value, and the first value is 0, that is, the second type character is 0.
For example, assuming that the currently selected or determined network address is of the 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 denoted as "11111111 00000000 00000000 00000000".
The dividing the first string to obtain N groups of strings may specifically be: and respectively and sequentially selecting a preset number of characters from the highest bit 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 may be 32. Taking the network address of which the type of the currently selected or determined network address is IPv4 as an example, the first string corresponding to the first mask is divided into 4 string groups, and each string group includes 8-bit characters. Taking the network address of which the type of the currently selected or determined network address is the IPv6 type as an example, the first string corresponding to the first mask is divided into 4 string groups, and each string group includes 32-bit characters.
The determining the fillable range corresponding to the N segment input areas based on the first type characters and/or the second type characters respectively included in the N character string groups may specifically include:
judging whether the r character string group in the N character string groups contains the first type characters or not; if the r character string group does not contain the first type character, the fillable range of the r segmentation input area corresponding to the r character string group is 0; r is an integer of 1 or more and N or less;
If the r character string group contains x first type characters, respectively taking first values from first x character bits of the r character string group and taking second values from the rest character bits, and calculating to obtain values of x target system; respectively combining and adding the values of the x target system 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 greater than or equal to 1.
The target system is 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, the target system is a decimal system, and if the type of the currently selected or determined network address is an IPv6 type network address, the target system is a hexadecimal system.
Wherein, the grouping the first x character bits of the r-th character string into first values and the remaining character bits into second values respectively, and calculating to obtain values of x target systems may include:
taking 1 from the 1 st character bit and 0 from the rest character bits of the r-th character string group, and calculating to obtain a 1 st numerical value of the target system;
And the same is repeated until the xth character bit of the xth character string group is 1, and the rest character bits are 0, and the value of the xth target system is obtained through calculation.
The step of respectively combining and adding the values of the x target systems to obtain at least one value may be: and combining and adding any one or more of the values of the x target systems respectively to obtain at least one value. Wherein the specific number of the at least one value can be equal to 2 x -1. For example, x is 2, the 1 st character bit and the 2 nd character bit of the highest bit in the 8 th binary character string in the r-th character string group are respectively taken as 1, and 2 is calculated 7 、2 6 Two values, which are combined and added respectively to obtain 3 values.
The determining, based on the at least one value, a fillable range corresponding to the r-th segment input area may include: and taking the at least one value and 0 as the fillable range of the r-th segment input area.
Taking the network address of which the type is currently selected or determined to be IPv4 as an example, the following description will be given:
assuming that the first mask=18, that is, the first 18 bits of the first string have a value of 1, and the remaining values have values of 0; dividing the first string into 4 string groups, wherein the 1 st string group is "11111111", and 2 7 、2 6 ~2 0 Any one or more numerical values of the three-dimensional matrix are combined and added to obtain 2 8 -1 number, the final fillable range of the 1 st segment input area comprising 0 and 2 as described above 8 -1 number, i.e. 0-255. The 2 nd string group and the 1 st string group have the same result. The 3 rd string is grouped as "11000000", 2 7 、2 6 Any one or more of the combinations are added to obtain 2 2 -1 value, the fillable range of the final 3 rd segment input area comprising 0 and the 3 values mentioned above. The 4 th string packet is "00000000", and the fillable range of the corresponding 4 th segment network address is 0.
By adopting the above scheme, the first type of characters with the first value and the second type of characters with the second value contained in the first character string can be determined based on the specific value M of the first mask, the first character string is divided to obtain N character string groups, and the fillable ranges respectively corresponding to the N segmented input areas are determined based on the first type of characters and/or the second type of characters contained in each character string group. Therefore, the fillable range in each segmented input area can be more accurately determined, and network address invalidation caused by errors when any segmented input area is filled is avoided, so that the correctness and the accuracy of the input network segment information can be improved, and the overall processing efficiency is improved.
In another embodiment, when the first network segment information to be filled in at this time is the network segment information of the subnet, that is, when the first mask is the subnet mask, the fillable ranges corresponding to the N segment input areas respectively are limited by the second mask, that is, the mask of the private network to which the present application belongs. The determining, based on the first mask, the fillable ranges corresponding to the N segment input areas respectively 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 character and a second type character, the value of the first type character is a first value, and the value of the second type character is a second value; the number of the first type characters is the difference value between 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 adjustment value corresponding to each of the N segmented input areas based on the first type characters and/or the second type characters respectively contained in the N character string groups obtained by the first character string division;
And determining the fillable range corresponding to each of the N segmented input areas based on the N segmented initial values and the at least one adjustment value corresponding to each of the N segmented input areas.
Wherein the first mask and the second mask are decimal integer values, and the maximum values of the first mask and the second mask 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 and the second mask are 32; the maximum value of the first mask and the second mask is 128, and the network address of the type IPv6 of the network address is currently selected or determined.
The determining the first 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 type characters, the M+1st characters are then second type characters, the values of the first type characters are first values, and the values of the second type characters are second values; 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 between 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 the positions of the first type 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 consecutive M binary characters from the most significant digit in the first initial character. The first type character has a first value of 1, that is to say the first type character has a value of 1.
The number and the positions of the second type of characters in the first initial character are specifically as follows: and the M+1st character and all the following characters in the first initial character are the second type characters. The m+1th character refers to the m+1th binary character from the most significant bit in the first initial character. The value of the second type character is a first value, and the first value is 0, that is, the second type character is 0.
Wherein, based on the second mask, the adjusting the first initial string to obtain the first string includes: based on the second mask, the first L characters in the first initial character string are adjusted to be the second type characters, and the rest characters are kept unchanged, so that the first character string is obtained; l is equal to the second mask, and L is an integer less than or equal to M. That is, the first type character is adjusted to be the L+1th to M-th characters in the first character string, the consecutive L-bit characters from the most significant bit in the first character string are the second type character, and the second type character is also the second type character from the M+1th character.
The first character string may be a binary character string; the total bit number included 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 bit number of the first string is 32 bits; the currently selected or determined network address is of the type IPv6, and the total number of bits of the first string is 128.
For example, assuming that the currently selected or determined network address is of the 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, the 14 th and 15 th bits in the first string are 1, and the remaining bits are 0, that is, the first string is "00000000 00000110 00000000 00000000".
The determining at least one adjustment value corresponding to each of the N segmented input regions based on the first type of character and/or the second type of character included in each of the N character string groups obtained by the first character string division may include: dividing the first character string into N character string groups, and determining at least one adjustment value corresponding to each of the N segmented input areas based on the first type characters and/or the second type characters respectively contained in the N character string groups.
The dividing the first string to obtain N groups of strings may specifically be: and respectively and sequentially selecting a preset number of characters from the highest bit 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 may be 32. Taking the network address of which the type of the currently selected or determined network address is IPv4 as an example, the first string corresponding to the first mask is divided into 4 string groups, and each string group includes 8-bit characters.
The determining at least one adjustment value corresponding to each of the N segmented input regions based on the first type characters and/or the second type characters respectively included in the N character string groups may specifically include:
judging whether the p-th character string group in the N character string groups contains the first type of characters or not; if the p-th character string group does not contain the first type characters, the adjustment value of the p-th segmented input area corresponding to the p-th character string group is 0; p is an integer of 1 or more and N or less;
if the p-th character string group contains f first type characters, f first type characters of the p-th character string group are respectively taken as a first value, the rest character bits are taken as a second value, and the values of f target system are calculated; combining and adding the values of the f target systems respectively to obtain at least one adjustment 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, the type of the currently selected or determined network address is an IPv4 type network address, the target system is a decimal system, and if the type of the currently selected or determined network address is an IPv6 type network address, the target system is a hexadecimal system.
The grouping the f first characters of the p-th character string with the first value and the remaining character bits with the second value respectively, and calculating to obtain the value of the f target system may include:
1 st character bit in the f first type characters of the p-th character string group is 1, and the rest character bits are 0, so that a 1 st numerical value of a target system is obtained through calculation;
and the same is repeated until the f character bits in the f first type characters of the p-th character string group are 1, and the rest character bits are 0, so that the value of the f target system is obtained through calculation.
The step of respectively combining and adding the values of the f target systems to obtain the at least one adjustment value may be: and combining and adding any one or more of the f target system values respectively to obtain the at least one adjustment value. Wherein a specific number of the at least one adjustment value may be equal to 2 f -1. For example, f is 2, the positions of the first type of character are 14 th and 15 th bits, the 2 nd and 3 rd bits from right to left in the 2 nd character string group are respectively taken as 1, the other character bits are respectively taken as 0, and 2 is calculated 2 、2 3 Two values, which are combined and added respectively to obtain 3 adjustment values.
The determining the fillable range 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:
dividing based on the second network address to obtain N segmentation initial values; 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 range corresponding to each of the N segment input areas based on the N segment initial values and the at least one adjustment value corresponding to each of the N segment input areas.
The determining the fillable range 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:
Respectively adding the initial value of the y-th segment and the at least one adjustment value corresponding to the input area of the y-th segment to obtain at least one numerical value; taking the at least one numerical value and the y-th segmentation initial value as the fillable range of the y-th segmentation input region; 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-th segment is xxx, and the adjustment values of the y-th segment input area are 0, 1, 2 and 3, the fillable range of the y-th segment input area comprises: xxx, xxx+1, xxx+2, xxx+3.
In connection with fig. 2a, the description will be given by taking, as an example, the network address currently selected or determined to be of the IPv4 type:
assuming that the first mask=18, the second mask is equal to 16, that is, the 17 th and 18 th bits of the first string take values of 1, and the remaining values of 0; the first character string is divided into 4 character string groups, wherein the 1 st character string group is '00000000', the adjustment value is 0, the 1 st segmentation initial value is determined to be 192 based on the second network address, and finally the fillable range of the 1 st segmentation input area contains 192 as one numerical value. The 2 nd character string is grouped into "00000000", the adjustment value is 0, and the initial value of the 2 nd segment is determined to be xxx based on the second network address, and finally the fillable range of the 2 nd segment input area contains xxx. The 3 rd string is grouped as "11000000", 2 7 、2 6 And adding any one or more combinations to obtain 3 numerical values and 0 as adjustment values, wherein the fillable range of the 3 rd segment network address is 0 and the 3 numerical values are assumed to be 0 based on the determination of the 3 rd segment initial value of the second network address.
By adopting the scheme, when the first mask is a subnet mask, the fillable ranges respectively corresponding to the N segmented input areas are determined based on the first mask and a 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 segmented input area is more accurately determined, so that network address invalidation caused by errors when any segmented input area is filled is avoided, the correctness and accuracy of the input network segment information can be improved, and the overall processing efficiency is improved.
In one embodiment, the first mask may be acquired in the following two acquisition manners:
in the first acquisition mode, in response to the input value being acquired in the mask input area in the presentation interface, the input value is taken as the acquired first mask.
The second mode is obtained, and the candidate numerical value is displayed in response to the first operation at the mask input area; in response to a second operation on a target value of the candidate values, the target value is taken as the first mask.
The mask input area may be at a first position of the display interface, where the first position may be set according to practical situations, for example, may be on the right side of the display interface, or below the display interface, etc.; in addition, the mask input area and the N segment input areas also have a relative positional relationship, for example, the mask input area is located on the right side or below the N segment input areas, and the like, which is not meant to be exhaustive.
Such as shown in fig. 2b, the rightmost side of the N segment input regions 201 is the mask input region 202.
The first operation may be: clicking operation for a select 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 of a preset pattern, for example, the downward arrow 2021 in the mask input area in fig. 2b may be the selection key. Accordingly, detecting the click down arrow 2021 in fig. 2b is the detection of the first operation at the mask input region.
The candidate value may be one or more, and the largest candidate value may be associated with the type of the currently selected or determined network address, e.g., the type of the currently selected or determined network address is IPv4 type, the largest candidate value may be 32, and the type of the currently selected or determined network address is IPv6 type, the largest candidate value may be 128.
The second operation for the target value in the candidate values may be: a click operation for the target value 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 directly determined by selecting without editing in the editing frame, the accuracy of the input is ensured to a certain extent, the operation is convenient, and the accuracy of the input network segment information and the overall processing efficiency are improved.
In the foregoing embodiment, it has been explained that the first mask, in the case of a subnet mask, is further limited by the second mask of the private network to which it belongs, so in one embodiment, the manner of determining the candidate value may include:
And determining at least part of values from all values as the candidate values based on a second mask of the private network to which the mask input area belongs.
Since the mask input area is a selection area of a subnet mask, that is, the first mask input by the user is a subnet mask, the mask input area is limited by the second mask of the CIDR of the private network to which the mask input area belongs.
The determining at least part of the values from all the values as the candidate values may specifically be: and taking the value which is larger than the second mask in the total values as the candidate value.
For example, the second mask of the private network to which it belongs is 25, the subnet mask, i.e. the first mask, has only 26-32 selectable ranges, i.e. the candidate value is 26-32.
In this case, the manner of presenting the candidate value may include: only the candidate values are shown; alternatively, all values are presented in a different selected state, e.g., the non-selectable state is presented with values other than the candidate value, and the selectable state is presented with the candidate value.
The display effect of the non-selectable state is different from the display effect of the selectable state, and the clicking operation is not responded in the non-selectable state, and the clicking operation is responded in the selectable state. The display effect of the non-selectable state may be: background grey, darkened font color, etc.; the display effect of the selectable state may be: the background is transparent and the font color is black.
In the case that the first mask to be selected currently 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 problem of time consumption caused by modification due to input errors 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 present disclosure, including:
s301: converting the first network address to obtain a binary character string of the first network address;
s302: determining a validation string of the binary strings 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.
The converting the first network address in S301 with reference to fig. 3b, to obtain a binary string of the first network address is described as follows:
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 an IPv4 type network address is ", and the preset identifier of an IPv6 type network address is": ".
Wherein 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 to obtain 4 segments of sub-information.
Assuming that the first network address is "192.Xxx.0.0", the first network address can be split into 4 pieces of sub-information of 192, xxx, 0 and 0 according to the preset identifier "". The code used may be "part array=cidr.
Since different numbers may be used in the case where the first network address is a different type of network address, for example, the first network address is an IPv4 type network address, and each piece of sub-information is a 10-number; the first network address is an IPv6 type network address, and each piece of sub-information is a 16-system number. Thus, the step may further comprise: and converting the N pieces of sub-information into decimal. The code used may be "part=part (10)", where part on the left of the equal sign indicates the number after any one of the N pieces of sub information is converted into 10 scale, "part ()" in "part (10)" indicates the function parsing string and returns an integer, (part, 10) indicates the integer for converting any one of the N pieces of sub information into 10 scale.
S3012: and converting the current segment sub-information in the N segments of sub-information into binary, and obtaining an initial binary character string of the current segment sub-information.
Because each piece of sub information in the N pieces of sub information is a decimal number of 0-255 at this time, 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 sub-information is equal to a preset length, if so, taking the initial binary string of the current segment sub-information as the binary string of the current segment sub-information, and then executing S3015; otherwise, S3014 is executed.
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 an IPv4 type network address, it is split into 4 pieces of sub-information 192, xxx, 0, and 0, where the current piece of sub-information is "192",192 may be processed into an initial binary string "11000000", where the length of the initial binary string is 8, and then the initial binary string may 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 sub-information to obtain the binary character string of the current segment sub-information.
S3015: judging whether the processing of the N pieces of sub-information is completed, and if not, returning to execute S3012; and if so, merging the binary character strings corresponding to the N pieces of sub-information respectively to obtain the binary character strings of the first network address.
Illustratively, 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; splitting the first network address into 4 segments of 192, xxx, 0 and 0 according to "," and then respectively performing binary conversion, for example, directly processing 192 into a binary string in an 8-bit 01 format, wherein if less than 8 bits are complemented by 0 in the front, 192 can be processed into 11000000, the whole network address can be processed into a 32-bit 01 string, and in particular, the binary string of the first network address 192.xxx.0.0 shown in fig. 4 is "11000000 yyyyyyyy 00000000 00000000", wherein the first segment 192 corresponds to 11000000, the second segment xxx corresponds to yyyyyyy, the third segment 0 corresponds to 000000000000, and the fourth segment 0 corresponds to 000000000000.
The determining the verification string in the binary string of the first network address based on the first mask may be extracting part of characters in the binary string of the first network address based on the first mask as the verification string.
The validity verification result of the first mask may include valid or invalid.
By adopting the scheme, the first network address can be converted into the corresponding binary character string, the verification character string is 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 is verified based on the first network address, the problem that the validity of the mask cannot be verified due to the fact that only the mask format is verified is avoided, the accuracy of the input first network address and the first mask is improved, and overall processing efficiency is further improved.
In one embodiment, the determining the validation string in the binary string of the first network address based on the first mask includes:
Based on the first mask, remaining binary characters other than consecutive M-bit binary characters from a highest bit in the binary character string of the first network address are used 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 yyyyyyyy 00000000 00000000", and the verification string is "00000000 00000000" assuming that the first mask is 16.
According to the processing, the binary character string of the first network address is obtained through binary conversion after the first network address is obtained, and subsequent verification processing can be performed more simply and rapidly by adopting the binary character string, so that the validity of the first mask 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 string to obtain a validity verification result of the first mask includes: determining that the validity verification result of the first mask is invalid when the verification string contains a first value; and determining that the validity verification result of the first mask is valid under the condition that the verification character string does not contain the first value.
Wherein the first value is 1.
That is, if the first network address is correctly filled, no character having a value of 1 should exist in the binary characters other than the M-bit binary character corresponding to the first mask, and if so, it is determined that the validity verification result of the first mask is invalid.
Further, the method may further include: displaying the verification result that the first mask is invalid; in response to the modification instruction, the foregoing process of S101 is performed in return, that is, in a case where the user views that the first mask of the first segment information input this time is invalid, the user may choose to reenter the first segment information.
In the related art, the client can only perform format verification on the network segment information, but cannot verify the content correctness of the network segment information filled by the user, if the network segment information is invalid, the network segment information is immediately prompted to the user. According to the embodiment of the disclosure, the binary character string of the first network address can be obtained through binary conversion after the first network address is obtained, the verification character string is further extracted from the binary character string of the first network address based on the first mask, the validity verification result of the first mask is determined based on whether the verification character string contains a first value or not, so that the validity of the first mask can be verified in real time and effectively, the problem that the processing effect is affected due to the fact that errors are found again and the processing effect is modified again after invalid network segment information is submitted is avoided, and the overall processing efficiency is improved.
In one embodiment, as shown in fig. 5, further comprising:
s501: the third network address is converted into a binary string of the third network address, and the first network address is converted into a binary string of the first network address.
S502: a first string to be compared is obtained from the binary string of the third network address based on the first mask, and a reference string is obtained 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 method for obtaining the third network address may include: by means of user input, user selection, or user presettings. That is, the third network address may be any network address input by a user or selected by a user.
In particular, the third network address may be an IP address; in addition, the type of the third network address may be the same as or different from the type of the first network address in the first network segment information. For example, the third network address and the first network address are both IPv4 type network addresses or IPv6 type network addresses.
The obtaining a first to-be-compared character string from the binary character string of the third network address based on the first mask and obtaining a reference character string from the binary character string of the first network address may include: acquiring consecutive M-bit binary characters from the highest bit in the binary character string of the third network address as the first character string to be compared and consecutive M-bit binary characters from the highest bit in the binary character string of the first network address as the reference character string based on the first mask; m is equal to the first mask.
For example, the first network address 192.Xxx.0.0 is converted into a binary string "11000000 yyyyyyyy 00000000 00000000", and the number of bits "11000000 yyyyyyyyy" corresponding to the first mask 16 is the reference string. The manner of determining the first to-be-compared string of the third network address is not described in detail.
The determining that the third network address and the first network address are in the same network segment may specifically include:
judging whether the values of the binary characters of each bit in the first character string to be compared and the reference character string are the same or not;
Determining that the third network address and the first network address are in the same network segment under the condition that the values of binary characters of each bit in the first character string to be compared and the reference character string are the same;
otherwise, determining that the third network address and the first network address are in different network segments.
It is further 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 then be a combination of a network address plus a host address. According to an embodiment of the present disclosure, assuming that the first mask in the first network segment information is 10, the third network address may be determined to be within the first network segment if the reference string and the first to-be-compared string are the same.
Because the rule of the network address expressed by decimal or hexadecimal is not obvious, whether the network address expressed by decimal or hexadecimal is in the same network segment is not easy to judge, the scheme converts the two network addresses into the binary character strings, and the first mask is used for acquiring the reference character strings and the first character strings to be compared to judge whether the two network addresses are in the same network segment, so that the judging efficiency and the judging accuracy can be ensured, reliable reference is provided for subsequent processing, and the overall processing efficiency is improved.
In one embodiment, as shown in fig. 6, it may further include:
s601: converting a fourth network address in fourth network segment information into a binary string of the fourth network address, and converting the first network address into a binary string of the first network address;
s602: taking the minimum value of the first mask and the 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 under the condition that the second to-be-compared character string is the same as the third to-be-compared character string, determining that the fourth network segment information is overlapped with the first network segment information.
Before S601 is performed, 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 one of the segment information inputted by the user.
Specifically, binary conversion is performed on the fourth network address and the first network address respectively, so as 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. The minimum value of the first mask and the fourth mask of the fourth network segment information is used as a target mask, the sizes of the first mask and the fourth mask are compared, 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.
The method is characterized in that if the masks in the two network segment information are the same, whether the network addresses are the same can be directly seen, and the processing mode is not needed to determine whether the two network segment information are overlapped. The method mainly aims at the fact that masks are different, and at the moment, network address information in two network segment information cannot be simply used for determining whether the same prefix exists, so that the method provided by the embodiment is adopted, 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 binary character strings of the two network addresses based on the target mask, and whether the two network segment information are overlapped is determined based on whether the extracted two character strings to be compared are identical.
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 belongs, based on whether the first mask is larger than the fourth mask.
For example, if the first mask is greater 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, based on the target mask, a second to-be-compared string from the binary string of the fourth network address, and obtaining, based on the target mask, a third to-be-compared string from the binary string of the first network address, may include: acquiring continuous K-bit binary characters from the highest bit in the binary character string of the fourth network address as the second to-be-compared character string and continuous K-bit binary characters from the highest bit in the binary character string of the first network address as the third to-be-compared character string based on the target mask; k is an integer greater than or equal to 1, and K is equal to the target mask.
The determining that the fourth network segment information overlaps with the first network segment information may specifically include:
judging whether the values of binary characters of each bit in the second character string to be compared and the third character string to be compared are the same or not;
determining that the fourth network segment information overlaps with the first network segment information under the condition that the values of binary characters of each bit in the second to-be-compared character string and the third to-be-compared character string are the same;
otherwise, determining that the fourth network segment information is not overlapped with the first network segment information.
By adopting the scheme, different network segment information can be converted into the binary character strings which are easy to process, and the corresponding prefixes of the binary character strings of the network addresses are extracted through masks respectively contained in each network segment information, so that the two network segment information is judged and determined to be overlapped. Therefore, the relation 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 determine fillable ranges corresponding to the N segment input areas, respectively, based on a first mask in response to acquiring the first mask; n is an integer greater than or equal to 1;
the display module 702 is configured to display the corresponding fillable ranges in the N segment input areas respectively;
the network segment information determining module 703 is configured to, in response to acquiring N pieces of input information in the N pieces of 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 string based on the first mask; the first character string comprises a first type character and a second type character, the value of the first type character is a first value, and the value of the second type character is a second value; dividing the first character string to obtain N character string groups; and determining the fillable ranges corresponding to the N segmentation input areas respectively based on the first type characters and/or the second type characters respectively contained in the N character string groups.
The range determining module 701 is configured to determine a first string according to the first mask and the second mask; the first character string comprises a first type character and a second type character, the value of the first type character is a first value, and the value of the second type character is a second value; the number of the first type characters is the difference value between 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 adjustment value corresponding to each of the N segmented input areas based on the first type characters and/or the second type characters respectively contained in the N character string groups obtained by the first character string division; and determining the fillable range corresponding to each of the N segmented input areas based on the N segmented initial values and the at least one adjustment value corresponding to each of the N segmented input areas.
On the basis of fig. 7a, the present embodiment further provides that the apparatus as shown in fig. 7b further includes:
a mask acquisition module 704 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, the target value is taken as the first mask.
The mask obtaining module 704 is configured to determine, when the mask input area is a selected area of a subnet mask, at least a part of values from all values as the candidate values based on a second mask included in the second segment information of the private network to which the mask input area belongs.
The device further comprises:
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 of the binary strings 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, remaining binary characters other than consecutive M-bit binary characters from a most significant bit in the binary string of the first network address based on the first mask; m is an integer greater than or equal to 1, and M is equal to the first mask.
The mask validity verification module 705 is configured to determine that a validity verification 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 under the condition that the verification character string does not contain the first value.
The device further comprises:
a first comparing module 706, configured to convert a third network address into a binary string of the third network address, and convert the first network address into a binary string of the first network address; acquiring a first character string to be compared from the binary character string of the third network address based on the first mask, and acquiring a reference character string from the binary character 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 further comprises:
a second comparison module 707, configured to convert a fourth network address in the 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 the 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 under the condition that the second to-be-compared character string is the same as the third to-be-compared character string, determining that the fourth network segment information is overlapped with the first network segment information.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the related user personal information all conform to the regulations of related laws and regulations, and the public sequence is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 8 illustrates a schematic block diagram of an example electronic device 800 that may 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 telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary 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 computing 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 the bus 804.
Various components in device 800 are connected to I/O interface 805, including: an input unit 806 such as a keyboard, mouse, etc.; 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, etc.; and a communication unit 809, such as a network card, modem, wireless communication transceiver, or the like. 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.
The computing unit 801 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the respective methods and processes described above, for example, 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 on a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 800 via ROM 802 and/or communication unit 809. When a computer program is loaded into RAM 803 and executed by computing unit 801, one or more steps of the network segment information processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the network segment information processing method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On 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, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code 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 code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. 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. The 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 pointing device (e.g., a mouse or 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 may 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 input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background 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 background, 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 a client and a server. The client and server are typically 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 incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially, or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (18)

1. A network segment information processing method, comprising:
in response to acquiring a first mask, determining fillable ranges corresponding to the N segmentation input regions respectively based on the first mask; n is an integer greater than or equal to 1;
respectively displaying the corresponding fillable ranges in the N segmentation input areas;
in response to acquiring N pieces of input information in the N segmented input regions, generating a first network address based on the N pieces of input information, determining first network segment information based on the first network address and the first mask;
Wherein the method further comprises: converting the first network address to obtain a binary character string of the first network address; based on the first mask, remaining binary characters other than consecutive M-bit binary characters from the most significant bit in the binary character string of the first network address are used as verification character strings, M is an integer greater than or equal to 1, and M is equal to the first mask; and verifying the first mask based on the verification character string to obtain a validity verification result of the first mask.
2. The method of claim 1, wherein the determining, based on the first mask, the fillable ranges to which the N segmented input regions respectively correspond comprises:
determining a first string based on the first mask; the first character string comprises a first type character and a second type character, the value of the first type character is a first value, and the value of the second type character is a second value;
dividing the first character string to obtain N character string groups;
and determining the fillable ranges corresponding to the N segmentation input areas respectively based on the first type characters and/or the second type characters respectively contained in the N character string groups.
3. The method of claim 1, wherein the determining, based on the first mask, the fillable ranges to which the N segmented input regions respectively correspond comprises:
determining a first character string according to the first mask and the second mask; the first character string comprises a first type character and a second type character, the value of the first type character is a first value, and the value of the second type character is a second value; the number of the first type characters is the difference value between 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 adjustment value corresponding to each of the N segmented input areas based on the first type characters and/or the second type characters respectively contained in the N character string groups obtained by the first character string division;
and determining the fillable range corresponding to each of the N segmented input areas based on the N segmented initial values and the at least one adjustment value corresponding to each of the N segmented input areas.
4. The method of claim 1, further comprising:
responsive to a first operation at the mask input region, exhibiting a candidate value;
In response to a second operation on a target value of the candidate values, the target value is taken as the first mask.
5. The method of claim 4, further comprising:
and determining at least part of values from all values as the candidate values based on a second mask contained in the second network segment information of the private network to which the mask input area belongs, in the case that the mask input area is a selected area of a subnet mask.
6. The method of claim 1, wherein the verifying the first mask based on the verification string results in a validity verification result of the first mask, comprising:
determining that the validity verification result of the first mask is invalid when the verification string contains a first value;
and determining that the validity verification result of the first mask is valid under the condition that the verification character string does not contain the first value.
7. The method of any of claims 1-5, further comprising:
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;
Acquiring a first character string to be compared from the binary character string of the third network address based on the first mask, and acquiring a reference character string from the binary character 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.
8. The method of any of claims 1-5, further comprising:
converting a fourth network address in fourth network segment information into a binary string of the fourth network address, and converting the first network address into a binary string of the first network address;
taking the minimum value of the first mask and the 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 under the condition that the second to-be-compared character string is the same as the third to-be-compared character string, determining that the fourth network segment information is overlapped with the first network segment information.
9. A network segment information processing apparatus comprising:
the range determining module is used for determining fillable ranges corresponding to the N segmentation input areas respectively based on the first mask in response to the first mask; n is an integer greater than or equal to 1;
the display module is used for displaying the corresponding fillable ranges in the N segmentation input areas respectively;
the network segment information determining module is used for responding to N pieces of input information acquired in the N pieces of 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 system further comprises a mask validity verification module, a mask validity verification module and a mask validity verification module, wherein the mask validity verification module is used for converting the first network address to obtain a binary character string of the first network address; based on the first mask, remaining binary characters other than consecutive M-bit binary characters from the most significant bit in the binary character string of the first network address are used as verification character strings, M is an integer greater than or equal to 1, and M is equal to the first mask; and verifying the first mask based on the verification character string to obtain a validity verification result of the first mask.
10. The apparatus of claim 9, wherein the range determination module is to determine a first string based on the first mask; the first character string comprises a first type character and a second type character, the value of the first type character is a first value, and the value of the second type character is a second value; dividing the first character string to obtain N character string groups; and determining the fillable ranges corresponding to the N segmentation input areas respectively based on the first type characters and/or the second type characters respectively contained in the N character string groups.
11. The apparatus of claim 9, wherein the range determining module is configured to determine a first string according to the first mask and the second mask; the first character string comprises a first type character and a second type character, the value of the first type character is a first value, and the value of the second type character is a second value; the number of the first type characters is the difference value between 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 adjustment value corresponding to each of the N segmented input areas based on the first type characters and/or the second type characters respectively contained in the N character string groups obtained by the first character string division; and determining the fillable range corresponding to each of the N segmented input areas based on the N segmented initial values and the at least one adjustment value corresponding to each of the N segmented input areas.
12. The apparatus of claim 9, further comprising:
a mask acquisition module for displaying 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, the target value is taken as the first mask.
13. The apparatus according to claim 12, wherein the mask obtaining module is configured to determine, in a case where the mask input area is a selected area of a subnet mask, at least a part of values from all values as the candidate values based on a second mask included in second network segment information of the private network to which the mask input area belongs.
14. The apparatus of claim 9, wherein the mask validity verification module is configured to determine that a validity verification result of the first mask is invalid if a first value is included in the verification string; and determining that the validity verification result of the first mask is valid under the condition that the verification character string does not contain the first value.
15. The apparatus of any of claims 9-13, further comprising:
a first comparison module, configured to convert a third network address into a binary string of the third network address, and convert the first network address into a binary string of the first network address; acquiring a first character string to be compared from the binary character string of the third network address based on the first mask, and acquiring a reference character string from the binary character 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.
16. The apparatus of any of claims 9-13, further comprising:
the second comparison module is used for converting a fourth network address in the 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 the 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 under the condition that the second to-be-compared character string is the same as the third to-be-compared character string, determining that the fourth network segment information is overlapped with the first network segment information.
17. 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 any one of claims 1-8.
18. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-8.
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 CN114363167A (en) 2022-04-15
CN114363167B true 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)

Families Citing this family (1)

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

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Family Cites Families (2)

* 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
US11012406B2 (en) * 2019-04-01 2021-05-18 International Business Machines Corporation Automatic IP range selection

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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
孙杰挺 ; .快速划分子网方法探究.职业教育(下旬刊).2014,(12),全文. *
王恒青 ; 宋如敏 ; .在TCP/IP网络模型下IP地址与子网掩码的计算解析.科技信息(学术研究).2008,(32),全文. *

Also Published As

Publication number Publication date
CN114363167A (en) 2022-04-15

Similar Documents

Publication Publication Date Title
CN108985066B (en) Intelligent contract security vulnerability detection method, device, terminal and storage medium
CN112597754B (en) Text error correction method, apparatus, electronic device and readable storage medium
JP2022003539A (en) Method, apparatus, electronic device and storage medium for correcting text errors
CN113342345A (en) Operator fusion method and device of deep learning framework
CN104268229B (en) Resource obtaining method and device based on multi-process browser
EP3896595A1 (en) Text key information extracting method, apparatus, electronic device, storage medium, and computer program product
US20140136967A1 (en) Method of providing predictive text
JP7384943B2 (en) Training method for character generation model, character generation method, device, equipment and medium
CN108243154B (en) verification code data processing method and device
EP3905125A2 (en) Method and apparatus for recommending chart, electronic device, and storage medium
CN114363167B (en) Network segment information processing method and device, electronic equipment and storage medium
CN106557452A (en) For the display packing of numeric character or character string, device, equipment and system
EP4191478A1 (en) Method and apparatus for compressing neural network model
CN113657518B (en) Training method, target image detection method, device, electronic device, and medium
CN108596120B (en) Target detection method and device based on deep learning
CN114511743A (en) Detection model training method, target detection method, device, equipment, medium and product
CN114218931A (en) Information extraction method and device, electronic equipment and readable storage medium
CN115344315A (en) Skin switching method and device of applet page and electronic equipment
CN115187995B (en) Document correction method, device, electronic equipment and storage medium
CN113691403A (en) Topological node configuration method, related device and computer program product
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN110881001B (en) Electronic red packet detection method, system and terminal equipment
CN114972606A (en) Rendering method and device for shadow effect of semitransparent object
CN113608809A (en) Component layout method, device, equipment, storage medium and program product
CN112861504A (en) Text interaction method, device, equipment, storage medium and program product

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