######################################################################
# Pia - an "internet" of peers.
# -----
# Licensed under Apache License 2.0
module Pia
include("./Errors.jl")

include("./Futures.jl")
include("./Lockables.jl")
include("./Logging.jl")
include("./Packets.jl")
include("./Signals.jl")
include("./Voidables.jl")

include("./utils.jl")

include("./Pia.Interface.jl")
include("./PacketFactories.jl")

include("./Pia.Applications.jl")
include("./Pia.LinkProtocol.jl")
include("./Pia.PortalProtocol.jl")

using Reexport
@reexport using .LinkProtocol
@reexport using .PortalProtocol
@reexport using .Applications
import .Logging

const DEFAULT_PORT = 27472
      DEFAULT_TIMEOUT = 10
const DEFAULT_DESIRED_CONNECTIONS = 32
const DEFAULT_CONNECTION_HARDCAP = 100
const DEFAULT_PEER_LIFETIME = 60

const LogConnectivity = Logging.LogCategory("Pia Connectivity")
const LogDiscovery    = Logging.LogCategory("Pia Discovery")

function set_default_timeout(timeout::Real)
    global DEFAULT_TIMEOUT
    DEFAULT_TIMEOUT = timeout
end

end # module
