1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
use crate::config::Address;
use crate::line::owned;
/// Represents a section in a config file.
#[derive(Debug)]
pub enum Section {
BlankLine,
/// Comment on a separate line not in a section
Comment(String),
/// The global section of a config.
Global {
/// Comment on the same line as the section header
comment: Option<String>,
/// [`Lines`](owned::Line) in this section.
lines: Vec<owned::Line>,
},
/// The lines in the default section of a config.
Default {
/// Comment on the same line as the section header
comment: Option<String>,
/// The default proxy stated after the section header
proxy: Option<String>,
/// [`Lines`](owned::Line) in this section.
lines: Vec<owned::Line>,
},
Frontend {
/// Comment on the same line as the section header
comment: Option<String>,
/// The proxy stated after the section header
proxy: String,
/// [`Lines`](owned::Line) in this section.
lines: Vec<owned::Line>,
/// Optional address to which the frontend binds can be stated
/// in the header, for example `frontend webserver *:80` instead
/// of a bind line, any optional config for the bind follows
header_addr: Option<(Address, Option<String>)>,
},
Listen {
/// Comment on the same line as the section header
comment: Option<String>,
/// The proxy stated after the section header
proxy: String,
/// [`Lines`](owned::Line) in this section.
lines: Vec<owned::Line>,
/// Optional address to which the listen binds can be stated
/// in the header, for example `frontend webserver *:80` instead
/// of a bind line, any optional config for the bind follows
header_addr: Option<(Address, Option<String>)>,
},
Backend {
/// Comment on the same line as the section header
comment: Option<String>,
/// The proxy stated after the section header
proxy: String,
/// [`Lines`](owned::Line) in this section.
lines: Vec<owned::Line>,
},
Userlist {
/// Comment on the same line as the section header
comment: Option<String>,
/// Name of this userlist
name: String,
/// [`Lines`](owned::Line) in this section.
lines: Vec<owned::Line>,
},
UnknownLine {
/// A line that could not be parsed.
line: String,
},
}