Merge pull request #656 from nlhintz/pull-request
[project/luci.git] / applications / luci-app-polipo / luasrc / model / cbi / polipo.lua
1 -- Copyright 2008 Aleksandar Krsteski <alekrsteski@gmail.com>
2 -- Licensed to the public under the Apache License 2.0.
3
4 m = Map("polipo", translate("Polipo"),
5         translate("Polipo is a small and fast caching web proxy."))
6
7 -- General section
8 s = m:section(NamedSection, "general", "polipo", translate("Proxy"))
9
10 s:tab("general", translate("General Settings"))
11 s:tab("dns",     translate("DNS and Query Settings"))
12 s:tab("proxy",   translate("Parent Proxy"))
13 s:tab("logging", translate("Logging and RAM"))
14
15 -- General settings
16 s:taboption("general", Flag, "enabled", translate("enable"))
17
18 o = s:taboption("general", Value, "proxyAddress", translate("Listen address"),
19         translate("The interface on which Polipo will listen. To listen on all " ..
20                 "interfaces use 0.0.0.0 or :: (IPv6)."))
21
22 o.placeholder = "0.0.0.0"
23 o.datatype = "ipaddr"
24
25
26 o = s:taboption("general", Value, "proxyPort", translate("Listen port"),
27         translate("Port on which Polipo will listen"))
28
29 o.optional = true
30 o.placeholder = "8123"
31 o.datatype = "port"
32
33
34 o = s:taboption("general", DynamicList, "allowedClients",
35         translate("Allowed clients"),
36         translate("When listen address is set to 0.0.0.0 or :: (IPv6), you must " ..
37                 "list clients that are allowed to connect. The format is IP address " ..
38                 "or network address (192.168.1.123, 192.168.1.0/24, " ..
39                 "2001:660:116::/48 (IPv6))"))
40
41 o.datatype = "ipaddr"
42 o.placeholder = "0.0.0.0/0"
43
44
45 -- DNS settings
46 dns = s:taboption("dns", Value, "dnsNameServer", translate("DNS server address"),
47         translate("Set the DNS server address to use, if you want Polipo to use " ..
48                 "different DNS server than the host system."))
49
50 dns.optional = true
51 dns.datatype = "ipaddr"
52
53 l = s:taboption("dns", ListValue, "dnsQueryIPv6",
54         translate("Query DNS for IPv6"))
55
56 l.default = "happily"
57 l:value("true", translate("Query only IPv6"))
58 l:value("happily", translate("Query IPv4 and IPv6, prefer IPv6"))
59 l:value("reluctantly", translate("Query IPv4 and IPv6, prefer IPv4"))
60 l:value("false", translate("Do not query IPv6"))
61
62
63 l = s:taboption("dns", ListValue, "dnsUseGethostbyname",
64         translate("Query DNS by hostname"))
65
66 l.default = "reluctantly"
67 l:value("true", translate("Always use system DNS resolver"))
68 l:value("happily",
69         translate("Query DNS directly, for unknown hosts fall back " ..
70                 "to system resolver"))
71 l:value("reluctantly",
72         translate("Query DNS directly, fallback to system resolver"))
73 l:value("false", translate("Never use system DNS resolver"))
74
75
76 -- Proxy settings
77 o = s:taboption("proxy", Value, "parentProxy",
78         translate("Parent proxy address"),
79         translate("Parent proxy address (in host:port format), to which Polipo " ..
80                 "will forward the requests."))
81
82 o.optional = true
83 o.datatype = "hostport"
84
85
86 o = s:taboption("proxy", Value, "parentAuthCredentials",
87         translate("Parent proxy authentication"),
88         translate("Basic HTTP authentication supported. Provide username and " ..
89                 "password in username:password format."))
90
91 o.optional = true
92 o.placeholder = "username:password"
93
94
95 -- Logging
96 s:taboption("logging", Flag, "logSyslog", translate("Log to syslog"))
97
98 s:taboption("logging", Value, "logFacility",
99         translate("Syslog facility")):depends("logSyslog", "1")
100
101
102 v = s:taboption("logging", Value, "logFile",
103         translate("Log file location"),
104         translate("Use of external storage device is recommended, because the " ..
105                 "log file is written frequently and can grow considerably."))
106
107 v:depends("logSyslog", "")
108 v.rmempty = true
109
110
111 o = s:taboption("logging", Value, "chunkHighMark",
112         translate("In RAM cache size (in bytes)"),
113         translate("How much RAM should Polipo use for its cache."))
114
115 o.datatype = "uinteger"
116
117
118 -- Disk cache section
119 s = m:section(NamedSection, "cache", "polipo", translate("On-Disk Cache"))
120 s:tab("general",  translate("General Settings"))
121 s:tab("advanced", translate("Advanced Settings"))
122
123
124 -- Disk cache settings
125 s:taboption("general", Value, "diskCacheRoot", translate("Disk cache location"),
126         translate("Location where polipo will cache files permanently. Use of " ..
127                 "external storage devices is recommended, because the cache can " ..
128                 "grow considerably. Leave it empty to disable on-disk " ..
129                 "cache.")).rmempty = true
130
131
132 s:taboption("general", Flag, "cacheIsShared", translate("Shared cache"),
133         translate("Enable if cache (proxy) is shared by multiple users."))
134
135
136 o = s:taboption("advanced", Value, "diskCacheTruncateSize",
137         translate("Truncate cache files size (in bytes)"),
138         translate("Size to which cached files should be truncated"))
139
140 o.optional = true
141 o.placeholder = "1048576"
142 o.datatype = "uinteger"
143
144
145 o = s:taboption("advanced", Value, "diskCacheTruncateTime",
146         translate("Truncate cache files time"),
147         translate("Time after which cached files will be truncated"))
148
149 o.optional = true
150 o.placeholder = "4d12h"
151
152
153 o = s:taboption("advanced", Value, "diskCacheUnlinkTime",
154         translate("Delete cache files time"),
155         translate("Time after which cached files will be deleted"))
156
157 o.optional = true
158 o.placeholder = "32d"
159
160
161 -- Poor man's multiplexing section
162 s = m:section(NamedSection, "pmm", "polipo",
163         translate("Poor Man's Multiplexing"),
164         translate("Poor Man's Multiplexing (PMM) is a technique that simulates " ..
165                 "multiplexing by requesting an instance in multiple segments. It " ..
166                 "tries to lower the latency caused by the weakness of HTTP " ..
167                 "protocol. NOTE: some sites may not work with PMM enabled."))
168
169 s:option(Value, "pmmSize", translate("PMM segments size (in bytes)"),
170         translate("To enable PMM, PMM segment size must be set to some " ..
171                 "positive value.")).rmempty = true
172
173 s:option(Value, "pmmFirstSize", translate("First PMM segment size (in bytes)"),
174         translate("Size of the first PMM segment. If not defined, it defaults " ..
175                 "to twice the PMM segment size.")).rmempty = true
176
177 return m