summaryrefslogtreecommitdiff
blob: 51bbfbbc677842dbce25e16d96d6ec0388c24b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
[folders]
# By default segget daemon will use the following folders for its files:
# /etc/seggetd - for config files for seggetd, tuiclient and request tool
# /etc/init.d/seggetd - init file for segget daemon
# /usr/bin - binary files: seggetd, tuiclient, request
# /usr/share/seggetd/scripts - for user-side python script files
# /usr/share/seggetd/webui - for webui files
# /var/tmp/seggetd/pkg.list - to save distfile list generated by portage and parse it
#                         by request tool to segget daemon
# /var/tmp/seggetd/segments - to store segments
# /usr/portage/distfiles - to store ready to use distfiles
# /var/log/seggetd - to store log files

# DISTFILES_DIR
# Define a dir to store distfiles
# Default:
# distfiles_dir=/usr/portage/distfiles
distfiles_dir=/usr/portage/distfiles

# SEGMENTS_DIR
# Define a dir to store distfiles' segments
# Default:
# segments_dir=/var/tmp/seggetd/segments
segments_dir=/var/tmp/seggetd/segments

[portage]
# SYNOPSIS: fetch_only=0 | 1
# NOT IMPLEMENTED YET: fetch_only=0

[distfiles]
# MAX_CONNECTION_NUM_PER_DISTFILE
# Each distfile can have up to max_connection_num_per_distfile simultaneous
# connections.
# Minimum value: 1
# Maximum value: 20
# Default:
# max_connection_num_per_distfile=3
max_connection_num_per_distfile=3

[segments]
# MAX_SEGMENT_SIZE
# Define maximum segment size in bytes.
# Minimum value: 10000
# Maximum value: 10000000
# Default:
# max_segment_size=500000
max_segment_size=500000

# SYNOPSIS: resume_on=0 | 1
# - If resume_on set to 1:
# Before starting downloading a segment segget checks whether this segment is 
# already downloaded, checks segments size and if size mathces considers this 
# segment to be downloaded and skips downloading process.
# - If resume_on set to 0:
# Segget always starts new fetch for a segment regardless of the fact whether it
# is downloaded or not.
# Default:
# resume_on=1
resume_on=1

# MAX_TRIES
# If segment download was unsuccessful, new attempts are made. When attempts
# number reaches max_tries, segment gets FAILED status and error logged to error_log
# Minimum value: 1
# Maximum value: -1 (for no limit)
# Default:
# max_tries=10
max_tries=10

[connections]
# MAX_CONNECTIONS
# Define maximum number of connections
# Minimum value: 1
# Maximum value: 20
# Default:
# max_connections=10
max_connections=10

# CURRENT_SPEED_TIME_INTERVAL_MSECS
# segget transfers may have bursty nature of their traffic. Therefore, while
# measuring current speed, segget actually calculates average speed during
# current_speed_time_interval_msecs time interval, defined in milliseconds.
# Minimum value: 100
# Maximum value: 60000
# Default:
# current_speed_time_interval_msecs=1000
current_speed_time_interval_msecs=1000

[mirrors]
# MAX_CONNECTIONS_NUM_PER_MIRROR
# Define how many simultaneous downloads from one mirror segget is allowed to 
# have. While choosing a mirror segget will skip mirrors with 
# max_connections_num_per_mirror active downloads.
# Minimum value: 1
# Maximum value: 10
# Default:
# max_connections_num_per_mirror=1
max_connections_num_per_mirror=1

# SYNOPSIS: collect_benchmark_stats_on=0 | 1
# - If set to 1, stats on mirrors performance will be collected.
# default:
# collect_benchmark_stats_on=1 (Note: at the moment can NOT be changed)
collect_benchmark_stats_on=1

# SYNOPSIS: use_benchmark_stats=0 | 1
# If use_benchmark_stats=1 statistics on mirrors is used to rate them 
# and therefore improve performance.
# Each time connection from a particular mirror closes mirror->dld_time, 
# and mirror->dld_size get increased (in case of unsuccessful connection
# only time gets increased), so avg speed for a mirror can be
# calculated:
# 
#           mirror->avg_speed=mirror->dld_size/mirror->dld_time.       (1)
#
# When new segment is going to be started segget goes through the list of
# the mirrors distfile/segment has, and asks each mirror for self_rating:
#
#          "ulong self_rating=mirror->mirror_on_the_wall();". 
#
# This way segget chooses a mirror with the best self_rating. To calculate 
# self_rating mirrors use the following formula:
#
#               self_rating=dld_time/dld_size*honesty.                 (2)
#
# So mirrors actually say how bad they are.
# Even mirrors can have critical times, so to give mirrors another chance 
# honesty was added to the formula (2). honesty can get values in 
# interval (0,1]. Each time connection from a mirror opens or closes mirror
# sets its honesty=1. If mirror was asked for self_evaluation with 
# mirror->mirror_on_the_wall(), but wasn't chosen its honesty decreases
# somewhat (see [mirror].benchmark_oblivion option), so next time it will 
# lie little bit more about how bad it's.
# Default:
# use_benchmark_results=1
# ***Note: at the moment use_benchmark_results can NOT be set to 0
use_benchmark_stats=1

# BENCHMARK_OBLIVION
# benchmark_oblivion option allows to adjust how fast segget "forgets" 
# benchmarking statistics on mirrors performance. 
# Each time mirror->mirror_on_the_wall() called, mirror decreases its
# honesty (to have more chances next time) using the following formula:
#
#       honesty=honesty*100/(100+settings.benchmark_oblivion)         (3)
#
# Therefore, setting benchmark_oblivion=100 will make mirror look twice
# less bad next time mirror->mirror_on_the_wall() called.
# Minimum value: 0 (Beware: setting to 0, will can exclude unlucky mirrors)
# Maximum value: 1000
# Default:
# benchmark_oblivion=5
benchmark_oblivion=5

[provide_mirror_to_others]
# PROVIDE_MIRROR_DIR
# Define a dir for making symlinks to downloaded distfiles. This dir can be 
# used to provide local mirror for other hosts (with help of Apache, vsftp, etc).
# If set to none, segget will not make symlinks.
# Default:
# provide_mirror_dir=none
provide_mirror_dir=none

# SYNOPSIS: PROVIDE_MIRROR_FILES_RESTRICT_LIST_ON= 0 | 1
# If PROVIDE_MIRROR_DIR=none this option will be ignored.
# - If set to 1, segget will compare distfile name with the list of forbiden 
# patterns from the restricted.conf file. If distfile name contains any of the 
# patterns, no symlink will be provided to this distfile.
# Default:
# provide_mirror_files_restrict_list_on=0
provide_mirror_files_restrict_list_on=0

# PROVIDE_MIRROR_TO_OTHERS_URL
# Specify url to the provided mirror.
# This option is used to generate rss feed.
# By default UI_IP is used for this.
# Default: 
# provide_mirror_to_others_url=ui_ip
provide_mirror_to_others_url=ui_ip

[provide_proxy_fetcher_to_others]
# PROVIDE_PROXY_FETCHER_IP
# Define an ip address segget will use to provide access for tuiclients.
# The parameter should be a string holding your host dotted IP address.
# Default:
# provide_proxy_fetcher_ip=none
provide_proxy_fetcher_ip=127.0.0.1

# PROVIDE_PROXY_FETCHER_PORT
# Define a port segget will use to provide access for tuiclients.
# The parameter should be an integer.
# Minimum value: 1
# Maximum value: 65535
# Default:
# provide_proxy_fetcher_port=3131
provide_proxy_fetcher_port=3130

[networks]
# NETWORK0_PRIORITY
# Define priority as a value in range from lowest 0 to highest 10.
# Segget tries to use networks with higher priority levels first, and in case of 
# failure will switch to networks with lower priority levels.
# Segget will NOT use network if its priority level set to 0. Therefore at least
# one network must have priority level higher than 0.
# Networks with local mirrors usually would have higher priority than that of 
# networks with remote mirrors.
# Segget can have up to 10 networks (from network0 to network9).
# Settings for each network should be defined in network#.conf file, where 
# instead of # should be network number. For network0 it's network0.conf
# Default:
# network0_priority=10
# network1_priority=0
# network2_priority=0
# network3_priority=0
# network4_priority=0
# network5_priority=0
# network6_priority=0
# network7_priority=0
# network8_priority=0
# network9_priority=0
network0_priority=10
network1_priority=0
network2_priority=0
network3_priority=0
network4_priority=0
network5_priority=0
network6_priority=0
network7_priority=0
network8_priority=0
network9_priority=0

[user-data]
# USER_AGENT
# Set the User-Agent: header in the http request sent to the remote server. 
# This can be used to fool servers or scripts.
# Default:
# user_agent=segget
user_agent=segget

# Specify the user and password for authentication on a ftp servers.
# NOT IMPLEMENTED YET: ftp-user=anonymous
# NOT IMPLEMENTED YET: ftp-password=me@mail.ru

[ui_server]
# tuiclient monitors segget's activity by establishing tcp connection
# with segget daemon (ui_server part of it).
# Same ip and port are used for WebUI which can be accessed from web
# browser via http://ui_ip:ui_port/

# UI_IP
# Define an ip address segget will use to provide access for tuiclients.
# The parameter should be a string holding your host dotted IP address.
# Default:
# ui_ip=127.0.0.1
ui_ip=127.0.0.1

# UI_PORT
# Define a port segget will use to provide access for tuiclients.
# The parameter should be an integer.
# Minimum value: 1
# Maximum value: 65535
# Default:
# ui_port=9999
ui_port=9999

# UI_WEB_UI_DIR
# Define a dir where segget stores webui files
# Default:
# ui_web_ui_dir=/usr/share/seggetd/webui
ui_web_ui_dir=/usr/share/seggetd/webui

[rss]
# RSS feed provides information on the files added (symlinked)
# to PROVIDE_MIRROR_DIR and can be accessed from feedreader
# via http://ui_ip:ui_port/rss.xml

# RSS_TITLE
# Specify a title for the RSS feed
# Default:
# rss_title=Seggetd feed
rss_title=Seggetd feed

# RSS_DESCRIPTION
# Specify description for the RSS feed
# Default:
# rss_description=Files downloaded by seggetd and provided in the local mirror
rss_description=Files downloaded by seggetd and provided in the local mirror

[request_server]
# request application adds distfiles to segget daemon queue by establishing tcp connection
# with segget daemon (request_server part of it).

# REQUEST_IP
# Define an ip address segget will use to provide access for request tool.
# The parameter should be a string holding your host dotted IP address.
# Default:
# request_ip=127.0.0.1
request_ip=127.0.0.1

# REQUEST_PORT
# Define a port segget will use to provide access for request tool.
# The parameter should be an integer.
# Minimum value: 1
# Maximum value: 65535
# Default:
# request_port=10000
request_port=10000

[scripting_and_scheduling]
# Segget provides Python scripting functionalyty to support scheduling.
# Each time segget tries to start a new connection via certain network it calls
# a python script (client.py) to accept or reject this connection and
# if necessary adjusts its settings.

# PYTHON_PATH
# Define path to python
# Default:
# python_path=/usr/bin/python
python_path=/usr/bin/python

# SCRIPTS_DIR
# Define a path to the dir with python scripts. Before establishing connection for
# a particular segment via network# segget checks SCRIPTS_DIR.
# If SCRIPTS_DIR contains net#.py file, segget will launch schedule() function
# from this file to apply settings for connetion and accept or reject this
# segment for the moment. net#.py file is a python script file
# with a user-writen schedule() function.
# It's necessary to import functions before using get("variable"),
# set("variable",value), accept_segment() and reject_segment() in schedule().
# get() function can obtain values for the following variables:
# connection.num, connection.url, connection.max_speed_limit,
# network.num, network.mode, network.active_connections_count,
# distfile.name, distfile.size, distfile.dld_segments_count,
# distfile.segments_count, distfile.active_connections_count,
# segment.num, segment.try_num, segment.size, segment.range
# set() function can change connection.max_speed_limit, see example:
# -----------------EXAMPLE STARTS-----------------
# from functions import *
# import time;
# def schedule():
#     localtime = time.localtime(time.time());
#     hour=localtime[3];
#     # disable downloading distfiles that have size more than 5 000 000 bytes
#     # from 8-00 to 22-00.
#     if hour>8 and hour<22 and (get("distfile.size"))>5000000:
#         print "reject because distfile is too big"
#         reject_segment()
#     # set speed limit 50 000 cps for distfiles larger than 1 000 000 bytes
#     if get("distfile.size")>1000000:
#         print "limit connection speed"
#         set(connection.max_speed_limit, 50000)
#         accept_segment()
# -----------------EXAMPLE ENDS-----------------
# From example above localtime returns following tuple:
# Index  Attributes       Values
#   0     tm_year   e.i.: 2008
#   1     tm_mon          1 to 12
#   2     tm_mday         1 to 31
#   3     tm_hour         0 to 23
#   4     tm_min          0 to 59
#   5     tm_sec          0 to 61 (60 or 61 are leap-seconds)
#   6     tm_wday         0 to 6 (0 is Monday)
#   7     tm_yday         1 to 366 (Julian day)
#   8     tm_isdst        -1, 0, 1, -1 means library determines DST
# Therefore localtime[3] provides hours.
# Segment will be accecpted by default if it was neither accepted nor rejected
# during the schedule() function.
# sagget saves logs of resulting stdout and stderr in the log folder
# separatly for each network. Hence, if there's an error in net3.py file python
# error message would be saved to net3_script_stderr.log. Results of print would
# be saved in net3_script_stdout.log.
# Default:
# scripts_dir=/usr/share/seggetd/scripts
scripts_dir=/usr/share/seggetd/scripts

# SCRIPT_SOCKET_PATH
# Segget uses AF_UNIX domain sockets for communication with python.
# Specify path for the socket on your filesystem.
# NOTE !: Default value can NOT be changed yet (option under development).
# Default:
# script_socket_path=/var/tmp/seggetd/script_socket
script_socket_path=/var/tmp/seggetd/script_socket

[logs]
# LOGS_DIR
# Define a dir to store log files.
# Default:
# logs_dir=/var/log/seggetd
logs_dir=/var/log/seggetd

# GENERAL_LOG_FILE
# Define a file name to store general log.
# Set to none to disable loggin.
# Default:
# general_log_file=segget.log
general_log_file=segget.log

# GENERAL_LOG_TIME_FORMAT
# Set time format for general log as a string containing any combination of
# regular characters and special format specifiers. These format specifiers are
# replaced by the function to the corresponding values to represent the time
# specified in timeptr. They all begin with a percentage (%) sign, and are:
# %a Abbreviated weekday name             [For example: Thu]
# %A Full weekday name                    [For example: Thursday]
# %b Abbreviated month name               [For example: Aug]
# %B Full month name                      [For example: August]
# %c Date and time representation         [For example: Thu Aug 23 14:55:02 2001]
# %d Day of the month (01-31)             [For example: 23]
# %H Hour in 24h format (00-23)           [For example: 14]
# %I Hour in 12h format (01-12)           [For example: 02]
# %j Day of the year (001-366)            [For example: 235]
# %m Month as a decimal number (01-12)    [For example: 08]
# %M Minute (00-59)                       [For example: 55]
# %p AM or PM designation                 [For example: PM]
# %S Second (00-61)                       [For example: 02]
# %U Week number with the first Sunday 
#    as the first day of week one (00-53) [For example: 33]
# %w Weekday as a decimal number with 
#    Sunday as 0 (0-6)                    [For example: 4]
# %W Week number with the first Monday as
#    the first day of week one (00-53)    [For example: 34]
# %x Date representation                  [For example: 08/23/01]
# %X Time representation                  [For example: 14:55:02]
# %y Year, last two digits (00-99)        [For example: 01]
# %Y Year                                 [For example: 2001]
# %Z Timezone name or abbreviation        [For example: CDT]
# %% A % sign                             [For example: %]
#
# For instace general_log_time_format=Time: %m/%d %X
#
# Default:
# general_log_time_format=%m/%d %X
general_log_time_format=%m/%d %X

# ERROR_LOG_FILE
# Define a file name to store error log.
# Set to none to disable loggin.
# Default:
# error_log_file=segget.log
error_log_file=error.log

# ERROR_LOG_TIME_FORMAT
# Set time format for error log as a string containing any combination of
# regular characters and special format specifiers. See GENERAL_LOG_TIME_FORMAT
# for details on format specifiers.
# Default:
# error_log_time_format=%m/%d %X
error_log_time_format=%m/%d %X

# DEBUG_LOG_FILE
# Define a file name to store debug log.
# Set to none to disable loggin.
# Default:
# debug_log_file=segget.log
debug_log_file=debug.log

# DEBUG_LOG_TIME_FORMAT
# Set time format for debug log as a string containing any combination of
# regular characters and special format specifiers. See GENERAL_LOG_TIME_FORMAT
# for details on format specifiers.
# Default:
# debug_log_time_format=%m/%d %X
debug_log_time_format=%m/%d %X