summaryrefslogtreecommitdiff
path: root/dht/dht-client.cabal
blob: dc9b7ca28da4a7a4ce721f0780b1497554805584 (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
name:                  dht-client
version:               0.0.0.4
license:               BSD3
license-file:          LICENSE
author:                Joe Crayne
maintainer:            Joe Crayne
copyright:             (c) 2017 Joe Crayne, (c) 2017 James Crayne, (c) 2013 Sam Truzjan
category:              Network
build-type:            Custom
cabal-version:         >= 1.10
synopsis:              BitTorrent and Tox DHT.
description:

  This package provides, in the form of a unix daemon, both the tox and bittorrent
  Distributed Hash Tables. Both of these DHT's are implementations of the Kademlia
  algorithm. Although, there is also a library in this package, it is really just a
  shared interface between the two executables this package provides: dhtd and dht.

  If you want to make a peer to peer application that uses this code, the proper way
  to do it is to start the dhtd server, and use the dht program as a means to communicate
  with it over a unix domain socket.

  Users who do wish to use the modules exported by the library should be aware that the
  API of these modules may change without notice and may vary depending on the selection
  of cabal flags.

extra-source-files:    ChangeLog
                       cbits/*.h


flag network-uri
  description:         Use network-uri package.
  default:             True

-- supports network-2.7, 2.8, with deprecation warnings
flag old-network-bsd
  description:         Use network-bsd package.
  default:             True

-- supports network >3.0
flag new-network-bsd
  description:         Use newer network-bsd package.
  default:             False

flag builder
  description: Use older bytestring package and bytestring-builder.
  default: False

-- flag aeson
--   description: Use aeson for pretty-printing bencoded data.
--   default: True

flag thread-debug
  description: Add instrumentation to threads.
  default: True

flag cryptonite-backport
  description: Backport curve 25519 to older cryptonite library.
  default: False

custom-setup
  setup-depends:
    base  >= 4.5,
    Cabal >= 1.14,
    directory

library
  default-language:    Haskell2010
  default-extensions:  PatternGuards
                     , OverloadedStrings
                     , RecordWildCards
                     , NondecreasingIndentation
  hs-source-dirs:      src, ., Presence
  exposed-modules:  Control.Concurrent.ThreadUtil
                    Network.SocketLike
                    Data.Digest.CRC32C
                    Data.Bits.ByteString
                    Data.TableMethods
                    Network.BitTorrent.DHT.ContactInfo
                    Network.BitTorrent.DHT.Token
                    Network.QueryResponse
                    Network.StreamServer
                    Data.BEncode.Pretty
                    Network.BitTorrent.MainlineDHT
                    Network.BitTorrent.MainlineDHT.Symbols
                    System.Global6
                    Data.PacketQueue
                    Data.PacketBuffer
                    Network.Tox.Onion.Routes
                    TCPProber
                    Data.Tox.Onion
                    Network.Tox
                    Network.Tox.Transport
                    Network.Tox.Crypto.Transport
                    Network.Tox.Onion.Handlers
                    Network.Tox.Onion.Transport
                    Network.Tox.DHT.Handlers
                    Network.Tox.DHT.Transport
                    Network.Tox.Handshake
                    Network.Tox.NodeId
                    Network.Tox.Avahi
                    Network.UPNP
                    Network.QueryResponse.TCP
                    Network.Tox.Relay
                    Network.Tox.TCP
                    Data.Tox.Msg
                    Data.Tox.Relay
                    Control.TriadCommittee
                    Text.XXD
                    Network.Tox.ContactInfo
                    Announcer
                    Announcer.Tox
                    Control.Concurrent.Delay
                    ByteStringOperators
                    ClientState
                    ConfigFiles
                    ConnectionKey
                    ConsoleWriter
                    Control.Concurrent.STM.StatusCache
                    Control.Concurrent.STM.UpdateStream
                    Control.Concurrent.STM.Util
                    ControlMaybe
                    Data.BitSyntax
                    DNSCache
                    EventUtil
                    FGConsole
                    GetHostByAddr
                    LocalPeerCred
                    LockedChan
                    Logging
                    Nesting
                    Paths
                    Connection.Tcp
                    SockAddr
                    UTmp
                    MUC
                    LocalChat
                    Chat
                    Stanza.Build
                    Stanza.Types
                    Stanza.Parse
                    XMPPServer
                    Util
                    Presence
                    Control.Concurrent.PingMachine
                    Connection
                    ToxChat
                    ToxToXMPP
                    ToxManager
                    XMPPToTox
                    DebugUtil
                    Data.IntervalSet
                    Data.Tox.Message
                    HandshakeCache
                    Network.Lossless
                    Network.SessionTransports
                    Network.Tox.AggregateSession
                    Network.Tox.Session
                    DebugTag
                    Codec.AsciiKey256
                    Paths_dht_client

  build-depends:      base
                    , containers
                    -- TODO: Use GShow,Has 'Show, when dependent-sum>0.6
                    , dependent-sum < 0.6
                    , array
                    , hashable
                    , iproute
                    , semigroups
                    , stm               >= 2.4.0
                    , stm-chans
                    , concurrent-supply
                    , base16-bytestring
                    -- TODO: FIXME: Using non-hackage base32-bytestring from eth-r's github
                    , base32-bytestring
                    , base64-bytestring
                    , psqueues
                    , reflection
                    , deepseq
                    , text
                    , filepath
                    , directory
                    , bencoding
                    , contravariant
                    , xml-types
                    , rank2classes

                    , memory
                    , time
                    , random
                    , entropy
                    , cpu

                    , cereal
                    , http-types

                    , process
                    , pretty
                    , convertible
                    , data-default

                    , lifted-base
                    , monad-control
                    , transformers-base
                    , mtl
                    , ghc-prim
                    , sensible-directory
                    , temporary
                    , transformers
                    , conduit
                    , conduit-extra
                    , xml-conduit >= 1.5.0
                    , unix
                    , template-haskell
                    , blaze-builder
                    , exceptions
                    , hinotify
                    , avahi >= 0.2.0
                    , dput-hslogger
                    , word64-map
                    , network-addr
                    , tox-crypto
                    , lifted-concurrent
                    , psq-wrap
                    , minmax-psq
                    , kad
                    , tasks
                    , torrent-types

  if impl(ghc < 8)
      Build-depends:  transformers

  if flag(old-network-bsd)
    Build-depends:  network < 3.0
                  , network-uri  >= 2.6
                  , network-bsd < 2.8.1.0
  else
   if flag(new-network-bsd)
    Build-depends:  network >= 3.0
                  , network-uri  >= 2.6
                  , network-bsd >= 2.8.1.0
   else
    if flag(network-uri)
      Build-depends:  network      >= 2.6 && < 3.0
                    , network-uri  >= 2.6
    else
      Build-depends:  network      >= 2.4 && < 2.6



  C-sources:           Presence/monitortty.c cbits/crc4_itu.c

  -- if flag(aeson)
  build-depends: aeson, aeson-pretty, unordered-containers, vector
  cpp-options:   -DBENCODE_AESON -DRENDERFLUSH
  if flag(thread-debug)
    -- exposed-modules: Control.Concurrent.Lifted.Instrument
    cpp-options:   -DTHREAD_DEBUG

  if flag(builder)
    build-depends: bytestring >= 0.9, bytestring-builder
  else
    build-depends: bytestring >= 0.10
  ghc-options:         -fwarn-missing-signatures -fdefer-typed-holes
  ghc-prof-options:

  if flag(cryptonite-backport)
        cpp-options: -DCRYPTONITE_BACKPORT
        hs-source-dirs: cryptonite-backport
        C-sources: cbits/cryptonite_xsalsa.c, cbits/cryptonite_salsa.c
        other-modules: Crypto.Cipher.Salsa
                       Crypto.Cipher.XSalsa
                       Crypto.ECC.Class
                       Crypto.ECC.Simple.Prim
                       Crypto.ECC.Simple.Types
                       Crypto.Error.Types
                       Crypto.Internal.ByteArray
                       Crypto.Internal.Compat
                       Crypto.Internal.DeepSeq
                       Crypto.Internal.Imports
                       Crypto.PubKey.Curve25519
        build-depends: cryptonite < 0.22
  else
        build-depends: cryptonite >= 0.22

executable avahi
  hs-source-dirs:      examples
  main-is:             avahi.hs
  default-language:    Haskell2010
  build-depends:       base-prelude, dht-client, avahi, network
  ghc-options:         -fobject-code

executable dht
  hs-source-dirs:      examples
  main-is:             dht.hs
  default-language:    Haskell2010
  build-depends:       base, haskeline, network, bytestring, transformers
  ghc-options:         -fobject-code

executable dhtd
  hs-source-dirs:      examples
  main-is:             dhtd.hs
  default-language:    Haskell2010
  build-depends:       base, network, bytestring, hashable, deepseq
                     , aeson
                     , array
                     , pretty
                     , dht-client
                     , dput-hslogger
                     , word64-map
                     , tox-crypto
                     , network-addr
                     , kad
                     , lifted-concurrent
                     , psq-wrap
                     , minmax-psq
                     , tasks
                     , unix
                     , containers
                     , stm
                     , stm-chans
                     , concurrent-supply
                     , cereal
                     , bencoding
                     , unordered-containers
                     , vector
                     , text
                     , monad-control
                     , xml-types
                     , conduit
                     , conduit-extra
                     , transformers
                     , filepath
                     , process
                     , cereal-conduit >= 0.7.3
                     , cryptonite

  if flag(thread-debug)
    build-depends: time
    cpp-options:   -DTHREAD_DEBUG -DRENDERFLUSH

  ghc-options:       -rtsopts  -fdefer-typed-holes -threaded
  ghc-prof-options:    -g

executable testcookie
  buildable:           False
  hs-source-dirs:      examples
  main-is:             testcookie.hs
  default-language:    Haskell2010
  build-depends:       base, bytestring, cereal, dht-client, stm

executable testTox
  hs-source-dirs:      examples
  main-is:             testTox.hs
  default-language:    Haskell2010
  build-depends:       base
                     , dht-client
                     , dput-hslogger
                     , tox-crypto
                     , lifted-concurrent
                     , stm
                     , stm-chans
                     , time
                     , concurrent-supply
                     , containers
                     , network
                     , unordered-containers
                     , dependent-sum
  if flag(thread-debug)
    cpp-options:   -DTHREAD_DEBUG