config.html

来自「perl教程」· HTML 代码 · 共 245 行

HTML
245
字号
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>Net::Config - Local configuration data for libnet</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',2);</script>
<h1><a>Net::Config - Local configuration data for libnet</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsys">SYNOPSYS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#methods">METHODS</a></li>
	<li><a href="#netconfig_values">NetConfig VALUES</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Net::Config - Local configuration data for libnet</p>
<p>
</p>
<hr />
<h1><a name="synopsys">SYNOPSYS</a></h1>
<pre>
    <span class="keyword">use</span> <span class="variable">Net::Config</span> <span class="string">qw(%NetConfig)</span><span class="operator">;</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p><code>Net::Config</code> holds configuration data for the modules in the libnet
distribuion. During installation you will be asked for these values.</p>
<p>The configuration data is held globally in a file in the perl installation
tree, but a user may override any of these values by providing their own. This
can be done by having a <code>.libnetrc</code> file in their home directory. This file
should return a reference to a HASH containing the keys described below.
For example</p>
<pre>
    <span class="comment"># .libnetrc</span>
    <span class="operator">{</span>
        <span class="string">nntp_hosts</span> <span class="operator">=&gt;</span> <span class="operator">[</span> <span class="string">"my_prefered_host"</span> <span class="operator">]</span><span class="operator">,</span>
        <span class="string">ph_hosts</span>   <span class="operator">=&gt;</span> <span class="operator">[</span> <span class="string">"my_ph_server"</span> <span class="operator">]</span><span class="operator">,</span>
    <span class="operator">}</span>
    <span class="comment">__END__
    </span>
</pre>
<p>
</p>
<hr />
<h1><a name="methods">METHODS</a></h1>
<p><code>Net::Config</code> defines the following methods. They are methods as they are
invoked as class methods. This is because <code>Net::Config</code> inherits from
<code>Net::LocalCfg</code> so you can override these methods if you want.</p>
<dl>
<dt><strong><a name="item_requires_firewall">requires_firewall HOST</a></strong>

<dd>
<p>Attempts to determine if a given host is outside your firewall. Possible
return values are.</p>
</dd>
<dd>
<pre>
  -1  Cannot lookup hostname
   0  Host is inside firewall (or there is no ftp_firewall entry)
   1  Host is outside the firewall</pre>
</dd>
<dd>
<p>This is done by using hostname lookup and the <a href="#item_local_netmask"><code>local_netmask</code></a> entry in
the configuration data.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="netconfig_values">NetConfig VALUES</a></h1>
<dl>
<dt><strong><a name="item_nntp_hosts">nntp_hosts</a></strong>

<dt><strong><a name="item_snpp_hosts">snpp_hosts</a></strong>

<dt><strong><a name="item_pop3_hosts">pop3_hosts</a></strong>

<dt><strong><a name="item_smtp_hosts">smtp_hosts</a></strong>

<dt><strong><a name="item_ph_hosts">ph_hosts</a></strong>

<dt><strong><a name="item_daytime_hosts">daytime_hosts</a></strong>

<dt><strong><a name="item_time_hosts">time_hosts</a></strong>

<dd>
<p>Each is a reference to an array of hostnames (in order of preference),
which should be used for the given protocol</p>
</dd>
</li>
<dt><strong><a name="item_inet_domain">inet_domain</a></strong>

<dd>
<p>Your internet domain name</p>
</dd>
</li>
<dt><strong><a name="item_ftp_firewall">ftp_firewall</a></strong>

<dd>
<p>If you have an FTP proxy firewall (<strong>NOT</strong> an HTTP or SOCKS firewall)
then this value should be set to the firewall hostname. If your firewall
does not listen to port 21, then this value should be set to
<code>&quot;hostname:port&quot;</code> (eg <code>&quot;hostname:99&quot;</code>)</p>
</dd>
</li>
<dt><strong><a name="item_ftp_firewall_type">ftp_firewall_type</a></strong>

<dd>
<p>There are many different ftp firewall products available. But unfortunately
there is no standard for how to traverse a firewall.  The list below shows the
sequence of commands that Net::FTP will use</p>
</dd>
<dd>
<pre>
  user        Username for remote host
  pass        Password for remote host
  fwuser      Username for firewall
  fwpass      Password for firewall
  remote.host The hostname of the remote ftp server</pre>
</dd>
<ol>
<li>
<p>There is no firewall</p>
</li>
<li>
<pre>
     USER user@remote.host
     PASS pass</pre>
<li>
<pre>
     USER fwuser
     PASS fwpass
     USER user@remote.host
     PASS pass</pre>
<li>
<pre>
     USER fwuser
     PASS fwpass
     SITE remote.site
     USER user
     PASS pass</pre>
<li>
<pre>
     USER fwuser
     PASS fwpass
     OPEN remote.site
     USER user
     PASS pass</pre>
<li>
<pre>
     USER user@fwuser@remote.site
     PASS pass@fwpass</pre>
<li>
<pre>
     USER fwuser@remote.site
     PASS fwpass
     USER user
     PASS pass</pre>
<li>
<pre>
     USER user@remote.host
     PASS pass
     AUTH fwuser
     RESP fwpass</pre>
</ol>
<dt><strong><a name="item_ftp_ext_passive">ftp_ext_passive</a></strong>

<dt><strong><a name="item_ftp_int_pasive">ftp_int_pasive</a></strong>

<dd>
<p>FTP servers can work in passive or active mode. Active mode is when
you want to transfer data you have to tell the server the address and
port to connect to.  Passive mode is when the server provide the
address and port and you establish the connection.</p>
</dd>
<dd>
<p>With some firewalls active mode does not work as the server cannot
connect to your machine (because you are behind a firewall) and the firewall
does not re-write the command. In this case you should set <a href="#item_ftp_ext_passive"><code>ftp_ext_passive</code></a>
to a <em>true</em> value.</p>
</dd>
<dd>
<p>Some servers are configured to only work in passive mode. If you have
one of these you can force <code>Net::FTP</code> to always transfer in passive
mode; when not going via a firewall, by setting <code>ftp_int_passive</code> to
a <em>true</em> value.</p>
</dd>
</li>
<dt><strong><a name="item_local_netmask">local_netmask</a></strong>

<dd>
<p>A reference to a list of netmask strings in the form <code>&quot;134.99.4.0/24&quot;</code>.
These are used by the <a href="#item_requires_firewall"><code>requires_firewall</code></a> function to determine if a given
host is inside or outside your firewall.</p>
</dd>
</li>
</dl>
<p>The following entries are used during installation &amp; testing on the
libnet package</p>
<dl>
<dt><strong><a name="item_test_hosts">test_hosts</a></strong>

<dd>
<p>If true then <code>make test</code> may attempt to connect to hosts given in the
configuration.</p>
</dd>
</li>
<dt><strong><a name="item_test_exists">test_exists</a></strong>

<dd>
<p>If true then <code>Configure</code> will check each hostname given that it exists</p>
</dd>
</li>
</dl>
<hr><p><em>$Id: //depot/libnet/Net/Config.pm#17 $</em></p>

</body>

</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?