29 |
"The port to bind the client to" |
"The port to bind the client to" |
30 |
int_option 6882 |
int_option 6882 |
31 |
|
|
32 |
|
(* Generate client_uid *) |
33 |
|
let generate_client_uid = |
34 |
|
let client_uid_from_version = "-ML" ^ Autoconf.current_version ^ "-" in |
35 |
|
let client_uid_random_tail = String.create (20 - (String.length client_uid_from_version)) in |
36 |
|
let sl_client_uid_random_tail = String.length client_uid_random_tail in |
37 |
|
if sl_client_uid_random_tail > 0 then |
38 |
|
for i = 0 to sl_client_uid_random_tail - 1 do |
39 |
|
client_uid_random_tail.[i] <- char_of_int (Random.int 256) |
40 |
|
done; |
41 |
|
client_uid_from_version ^ client_uid_random_tail |
42 |
|
|
43 |
let client_uid = define_option bittorrent_section ["client_uid"] |
let client_uid = define_option bittorrent_section ["client_uid"] |
44 |
"The UID of this client" Sha1.option (Sha1.random ()) |
"The UID of this client" Sha1.option (Sha1.direct_of_string generate_client_uid) |
45 |
|
|
46 |
|
(* Check if the uid is in sync with Autoconf.current_version *) |
47 |
|
let check_client_uid () = |
48 |
|
let s = Sha1.direct_to_string !!client_uid in |
49 |
|
if Autoconf.current_version != String.sub s 3 (( |
50 |
|
try |
51 |
|
String.index_from s 1 s.[0] |
52 |
|
with |
53 |
|
Not_found -> 3 |
54 |
|
) - 3) then |
55 |
|
client_uid =:= Sha1.direct_of_string generate_client_uid |
56 |
|
|
57 |
let shortname o = |
let shortname o = |
58 |
Printf.sprintf "BT-%s" (shortname o) |
Printf.sprintf "BT-%s" (shortname o) |
66 |
"Ask the tracker for new sources only if you have fewer than that number of sources" |
"Ask the tracker for new sources only if you have fewer than that number of sources" |
67 |
int_option 20 |
int_option 20 |
68 |
|
|
69 |
|
let send_key = define_option bittorrent_section ["send_key"] |
70 |
|
"Send client key to trackers" |
71 |
|
bool_option true |
72 |
|
|
73 |
let max_uploaders_per_torrent = define_option bittorrent_section ["max_uploaders_per_torrent"] |
let max_uploaders_per_torrent = define_option bittorrent_section ["max_uploaders_per_torrent"] |
74 |
"Maximum number of uploaders for one torrent" |
"Maximum number of uploaders for one torrent" |
75 |
int_option 5 |
int_option 5 |