Access control method and device for domain name, equipment and storage medium
By dividing the domain name into a string and using the hash algorithm to calculate its expected value, the problem of long domain name matching time in the existing technology is solved, and a more efficient domain name matching is realized.
Patent Information
- Application Number
- CN202310926498.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-26
- Publication Date
- 2025-01-28
AI Technical Summary
In the prior art, when domain name matching is established by establishing a dictionary tree, the matching time is long since the character string of the domain name rarely has common string prefixes.
Divide the domain name to be matched to at least two string, and use the hash algorithm to obtain the hash values and masks of these string. The hash values and masks expressed by these values are calculated. Matching the expected value in the domain name rule library.
The combination of numerical representation and hash algorithm reduces the calculation of the domain name matching process, saves the matching time, and improves the matching efficiency.
Smart Images

Figure CN119382908A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for access control of domain names. Background Art
[0002] Access control is a network security mechanism that controls the access rights of users or processes to system resources. It ensures that only authorized users or processes can access system resources, thereby protecting the system from unauthorized access and malicious attacks.
[0003] In the related art, a method for access control of domain names is proposed, which searches for domain names by building a dictionary tree to achieve domain name matching. First, it is necessary to check whether the domain name exists, and then check whether the string of the domain name and the string of the access address have a common string prefix. After at least two queries, the domain name matching is completed.
[0004] However, since domain name strings rarely have common string prefixes, the matching time is relatively long. Summary of the invention
[0005] The embodiment of the present application provides a method, apparatus, device and storage medium for access control of domain names. The technical solution is as follows:
[0006] According to one aspect of an embodiment of the present application, a method for access control for a domain name is provided, the method comprising:
[0007] receiving a web page access request, wherein the web page domain name corresponding to the web page access request is a first domain name;
[0008] Splitting the first domain name to be matched into at least two character strings;
[0009] Using a hash algorithm for the character string, obtaining hash values corresponding to the at least two character strings respectively;
[0010] Obtaining an expected value corresponding to the first domain name in numerical representation according to the hash values corresponding to the at least two strings and the masks corresponding to the at least two strings; converting the at least two strings into numerical representations, and calculating the expected value corresponding to the first domain name;
[0011] Matching the expected value corresponding to the first domain name with the expected values corresponding to each second domain name in the domain name rule base to obtain a matching result;
[0012] Access control is performed on the webpage access request according to the matching result.
[0013] According to one aspect of an embodiment of the present application, there is provided an access control device for a domain name, the device comprising:
[0014] A request receiving module, used to receive a web page access request, wherein the web page domain name corresponding to the web page access request is a first domain name;
[0015] A character string segmentation module, used for segmenting the first domain name into at least two character strings;
[0016] A hash value determination module, configured to obtain hash values corresponding to the at least two character strings respectively by using a hash algorithm for the character string;
[0017] An expected value determination module, configured to obtain an expected value corresponding to the first domain name represented in numerical form according to the hash values corresponding to the at least two character strings and the masks corresponding to the at least two character strings;
[0018] A domain name matching module, used to match the expected value corresponding to the first domain name with the expected values corresponding to each domain name in the domain name rule library to obtain a matching result;
[0019] The access control module is used to perform access control on the web page access request according to the matching result.
[0020] According to one aspect of an embodiment of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the above-mentioned access control method for a domain name.
[0021] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned access control method for a domain name.
[0022] According to one aspect of an embodiment of the present application, a computer program product is provided. The computer program product includes a computer program. The computer program is loaded and executed by a processor to implement the above-mentioned access control method for a domain name.
[0023] The technical solution provided in the embodiments of the present application can bring the following beneficial effects:
[0024] By dividing the received first domain name into at least two character strings, and obtaining the expected value corresponding to the first domain name represented numerically according to the hash values and masks corresponding to the at least two character strings, the first domain name and each domain name in the domain name rule base are matched, and the expected value corresponding to the first domain name is matched with the expected value corresponding to each domain name in the domain name rule base. Compared with matching domain names composed of various types of characters, matching the expected value corresponding to the first domain name represented numerically with the expected value corresponding to each domain name in the domain name rule base reduces the amount of calculation in the domain name matching process, saves the time of domain name matching, and improves the efficiency of domain name matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;
[0026] Figure 2 is a flow chart of a method for access control of a domain name provided by an embodiment of the present application;
[0027] Figure 3 is a flow chart of a method for access control of a domain name provided by another embodiment of the present application;
[0028] Figure 4 is a schematic diagram of a calculation process of an expected value provided by an embodiment of the present application;
[0029] Figure 5 is a flow chart of web page access provided by an embodiment of the present application;
[0030] Figure 6 This is a flowchart of domain name matching provided by an embodiment of the present application;
[0031] Figure 7 is a block diagram of an access control device for a domain name provided by an embodiment of the present application;
[0032] Figure 8 It is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0034] Please refer to Figure 1 , which shows a schematic diagram of a solution implementation environment provided by an embodiment of the present application. The solution implementation environment can be implemented as an access control system for domain names. The solution implementation environment may include: a terminal device 10 and a computer device 20.
[0035] The number of terminal devices 10 can be one or more. The terminal device 10 can be an electronic device such as a smart phone, a tablet computer, a laptop computer, a PC (Personal Computer), a multimedia player, a vehicle-mounted terminal, etc., but is not limited thereto. The terminal device 10 has a client of an application installed therein, wherein the application does not limit the type of application, including but not limited to a search application, a news application, a game application, a video application, etc. The user can access different web pages in the application.
[0036] In the embodiment of the present application, the execution subject of each step may be a computer device 20, which refers to an electronic device with the function of controlling network traffic, and can filter traffic according to predefined domain name matching rules to protect the network from malicious attacks and unauthorized access. The computer device 20 may be an electronic device such as a gateway device, a firewall, a server, etc., wherein the server may be a single server, a server cluster consisting of multiple servers, or a cloud computing service center.
[0037] The server can be used to provide background services for the client of the application installed and running in the terminal device 10. For example, the server can be the background server of the above application. Optionally, the server provides background services for the clients of the application in multiple terminal devices 10 at the same time. The terminal device 10 and the server can communicate with each other through the network.
[0038] The computer device 20 stores a domain name rule library, and the domain name rule library stores at least one domain name rule, and each domain name rule corresponds to an expected value corresponding to a wildcard domain name. In the embodiment of the present application, the user sends a web page access request to the computer device 10 through the client of the application in the terminal device 10, and the web page access request is used to request access to the web page domain name. Then, the computer device 20 matches the expected value corresponding to the web page domain name with the expected value corresponding to each wildcard domain name in the domain name rule library. If the match is successful, the terminal device 10 is controlled to access the domain name in the domain name rule library that matches it, and displays it in the client of the application.
[0039] Please refer to Figure 2 , which shows a flow chart of a method for access control of a domain name provided by an embodiment of the present application. The execution subject of each step of the method may be a computer device. The method may include at least one of the following steps 210 to 260:
[0040] Step 210: receiving a web page access request, where the web page domain name corresponding to the web page access request is the first domain name.
[0041] A domain name, also known as a network domain, is a string of characters separated by dots that is used to identify a computer or group of computers on the Internet. It is used to locate the computer during data transmission. The first domain name is the webpage domain name corresponding to the webpage access request, which is used to indicate the webpage address that the webpage access request is requesting to access.
[0042] The user enters access information in the client of the application installed and running on the terminal device, and sends a web page access request to the computer device through the terminal device, and the computer device receives the web page access request. The web page access request is used to request access to the web page corresponding to the first domain name, which is obtained based on the access information entered by the user in the client.
[0043] Step 220: split the first domain name into at least two character strings.
[0044] The first domain name includes at least two character strings and at least one identifier. The character string may also be referred to as a character sequence, including at least one character, and the length of the character string refers to the number of at least one character included in the character string. The characters include at least one of words, letters, numbers, and symbols, wherein the letters include uppercase letters and lowercase letters. The identifier is used to separate the character strings in the first domain name, and the "dot" mentioned above is the identifier, which can be represented by ".".
[0045] Exemplarily, if the first domain name is "www.abcd.com", the first domain name can be divided into three strings of "www", "abcd", and "com", each of which is composed of lowercase letters. If the first domain name is "www.ab.cd.com", the first domain name can be divided into four strings of "www", "ab", "cd", and "com", each of which is composed of lowercase letters. If the first domain name is "www.abcd.com / 1234?ABCD=software development", the first domain name can be divided into three strings of "www", "abcd", and "com / 1234?ABCD=software development", among which "www" and "abcd" are composed of lowercase letters, and "com / 1234?ABCD=software development" is composed of lowercase letters, uppercase letters, words, numbers, and characters.
[0046] Optionally, if the first domain name is "www.abcd.com", the first domain name can also be divided into two character strings of "www.abcd" and "com", where "www.abcd" consists of lowercase letters and identifiers, or the first domain name can also be divided into two character strings of "www" and "abcd.com", where "abcd.com" consists of lowercase letters and identifiers.
[0047] The first domain name can be a wildcard domain name or a specific domain name. In addition to at least two character strings and at least one identifier, the wildcard domain name also includes wildcard characters, which can represent any character string. If the first domain name is a wildcard domain name, the first domain name can be represented as "*.abcd.com", where "*" represents a wildcard character; if the first domain name is a specific domain name, the first domain name can be represented as "www.abcd.com".
[0048] Domain names can be used to identify and locate websites, so domain names have a specific representation method. Not all character sequences consisting of at least two strings and at least one identifier can be called domain names. For example, character sequences such as "www.abcd" and "www.ab.cd" are not domain names.
[0049] Step 230: Use a hash algorithm for character strings to obtain hash values corresponding to at least two character strings.
[0050] A hash value is a numerical representation of at least two character strings converted. In the embodiment of the present application, each character string is converted into an integer form by calculating a hash value, and the integer hash value is further converted into a binary digital sequence consisting of 0 and 1.
[0051] Hash algorithms include BKDRHash, RSHash, APHash, SDBMHash, FNVHash and other hash algorithms for strings. In order to ensure that the hash values obtained by the strings do not conflict, that is, to ensure that the hash values obtained by different strings are different, it is necessary to select a suitable string hash algorithm. Randomly select 100,000 strings to calculate the hash value, and obtain the hash conflict rate of the 100,000 strings. You can refer to Table 1 below.
[0052] Table 1
[0053] String hashing algorithm Hash collision rate BKDRHash 0 / 142436 RSHash 2 / 142434 APHash 3 / 142434 SDBMHash 3 / 142434 FNVHash 2 / 142434
[0054] According to Table 1 above, there are digit conflicts between the hash values obtained by other string hash algorithms, while there are no conflicts between the hash values obtained by the BKDRHash algorithm. Therefore, the BKDRHash algorithm is the optimal string hash algorithm. In the embodiment of the present application, the BKDRHash algorithm can be selected as the hash algorithm for the domain name rule.
[0055] Step 240: Obtain an expected value corresponding to the first domain name represented numerically according to the hash values corresponding to the at least two character strings and the masks corresponding to the at least two character strings.
[0056] The mask (range_mask) is a string of binary codes used to perform bitwise operations on the target field. The source code and the mask are subjected to bitwise operations or logical operations to obtain a new operand. The source code here refers to the hash value corresponding to each string. The hash value corresponding to each string and the mask corresponding to each string are subjected to bitwise operations to obtain the expected value corresponding to each string.
[0057] The specific value of the mask corresponding to each string can be determined by the hash value corresponding to each string. In the embodiment of the present application, the mask is a binary value, for example, it can be expressed as 0 or 1.
[0058] Numerical representation means that the expected value corresponding to the first domain name is represented in the form of a numerical value. In the embodiment of the present application, the expected value (value) is a numerical representation, and the numerical representation can be in the form of a numerical value after base conversion, for example, a numerical value after base conversion such as binary, quaternary, octal, etc. Exemplarily, it can be a binary digital sequence consisting of 0 and 1.
[0059] According to the hash values corresponding to the at least two strings and the masks corresponding to the at least two strings, the expected value corresponding to the first domain name represented in numerical form is obtained. Optionally, the expected value corresponding to the at least two strings represented in numerical form can be obtained according to the hash values corresponding to the at least two strings and the masks corresponding to the at least two strings, thereby obtaining the expected value corresponding to the first domain name represented in numerical form; or the hash value corresponding to the first domain name can be obtained according to the hash values corresponding to the at least two strings, and then the mask corresponding to the first domain name can be obtained according to the masks corresponding to the at least two strings, thereby obtaining the expected value corresponding to the first domain name represented in numerical form according to the hash value corresponding to the first domain name and the mask corresponding to the first domain name.
[0060] Step 250, matching the expected value corresponding to the first domain name with the expected values corresponding to each domain name in the domain name rule library to obtain a matching result.
[0061] At least one domain name rule is stored in the domain name rule base, each domain name rule corresponds to an expected value of a domain name, and each domain name in the domain name rule base includes at least two character strings and at least one identifier. The expected value corresponding to the first domain name is matched with the expected values corresponding to each domain name in the domain name rule base to obtain a matching result, and the matching result is used to indicate whether the expected value corresponding to the first domain name matches the expected values corresponding to each domain name in the domain name rule base.
[0062] Optionally, matching the expected value corresponding to the first domain name with the expected values corresponding to each domain name in the domain name rule base may refer to directly matching the expected value corresponding to the first domain name with the expected values corresponding to each domain name in the domain name rule base; or may refer to matching the expected values corresponding to at least two character strings included in the first domain name with the expected values corresponding to at least two character strings included in each domain name in the domain name rule base.
[0063] In the embodiment of the present application, the expected values corresponding to at least two character strings included in the first domain name are matched with the expected values corresponding to at least two character strings respectively included in each domain name in the domain name rule base.
[0064] If the matching result indicates that the expected value corresponding to the first domain name satisfies a domain name rule in the domain name rule library, that is, the expected value corresponding to the first domain name matches the expected value corresponding to a domain name in the domain name rule library, then it is determined that the first domain name matches the domain name.
[0065] Each domain name in the domain name rule base is a wildcard domain name, which can be represented as "*.abcd.com", where "*" represents any string or a blank string. When "*" represents any string, "*" can represent at least one string, for example, "*" can be represented as "www" or "www.abcd", etc., and this application does not limit this.
[0066] Step 260: Perform access control on the web page access request based on the matching result.
[0067] In some embodiments, when the domain name rule base stores domain name rules that allow access, if the matching result indicates that the first domain name matches a domain name in the domain name rule base, it indicates that the web page access request can be responded to, and the terminal device is controlled to access the web page corresponding to the web page access request. If the matching result indicates that the first domain name does not match any domain name in the domain name rule base, it indicates that the web page access request cannot be responded to, and the terminal device is not allowed to access the web page corresponding to the web page access request.
[0068] In some embodiments, when the domain name rule library stores domain name rules that do not allow access, if the matching result indicates that the first domain name matches a domain name in the domain name rule library, it indicates that the web page access request cannot be responded to, and the terminal device is not allowed to access the web page corresponding to the web page access request. If the matching result indicates that the first domain name does not match any domain name in the domain name rule library, it indicates that the web page access request can be responded to, and the terminal device is controlled to access the web page corresponding to the web page access request.
[0069] If the web page access request is responded to, the web page corresponding to the web page access request is displayed in the client of the application program of the control terminal device; if the web page access request cannot be responded to, the prompt information of access failure is displayed in the client of the application program of the control terminal device.
[0070] The technical solution provided by the embodiment of the present application is to obtain the expected value corresponding to the first domain name represented numerically by dividing the received first domain name into at least two character strings, and according to the hash values and masks corresponding to the at least two character strings, thereby matching the first domain name with each domain name in the domain name rule base, and converting the expected value corresponding to the first domain name to the expected value corresponding to each domain name in the domain name rule base. Compared with matching domain names composed of various types of characters, matching the expected value corresponding to the first domain name represented numerically with the expected value corresponding to each domain name in the domain name rule base reduces the amount of calculation in the domain name matching process, saves the time of domain name matching, and improves the efficiency of domain name matching.
[0071] Please refer to Figure 3 , which shows a flow chart of a method for access control of a domain name provided by another embodiment of the present application. The execution subject of each step of the method may be a computer device. The method may include at least one of the following steps 310 to 370:
[0072] Step 310: Receive a web page access request, where the web page domain name corresponding to the web page access request is a first domain name.
[0073] Step 320: split the first domain name into at least two character strings.
[0074] In some embodiments, the first domain name includes at least two character segments, each of which is separated by an identifier. According to the identifier and a predefined first number N, the at least two character segments included in the first domain name are divided into N character strings, where N is an integer greater than 1.
[0075] The first domain name includes at least two character segments and at least one character string. A character segment is also a character sequence, and is different from a character string in that a character string may include an identifier, but a character segment does not include an identifier.
[0076] The identifier is used to separate each character segment. For example, for the first domain name "www.abcd.com", the identifier "." can separate the first domain name into three character segments "www", "abcd", and "com", or can separate the first domain name into two character strings, for example, the first domain name can be separated into two character strings "www.abcd" and "com", or the first domain name can be separated into two character strings "www" and "abcd.com".
[0077] According to the identifier and the predefined first number N, the at least two character segments included in the first domain name are divided into N character strings. In the embodiment of the present application, the first number N is set to 4 to illustrate the domain name matching, then according to the identifier and the predefined first number 4, the at least two character segments included in the first domain name are divided into 4 character strings.
[0078] By dividing the first domain name into character strings that do not contain identifiers, the expected values corresponding to each character string can be matched separately subsequently, thus avoiding the problem of large matching calculation amount caused by matching all expected values corresponding to the first domain name, saving domain name matching time and improving domain name matching efficiency.
[0079] In some embodiments, according to the identifier and the predefined first number N, N-1 character segments are sequentially divided into N-1 character strings from back to front; and at least one character segment before the N-1 character segment is divided into the Nth character string.
[0080] If the number of character segments included in the first domain name is greater than or equal to the first number, N-1 character segments are sequentially used as N-1 character strings from back to front, and at least one character segment before the N-1 character segment is used as the Nth character string.
[0081] Exemplarily, N is 4, and the first domain name is "www.abcdcom", then the first domain name includes six character segments "www", "a", "b", "c", "d", and "com" and five identifiers ".", and the number of character segments is greater than the first number. According to the identifiers and the predefined first number 4, the three character segments "com", "d", and "c" are taken as three character strings from the end of the first domain name, and the three character segments "www", "a", and "b" before the character segment "c" are taken as the fourth character string, that is, "www.ab" is taken as the fourth character string, thereby dividing the first domain name "www.abcdcom" into four character strings "www.ab", "c", "d", and "com".
[0082] The first character string to the N-1th character string only include one character segment, and the Nth character string may include only one character segment, or may include at least two character segments and at least one identifier. The first character string refers to the first character string of the first domain name from the back to the front, and the order is ranked in sequence. The Nth character string refers to the character string with the first domain name at the front position.
[0083] If the first domain name includes N character strings, the number of character strings included in the second domain name that matches it is less than or equal to N.
[0084] When matching the expected value corresponding to the first domain name with the expected value corresponding to the second domain name in the domain name rule library, the expected value corresponding to the first character string of the first domain name and the expected value corresponding to the first character string of the second domain name can be matched, and the expected values corresponding to each character string can be matched in sequence. If the expected value corresponding to the first character string of the first domain name does not match the expected value corresponding to the first character string of the second domain name, the second character string does not need to be matched; if the sth character string cannot be matched successfully, the s+1th character string does not need to be matched, and s is a positive integer less than or equal to N.
[0085] By dividing the first domain name into N strings from back to front, when matching the first domain name with the second domain name, the expected values corresponding to the strings can be matched in sequence from back to front, avoiding matching of redundant strings, reducing the amount of calculation in the domain name matching process, and saving domain name matching time.
[0086] In some embodiments, if the number of at least two character segments included in the first domain name is less than the first number, the at least two character segments are divided into M character strings, where M is an integer less than N; the NM character strings before the M character strings are taken as blank strings, and the hash value corresponding to the blank string is 1.
[0087] For example, N is 4, and the first domain name is "www.abcd.com", then the first domain name includes three character segments "www", "abcd", and "com", and the number of character segments is less than the first number. The three character segments are taken as three character strings according to the identifier, and according to the predefined first number 4, the first domain name is still missing a character string, then a blank character string is added before the three character strings as the fourth character string.
[0088] A blank string refers to a string that does not include any characters, and the hash value corresponding to the blank string is 1. The hash value of a blank string is a numerical sequence of all 1s, and the length of the numerical sequence can be freely adjusted. The length of the sequence is the same as the numerical sequence length of the hash value of the string that matches it in the second domain name. For example, if the hash value of the string that matches it in the second domain name is a 32-bit numerical representation, the hash value of the blank string is a 32-bit sequence of all 1s.
[0089] By adding NM strings as blank strings before the first domain name that does not satisfy N strings, all first domain names to be matched include the same number of strings, thereby facilitating the computer device to perform domain name matching in an orderly manner according to the matching rules, thereby improving the efficiency of domain name matching.
[0090] Step 330: Use a hash algorithm for character strings to obtain hash values corresponding to at least two character strings.
[0091] In some embodiments, a first coefficient is obtained, and the first coefficient is an odd number greater than 1; for each character string, the i-th character in the string is multiplied by the i-1th power of the first coefficient to obtain an intermediate calculation result corresponding to the i-th character, where the i-th character refers to the i-th character counted from the back to the front among the characters included in the string, and i is a positive integer; the sum of the intermediate calculation results corresponding to each character included in the string is determined as the hash value corresponding to the string.
[0092] The first coefficient is an odd number greater than 1, which can reduce the hash conflict rate. Usually, the first coefficient can be set to 131 or 13331. At this time, the probability of a hash algorithm causing a conflict is extremely low.
[0093] A string includes at least one character, which can be expressed as T[j]. It includes j strings in total, where j is a positive integer. The hash value corresponding to the string can be expressed as:
[0094]
[0095] Where P represents the first coefficient, T[i]×P i-1 Indicates the intermediate calculation result corresponding to the i-th character, where the i-th character refers to the i-th character counted from the back to the front of the string.
[0096] For example, if the string is "abcd", the hash value corresponding to the string can be expressed as SUM = a × P 3 +b×P 2 +c×P+d, where a×P 3 Indicates the intermediate calculation result corresponding to the fourth character, b×P 2 represents the intermediate calculation result corresponding to the third character, c×P represents the intermediate calculation result corresponding to the second character, and d represents the intermediate calculation result corresponding to the first character.
[0097] Taking the first domain name "www.abcd.com" as an example, the first domain name is divided into four strings, and the hash value corresponding to each string is calculated, and the following table 2 can be obtained:
[0098] Table 2
[0099] String Hash value com 0x1A25B5 abcd 0xD19443A www 0x1F668B - 0xFFFFFFFF
[0100] In Table 2 above, “-” represents a blank string, and the hash value is numerically represented in a simplified form. Further, the hash value in Table 2 above can be represented as a binary digital sequence consisting of 0 and 1. For example, “0xFFFFFFFF” can be represented as a 32-bit all-1 sequence.
[0101] The hash value corresponding to each character string is obtained by the above hash algorithm, so that the expected value corresponding to the first domain name can be calculated according to the hash value corresponding to each character string.
[0102] Step 340: Determine masks corresponding to the at least two character strings respectively according to the hash values corresponding to the at least two character strings respectively.
[0103] In some embodiments, if the hash value corresponding to the string is 0, the mask corresponding to the string is determined to be 0; if the hash value corresponding to the string is not 0, the mask corresponding to the string is determined to be 1.
[0104] Taking the first domain name "www.abcd.com" as an example, the first domain name is divided into four character strings, and the masks corresponding to each character string can be referred to as shown in Table 3 below.
[0105] Table 3
[0106] String Hash value Mask com 0x1A25B5 0xFFFFFFFF abcd 0xD19443A 0xFFFFFFFF www 0x1F668B 0xFFFFFFFF - 0xFFFFFFFF 0xFFFFFFFF * 0x00000000 0x00000000
[0107] According to Table 3 above, the hash values corresponding to the strings "www", "abcd", and "com" are not 0, and the hash value corresponding to the blank string "-" is 1. Therefore, the mask corresponding to the strings "www", "abcd", "com", and "-" is 1, which is represented as a 32-bit all-1 sequence "0xFFFFFFFF" in Table 3 above.
[0108] “*” represents a wildcard character, which can be any string of characters. Therefore, the hash value corresponding to the wildcard character is 0, and the corresponding mask is 0, which is represented as a 32-bit all-0 sequence “0x00000000” in Table 3 above.
[0109] The mask corresponding to each character string is obtained by the above mask mapping rule, so that the expected value corresponding to the first domain name can be calculated according to the hash value corresponding to each character string and the corresponding mask.
[0110] Step 350: Obtain an expected value corresponding to the first domain name represented numerically according to the hash values corresponding to the at least two character strings and the masks corresponding to the at least two character strings.
[0111] In the embodiment of the present application, the expected value corresponding to each string is calculated according to the hash value corresponding to each string and the mask corresponding to each string, and then the expected value corresponding to the first domain name is obtained according to the expected value corresponding to each string. In this way, the expected value corresponding to each string can be matched sequentially from back to front, so as to avoid matching redundant strings, reduce the amount of calculation in the domain name matching process, and save the time of domain name matching.
[0112] In some embodiments, for each string, an AND operation is performed on the hash value corresponding to the string and the mask corresponding to the string to obtain an expected value corresponding to the string; and based on the expected values corresponding to at least two strings, an expected value corresponding to the first domain name is obtained.
[0113] Performing an AND operation on the hash value corresponding to the string and the mask corresponding to the string means performing an AND operation on the hash value corresponding to the string and the numerical value at each position in the mask corresponding to the string to obtain the expected value corresponding to the string. The numerical sequence length of the mask corresponding to the string is the same as the numerical sequence length of the hash value corresponding to the string. For example, if the hash value corresponding to the string is a 32-bit numerical sequence, the mask corresponding to the string is a 32-bit all-1 sequence, or a 32-bit all-0 sequence.
[0114] According to the operation rules of the AND operation, if the mask corresponding to the string is 0, the expected value corresponding to the string is 0. If the mask corresponding to the string is 1, the expected value corresponding to the string is the same as the hash value corresponding to the string.
[0115] The calculation process of expected value can refer to Figure 4 , perform an AND operation on the hash value corresponding to the string and the mask corresponding to the string to obtain the expected value corresponding to the string, which is specifically expressed as: hash value & mask = expected value. For example, if the hash value corresponding to the string is "01100001", the mask corresponding to the string is "11111111", and an AND operation is performed on "01100001" and "11111111", that is, the values at the corresponding positions of "01100001" and "11111111" are respectively ANDed, and the expected value corresponding to the string is "01100001".
[0116] Step 360: If the expected value corresponding to the first domain name contains the expected value corresponding to the second domain name in the domain name rule library, then it is determined that the matching result is that the first domain name matches the second domain name.
[0117] The second domain name refers to any domain name in the domain name rule library. The expected value corresponding to the first domain name is matched with the expected value corresponding to the second domain name in the domain name rule library. If the expected value corresponding to the first domain name contains the expected value corresponding to the second domain name in the domain name rule library, the matching result is determined to be that the first domain name matches the second domain name.
[0118] In the embodiment of the present application, the expected value of each string in the first domain name is matched with the expected value of each corresponding string in the second domain name, that is, the expected value of the sth string in the first domain name is matched with the expected value of the sth string in the second domain name. If the expected value of the sth string in the first domain name matches the expected value of the sth string in the second domain name, it means that the sth string in the first domain name matches the sth string in the second domain name.
[0119] In some embodiments, if the expected value corresponding to the first domain name exists in the expected value corresponding to the second domain name, it is determined that the first domain name matches the second domain name. It can also be understood that if there is a character string that matches each character string of the second domain name among at least two character strings included in the first domain name, it means that the first domain name matches the second domain name.
[0120] If the expected value corresponding to the first domain name includes the expected value corresponding to the second domain name, it means that the number of character strings included in the first domain name is greater than or equal to the number of character strings included in the second domain name.
[0121] Optionally, the expected value corresponding to the first domain name may be the same as the expected value corresponding to the second domain name, that is, at least two character strings included in the first domain name are the same as at least two character strings included in the second domain name. Alternatively, the expected value corresponding to the first domain name may contain other values in addition to the expected value corresponding to the second domain name, that is, the at least two character strings included in the first domain name may contain at least one character string in addition to the at least two character strings included in the second domain name.
[0122] For example, when the second domain name is "*.abcd.com", if the first domain name is "abcd.com", or "www.abcd.com", or "www.efgh.abcd.com", then the at least two character strings included in the first domain name include the two character strings "abcd" and "com" corresponding to the second domain name. Accordingly, it can be indicated that all the character strings of the second domain name exist in the at least two character strings included in the first domain name, and therefore the matching result is determined to be that the first domain name matches the second domain name.
[0123] When matching the expected value corresponding to the first domain name with the expected value corresponding to the second domain name in the domain name rule library, if the expected value corresponding to the s-th string in the first domain name is the same as the expected value corresponding to the s-th string in the second domain name, it means that the expected value of the s-th string in the first domain name matches the expected value of the s-th string in the second domain name. Therefore, the matching can be started from the expected value corresponding to the first string of the first domain name and the expected value corresponding to the first string of the second domain name, and the expected values corresponding to each string are matched in sequence. If the expected values corresponding to each string of the second domain name exist among the expected values corresponding to at least two strings of the first domain name, it means that the first domain name matches the second domain name. If the expected value corresponding to the first string of the first domain name does not match the expected value corresponding to the first string of the second domain name, there is no need to match the second string; that is, if the s-th string cannot be matched successfully, there is no need to match the s+1-th string.
[0124] In the actual test, for 10,000 second domain names in the domain name rule library, 1 million random matching tests were performed, which took a total of 100ms. However, using the dictionary tree domain name matching method in the related art, it takes 6s to perform 1 million random matches. Therefore, it can be seen that the technical solution provided in the embodiment of the present application has a 50-fold performance improvement compared to the technical solution in the related art, which fully saves the time of domain name matching and improves the efficiency of domain name matching.
[0125] By converting the matching of the first domain name and each domain name in the domain name rule library into judging whether there is an expected value corresponding to the second domain name in the expected value corresponding to the first domain name, and converting the character sequence composed of various characters into judging a binary digital sequence composed of two numbers 0 and 1, the domain name matching process is simplified, the amount of calculation in the matching process is reduced, and the domain name matching time is saved.
[0126] Step 370: If the expected value corresponding to the first domain name does not include the expected value corresponding to the second domain name, it is determined that the matching result is that the first domain name does not match the second domain name.
[0127] In some embodiments, if the expected value corresponding to the second domain name does not exist in the expected value corresponding to the first domain name, it is determined that the first domain name does not match the second domain name. It can also be understood that if at least one of the at least two character strings included in the first domain name does not match at least one corresponding character string in the second domain name, it indicates that the first domain name does not match the second domain name.
[0128] If the first domain name does not match the second domain name, the number of character strings included in the first domain name may be greater than or equal to the number of character strings included in the second domain name, or may be less than the number of character strings included in the second domain name.
[0129] For example, when the second domain name is "*.abcd.com", if the first domain name is "www.ab.cd.com", the four character strings included in the first domain name only include one character string "com" in the second domain name, or, the first domain name is "www.abcd.cn", the three character strings included in the first domain name only include one character string "abcd" in the second domain name. Accordingly, it can be indicated that only part of the character strings of the second domain name exist in at least two character strings included in the first domain name, and not all the character strings of the second domain name exist, so that the expected value corresponding to the first domain name does not exist in the expected value corresponding to the second domain name, and it is determined that the matching result is that the first domain name does not match the second domain name.
[0130] Normally, if the expected value corresponding to the first domain name does not exist in the expected value corresponding to the second domain name, when matching the expected value corresponding to the first domain name with the expected value corresponding to the second domain name, the expected value corresponding to the s-th string in the first domain name is different from the expected value corresponding to the s-th string in the second domain name, indicating that the s-th string cannot be matched successfully and there is no need to match the s+1-th string.
[0131] The flowchart of web page access can be referenced Figure 5 After receiving the web page access request sent by the terminal device, the computer device extracts the first domain name in the web page access request, and divides the first domain name into N strings to obtain the hash value array hash[N] corresponding to the N strings. According to the hash value array hash[N] corresponding to the N strings, the mask corresponding to the N strings is obtained, and according to the hash value hash[N] corresponding to the N strings and the mask corresponding to the N strings, the expected value corresponding to the N strings is obtained, so as to match the first domain name with the second domain name in the domain name rule library according to the expected value corresponding to the N strings to obtain a matching result. The computer device returns corresponding information to the terminal device according to the matching result. If the match is successful, the terminal device is controlled to display the web page corresponding to the web page access request. If the match is unsuccessful, the terminal device is controlled to display a prompt message indicating that the access failed.
[0132] The technical solution provided by the embodiment of the present application divides the first domain name into N character strings and calculates the expected values corresponding to the N character strings, so that when matching the first domain name with the second domain name, the expected values corresponding to the various character strings can be matched in sequence from back to front, thereby avoiding matching of redundant character strings for the first domain name, thereby reducing the amount of calculation in the domain name matching process, saving the time of domain name matching, and improving the efficiency of domain name matching.
[0133] Figure 6The flowchart of domain name matching is shown. The user enters access information in the application of the terminal device, and the computer device parses the input information, first determining whether the input information is a domain name. If the input information is a domain name, it is necessary to calculate the hash values corresponding to the N strings included in the domain name. If the input information is not a domain name, the elements of the N hash value array hash[N] are directly set to 0.
[0134] If the input information is a domain name, first obtain the character segments in the domain name, and divide the domain name into N strings according to the identifier and the predefined first number N. Use the string hash algorithm to obtain the hash values corresponding to the N strings, and fill the N hash values in the hash value array hash[N], where hash[i] represents the hash value corresponding to the i-th string. If the number of character segments included in the first domain name is less than the first number, fill a blank string before the string included in the first domain name, and the hash value corresponding to the blank string is 1. For example, if the N-th string is a blank string, hash[N]=1.
[0135] After obtaining the N hash value arrays hash[N] corresponding to the input information, determine whether the array element of hash[N] is 0. If the hash value is 0, set the mask of the string corresponding to the hash value to 0. If the hash value is not 0, set the mask of the string corresponding to the hash value to 1. Perform an AND operation on the hash values corresponding to the N strings and the masks corresponding to the N strings to obtain the expected values corresponding to the N strings, and then obtain the expected value corresponding to the domain name based on the expected values corresponding to the N strings.
[0136] The expected value corresponding to the domain name is matched with the expected value corresponding to at least one domain name in the domain name rule library. If the expected value corresponding to the domain name contains an expected value corresponding to a domain name in the domain name rule library, it is determined that the domain name matches the domain name in the domain name rule library, and the computer device controls the terminal device to display the webpage corresponding to the domain name. If the expected value corresponding to the domain name does not contain an expected value corresponding to any domain name in the domain name rule library, it is determined that the domain name does not match the domain name in the domain name rule library, and the computer device controls the terminal device to display a prompt message indicating that the domain name access failed.
[0137] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0138] Please refer to Figure 7, which shows a block diagram of an access control device for domain names provided by an embodiment of the present application. The device has the function of implementing the above-mentioned access control method for domain names, and the function can be implemented by hardware, or by hardware executing corresponding software. The device can be the computer device introduced above, or it can be set in a computer device. Figure 7 As shown, the apparatus 700 may include: a request receiving module 710 , a string segmentation module 720 , a hash value determination module 730 , an expected value determination module 740 , a domain name matching module 750 and an access control module 760 .
[0139] The request receiving module 710 is used to receive a web page access request, where the web page domain name corresponding to the web page access request is a first domain name.
[0140] The character string segmentation module 720 is configured to segment the first domain name into at least two character strings.
[0141] The hash value determination module 730 is configured to obtain hash values corresponding to the at least two character strings respectively by using a hash algorithm for the character string.
[0142] The expected value determination module 740 is used to obtain the expected value corresponding to the first domain name expressed in numerical form according to the hash values corresponding to the at least two character strings and the masks corresponding to the at least two character strings.
[0143] The domain name matching module 750 is used to match the expected value corresponding to the first domain name with the expected values corresponding to each domain name in the domain name rule library to obtain a matching result.
[0144] The access control module 760 is used to perform access control on the web page access request according to the matching result.
[0145] In some embodiments, the hash value determination module 730 is used to:
[0146] Obtaining a first coefficient, where the first coefficient is an odd number greater than 1;
[0147] For each character string, multiply the i-th character in the character string by the first coefficient raised to the power of i-1 to obtain an intermediate calculation result corresponding to the i-th character, where the i-th character refers to the i-th character counted from the back to the front among the characters included in the character string, and i is a positive integer;
[0148] The sum of the intermediate calculation results corresponding to each character included in the string is determined as the hash value corresponding to the string.
[0149] In some embodiments, the apparatus further comprises a mask determination module, the mask determination module being configured to:
[0150] If the hash value corresponding to the string is 0, then determining that the mask corresponding to the string is 0;
[0151] If the hash value corresponding to the string is not 0, it is determined that the mask corresponding to the string is 1.
[0152] In some embodiments, the expected value determination module 740 is used to:
[0153] For each string, perform an AND operation on the hash value corresponding to the string and the mask corresponding to the string to obtain an expected value corresponding to the string;
[0154] The expected value corresponding to the first domain name is obtained according to the expected values respectively corresponding to the at least two character strings.
[0155] In some embodiments, the domain name matching module 750 is used to:
[0156] If the expected value corresponding to the first domain name contains the expected value corresponding to the second domain name in the domain name rule library, determining that the matching result is that the first domain name matches the second domain name;
[0157] If the expected value corresponding to the first domain name does not include the expected value corresponding to the second domain name, it is determined that the matching result is that the first domain name does not match the second domain name.
[0158] In some embodiments, the first domain name includes at least two character segments, each of which is separated by an identifier; the string segmentation module 720 is used to segment the at least two character segments included in the first domain name into N character strings according to the identifier and a predefined first number N, where N is an integer greater than 1.
[0159] In some embodiments, the string segmentation module 720 is used to:
[0160] According to the identifier and the predefined first number N, the N-1 character segments are divided into N-1 character strings from back to front;
[0161] At least one character segment before N-1 of the character segments is taken as the Nth character string.
[0162] In some embodiments, the string segmentation module 720 is further used to:
[0163] If the number of the at least two character segments included in the first domain name is less than the first number, dividing the at least two character segments into M character strings, where M is an integer less than N;
[0164] The NM character strings before the M character strings are regarded as blank character strings, and the hash value corresponding to the blank character strings is 1.
[0165] The technical solution provided by the embodiment of the present application is to obtain the expected value corresponding to the first domain name represented numerically by dividing the received first domain name into at least two character strings, and according to the hash values and masks corresponding to the at least two character strings, thereby matching the first domain name with each domain name in the domain name rule base, and converting the expected value corresponding to the first domain name to the expected value corresponding to each domain name in the domain name rule base. Compared with matching domain names composed of various types of characters, matching the expected value corresponding to the first domain name represented numerically with the expected value corresponding to each domain name in the domain name rule base reduces the amount of calculation in the domain name matching process, saves the time of domain name matching, and improves the efficiency of domain name matching.
[0166] It should be noted that the device provided in the above embodiment, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the content structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0167] Please refer to Figure 8 , which shows a structural block diagram of a computer device 800 provided in one embodiment of the present application. The computer device 800 may be any electronic device having a function of controlling network traffic. The computer device 800 may be used to implement the access control method for domain names provided in the above embodiments.
[0168] Typically, the computer device 800 includes a processor 801 and a memory 802 .
[0169] The processor 801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 801 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI processor for processing computing operations related to machine learning.
[0170] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include a high-speed random access memory and a non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store a computer program, which is configured to be executed by one or more processors to implement the above-mentioned access control method for a domain name.
[0171] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the computer device 800, and the computer device 800 may include more or less components than those shown in the figure, or combine some components, or adopt a different arrangement of components.
[0172] In an illustrative embodiment, a computer-readable storage medium is also provided, in which a computer program is stored, and when the computer program is executed by a processor of a computer device, the access control method for a domain name is implemented. Optionally, the computer-readable storage medium may be a ROM (Read-Only Memory), a RAM (Random Access Memory), a CD-ROM (Compact Disc Read-Only Memory), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0173] In an exemplary embodiment, a computer program product is also provided, the computer program product includes a computer program, the computer program is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned access control method for a domain name.
[0174] It should be noted that this application can display a prompt interface, pop-up window or output voice prompt information before collecting relevant data of users and during the process of collecting relevant data of users. The prompt interface, pop-up window or voice prompt information is used to prompt the user that relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining relevant data of users after obtaining the confirmation operation issued by the user on the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user on the prompt interface or pop-up window is not obtained), the relevant steps of obtaining relevant data of users are terminated, that is, the relevant data of users are not obtained. In other words, all data (including domain name data) collected by this application are processed strictly in accordance with the requirements of relevant national laws and regulations, and the informed consent or separate consent of the subject of personal information is obtained with the consent and authorization of the user. The subsequent data use and processing behavior is carried out within the scope of authorization of laws and regulations and the subject of personal information, and the collection, use and processing of relevant user data shall comply with the relevant laws, regulations and standards of relevant countries and regions.
[0175] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.
[0176] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for access control of a domain name, characterized in that: The method comprises: receiving a web page access request, wherein the web page domain name corresponding to the web page access request is a first domain name; Splitting the first domain name into at least two character strings; Using a hash algorithm for the character string, obtaining hash values corresponding to the at least two character strings respectively; Obtaining an expected value corresponding to the first domain name represented numerically according to the hash values corresponding to the at least two character strings and the masks corresponding to the at least two character strings; Matching the expected value corresponding to the first domain name with the expected values corresponding to each domain name in the domain name rule library to obtain a matching result; Access control is performed on the webpage access request according to the matching result.
2. The method according to claim 1, characterized in that The adopting a hash algorithm for the character string to obtain hash values corresponding to the at least two character strings respectively includes: Obtaining a first coefficient, where the first coefficient is an odd number greater than 1; For each character string, multiply the i-th character in the character string by the first coefficient raised to the power of i-1 to obtain an intermediate calculation result corresponding to the i-th character, where the i-th character refers to the i-th character counted from the back to the front among the characters included in the character string, and i is a positive integer; A hash value corresponding to the string is obtained according to the intermediate calculation results corresponding to each character included in the string.
3. The method according to claim 1, characterized in that After the hash algorithm for the string is used to obtain the hash values corresponding to the at least two strings respectively, the method further includes: If the hash value corresponding to the string is 0, then determining that the mask corresponding to the string is 0; If the hash value corresponding to the string is not 0, it is determined that the mask corresponding to the string is 1.
4. The method according to claim 1, characterized in that: The obtaining, according to the hash values corresponding to the at least two character strings and the masks corresponding to the at least two character strings, an expected value corresponding to the first domain name represented numerically includes: For each character string, perform an AND operation on the hash value corresponding to the character string and the mask corresponding to the character string to obtain an expected value corresponding to the character string represented numerically; According to the expected values respectively corresponding to the at least two character strings, the expected value corresponding to the first domain name represented in numerical form is obtained.
5. The method according to claim 1, characterized in that The matching of the expected value corresponding to the first domain name with the expected values corresponding to each domain name in the domain name rule library to obtain a matching result includes: If the expected value corresponding to the first domain name contains the expected value corresponding to the second domain name in the domain name rule library, determining that the matching result is that the first domain name matches the second domain name; If the expected value corresponding to the first domain name does not include the expected value corresponding to the second domain name, it is determined that the matching result is that the first domain name does not match the second domain name.
6. The method according to claim 1, characterized in that The first domain name includes at least two character segments, and each of the character segments is separated by an identifier; The step of dividing the first domain name into at least two character strings includes: According to the identifier and a predefined first number N, the at least two character segments included in the first domain name are divided into N character strings, where N is an integer greater than 1.
7. The method according to claim 6, characterized in that The step of segmenting the at least two characters included in the first domain name into N character strings according to the identifier and the predefined first number N includes: According to the identifier and the predefined first number N, the N-1 character segments are divided into N-1 character strings from back to front; At least one character segment before N-1 of the character segments is taken as the Nth character string.
8. The method according to claim 6, characterized in that The method further comprises: If the number of the at least two character segments included in the first domain name is less than the first number, dividing the at least two character segments into M character strings, where M is an integer less than N; The NM character strings before the M character strings are regarded as blank character strings, and the hash value corresponding to the blank character strings is 1.
9. An access control device for a domain name, characterized in that: The device comprises: A request receiving module, used to receive a web page access request, wherein the web page domain name corresponding to the web page access request is a first domain name; A character string segmentation module, used for segmenting the first domain name into at least two character strings; A hash value determination module, configured to obtain hash values corresponding to the at least two character strings respectively by using a hash algorithm for the character string; An expected value determination module, configured to obtain an expected value corresponding to the first domain name represented in numerical form according to the hash values corresponding to the at least two character strings and the masks corresponding to the at least two character strings; A domain name matching module, used to match the expected value corresponding to the first domain name with the expected values corresponding to each domain name in the domain name rule library to obtain a matching result; The access control module is used to perform access control on the web page access request according to the matching result.
10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the access control method for a domain name according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the access control method for a domain name according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises a computer program, and the computer program is loaded and executed by a processor to implement the access control method for a domain name according to any one of claims 1 to 8.
Citation Information
Patent Citations
URL lookup method for URL filtering system
CN101605129A
Domain name matching method and device and tree structure construction method and device
CN115687719A
Combat system information provision interface system and method for displaying target data item
KR102690361B1
Technologies for access control
US20160191530A1
Hardware acceleration device for string matching and range comparison
US20210084011A1