tiny_proxy/config/
models.rs1use std::collections::HashMap;
2
3#[cfg(feature = "api")]
4use serde::Serialize;
5
6#[derive(Debug, Clone)]
8#[cfg_attr(feature = "api", derive(Serialize))]
9pub struct Config {
10 pub sites: HashMap<String, SiteConfig>,
11}
12
13#[derive(Debug, Clone)]
14#[cfg_attr(feature = "api", derive(Serialize))]
15pub struct SiteConfig {
16 pub address: String,
17 pub directives: Vec<Directive>,
18}
19
20#[derive(Debug, Clone)]
21#[cfg_attr(feature = "api", derive(Serialize))]
22pub enum Directive {
23 ReverseProxy {
24 to: String,
25 },
26 HandlePath {
27 pattern: String,
28 directives: Vec<Directive>,
29 },
30 UriReplace {
31 find: String,
32 replace: String,
33 },
34 Header {
35 name: String,
36 value: String,
37 },
38 Method {
39 methods: Vec<String>,
40 directives: Vec<Directive>,
41 },
42 Respond {
43 status: u16,
44 body: String,
45 },
46}