| 1 | package TaskPipe::OpenProxyManager::Settings; | ||
| 2 | |||
| 3 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | with 'MooseX::ConfigCascade'; | |
| 5 | 1 | with 'TaskPipe::Role::MooseType_StrArrayRef'; | |
| 6 | 1 | with 'TaskPipe::Role::MooseType_ShellMode'; | |
| 7 | 1 | with 'TaskPipe::Role::MooseType_IterateMode'; | |
| 8 | |||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | TaskPipe::OpenProxyManager::Settings - settings for TaskPipe::OpenProxyManager | ||
| 13 | |||
| 14 | =head1 METHODS | ||
| 15 | |||
| 16 | =over | ||
| 17 | |||
| 18 | =item shell | ||
| 19 | |||
| 20 | Whether to run in the terminal or daemonize. Options are C<foreground> and C<background> | ||
| 21 | |||
| 22 | =cut | ||
| 23 | |||
| 24 | 1 | has shell => (is => 'ro', isa => 'ShellMode', default => 'foreground'); | |
| 25 | |||
| 26 | |||
| 27 | |||
| 28 | =item iterate | ||
| 29 | |||
| 30 | Choices are 'once' or 'repeat'. To kick off a daemon process that continually polls for open proxies, use C<--shell=background> together with C<--iterate=repeat> | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | 1 | has iterate => (is => 'ro', isa => 'IterateMode', default => 'once'); | |
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | =item poll_interval | ||
| 39 | |||
| 40 | If --iterate=repeat then --poll_interval is the number of seconds to wait between iterations. --poll_interval is ignored if --iterate=once | ||
| 41 | |||
| 42 | =cut | ||
| 43 | |||
| 44 | 1 | has poll_interval => (is => 'ro', isa => 'Int', default => '600'); | |
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | =item proxy_scheme | ||
| 49 | |||
| 50 | The scheme passed to the proxy. Usually this is 'http' and does not need to be changed | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 1 | has proxy_scheme => (is => 'ro', isa => 'Str', default => 'http'); | |
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | =item protocols | ||
| 59 | |||
| 60 | Which protocols to proxy e.g. --protocols=http,https | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | 1 | ▶ | has protocols => (is => 'ro', isa => 'StrArrayRef', default => sub{["http","https"]}); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | =item ip_list_names | ||
| 69 | |||
| 70 | The names of lists to check for open proxies | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | has ip_list_names => (is => 'ro', isa => 'StrArrayRef', default => sub{[ | ||
| 75 | 1 | ▶ | 'PremProxy', |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 76 | 'ProxyNova', | ||
| 77 | 'Xroxy' | ||
| 78 | 1 | ]}); | |
| 79 | |||
| 80 | |||
| 81 | =item unavailable_poll_interval | ||
| 82 | |||
| 83 | The number of seconds to wait before trying again if there are no available proxies | ||
| 84 | |||
| 85 | =cut | ||
| 86 | |||
| 87 | 1 | has unavailable_poll_interval => (is => 'ro', isa => 'Int', default => '60'); | |
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | =item max_unavailable_fails | ||
| 92 | |||
| 93 | The maximum number of consecutive fails when requesting an open proxy with status "available", before giving up (and dying with an error) | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | 1 | has max_unavailable_fails => (is => 'ro', isa => 'Int', default => '30'); | |
| 98 | |||
| 99 | |||
| 100 | |||
| 101 | =item max_threads | ||
| 102 | |||
| 103 | The maximum number of concurrent threads to employ when testing proxies | ||
| 104 | |||
| 105 | =cut | ||
| 106 | |||
| 107 | 1 | has max_threads => (is => 'ro', isa => 'Int', default => '10'); | |
| 108 | |||
| 109 | |||
| 110 | |||
| 111 | =item clean_dud_proxies_after | ||
| 112 | |||
| 113 | The time interval (in days) to wait before deleting 'dud' proxies from the database. ie after this time period, if the proxy is encountered again on a list, it will be tested again | ||
| 114 | |||
| 115 | =back | ||
| 116 | |||
| 117 | =cut | ||
| 118 | |||
| 119 | 1 | has clean_dud_proxies_after => (is => 'ro', isa=> 'Int', default => '28'); | |
| 120 | |||
| 121 | =head1 AUTHOR | ||
| 122 | |||
| 123 | Tom Gracey <tomgracey@gmail.com> | ||
| 124 | |||
| 125 | =head1 COPYRIGHT AND LICENSE | ||
| 126 | |||
| 127 | Copyright (c) Tom Gracey 2018 | ||
| 128 | |||
| 129 | TaskPipe is free software, licensed under | ||
| 130 | |||
| 131 | The GNU Public License Version 3 | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | 1 | __PACKAGE__->meta->make_immutable; | |
| 136 | 1 | 1; | |