/src/constants.rs

https://github.com/minio/minsql · Rust · 53 lines · 27 code · 5 blank · 21 comment · 0 complexity · 0f1d3b4aef2fd3394203a7c5b67be0be MD5 · raw file

  1. // This file is part of MinSQL
  2. // Copyright (c) 2019 MinIO, Inc.
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. // Server Defaults
  17. pub const DEFAULT_SERVER_ADDRESS: &str = "0.0.0.0:9999";
  18. // Smart Fields
  19. pub const SF_IP: &str = "$ip";
  20. pub const SF_EMAIL: &str = "$email";
  21. pub const SF_DATE: &str = "$date";
  22. pub const SF_QUOTED: &str = "$quoted";
  23. pub const SF_URL: &str = "$url";
  24. pub const SF_PHONE: &str = "$phone";
  25. pub const SF_USER_AGENT: &str = "$user_agent";
  26. pub const SMART_FIELDS_RAW_RE: &str =
  27. r"((\$(ip|email|date|url|quoted|phone|user_agent))([0-9]+)*)\b";
  28. // MIME Types
  29. pub const UNKNOWN_CONTENT_TYPE: &str = "text/plain";
  30. pub const IMAGE_JPEG: &str = "image/jpeg";
  31. pub const APP_JAVASCRIPT: &str = "application/javascript";
  32. pub const APP_JSON: &str = "application/json";
  33. pub const TEXT_HTML: &str = "text/html";
  34. bitflags! {
  35. // ScanFlags determine which regex should be evaluated
  36. // If you are adding new values make sure to add the next power of 2 as
  37. // they are evaluated using a bitwise operation
  38. pub struct ScanFlags: u32 {
  39. const NONE = 1;
  40. const IP = 2;
  41. const EMAIL = 4;
  42. const DATE = 8;
  43. const QUOTED = 16;
  44. const URL = 32;
  45. const PHONE = 64;
  46. const USER_AGENT = 128;
  47. }
  48. }