1 (* Copyright 2001, 2002 b8_bavard, b8_fee_carabine, INRIA *)
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
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"
32 let donkey_port = define_option
donkey_section ["port"]
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"
41 let client_timeout = define_expert_option
donkey_section ["client_timeout"]
42 "Timeout on client connections when not queued"
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"
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"
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"
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
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"
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"
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"
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"
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"
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"
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"
105 let max_walker_servers = define_expert_option
donkey_section ["max_walker_servers"]
106 "Number of servers that can be used to walk
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"
114 let log_clients_on_console = define_expert_option
donkey_section ["log_clients_on_console"]
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"
124 let max_sources_per_file = define_option
donkey_section ["max_sources_per_file"]
125 "Maximal number of sources for each file"
128 let keep_sources = define_expert_option
donkey_section ["keep_sources"]
129 "Save sources to file_sources.ini and reload them on core start."
134 let mldonkey_md4 md4
=
135 (* not sure if mutation in-place is necessary, keeping behaviour as it was *)
136 let md4 = Bytes.unsafe_of_string
@@ Md4.direct_to_string
md4 in
137 md4.[5] <- Char.chr
14;
138 md4.[14] <- Char.chr
111;
139 Md4.direct_of_string
@@ Bytes.unsafe_to_string
md4
141 let client_md4 = define_option
donkey_section ["client_md4"]
142 "The MD4 of this client"
143 Md4.option (mldonkey_md4 (Md4.random
()))
145 let client_private_key = define_option
donkey_section ["client_private_key"]
146 "The RSA private key of this client"
147 string_option
(if Autoconf.donkey_sui_works
() then DonkeySui.SUI.create_key
() else "")
149 let enable_sui = define_option
donkey_section ["enable_sui"]
150 "Enable secure user identification support"
154 option_hook
client_md4 (fun _ ->
155 let m = mldonkey_md4 !!client_md4 in
156 if m <> !!client_md4 then
159 let black_list = define_expert_option
donkey_section ["black_list"]
163 let port_black_list = define_expert_option
donkey_section ["port_black_list"]
164 "A list of ports that specify servers to remove
165 from server list. Servers with ports on this list can't be added, and
166 will eventually be removed"
167 (list_option int_option
) []
169 let queued_timeout = define_expert_option
donkey_section ["queued_timeout"]
170 "How long should we wait in the queue of another client"
173 let upload_timeout = define_expert_option
donkey_section ["upload_timeout"]
174 "How long can a silent client stay in the upload queue"
177 let upload_lifetime = define_expert_option
donkey_section ["upload_lifetime"]
178 "How long a downloading client can stay in my upload queue (in minutes >5)"
181 let upload_full_chunks = define_expert_option
donkey_section ["upload_full_chunks"]
182 "If true, each client is allowed to receive one chunk, this setting overrides upload_lifetime"
185 let upload_complete_chunks = define_expert_option
donkey_section ["upload_complete_chunks"]
186 "If true, each client is allowed to complete only one chunk, independent, if it is empty or
187 partial. this setting overrides upload_full_chunks and dynamic_upload_lifetime,
188 but is, as a failsafe, limited by upload_lifetime (should be set reasonable high)"
191 let dynamic_upload_lifetime = define_expert_option
donkey_section ["dynamic_upload_lifetime"]
192 "Each client upload lifetime depends on download-upload ratio"
195 let dynamic_upload_threshold = define_expert_option
donkey_section ["dynamic_upload_threshold"]
196 "Uploaded zones (1 zone = 180 kBytes) needed to enable the dynamic upload lifetime"
199 let connected_server_timeout = define_expert_option
donkey_section ["connected_server_timeout"]
200 "How long can a silent server stay connected"
203 let upload_power = define_expert_option
donkey_section ["upload_power"]
204 "The weight of upload on a donkey connection compared to upload on other
205 peer-to-peer networks. Setting it to 5 for example means that a donkey
206 connection will be allowed to send 5 times more information per second than
207 an Open Napster connection. This is done to favorise donkey connections
208 over other networks, where upload is less efficient, without preventing
209 upload from these networks."
212 let max_server_age = define_expert_option
donkey_section ["max_server_age"]
213 "max number of days after which an unconnected server is removed"
216 let remove_old_servers_delay = define_expert_option
donkey_section ["remove_old_servers_delay"]
218 "How often should remove old donkey servers (see max_server_age) be called
219 (in seconds, 0 to disable)"
222 let min_left_servers = define_expert_option
donkey_section ["min_left_servers"]
223 "Minimal number of servers remaining after remove_old_servers"
226 let servers_walking_period = define_expert_option
donkey_section ["servers_walking_period"]
227 "How often should we check all servers (minimum 4 hours, 0 to disable)"
231 option_hook
servers_walking_period (fun _ ->
232 if !!servers_walking_period > 0
233 && !!servers_walking_period < 4 then
234 servers_walking_period =:= 4
237 let keep_cancelled_in_old_files = define_expert_option
donkey_section ["keep_cancelled_in_old_files"]
238 "Are the cancelled files added to the old files list to prevent re-download ?"
241 let keep_downloaded_in_old_files = define_expert_option
donkey_section ["keep_downloaded_in_old_files"]
242 "Are the downloaded files added to the old files list to prevent re-download ?"
245 let send_warning_messages = define_expert_option
donkey_section ["send_warning_messages"]
246 "true if you want your mldonkey to lose some
247 upload bandwidth sending messages to clients which are banned :)"
250 let ban_queue_jumpers = define_expert_option
donkey_section ["ban_queue_jumpers"]
251 "true if you want your client to ban
252 clients that try queue jumping (3 reconnections faster than 9 minutes)"
255 let use_server_ip = define_expert_option
donkey_section ["use_server_ip"]
256 "true if you want your client IP to be set from servers ID"
259 let ban_period = define_expert_option
donkey_section ["ban_period"]
260 "Set the number of hours you want client to remain banned"
263 let good_client_rank = define_expert_option
donkey_section ["good_client_rank"]
264 "Set the maximal rank of a client to be kept as a client"
267 let min_users_on_server = define_option
donkey_section ["min_users_on_server"]
268 "disconnect if server users is smaller"
271 let max_published_files = define_option
donkey_section ["max_published_files"]
272 "maximum number of files published to servers per minute, eMule default 200"
275 let login = define_option
donkey_section ["login"]
276 "login of client on eDonkey network (nothing default to global one)"
279 let overnet_options_section_name = "Overnet"
281 let overnet_section = file_section
donkey_ini [ overnet_options_section_name ]
284 let overnet_port = define_option
overnet_section [overnet_options_section_name; "port"]
287 port_option
(2000 + Random.int 20000)
289 let options_version = define_expert_option
donkey_section ["options_version"]
294 let gui_donkey_options_panel =
296 (* "Maximal Source Age", shortname max_sources_age, "T"; *)
297 "Maximal Server Age", shortname
max_server_age, "T";
298 "Min Left Servers After Clean", shortname
min_left_servers, "T";
299 "Update Server List Server", shortname
update_server_list_server, "B";
300 "Update Server List Server.met", shortname
update_server_list_server_met, "B";
301 "Update Server List Client", shortname
update_server_list_client, "B";
302 "Servers Walking Period", shortname
servers_walking_period, "T";
303 "Force High ID", shortname
force_high_id, "B";
304 "Max Number of Connected Servers", shortname
max_connected_servers, "T";
305 "Max Upload Slots", shortname max_upload_slots
, "T";
306 "Max Sources Per Download", shortname
max_sources_per_file, "T";
307 "Port", shortname
donkey_port, "T";
308 "Login", shortname
login, "T";
309 "Sources Per Chunk", shortname sources_per_chunk
, "T";
310 "Prevent Re-download of Cancelled Files", shortname
keep_cancelled_in_old_files, "B";
311 "Prevent Re-download of Downloaded Files", shortname
keep_downloaded_in_old_files, "B";
312 "Dynamic Slot Allocation", shortname dynamic_slots
, "B";
315 let old_files = define_option
donkey_section ["old_files"]
316 "The files that were downloaded"
317 (list_option
Md4.option) []