http_constant/common/
const.rs

1use crate::*;
2/// A single space character.
3/// This constant is used to represent a space character in string/// or byte operations.
4pub const SPACE: &str = " ";
5/// A const byte slice representation of the string `SPACE`.
6pub const SPACE_BYTES: &[u8] = SPACE.as_bytes();
7/// The byte representation of a single space character.
8/// This constant provides the byte equivalent of the space character/// for use in low-level operations.
9pub const SPACE_U8: u8 = SPACE_BYTES[0];
10/// A tab character.
11/// This constant is used to represent a tab character in string/// or byte operations.
12pub const TAB: &str = "\t";
13/// A const byte slice representation of the string `TAB`.
14pub const TAB_BYTES: &[u8] = TAB.as_bytes();
15/// The byte representation of a tab character.
16/// This constant provides the byte equivalent of the tab character/// for use in low-level operations.
17pub const TAB_U8: u8 = TAB_BYTES[0];
18/// A line break character (newline).
19/// This constant is used to represent a line break character in/// string or byte operations.
20pub const BR: &str = "\n";
21/// A const byte slice representation of the string `BR`.
22pub const BR_BYTES: &[u8] = BR.as_bytes();
23/// The byte representation of a line break character.
24/// This constant provides the byte equivalent of the line break character/// for use in low-level operations.
25pub const BR_U8: u8 = BR_BYTES[0];
26/// A double line break.
27pub const DOUBLE_BR: &str = "\n\n";
28/// A const byte slice representation of the string `DOUBLE_BR`.
29pub const DOUBLE_BR_BYTES: &[u8] = DOUBLE_BR.as_bytes();
30/// A colon followed by a space (`: `).
31/// This constant is commonly used in formatted strings, such as/// headers or key-value pairs, where a colon and a space are needed.
32pub const COLON_SPACE: &str = ": ";
33/// The byte representation of the first character in the `COLON_SPACE`.
34/// This constant provides the byte equivalent of the colon character/// from the `COLON_SPACE` string.
35pub const COLON_SPACE_BYTES: &[u8] = COLON_SPACE.as_bytes();
36/// A colon followed by a space symbol (`:`).
37/// This constant is commonly used in formatted strings, such as/// headers or key-value pairs, where a colon and a space are needed.
38pub const COLON: &str = ":";
39/// A const byte slice representation of the string `COLON`.
40pub const COLON_BYTES: &[u8] = COLON.as_bytes();
41/// The byte representation of a colon character.
42/// This constant provides the byte equivalent of the colon character/// for use in low-level operations.
43pub const COLON_U8: u8 = COLON_BYTES[0];
44/// A query symbol (`?`).
45/// This constant represents the question mark character, which is/// commonly used to denote the beginning of a query string in a URL.
46pub const QUERY: &str = "?";
47/// A const byte slice representation of the string `QUERY`.
48pub const QUERY_BYTES: &[u8] = QUERY.as_bytes();
49/// The byte representation of a query symbol.
50/// This constant provides the byte equivalent of the query character/// for use in low-level operations.
51pub const QUERY_U8: u8 = QUERY_BYTES[0];
52/// The string ",".
53/// This constant is used to represent a comma.
54pub const COMMA: &str = ",";
55/// A const byte slice representation of the string `COMMA`.
56pub const COMMA_BYTES: &[u8] = COMMA.as_bytes();
57/// The byte representation of a comma character.
58/// This constant provides the byte equivalent of the comma character/// for use in low-level operations.
59pub const COMMA_U8: u8 = COMMA_BYTES[0];
60/// A hash symbol (`#`).
61/// This constant represents the hash character, which is used to/// identify a fragment or anchor in a URL.
62pub const HASH: &str = "#";
63/// A const byte slice representation of the string `HASH`.
64pub const HASH_BYTES: &[u8] = HASH.as_bytes();
65/// The byte representation of a hash symbol.
66/// This constant provides the byte equivalent of the hash character/// for use in low-level operations.
67pub const HASH_U8: u8 = HASH_BYTES[0];
68/// An empty string.
69/// This constant represents an empty string, which can be used as a/// default or placeholder value.
70pub const EMPTY_STR: &str = "";
71/// A const byte slice representation of the string `EMPTY_STR`.
72pub const EMPTY_STR_BYTES: &[u8] = EMPTY_STR.as_bytes();
73/// The default host address.
74/// This constant represents the default host address, which is typically/// used to bind a server to all available network interfaces.
75pub const DEFAULT_HOST: &str = "0.0.0.0";
76/// A const byte slice representation of the string `DEFAULT_HOST`.
77pub const DEFAULT_HOST_BYTES: &[u8] = DEFAULT_HOST.as_bytes();
78/// The default web port.
79/// This constant represents the default port for HTTP traffic.
80pub const DEFAULT_WEB_PORT: usize = 80;
81/// An HTTP line break (`\r\n`).
82/// This constant represents the standard line break sequence used in/// the HTTP protocol.
83pub const HTTP_BR: &str = "\r\n";
84/// The byte representation of an HTTP line break.
85/// This constant provides the byte equivalent of the HTTP line break/// for use in low-level network operations.
86pub const HTTP_BR_BYTES: &[u8] = HTTP_BR.as_bytes();
87/// A double HTTP line break (`\r\n\r\n`).
88/// This constant represents the sequence used to separate headers/// from the body in an HTTP message.
89pub const HTTP_DOUBLE_BR: &str = "\r\n\r\n";
90/// The byte representation of a double HTTP line break.
91/// This constant provides the byte equivalent of the double HTTP line/// break for use in parsing and constructing HTTP messages.
92pub const HTTP_DOUBLE_BR_BYTES: &[u8] = HTTP_DOUBLE_BR.as_bytes();
93/// The default HTTP path.
94/// This constant represents the root path of a URL, which is used/// when no specific path is provided.
95pub const DEFAULT_HTTP_PATH: &str = "/";
96/// The byte representation of the default HTTP path.
97/// This constant provides the byte equivalent of the default HTTP path/// for use in low-level operations.
98pub const DEFAULT_HTTP_PATH_BYTES: &[u8] = DEFAULT_HTTP_PATH.as_bytes();
99/// An ampersand character (`&`).
100/// This constant represents the ampersand character, which is used/// to separate query parameters in a URL.
101pub const AND: &str = "&";
102/// The byte representation of an ampersand character.
103/// This constant provides the byte equivalent of the ampersand character/// for use in URL parsing and construction.
104pub const AND_BYTES: &[u8] = AND.as_bytes();
105/// The byte representation of an ampersand character.
106/// This constant provides the byte equivalent of the ampersand character/// for use in low-level operations.
107pub const AND_U8: u8 = AND_BYTES[0];
108/// An equal sign (`=`).
109/// This constant represents the equal sign, which is used to separate/// keys and values in query parameters.
110pub const EQUAL: &str = "=";
111/// The byte representation of an equal sign.
112/// This constant provides the byte equivalent of the equal sign for/// use in URL parsing and construction.
113pub const EQUAL_BYTES: &[u8] = EQUAL.as_bytes();
114/// The byte representation of an equal sign.
115/// This constant provides the byte equivalent of the equal sign for/// use in low-level operations.
116pub const EQUAL_U8: u8 = EQUAL_BYTES[0];
117/// The string representation of the number zero.
118/// This constant represents the character '0' as a string.
119pub const ZERO_STR: &str = "0";
120/// The byte representation of the number zero.
121/// This constant provides the byte equivalent of the character '0'.
122pub const ZERO_STR_BYTES: &[u8] = ZERO_STR.as_bytes();
123/// The byte representation of the number zero.
124/// This constant provides the byte equivalent of the character '0'/// for use in low-level operations.
125pub const ZERO_STR_U8: u8 = ZERO_STR_BYTES[0];
126/// The default buffer size.
127/// This constant defines the default size for buffers used in I/O/// operations, such as reading from a network stream.
128pub const DEFAULT_BUFFER_SIZE: usize = 4096;
129/// The default maximum number of redirect times.
130/// This constant specifies the default limit for the number of times/// an HTTP client should follow a redirect.
131pub const DEFAULT_MAX_REDIRECT_TIMES: usize = 8;
132/// The default timeout value.
133/// This constant represents the default timeout for operations, which/// is set to the maximum value of `u64` to indicate no timeout.
134pub const DEFAULT_TIMEOUT: u64 = u64::MAX;
135/// A point character (`.`).
136/// This constant represents the period or dot character, which is/// often used as a separator in file names or domain names.
137pub const POINT: &str = ".";
138/// A const byte slice representation of the string `POINT`.
139pub const POINT_BYTES: &[u8] = POINT.as_bytes();
140/// The byte representation of a point character.
141/// This constant provides the byte equivalent of the point character/// for use in low-level operations.
142pub const POINT_U8: u8 = POINT_BYTES[0];
143/// The root path.
144/// This constant represents the root path in a file system or URL.
145pub const ROOT_PATH: &str = "/";
146/// A const byte slice representation of the string `ROOT_PATH`.
147pub const ROOT_PATH_BYTES: &[u8] = ROOT_PATH.as_bytes();
148/// The byte representation of the root path character.
149/// This constant provides the byte equivalent of the root path character/// for use in low-level operations.
150pub const ROOT_PATH_U8: u8 = ROOT_PATH_BYTES[0];
151/// A semicolon character (`;`).
152/// This constant represents the semicolon character, which is used/// as a separator in various contexts.
153pub const SEMICOLON: &str = ";";
154/// A const byte slice representation of the string `SEMICOLON`.
155pub const SEMICOLON_BYTES: &[u8] = SEMICOLON.as_bytes();
156/// The byte representation of a semicolon character.
157/// This constant provides the byte equivalent of the semicolon character/// for use in low-level operations.
158pub const SEMICOLON_U8: u8 = SEMICOLON_BYTES[0];
159/// A semicolon followed by a space (`; `).
160/// This constant represents a semicolon followed by a space, which is/// commonly used as a separator in formatted text.
161pub const SEMICOLON_SPACE: &str = "; ";
162/// A const byte slice representation of the string `SEMICOLON_SPACE`.
163pub const SEMICOLON_SPACE_BYTES: &[u8] = SEMICOLON_SPACE.as_bytes();
164/// A globally unique identifier (GUID) for WebSocket connections.
165/// This constant is used in the WebSocket handshake process to create/// the `Sec-WebSocket-Accept` header.
166pub const GUID: &[u8; 36] = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
167/// The initial hash state for SHA-1.
168/// This constant represents the initial values used in the SHA-1/// hashing algorithm.
169pub const HASH_STATE: [u32; 5] = [
170    0x67452301u32,
171    0xEFCDAB89,
172    0x98BADCFE,
173    0x10325476,
174    0xC3D2E1F0,
175];
176/// The Base64 character set table.
177/// This constant contains the characters used for Base64 encoding.
178pub const BASE64_CHARSET_TABLE: &[u8] =
179    b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
180/// The maximum frame size for WebSockets.
181/// This constant defines the maximum size of a WebSocket frame that/// can be processed.
182pub const MAX_FRAME_SIZE: usize = 65535;
183/// The maximum number of attempts to decode a UTF-8 character.
184/// This constant specifies the maximum number of bytes that can be/// part of a single UTF-8 character.
185pub const MAX_UTF8_ATTEMPTS: usize = 4;
186/// The default socket address.
187/// This constant represents a default, unspecified socket address.
188pub const DEFAULT_SOCKET_ADDR: SocketAddr =
189    SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), 0));
190/// The loopback socket address (127.0.0.1).
191/// This constant represents the loopback address, which is used for/// local network communication.
192pub const SOCKET_ADDR_127_0_0_1: SocketAddr =
193    SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 0));
194/// The string "hyperlane".
195/// This constant is used for identification or naming purposes.
196pub const HYPERLANE: &str = "hyperlane";
197/// A const byte slice representation of the string `HYPERLANE`.
198pub const HYPERLANE_BYTES: &[u8] = HYPERLANE.as_bytes();
199/// The string "Hyperlane" in PascalCase.
200/// This constant is a PascalCase version of the "hyperlane" string.
201pub const HYPERLANE_PASCAL_CASE: &str = "Hyperlane";
202/// A const byte slice representation of the string `HYPERLANE_PASCAL_CASE`.
203pub const HYPERLANE_PASCAL_CASE_BYTES: &[u8] = HYPERLANE_PASCAL_CASE.as_bytes();
204/// The string "Hyperlane" in UpperCase.
205/// This constant is a UpperCase version of the "hyperlane" string.
206pub const HYPERLANE_UPPERCASE: &str = "HYPERLANE";
207/// A const byte slice representation of the string `HYPERLANE_UPPERCASE`.
208pub const HYPERLANE_UPPERCASE_BYTES: &[u8] = HYPERLANE_UPPERCASE.as_bytes();
209/// The default setting for inner printing.
210/// This constant determines whether internal printing is enabled by/// default.
211pub const DEFAULT_INNER_PRINT: bool = true;
212/// The default setting for inner logging.
213/// This constant determines whether internal logging is enabled by/// default.
214pub const DEFAULT_INNER_LOG: bool = true;
215/// The default setting for TCP_NODELAY.
216/// This constant specifies the default value for the `TCP_NODELAY`/// socket option.
217pub const DEFAULT_NODELAY: Option<bool> = None;
218/// The default setting for socket linger.
219/// This constant specifies the default value for the `SO_LINGER`/// socket option.
220pub const DEFAULT_LINGER: Option<Duration> = None;
221/// The default time-to-live (TTL) setting.
222/// This constant specifies the default value for the IP_TTL socket/// option.
223pub const DEFAULT_TTI: Option<u32> = None;
224/// The string "warning".
225/// This constant is used to represent a warning message type.
226pub const WARNING: &str = "warning";
227/// A const byte slice representation of the string `WARNING`.
228pub const WARNING_BYTES: &[u8] = WARNING.as_bytes();
229/// The string "success".
230/// This constant is used to represent a success message type.
231pub const SUCCESS: &str = "success";
232/// A const byte slice representation of the string `SUCCESS`.
233pub const SUCCESS_BYTES: &[u8] = SUCCESS.as_bytes();
234/// The string "fail".
235/// This constant is used to represent a failure message type.
236pub const FAIL: &str = "fail";
237/// A const byte slice representation of the string `FAIL`.
238pub const FAIL_BYTES: &[u8] = FAIL.as_bytes();
239/// The string "error".
240/// This constant is used to represent an error message type.
241pub const ERROR: &str = "error";
242/// A const byte slice representation of the string `ERROR`.
243pub const ERROR_BYTES: &[u8] = ERROR.as_bytes();
244/// The string "info".
245/// This constant is used to represent an informational message type.
246pub const INFO: &str = "info";
247/// A const byte slice representation of the string `INFO`.
248pub const INFO_BYTES: &[u8] = INFO.as_bytes();
249/// The string "debug".
250/// This constant is used to represent a debug message type.
251pub const DEBUG: &str = "debug";
252/// A const byte slice representation of the string `DEBUG`.
253pub const DEBUG_BYTES: &[u8] = DEBUG.as_bytes();
254/// The string "plain".
255/// This constant is used to represent plain text content.
256pub const PLAIN: &str = "plain";
257/// A const byte slice representation of the string `PLAIN`.
258pub const PLAIN_BYTES: &[u8] = PLAIN.as_bytes();
259/// The string "binary".
260/// This constant is used to represent binary content.
261pub const BINARY: &str = "binary";
262/// A const byte slice representation of the string `BINARY`.
263pub const BINARY_BYTES: &[u8] = BINARY.as_bytes();
264/// The string "{".
265/// This constant is used to represent a left bracket.
266pub const LEFT_BRACKET: &str = "{";
267/// A const byte slice representation of the string `LEFT_BRACKET`.
268pub const LEFT_BRACKET_BYTES: &[u8] = LEFT_BRACKET.as_bytes();
269/// The byte representation of a left bracket character.
270/// This constant provides the byte equivalent of the left bracket character/// for use in low-level operations.
271pub const LEFT_BRACKET_U8: u8 = LEFT_BRACKET_BYTES[0];
272/// The string "}".
273/// This constant is used to represent a right bracket.
274pub const RIGHT_BRACKET: &str = "}";
275/// A const byte slice representation of the string `RIGHT_BRACKET`.
276pub const RIGHT_BRACKET_BYTES: &[u8] = RIGHT_BRACKET.as_bytes();
277/// The byte representation of a right bracket character.
278/// This constant provides the byte equivalent of the right bracket character/// for use in low-level operations.
279pub const RIGHT_BRACKET_U8: u8 = RIGHT_BRACKET_BYTES[0];
280/// The string "(":
281/// This constant is used to represent a left parenthesis.
282pub const LEFT_PAREN: &str = "(";
283/// A const byte slice representation of the string `LEFT_PAREN`.
284pub const LEFT_PAREN_BYTES: &[u8] = LEFT_PAREN.as_bytes();
285/// The byte representation of a left parenthesis character.
286/// This constant provides the byte equivalent of the left parenthesis character/// for use in low-level operations.
287pub const LEFT_PAREN_U8: u8 = LEFT_PAREN_BYTES[0];
288/// The string ")".
289/// This constant is used to represent a right parenthesis.
290pub const RIGHT_PAREN: &str = ")";
291/// A const byte slice representation of the string `RIGHT_PAREN`.
292pub const RIGHT_PAREN_BYTES: &[u8] = RIGHT_PAREN.as_bytes();
293/// The byte representation of a right parenthesis character.
294/// This constant provides the byte equivalent of the right parenthesis character/// for use in low-level operations.
295pub const RIGHT_PAREN_U8: u8 = RIGHT_PAREN_BYTES[0];
296/// The string "[".
297/// This constant is used to represent a left square bracket.
298pub const LEFT_SQUARE_BRACKET: &str = "[";
299/// A const byte slice representation of the string `LEFT_SQUARE_BRACKET`.
300pub const LEFT_SQUARE_BRACKET_BYTES: &[u8] = LEFT_SQUARE_BRACKET.as_bytes();
301/// The byte representation of a left square bracket character.
302/// This constant provides the byte equivalent of the left square bracket character/// for use in low-level operations.
303pub const LEFT_SQUARE_BRACKET_U8: u8 = LEFT_SQUARE_BRACKET_BYTES[0];
304/// The string "]".
305/// This constant is used to represent a right square bracket.
306pub const RIGHT_SQUARE_BRACKET: &str = "]";
307/// A const byte slice representation of the string `RIGHT_SQUARE_BRACKET`.
308pub const RIGHT_SQUARE_BRACKET_BYTES: &[u8] = RIGHT_SQUARE_BRACKET.as_bytes();
309/// The byte representation of a right square bracket character.
310/// This constant provides the byte equivalent of the right square bracket character/// for use in low-level operations.
311pub const RIGHT_SQUARE_BRACKET_U8: u8 = RIGHT_SQUARE_BRACKET_BYTES[0];
312/// localhost
313/// This constant is used to represent the localhost address.
314pub const LOCALHOST: &str = "localhost";
315/// A const byte slice representation of the string `LOCALHOST`.
316pub const LOCALHOST_BYTES: &[u8] = LOCALHOST.as_bytes();
317/// 127.0.0.1
318/// This constant is used to represent the loopback address.
319pub const LOOPBACK: &str = "127.0.0.1";
320/// A const byte slice representation of the string `LOOPBACK`.
321pub const LOOPBACK_BYTES: &[u8] = LOOPBACK.as_bytes();