24 |
let donkey_ini = create_options_file "donkey.ini" |
let donkey_ini = create_options_file "donkey.ini" |
25 |
|
|
26 |
let donkey_section = file_section donkey_ini ["Donkey"] "Donkey options" |
let donkey_section = file_section donkey_ini ["Donkey"] "Donkey options" |
27 |
|
|
28 |
let initial_score = define_expert_option donkey_section ["initial_score"] "" int_option 5 |
let initial_score = define_expert_option donkey_section ["initial_score"] "" int_option 5 |
29 |
|
|
30 |
let max_xs_packets = define_expert_option donkey_section ["max_xs_packets"] |
let max_xs_packets = define_expert_option donkey_section ["max_xs_packets"] |
31 |
"Max number of UDP packets per round for eXtended Search" int_option 30 |
"Max number of UDP packets per round for eXtended Search" int_option 30 |
32 |
|
|
33 |
let max_dialog_history = define_expert_option donkey_section ["max_dialog_history"] |
let max_dialog_history = define_expert_option donkey_section ["max_dialog_history"] |
34 |
"Max number of messages of Chat remembered" int_option 30 |
"Max number of messages of Chat remembered" int_option 30 |
35 |
|
|
36 |
let donkey_port = define_option donkey_section ["port"] "The port used for connection by other donkey clients." int_option 4662 |
let donkey_port = define_option donkey_section ["port"] "The port used for connection by other donkey clients." int_option 4662 |
37 |
|
|
38 |
let check_client_connections_delay = |
let check_client_connections_delay = |
39 |
define_expert_option donkey_section ["check_client_connections_delay"] |
define_expert_option donkey_section ["check_client_connections_delay"] |
40 |
"Delay used to request file sources" float_option 180.0 |
"Delay used to request file sources" float_option 180.0 |
41 |
|
|
42 |
let check_connections_delay = |
let check_connections_delay = |
43 |
define_expert_option donkey_section ["check_connections_delay"] |
define_expert_option donkey_section ["check_connections_delay"] |
44 |
"The delay between server connection rounds" float_option 5.0 |
"The delay between server connection rounds" float_option 5.0 |
45 |
|
|
46 |
let max_connected_servers = define_option donkey_section |
let max_connected_servers = define_option donkey_section |
47 |
["max_connected_servers"] |
["max_connected_servers"] |
48 |
"The number of servers you want to stay connected to" int_option 3 |
"The number of servers you want to stay connected to" int_option 3 |
49 |
|
|
50 |
let max_udp_sends = define_expert_option donkey_section ["max_udp_sends"] |
let max_udp_sends = define_expert_option donkey_section ["max_udp_sends"] |
51 |
"The number of UDP packets you send every check_client_connections_delay" |
"The number of UDP packets you send every check_client_connections_delay" |
52 |
int_option 10 |
int_option 10 |
53 |
|
|
54 |
let max_server_age = define_expert_option donkey_section ["max_server_age"] "max number of days after which an unconnected server is removed" int_option 2 |
let max_server_age = define_expert_option donkey_section ["max_server_age"] "max number of days after which an unconnected server is removed" int_option 2 |
55 |
|
|
56 |
let reliable_sources = define_option donkey_section ["reliable_sources"] |
let reliable_sources = define_option donkey_section ["reliable_sources"] |
57 |
"Should mldonkey try to detect sources responsible for corruption and ban them" bool_option true |
"Should mldonkey try to detect sources responsible for corruption and ban them" bool_option true |
58 |
|
|
59 |
let emule_compression = define_option donkey_section ["emule_compression"] |
let emule_compression = define_option donkey_section ["emule_compression"] |
60 |
"Should mldonkey accept compressed packets from emule" bool_option true |
"Should mldonkey accept compressed packets from emule" bool_option true |
61 |
|
|
62 |
let ban_identity_thieves = define_option donkey_section ["ban_identity_thieves"] |
let ban_identity_thieves = define_option donkey_section ["ban_identity_thieves"] |
63 |
"Should mldonkey try to detect sources masquerading as others and ban them" bool_option true |
"Should mldonkey try to detect sources masquerading as others and ban them" bool_option true |
64 |
|
|
65 |
let max_allowed_connected_servers () = |
let max_allowed_connected_servers () = |
66 |
BasicSocket.mini 5 !!max_connected_servers |
BasicSocket.mini 5 !!max_connected_servers |
67 |
|
|
68 |
(* |
(* |
69 |
let local_index_find_cmd = define_expert_option donkey_section |
let local_index_find_cmd = define_expert_option donkey_section |
70 |
["local_index_find_cmd"] "A command used locally to find more results |
["local_index_find_cmd"] "A command used locally to find more results |
71 |
during a search" |
during a search" |
72 |
string_option "" (* (cmd_basedir ^ "local_index_find") *) |
string_option "" (* (cmd_basedir ^ "local_index_find") *) |
73 |
|
|
74 |
let local_index_add_cmd = define_expert_option donkey_section |
let local_index_add_cmd = define_expert_option donkey_section |
75 |
["local_index_add_cmd"] "A command used locally to add new results |
["local_index_add_cmd"] "A command used locally to add new results |
76 |
to a local index after a search" |
to a local index after a search" |
77 |
string_option "" (* (cmd_basedir ^ "local_index_add") *) |
string_option "" (* (cmd_basedir ^ "local_index_add") *) |
78 |
*) |
*) |
|
|
|
|
|
|
79 |
|
|
80 |
let compute_md4_delay = define_expert_option donkey_section ["compute_md4_delay"] |
let compute_md4_delay = define_expert_option donkey_section ["compute_md4_delay"] |
81 |
"The delay between computations of the md4 of chunks" |
"The delay between computations of the md4 of chunks" |
84 |
let _ = |
let _ = |
85 |
option_hook compute_md4_delay (fun _ -> |
option_hook compute_md4_delay (fun _ -> |
86 |
if !!compute_md4_delay < 0.1 then compute_md4_delay =:= 0.1) |
if !!compute_md4_delay < 0.1 then compute_md4_delay =:= 0.1) |
87 |
|
|
88 |
let server_black_list = define_option donkey_section |
let server_black_list = define_option donkey_section |
89 |
["server_black_list"] "A list of server IP to remove from server list. |
["server_black_list"] "A list of server IP to remove from server list. |
90 |
Servers on this list can't be added, and will eventually be removed" |
Servers on this list can't be added, and will eventually be removed" |
91 |
(list_option Ip.option) [] |
(list_option Ip.option) [] |
92 |
|
|
93 |
let force_high_id = define_option donkey_section ["force_high_id"] |
let force_high_id = define_option donkey_section ["force_high_id"] |
94 |
"immediately close connection to servers that don't grant a High ID" |
"immediately close connection to servers that don't grant a High ID" |
95 |
bool_option false |
bool_option false |
96 |
|
|
124 |
between servers" int_option 1 |
between servers" int_option 1 |
125 |
|
|
126 |
let walker_server_lifetime = define_expert_option donkey_section |
let walker_server_lifetime = define_expert_option donkey_section |
127 |
["walker_server_lifetime"] |
["walker_server_lifetime"] |
128 |
"The maximal delay a connection with a server should last when walking |
"The maximal delay a connection with a server should last when walking |
129 |
through the list (should be greater than become_master_delay)" int_option 300 |
through the list (should be greater than become_master_delay)" int_option 300 |
130 |
|
|
131 |
(* let max_sources_age = define_expert_option donkey_section |
(* let max_sources_age = define_expert_option donkey_section |
132 |
["max_source_age"] "Sources that have not been connected for this number of days are removed" |
["max_source_age"] "Sources that have not been connected for this number of days are removed" |
133 |
int_option 3 *) |
int_option 3 *) |
134 |
|
|
135 |
let max_indirect_connections = define_option donkey_section |
let max_indirect_connections = define_option donkey_section |
136 |
["max_indirect_connections"] |
["max_indirect_connections"] |
137 |
"Maximal number of indirect connections at any moment" |
"Maximal number of indirect connections at any moment" |
138 |
int_option (!!max_opened_connections/2) |
int_option (!!max_opened_connections/2) |
139 |
|
|
140 |
let log_clients_on_console = define_expert_option donkey_section |
let log_clients_on_console = define_expert_option donkey_section |
141 |
["log_clients_on_console"] |
["log_clients_on_console"] |
142 |
"" |
"" |
143 |
bool_option false |
bool_option false |
144 |
|
|
145 |
let propagate_sources = define_expert_option donkey_section ["propagate_sources"] |
let propagate_sources = define_expert_option donkey_section ["propagate_sources"] |
146 |
"Allow mldonkey to propagate your sources to other donkey clients" |
"Allow mldonkey to propagate your sources to other donkey clients" |
147 |
bool_option true |
bool_option true |
148 |
|
|
149 |
let max_sources_per_file = define_option donkey_section ["max_sources_per_file"] |
let max_sources_per_file = define_option donkey_section ["max_sources_per_file"] |
150 |
"Maximal number of sources for each file" |
"Maximal number of sources for each file" |
151 |
int_option 20000 |
int_option 20000 |
152 |
|
|
153 |
open Md4 |
open Md4 |
154 |
|
|
155 |
let mldonkey_md4 md4 = |
let mldonkey_md4 md4 = |
156 |
let md4 = Md4.direct_to_string md4 in |
let md4 = Md4.direct_to_string md4 in |
157 |
md4.[5] <- Char.chr 14; |
md4.[5] <- Char.chr 14; |
163 |
|
|
164 |
let client_md4 = define_option donkey_section ["client_md4"] |
let client_md4 = define_option donkey_section ["client_md4"] |
165 |
"The MD4 of this client" Md4.option (mldonkey_md4 (Md4.random ())) |
"The MD4 of this client" Md4.option (mldonkey_md4 (Md4.random ())) |
166 |
|
|
167 |
let _ = |
let _ = |
168 |
option_hook client_md4 (fun _ -> |
option_hook client_md4 (fun _ -> |
169 |
let m = mldonkey_md4 !!client_md4 in |
let m = mldonkey_md4 !!client_md4 in |
170 |
if m <> !!client_md4 then |
if m <> !!client_md4 then |
171 |
client_md4 =:= m) |
client_md4 =:= m) |
172 |
|
|
173 |
let black_list = define_expert_option donkey_section ["black_list"] |
let black_list = define_expert_option donkey_section ["black_list"] |
174 |
"" bool_option true |
"" bool_option true |
175 |
|
|
176 |
let port_black_list = define_expert_option donkey_section |
let port_black_list = define_expert_option donkey_section |
177 |
["port_black_list"] "A list of ports that specify servers to remove |
["port_black_list"] "A list of ports that specify servers to remove |
178 |
from server list. Servers with ports on this list can't be added, and |
from server list. Servers with ports on this list can't be added, and |
179 |
will eventually be removed" |
will eventually be removed" |
180 |
(list_option int_option) [] |
(list_option int_option) [] |
181 |
|
|
182 |
let queued_timeout = |
let queued_timeout = |
183 |
define_expert_option donkey_section ["queued_timeout"] |
define_expert_option donkey_section ["queued_timeout"] |
184 |
"How long should we wait in the queue of another client" |
"How long should we wait in the queue of another client" |
185 |
float_option 1800. |
float_option 1800. |
186 |
|
|
187 |
let upload_timeout = |
let upload_timeout = |
188 |
define_expert_option donkey_section ["upload_timeout"] |
define_expert_option donkey_section ["upload_timeout"] |
189 |
"How long can a silent client stay in the upload queue" |
"How long can a silent client stay in the upload queue" |
190 |
float_option 1800. |
float_option 1800. |
191 |
|
|
192 |
let upload_lifetime = |
let upload_lifetime = |
193 |
define_expert_option donkey_section ["upload_lifetime"] |
define_expert_option donkey_section ["upload_lifetime"] |
194 |
"How long a downloading client can stay in my upload queue (in minutes >5)" |
"How long a downloading client can stay in my upload queue (in minutes >5)" |
195 |
int_option 90 |
int_option 90 |
196 |
|
|
197 |
let dynamic_upload_lifetime = |
let dynamic_upload_lifetime = |
198 |
define_expert_option donkey_section ["dynamic_upload_lifetime"] |
define_expert_option donkey_section ["dynamic_upload_lifetime"] |
199 |
"Each client upload lifetime depends on download-upload ratio" |
"Each client upload lifetime depends on download-upload ratio" |
200 |
bool_option false |
bool_option false |
201 |
|
|
202 |
let dynamic_upload_threshold = |
let dynamic_upload_threshold = |
203 |
define_expert_option donkey_section ["dynamic_upload_threshold"] |
define_expert_option donkey_section ["dynamic_upload_threshold"] |
204 |
"Uploaded zones (1 zone = 180 kBytes) needed to enable the dynamic upload lifetime" |
"Uploaded zones (1 zone = 180 kBytes) needed to enable the dynamic upload lifetime" |
205 |
int_option 10 |
int_option 10 |
206 |
|
|
207 |
let random_order_download = |
let random_order_download = |
208 |
define_option donkey_section ["random_order_download"] |
define_option donkey_section ["random_order_download"] |
209 |
"Should we try to download chunks in random order (false = linearly) ?" |
"Should we try to download chunks in random order (false = linearly) ?" |
210 |
bool_option true |
bool_option true |
211 |
|
|
212 |
let connected_server_timeout = |
let connected_server_timeout = |
213 |
define_expert_option donkey_section ["connected_server_timeout"] |
define_expert_option donkey_section ["connected_server_timeout"] |
214 |
"How long can a silent server stay connected" |
"How long can a silent server stay connected" |
215 |
float_option 1800. |
float_option 1800. |
216 |
|
|
217 |
let upload_power = define_expert_option donkey_section ["upload_power"] |
let upload_power = define_expert_option donkey_section ["upload_power"] |
218 |
"The weight of upload on a donkey connection compared to upload on other |
"The weight of upload on a donkey connection compared to upload on other |
219 |
peer-to-peer networks. Setting it to 5 for example means that a donkey |
peer-to-peer networks. Setting it to 5 for example means that a donkey |
220 |
connection will be allowed to send 5 times more information per second than |
connection will be allowed to send 5 times more information per second than |
221 |
an Open Napster connection. This is done to favorise donkey connections |
an Open Napster connection. This is done to favorise donkey connections |
222 |
over other networks, where upload is less efficient, without preventing |
over other networks, where upload is less efficient, without preventing |
229 |
let min_left_servers = define_expert_option donkey_section ["min_left_servers"] |
let min_left_servers = define_expert_option donkey_section ["min_left_servers"] |
230 |
"Minimal number of servers remaining after remove_old_servers" |
"Minimal number of servers remaining after remove_old_servers" |
231 |
int_option 20 |
int_option 20 |
232 |
|
|
233 |
let servers_walking_period = define_expert_option donkey_section ["servers_walking_period"] |
let servers_walking_period = define_expert_option donkey_section ["servers_walking_period"] |
234 |
"How often should we check all servers (minimum 4 hours, 0 to disable)" |
"How often should we check all servers (minimum 4 hours, 0 to disable)" |
235 |
int_option 6 |
int_option 6 |
236 |
|
|
237 |
let _ = |
let _ = |
238 |
option_hook servers_walking_period (fun _ -> |
option_hook servers_walking_period (fun _ -> |
239 |
if !!servers_walking_period > 0 && |
if !!servers_walking_period > 0 && |
240 |
!!servers_walking_period < 4 then |
!!servers_walking_period < 4 then |
241 |
servers_walking_period =:= 4) |
servers_walking_period =:= 4) |
242 |
|
|
243 |
let keep_cancelled_in_old_files = define_expert_option donkey_section |
let keep_cancelled_in_old_files = define_expert_option donkey_section |
244 |
["keep_cancelled_in_old_files"] |
["keep_cancelled_in_old_files"] |
245 |
"Are the cancelled files added to the old files list to prevent re-download ?" |
"Are the cancelled files added to the old files list to prevent re-download ?" |
246 |
bool_option false |
bool_option false |
247 |
|
|
248 |
|
let keep_downloaded_in_old_files = define_expert_option donkey_section |
249 |
|
["keep_downloaded_in_old_files"] |
250 |
|
"Are the downloaded files added to the old files list to prevent re-download ?" |
251 |
|
bool_option false |
252 |
|
|
253 |
let send_warning_messages = define_expert_option donkey_section |
let send_warning_messages = define_expert_option donkey_section |
254 |
["send_warning_messages"] "true if you want your mldonkey to lose some |
["send_warning_messages"] "true if you want your mldonkey to lose some |
255 |
upload bandwidth sending messages to clients which are banned :)" |
upload bandwidth sending messages to clients which are banned :)" |
256 |
bool_option false |
bool_option false |
257 |
|
|
258 |
let ban_queue_jumpers = define_expert_option donkey_section |
let ban_queue_jumpers = define_expert_option donkey_section |
259 |
["ban_queue_jumpers"] "true if you want your client to ban |
["ban_queue_jumpers"] "true if you want your client to ban |
260 |
clients that try queue jumping (3 reconnections faster than 9 minutes)" |
clients that try queue jumping (3 reconnections faster than 9 minutes)" |
261 |
bool_option true |
bool_option true |
262 |
|
|
263 |
let use_server_ip = define_expert_option donkey_section |
let use_server_ip = define_expert_option donkey_section |
264 |
["use_server_ip"] "true if you want your client IP to be set from servers ID" bool_option true |
["use_server_ip"] "true if you want your client IP to be set from servers ID" bool_option true |
265 |
|
|
266 |
let ban_period = define_expert_option donkey_section |
let ban_period = define_expert_option donkey_section |
267 |
["ban_period"] "Set the number of hours you want client to remain banned" |
["ban_period"] "Set the number of hours you want client to remain banned" |
268 |
int_option 1 |
int_option 1 |
271 |
["good_client_rank"] |
["good_client_rank"] |
272 |
"Set the maximal rank of a client to be kept as a client" |
"Set the maximal rank of a client to be kept as a client" |
273 |
int_option 500 |
int_option 500 |
274 |
|
|
275 |
let min_users_on_server = define_option donkey_section ["min_users_on_server"] |
let min_users_on_server = define_option donkey_section ["min_users_on_server"] |
276 |
"min connected users for each server" int_option 0 |
"min connected users for each server" int_option 0 |
277 |
|
|
278 |
let login = define_option donkey_section ["login"] |
let login = define_option donkey_section ["login"] |
279 |
"login of client on eDonkey network (nothing default to global one)" string_option "" |
"login of client on eDonkey network (nothing default to global one)" string_option "" |
280 |
|
|
281 |
let overnet_options_section_name = "Overnet" |
let overnet_options_section_name = "Overnet" |
282 |
|
|
283 |
let overnet_section = file_section donkey_ini [ overnet_options_section_name ] |
let overnet_section = file_section donkey_ini [ overnet_options_section_name ] |
284 |
"Overnet options" |
"Overnet options" |
285 |
|
|
286 |
let overnet_port = |
let overnet_port = |
287 |
define_option overnet_section [overnet_options_section_name; "port"] |
define_option overnet_section [overnet_options_section_name; "port"] |
288 |
"port for overnet" |
"port for overnet" |
289 |
int_option (2000 + Random.int 20000) |
int_option (2000 + Random.int 20000) |
290 |
|
|
|
|
|
|
|
|
291 |
(* let source_management = define_expert_option donkey_section |
(* let source_management = define_expert_option donkey_section |
292 |
["source_management"] "Which source management to use: |
["source_management"] "Which source management to use: |
293 |
1: based on separate time queues, shared by files (2.02-1...2.02-5) |
1: based on separate time queues, shared by files (2.02-1...2.02-5) |
294 |
2: based on unified queues with scores, shared by files (2.02-6...2.02-9) |
2: based on unified queues with scores, shared by files (2.02-6...2.02-9) |
295 |
3: based on separate file queues (2.02-10) |
3: based on separate file queues (2.02-10) |
296 |
" int_option 3 *) |
" int_option 3 *) |
297 |
|
|
298 |
let sources_per_chunk = |
let sources_per_chunk = |
299 |
define_expert_option donkey_section ["sources_per_chunk"] |
define_expert_option donkey_section ["sources_per_chunk"] |
300 |
"How many sources to use to download each chunk" |
"How many sources to use to download each chunk" |
301 |
int_option 3 |
int_option 3 |
302 |
|
|
|
|
|
303 |
(* This option is used to avoid the delay when connecting to a server before |
(* This option is used to avoid the delay when connecting to a server before |
304 |
sending the list of shared files, which is only sent to master servers. *) |
sending the list of shared files, which is only sent to master servers. *) |
305 |
let immediate_master = |
let immediate_master = |
306 |
define_expert_option donkey_section ["immediate_master"] |
define_expert_option donkey_section ["immediate_master"] |
307 |
"(only for development tests)" bool_option false |
"(only for development tests)" bool_option false |
308 |
|
|
309 |
let become_master_delay = |
let become_master_delay = |
310 |
define_expert_option donkey_section ["become_master_delay"] |
define_expert_option donkey_section ["become_master_delay"] |
311 |
"(only for development tests)" int_option 120 |
"(only for development tests)" int_option 120 |
312 |
|
|
313 |
let gui_donkey_options_panel = |
let gui_donkey_options_panel = |
314 |
[ |
[ |
315 |
(* "Maximal Source Age", shortname max_sources_age, "T"; *) |
(* "Maximal Source Age", shortname max_sources_age, "T"; *) |
316 |
"Maximal Server Age", shortname max_server_age, "T"; |
"Maximal Server Age", shortname max_server_age, "T"; |
325 |
"Max Sources Per Download", shortname max_sources_per_file, "T"; |
"Max Sources Per Download", shortname max_sources_per_file, "T"; |
326 |
"Port", shortname donkey_port, "T"; |
"Port", shortname donkey_port, "T"; |
327 |
"Login", shortname login, "T"; |
"Login", shortname login, "T"; |
328 |
"Download Chunks in Random order", shortname random_order_download, "B"; |
"Download Chunks in Random order", shortname random_order_download, "B"; |
329 |
"Sources Per Chunk", shortname sources_per_chunk, "T"; |
"Sources Per Chunk", shortname sources_per_chunk, "T"; |
330 |
"Prevent Re-download of Cancelled Files", shortname keep_cancelled_in_old_files, "B"; |
"Prevent Re-download of Cancelled Files", shortname keep_cancelled_in_old_files, "B"; |
331 |
|
"Prevent Re-download of Downloaded Files", shortname keep_downloaded_in_old_files, "B"; |
332 |
"Dynamic Slot Allocation", shortname dynamic_slots, "B"; |
"Dynamic Slot Allocation", shortname dynamic_slots, "B"; |
333 |
] |
] |
|
|
|