patch #7310
[mldonkey.git] / src / networks / donkey / donkeyOptions.ml
blob51a8cb6cc3af8803d1412d39bae18b3a86f81d38
1 (* Copyright 2001, 2002 b8_bavard, b8_fee_carabine, INRIA *)
2 (*
3 This file is part of mldonkey.
5 mldonkey is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 mldonkey is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mldonkey; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 open Options
22 open CommonOptions
24 let donkey_ini = create_options_file "donkey.ini"
26 let donkey_section = file_section donkey_ini ["Donkey"] "Donkey options"
28 let max_xs_packets = define_expert_option donkey_section ["max_xs_packets"]
29 "Max number of UDP packets per round for eXtended Search"
30 int_option 30
32 let donkey_port = define_option donkey_section ["port"]
33 ~restart: true
34 "The port used for TCP connection by other donkey clients. UDP port = port + 4."
35 port_option (2000 + Random.int 20000)
37 let check_client_connections_delay = define_expert_option donkey_section ["check_client_connections_delay"]
38 "Delay used to request file sources"
39 float_option 180.0
41 let client_timeout = define_expert_option donkey_section ["client_timeout"]
42 "Timeout on client connections when not queued"
43 float_option 40.
45 let max_connected_servers = define_option donkey_section ["max_connected_servers"]
46 "The number of servers you want to stay connected to, maximum allowable = 3"
47 int_option 3
49 let max_allowed_connected_servers () =
50 min (int_of_string (strings_of_option max_connected_servers).option_default)
51 !!max_connected_servers
53 let reliable_sources = define_option donkey_section ["reliable_sources"]
54 "Should mldonkey try to detect sources responsible for corruption and ban them, currently disabled"
55 bool_option true
57 let ban_identity_thieves = define_option donkey_section ["ban_identity_thieves"]
58 "Should mldonkey try to detect sources masquerading as others and ban them"
59 bool_option true
61 let server_black_list = define_option donkey_section ["server_black_list"]
62 "A list of server IP to remove from server list. Can contain single IPs, CIDR ranges, or begin-end ranges.
63 Servers on this list can't be added, and will eventually be removed"
64 CommonOptions.ip_range_list_option []
66 let server_black_list_set = ref Ip_set.bl_empty
68 let () =
69 option_hook server_black_list (fun _ ->
70 server_black_list_set := Ip_set.of_list !!server_black_list)
72 let force_high_id = define_option donkey_section ["force_high_id"]
73 "immediately close connection to servers that don't grant a High ID"
74 bool_option false
76 let force_client_high_id = define_option donkey_section ["force_client_high_id"]
77 "send all clients your IP regardless of what ID was assigned by the server"
78 bool_option false
80 let update_server_list_server = define_option donkey_section ["update_server_list_server"]
81 "Set this option to false if you don't want to
82 receive new servers from servers"
83 bool_option false
85 let update_server_list_server_met = define_option donkey_section ["update_server_list_server_met"]
86 "Set this option to false if you don't want to
87 receive new servers from server.met"
88 bool_option true
90 let update_server_list_client = define_option donkey_section ["update_server_list_client"]
91 "Set this option to false if you don't want to
92 receive new servers from clients"
93 bool_option false
95 let keep_best_server = define_expert_option donkey_section ["keep_best_server"]
96 "Set this option to false if you don't want mldonkey
97 to change the master servers it is connected to"
98 bool_option true
100 let connect_only_preferred_server = define_expert_option donkey_section ["connect_only_preferred_server"]
101 "only servers which are set to 'preferred' will be connected,
102 please note that any server must be set to preferred to use this feature"
103 bool_option false
105 let max_walker_servers = define_expert_option donkey_section ["max_walker_servers"]
106 "Number of servers that can be used to walk
107 between servers"
108 int_option 1
110 let walker_server_lifetime = define_expert_option donkey_section ["walker_server_lifetime"]
111 "The maximal delay a connection with a server should last when walking through the list"
112 int_option 300
114 let log_clients_on_console = define_expert_option donkey_section ["log_clients_on_console"]
116 bool_option false
118 let propagate_sources = define_expert_option donkey_section ["propagate_sources"]
119 "Allow mldonkey to propagate your sources to other mldonkey clients.
120 This function is superseded by eMule-style source exchange,
121 this option is outdated"
122 bool_option false
124 let max_sources_per_file = define_option donkey_section ["max_sources_per_file"]
125 "Maximal number of sources for each file"
126 int_option 5000
128 let keep_sources = define_expert_option donkey_section ["keep_sources"]
129 "Save sources to file_sources.ini and reload them on core start."
130 bool_option true
132 open Md4
134 let mldonkey_md4 md4 =
135 let md4 = Md4.direct_to_string md4 in
136 md4.[5] <- Char.chr 14;
137 md4.[14] <- Char.chr 111;
138 Md4.direct_of_string md4
140 let client_md4 = define_option donkey_section ["client_md4"]
141 "The MD4 of this client"
142 Md4.option (mldonkey_md4 (Md4.random ()))
144 let client_private_key = define_option donkey_section ["client_private_key"]
145 "The RSA private key of this client"
146 string_option (if Autoconf.donkey_sui_works () then DonkeySui.SUI.create_key () else "")
148 let enable_sui = define_option donkey_section ["enable_sui"]
149 "Enable secure user identification support"
150 bool_option true
152 let _ =
153 option_hook client_md4 (fun _ ->
154 let m = mldonkey_md4 !!client_md4 in
155 if m <> !!client_md4 then
156 client_md4 =:= m)
158 let black_list = define_expert_option donkey_section ["black_list"]
160 bool_option true
162 let port_black_list = define_expert_option donkey_section ["port_black_list"]
163 "A list of ports that specify servers to remove
164 from server list. Servers with ports on this list can't be added, and
165 will eventually be removed"
166 (list_option int_option) []
168 let queued_timeout = define_expert_option donkey_section ["queued_timeout"]
169 "How long should we wait in the queue of another client"
170 float_option 1800.
172 let upload_timeout = define_expert_option donkey_section ["upload_timeout"]
173 "How long can a silent client stay in the upload queue"
174 float_option 600.
176 let upload_lifetime = define_expert_option donkey_section ["upload_lifetime"]
177 "How long a downloading client can stay in my upload queue (in minutes >5)"
178 int_option 90
180 let upload_full_chunks = define_expert_option donkey_section ["upload_full_chunks"]
181 "If true, each client is allowed to receive one chunk, this setting overrides upload_lifetime"
182 bool_option true
184 let upload_complete_chunks = define_expert_option donkey_section ["upload_complete_chunks"]
185 "If true, each client is allowed to complete only one chunk, independent, if it is empty or
186 partial. this setting overrides upload_full_chunks and dynamic_upload_lifetime,
187 but is, as a failsafe, limited by upload_lifetime (should be set reasonable high)"
188 bool_option false
190 let dynamic_upload_lifetime = define_expert_option donkey_section ["dynamic_upload_lifetime"]
191 "Each client upload lifetime depends on download-upload ratio"
192 bool_option false
194 let dynamic_upload_threshold = define_expert_option donkey_section ["dynamic_upload_threshold"]
195 "Uploaded zones (1 zone = 180 kBytes) needed to enable the dynamic upload lifetime"
196 int_option 10
198 let connected_server_timeout = define_expert_option donkey_section ["connected_server_timeout"]
199 "How long can a silent server stay connected"
200 float_option 1800.
202 let upload_power = define_expert_option donkey_section ["upload_power"]
203 "The weight of upload on a donkey connection compared to upload on other
204 peer-to-peer networks. Setting it to 5 for example means that a donkey
205 connection will be allowed to send 5 times more information per second than
206 an Open Napster connection. This is done to favorise donkey connections
207 over other networks, where upload is less efficient, without preventing
208 upload from these networks."
209 int_option 5
211 let max_server_age = define_expert_option donkey_section ["max_server_age"]
212 "max number of days after which an unconnected server is removed"
213 int_option 2
215 let remove_old_servers_delay = define_expert_option donkey_section ["remove_old_servers_delay"]
216 ~restart: true
217 "How often should remove old donkey servers (see max_server_age) be called
218 (in seconds, 0 to disable)"
219 float_option 900.
221 let min_left_servers = define_expert_option donkey_section ["min_left_servers"]
222 "Minimal number of servers remaining after remove_old_servers"
223 int_option 20
225 let servers_walking_period = define_expert_option donkey_section ["servers_walking_period"]
226 "How often should we check all servers (minimum 4 hours, 0 to disable)"
227 int_option 6
229 let _ =
230 option_hook servers_walking_period (fun _ ->
231 if !!servers_walking_period > 0
232 && !!servers_walking_period < 4 then
233 servers_walking_period =:= 4
236 let keep_cancelled_in_old_files = define_expert_option donkey_section ["keep_cancelled_in_old_files"]
237 "Are the cancelled files added to the old files list to prevent re-download ?"
238 bool_option false
240 let keep_downloaded_in_old_files = define_expert_option donkey_section ["keep_downloaded_in_old_files"]
241 "Are the downloaded files added to the old files list to prevent re-download ?"
242 bool_option false
244 let send_warning_messages = define_expert_option donkey_section ["send_warning_messages"]
245 "true if you want your mldonkey to lose some
246 upload bandwidth sending messages to clients which are banned :)"
247 bool_option false
249 let ban_queue_jumpers = define_expert_option donkey_section ["ban_queue_jumpers"]
250 "true if you want your client to ban
251 clients that try queue jumping (3 reconnections faster than 9 minutes)"
252 bool_option true
254 let use_server_ip = define_expert_option donkey_section ["use_server_ip"]
255 "true if you want your client IP to be set from servers ID"
256 bool_option true
258 let ban_period = define_expert_option donkey_section ["ban_period"]
259 "Set the number of hours you want client to remain banned"
260 int_option 1
262 let good_client_rank = define_expert_option donkey_section ["good_client_rank"]
263 "Set the maximal rank of a client to be kept as a client"
264 int_option 500
266 let min_users_on_server = define_option donkey_section ["min_users_on_server"]
267 "disconnect if server users is smaller"
268 int_option 0
270 let max_published_files = define_option donkey_section ["max_published_files"]
271 "maximum number of files published to servers per minute, eMule default 200"
272 int_option 200
274 let login = define_option donkey_section ["login"]
275 "login of client on eDonkey network (nothing default to global one)"
276 string_option ""
278 let overnet_options_section_name = "Overnet"
280 let overnet_section = file_section donkey_ini [ overnet_options_section_name ]
281 "Overnet options"
283 let overnet_port = define_option overnet_section [overnet_options_section_name; "port"]
284 ~restart: true
285 "port for overnet"
286 port_option (2000 + Random.int 20000)
288 let options_version = define_expert_option donkey_section ["options_version"]
289 ~internal: true
290 "(internal option)"
291 int_option 4
293 let gui_donkey_options_panel =
295 (* "Maximal Source Age", shortname max_sources_age, "T"; *)
296 "Maximal Server Age", shortname max_server_age, "T";
297 "Min Left Servers After Clean", shortname min_left_servers, "T";
298 "Update Server List Server", shortname update_server_list_server, "B";
299 "Update Server List Server.met", shortname update_server_list_server_met, "B";
300 "Update Server List Client", shortname update_server_list_client, "B";
301 "Servers Walking Period", shortname servers_walking_period, "T";
302 "Force High ID", shortname force_high_id, "B";
303 "Max Number of Connected Servers", shortname max_connected_servers, "T";
304 "Max Upload Slots", shortname max_upload_slots, "T";
305 "Max Sources Per Download", shortname max_sources_per_file, "T";
306 "Port", shortname donkey_port, "T";
307 "Login", shortname login, "T";
308 "Sources Per Chunk", shortname sources_per_chunk, "T";
309 "Prevent Re-download of Cancelled Files", shortname keep_cancelled_in_old_files, "B";
310 "Prevent Re-download of Downloaded Files", shortname keep_downloaded_in_old_files, "B";
311 "Dynamic Slot Allocation", shortname dynamic_slots, "B";
314 let old_files = define_option donkey_section ["old_files"]
315 "The files that were downloaded"
316 (list_option Md4.option) []