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