@@ -2,9 +2,9 @@ use anyhow::Result;
2
2
use data_encoding:: BASE32 ;
3
3
use futures:: future:: { BoxFuture , FutureExt , Ready } ;
4
4
use libp2p:: core:: multiaddr:: { Multiaddr , Protocol } ;
5
- use libp2p:: core:: transport:: TransportError ;
5
+ use libp2p:: core:: transport:: { ListenerId , TransportError } ;
6
6
use libp2p:: core:: Transport ;
7
- use libp2p:: tcp:: tokio:: { Tcp , TcpStream } ;
7
+ use libp2p:: tcp:: tokio:: TcpStream ;
8
8
use std:: borrow:: Cow ;
9
9
use std:: net:: { Ipv4Addr , Ipv6Addr } ;
10
10
use std:: { fmt, io} ;
@@ -25,11 +25,14 @@ impl TorDialOnlyTransport {
25
25
impl Transport for TorDialOnlyTransport {
26
26
type Output = TcpStream ;
27
27
type Error = io:: Error ;
28
- type Listener = TcpListenStream < Tcp > ;
29
28
type ListenerUpgrade = Ready < Result < Self :: Output , Self :: Error > > ;
30
29
type Dial = BoxFuture < ' static , Result < Self :: Output , Self :: Error > > ;
31
30
32
- fn listen_on ( self , addr : Multiaddr ) -> Result < Self :: Listener , TransportError < Self :: Error > > {
31
+ fn listen_on (
32
+ & mut self ,
33
+ id : ListenerId ,
34
+ addr : Multiaddr ,
35
+ ) -> Result < ( ) , TransportError < Self :: Error > > {
33
36
Err ( TransportError :: MultiaddrNotSupported ( addr) )
34
37
}
35
38
@@ -59,6 +62,7 @@ impl Transport for TorDialOnlyTransport {
59
62
fn address_translation ( & self , _: & Multiaddr , _: & Multiaddr ) -> Option < Multiaddr > {
60
63
None
61
64
}
65
+
62
66
fn dial_as_listener (
63
67
& mut self ,
64
68
addr : Multiaddr ,
@@ -84,6 +88,25 @@ impl Transport for TorDialOnlyTransport {
84
88
85
89
Ok ( dial_future. boxed ( ) )
86
90
}
91
+
92
+ fn remove_listener ( & mut self , id : ListenerId ) -> bool {
93
+ // TODO: Libp2p Upgrade: What do we need to do here?
94
+ // I believe nothing because we are not using the transport to listen.
95
+ false
96
+ }
97
+
98
+ fn poll (
99
+ self : std:: pin:: Pin < & mut Self > ,
100
+ cx : & mut std:: task:: Context < ' _ > ,
101
+ ) -> std:: task:: Poll < libp2p:: core:: transport:: TransportEvent < Self :: ListenerUpgrade , Self :: Error > >
102
+ {
103
+ // TODO: Libp2p Upgrade: What do we need to do here?
104
+ // See: https://github.com/libp2p/rust-libp2p/pull/2652
105
+ // I believe we do not need to do anything here because we are not using the transport to listen.
106
+ // But we need to verify this before merging.
107
+
108
+ return std:: task:: Poll :: Pending ;
109
+ }
87
110
}
88
111
89
112
/// Represents an address that is _compatible_ with Tor, i.e. can be resolved by
0 commit comments