📄 edit_icp.cgi
字号:
#!/usr/local/bin/perl# edit_icp.cgi# A form for editing options for communication with other cachesrequire './squid-lib.pl';&header("Other Caches", "", undef, 0, 0, 0, &restart_button());$conf = &get_config();$cache_host = $squid_version >= 2 ? "cache_peer" : "cache_host";print "<hr><p>\n";@ch = &find_config($cache_host, $conf);if (@ch) { print "<h3>Other proxy cache servers</h3>\n"; $mid = int((@ch+1)/2); print "<table width=100%><tr> <td width=50% valign=top>\n"; &cache_table(0, $mid-1); print "</td><td width=50% valign=top>\n"; if ($mid < @ch) { &cache_table($mid, $#ch); } print "</td> </tr></table>\n"; }else { print "<b>No other caches defined</b>.<p>\n"; }print "<a href=\"edit_cache_host.cgi?new=1\">Add another cache</a><p>\n";print "<hr>\n";print "<form action=save_icp.cgi>\n";print "<table border width=100%>\n";print "<tr $tb> <td><b>Cache Selection Options</b></td> </tr>\n";print "<tr $cb> <td><table width=100%>\n";if ($squid_version < 2) { print "<tr>\n"; print &list_input("Fetch directly from domains", "local_domain", $conf); print &address_input("Fetch directly from IPs", "local_ip", $conf); print "</tr>\n"; print "<tr>\n"; print &list_input("Domains inside firewall", "inside_firewall", $conf); print &address_input("IPs inside firewall", "firewall_ip", $conf); print "</tr>\n"; }print "<tr>\n";print &list_input("Directly fetch URLs containing", "hierarchy_stoplist", $conf, 1, "Default");print "</tr>\n";if ($squid_version < 2) { print "<tr>\n"; print &choice_input("Bypass ping for single parent?", "single_parent_bypass", $conf, "off", "Yes", "on", "No", "off"); print &choice_input("Send source in ping?", "source_ping", $conf, "off", "Yes", "on", "No", "off"); print "</tr>\n"; print "<tr>\n"; print &opt_input("Cache reply timeout", "neighbor_timeout", $conf, "Default", 4, "secs"); print "</tr>\n"; }else { print "<tr>\n"; print &opt_input("ICP query timeout", "icp_query_timeout", $conf, "Default", 8, "ms"); print &opt_input("Multicase ICP timeout", "mcast_icp_query_timeout", $conf, "Default", 8, "ms"); print "</tr>\n"; print "<tr>\n"; print &opt_input("Dead peer timeout", "dead_peer_timeout", $conf, "Default", 8, "secs"); print "</tr>\n"; }print "</table></td></tr></table><br>\n";print "<input type=submit value=Save></form>\n";print "<hr>\n";&footer("", "squid index");# cache_table(start, end)sub cache_table{print "<table border width=100%>\n";print "<tr $tb> <td><b>Hostname</b></td> <td><b>Type</b></td>\n";print "<td><b>Proxy port</b></td> <td><b>ICP port</b></td> </tr>\n";for($i=$_[0]; $i<=$_[1]; $i++) { @chv = @{$ch[$i]->{'values'}}; print "<tr $cb>\n"; print "<td><a href=\"edit_cache_host.cgi?num=$i\">$chv[0]</a></td>\n"; print "<td>$chv[1]</td>\n"; print "<td>$chv[2]</td>\n"; print "<td>$chv[3]</td>\n"; print "</tr>\n"; }print "</table>\n";}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -