Skip to content

Latest commit

 

History

History
executable file
·
344 lines (300 loc) · 18.2 KB

README-zh-CN.md

File metadata and controls

executable file
·
344 lines (300 loc) · 18.2 KB

Proxy manager

dependencies Status devDependencies Status optionalDependencies Status

一个HTTP/HTTPS 代理服务器在你身边,为你世界各地的代理流量加速/压缩/轮流/分发/管理/监控/汇报/日志/调试

用 代理管理器你可以使用Bright Data 住宅 IPs 或 Bright Data 数据心 IPs.

这个工具需要一个 Bright Data 账户.

特征

  • 可扩展
  • 连接池(更快的反应)
  • 省心的建立组态
  • 统计数据
  • 每N请求自动轮流IP
  • 负载均衡
  • SSL 嗅探
  • SOCKSv5 代理

软件更新要求

  • 2GB RAM
  • 1 CPU
  • 3GB HDD

需要的组态

  • 4GB RAM
  • 2 CPUs
  • 3GB SSD

安装

要求

软件要求:

Windows

下载 代理管理安装器.

Linux/MacOS

  • 安装 Node.js 20.12.1版 (最好用x nave)
  • 从终端安装 Bright Data 代理:
sudo npm install -g luminati-io/luminati-proxy

升级

  • 用npm升级
sudo npm install -g luminati-io/luminati-proxy

发布说明

你可以在 CHANGELOG.md 里找到每个版本的修改.

运用

第一次运行

第一次运行之后:

pmgr

把你的浏览器设到 http://127.0.0.1:22999 为了设置凭证和代理服务器.

登录之后,你会看到Bright Data的默认设置所含一个”drop in”代理服务器在接口22225运行。细节提供在下面.

超级代理服务器的'Dropin'替代

Bright Data 代理服务器所含的”Dropin 模式” 和现有的超级代理服务器的功能相同。在 'dropin' 模式运行代理时,你不需要登录行政UI就能发出请求。代理账户和密码会自动被提供。'dropin' 模式是默认模式,和可以让你容易的从一般的超级代理服务器转到Bright Data 代理管理器.

'dropin' 模式是默认模式。如果你想禁用'dropin',请用命令:--no-dropin:

pmgr --no-dropin

为了完整的API解说文件 (为了'dropin'代理请求),请从你的Bright Data账户关注 API例网页.

完整的API命令名单:

pmgr --help
Usage:
  pmgr [options] config1 config2 ...

Options:
  -h, -?, --help                   Show help                           [boolean]
  -v, --version                    Show version number                 [boolean]
  -p, --port                       Port for the HTTP proxy              [number]
      --proxy_type                 Set to "persist" to save proxy into the
                                   configuration file.                  [string]
      --multiply                   Multiply the port definition given number of
                                   times                   [number] [default: 0]
      --multiply_users                                [boolean] [default: false]
      --users                      List of users. This option has to be used
                                   along with "multiply_users"           [array]
      --ssl                        Enable SSL analyzing
                                                      [boolean] [default: false]
      --tls_lib                    SSL library    [string] [default: "open_ssl"]
      --av_check                   Enable antivirus check
                                                      [boolean] [default: false]
      --iface                      Interface or IP to listen on         [string]
      --customer                   Customer name                        [string]
      --zone                       Zone name        [string] [default: "static"]
      --password                   Zone password                        [string]
      --proxy                      Hostname or IP of super proxy
                                         [string] [default: "brd.superproxy.io"]
      --proxy_port                 Super proxy port    [number] [default: 22225]
      --proxy_connection_type      Determines what kind of connection will be
                                   used between Proxy Manager and Super Proxy
                                                      [string] [default: "http"]
      --proxy_retry                Automatically retry on super proxy failure
                                                           [number] [default: 2]
      --insecure                   Enable SSL connection/analyzing to insecure
                                   hosts                               [boolean]
      --country                    Country                              [string]
      --state                      State                                [string]
      --city                       City                                 [string]
      --zip                        Zip code                             [string]
      --asn                        ASN                                  [string]
      --ip                         Data Center IP                       [string]
      --vip                        gIP                                  [number]
      --ext_proxies                A list of proxies from external vendors.
                                   Format: [username:password@]ip[:port] [array]
      --ext_proxy_username         Default username for external vendor ips
                                                                        [string]
      --ext_proxy_password         Default password for external vendor ips
                                                                        [string]
      --ext_proxy_port             Default port for external vendor ips [number]
      --dns                        DNS resolving     [string] [default: "local"]
      --reverse_lookup_dns         Process reverse lookup via DNS
                                                      [boolean] [default: false]
      --reverse_lookup_file        Process reverse lookup via file      [string]
      --reverse_lookup_values      Process reverse lookup via value      [array]
      --session                    Session for all proxy requests
                                                        [string] [default: true]
      --sticky_ip                  Use session per requesting host to maintain
                                   IP per host        [boolean] [default: false]
      --pool_size                                                       [number]
      --rotate_session             Session pool size  [boolean] [default: false]
      --throttle                   Throttle requests above given number
                                                          [number] [default: ""]
      --rules                      Proxy request rules                   [array]
      --route_err                  Block or allow requests to be automatically
                                   sent through super proxy on error
                                                  [string] [default: "pass_dyn"]
      --smtp                                                             [array]
      --override_headers                                               [boolean]
      --os                         Operating System of the Peer IP      [string]
      --headers                    Request headers                       [array]
      --debug                      Request debug info default value
                                                      [string] [default: "none"]
      --lpm_auth                   x-lpm-authorization header
                                                      [string] [default: "none"]
      --const                                         [boolean] [default: false]
      --multiply_ips                                  [boolean] [default: false]
      --multiply_vips                                 [boolean] [default: false]
      --max_ban_retries                                   [number] [default: 10]
      --preset                                [string] [default: "session_long"]
      --ua                         Unblocker Mobile UA[boolean] [default: false]
      --timezone                   Timezone ID to be used by the browser[string]
      --resolution                 Browser screen size                  [string]
      --webrtc                     WebRTC plugin behavior in the browser[string]
      --bw_limit                   BW limit params
      --follow_redirect            Auto redirect requests
                                                      [boolean] [default: false]
      --render                     Process scripts from HTML pages     [boolean]
      --whitelist_ips              Default for all proxies whitelist ip list for
                                   granting access to them [array] [default: []]
      --www_whitelist_ips          Whitelist ip list for granting access to
                                   browser admin UI        [array] [default: []]
      --www                        HTTP and WebSocket port used for browser
                                   admin UI and request logs    [default: 22999]
      --config                     Config file containing proxy definitions
                                                                        [string]
      --mode                       Defines a set of permissible operations
                                   within the UI/API                    [string]
      --dropin                     Create dropin mode proxy port (default:
                                   22225)              [boolean] [default: true]
      --dropin_port                Port for dropin mode         [default: 22225]
      --no_usage_stats             Disable collection of usage statistics
                                                      [boolean] [default: false]
      --lpm_token                  An authorization token               [string]
      --high_perf                                     [boolean] [default: false]
      --zagent                                        [boolean] [default: false]
      --reseller                                      [boolean] [default: false]
      --cluster                                         [string] [default: true]
      --sync_config                Synchronize Proxy Manager configuration with
                                   the cloud          [boolean] [default: false]
      --sync_zones                                     [boolean] [default: true]
      --sync_stats                                     [boolean] [default: true]
      --request_stats              Enable requests statistics
                                                       [boolean] [default: true]
      --test_url                   Url for testing proxy
                         [string] [default: "http://geo.brdtest.com/mygeo.json"]
      --log                        Log level        [string] [default: "notice"]
      --logs                       Number of request logs to store
                                                        [number] [default: 1000]
      --logs_settings              Settings for logs remote delivery
                                                                   [default: {}]
      --har_limit                  Number of bytes to store
                                                        [number] [default: 1024]
      --ports_limit                Limit the numer of open proxy ports at the
                                   same time                    [default: 10000]
      --ui_ws                      Enable live logs preview and other live data
                                   communication on the UI
                                                       [boolean] [default: true]
      --force                      Kill other instances of Proxy Manager if
                                   there are any      [boolean] [default: false]
      --session_termination        Stop sending new requests when the peer IP
                                   becomes unavailable and redirect to
                                   confimration page before new IP is taken
                                                      [boolean] [default: false]
      --api                        Alternative url to luminati API      [string]
      --api_domain                 Alternative domain url to luminati API
                                               [string] [default: "lum-lpm.com"]
      --pmgr_domain                Alternative domain url to Proxy Manager
                                                                        [string]
      --local_login                Requires each browser to authenticate against
                                   Proxy Manager      [boolean] [default: false]
      --read_only                  Avoid saving current config in the config
                                   file               [boolean] [default: false]
      --extra_ssl_ips              List of IPs to add to SSL certificate
                                                           [array] [default: []]
      --bw_limit_webhook_url       URL to send webhook messages to when BW limit
                                   is reached                           [string]
      --bw_th_webhook_url          URL to send webhook messages to when BW limit
                                   threshold is reached                 [string]
      --new_ui                     Enable UiKit UI    [boolean] [default: false]
      --api_body_limit             Controls the maximum request body size
                                                       [string] [default: "2mb"]
      --api_parameter_limit        Controls the maximum number of parameters
                                   that are allowed in the URL-encoded data
                                                       [number] [default: 10000]
      --socket_inactivity_timeout  The amount of time a socket can be inactive
                                   before it times out and closes
                                                               [default: 120000]
      --no-www                     Disable local web
      --no-config                  Working without a config file
  -d, --daemon, --start-daemon     Start as a daemon
      --restart-daemon             Restart running daemon
      --stop-daemon                Stop running daemon
      --delete-daemon              Delete daemon instance
      --upgrade                    Upgrade proxy manager
      --downgrade                  Downgrade proxy manager (if backup exists on
                                   disk)
      --dir                        Path to the directory with database and
                                   configuration files
      --status                     Show proxy manager processes current status
      --gen-cert                   Generate cert
      --auto-upgrade               Enable auto upgrade
      --start-upgrader             Install CRON process that checks upgrades
      --stop-upgrader              Removes CRON process that checks upgrades
      --insecure-http-parser       Disables the strict checks
      --proxy_country                                              [default: ""]
      --resolve_proxies_interval                                [default: 10000]
      --info                                                    [default: false]
      --av_server                                               [default: false]
      --cn                                                      [default: false]
      --api_domain_fallback                               [default: "l-lpm.com"]

Docker

'Docker' 图片能在这里找着 https://hub.docker.com/r/luminati/luminati-proxy/

docker pull luminati/luminati-proxy

docker run luminati/luminati-proxy

docker run luminati/luminati-proxy pmgr --version

SSL 请求

-ssl 参数是为了 SSL analyzing, HTTPS请求不需要它就能运行

帮助

常见问题 FAQ

如果你在Bright Data 常见问题找不着解决方式,可以在 github 上提问.

或联系 [email protected].

REST API

API的解说文件能在APP里找着

详细解释能在 这里 找到

Node.js API

代理管理器可以当作一个需要的软件为了node.js软件 - 消除独立运行node.js的必要.

API支持 PromisesGenerators. 它内部会用 request module 莫和支持所有它的特征

Promises

'use strict';
const Server = require('luminati-proxy').Server;

const proxy = new Server({
    customer: 'CUSTOMER', // your customer name
    password: 'PASSWORD', // your password
    zone: 'gen', // zone to use
});
proxy.on('response', res=>console.log('Response:', res));
proxy.listen(0, '127.0.0.1').then(()=>new Promise((resolve, reject)=>{
    proxy.request('http://geo.brdtest.com/mygeo.json', (err, res)=>{
        if (err)
            return reject(err);
        resolve(res);
    });
})).then(res=>{
    console.log('Result:', res.statusCode, res.body);
}, err=>{
    console.log('Error:', err);
}).then(()=>proxy.stop());

Generators

'use strict';
const etask = require('./util/etask.js');
const Server = require('luminati-proxy').Server;

etask(function*(){
    const proxy = new Server({
        customer: 'CUSTOMER', // your customer name
        password: 'PASSWORD', // your password
        zone: 'gen', // zone to use
    });
    yield proxy.listen(0, '127.0.0.1'); // port and ip to listen to
    let res = yield etask.nfn_apply(proxy, '.request',
        ['http://geo.brdtest.com/mygeo.json']);
    console.log('Result:', res.statusCode, res.body);
    yield proxy.stop();
});