2022-07-01 18:19:57 +00:00
|
|
|
# Nim-LibP2P
|
|
|
|
# Copyright (c) 2022 Status Research & Development GmbH
|
|
|
|
# Licensed under either of
|
|
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
|
|
# at your option.
|
|
|
|
# This file may not be copied, modified, or distributed except according to
|
|
|
|
# those terms.
|
2021-03-18 15:20:36 +00:00
|
|
|
|
2022-08-03 11:33:19 +00:00
|
|
|
when (NimMajor, NimMinor) < (1, 4):
|
|
|
|
{.push raises: [Defect].}
|
|
|
|
else:
|
|
|
|
{.push raises: [].}
|
2021-05-24 17:55:33 +00:00
|
|
|
|
2021-03-18 15:20:36 +00:00
|
|
|
import chronos
|
|
|
|
import peerid,
|
2022-05-18 08:19:37 +00:00
|
|
|
stream/connection,
|
|
|
|
transports/transport
|
2021-03-18 15:20:36 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
Dial* = ref object of RootObj
|
|
|
|
|
|
|
|
method connect*(
|
|
|
|
self: Dial,
|
2021-12-16 10:05:20 +00:00
|
|
|
peerId: PeerId,
|
2022-02-24 16:31:47 +00:00
|
|
|
addrs: seq[MultiAddress],
|
|
|
|
forceDial = false) {.async, base.} =
|
2021-03-18 15:20:36 +00:00
|
|
|
## connect remote peer without negotiating
|
|
|
|
## a protocol
|
|
|
|
##
|
|
|
|
|
|
|
|
doAssert(false, "Not implemented!")
|
|
|
|
|
|
|
|
method dial*(
|
|
|
|
self: Dial,
|
2021-12-16 10:05:20 +00:00
|
|
|
peerId: PeerId,
|
2022-02-24 16:31:47 +00:00
|
|
|
protos: seq[string],
|
|
|
|
): Future[Connection] {.async, base.} =
|
2021-03-18 15:20:36 +00:00
|
|
|
## create a protocol stream over an
|
|
|
|
## existing connection
|
|
|
|
##
|
|
|
|
|
|
|
|
doAssert(false, "Not implemented!")
|
|
|
|
|
|
|
|
method dial*(
|
|
|
|
self: Dial,
|
2021-12-16 10:05:20 +00:00
|
|
|
peerId: PeerId,
|
2021-03-18 15:20:36 +00:00
|
|
|
addrs: seq[MultiAddress],
|
2022-02-24 16:31:47 +00:00
|
|
|
protos: seq[string],
|
|
|
|
forceDial = false): Future[Connection] {.async, base.} =
|
2021-03-18 15:20:36 +00:00
|
|
|
## create a protocol stream and establish
|
|
|
|
## a connection if one doesn't exist already
|
|
|
|
##
|
|
|
|
|
|
|
|
doAssert(false, "Not implemented!")
|
2022-05-18 08:19:37 +00:00
|
|
|
|
|
|
|
method addTransport*(
|
|
|
|
self: Dial,
|
|
|
|
transport: Transport) {.base.} =
|
|
|
|
doAssert(false, "Not implemented!")
|