@@ -444,8 +444,6 @@ where S::Artifact: IntoInit<M::Init>
444
444
type Connection = S :: Connection ;
445
445
type Artifact = ProtocolArtifact < M , S > ;
446
446
447
- fn is_established ( & self ) -> bool { self . state . is_complete ( ) && self . artifact ( ) . is_some ( ) }
448
-
449
447
fn run_handshake ( & mut self ) -> io:: Result < ( ) > {
450
448
#[ cfg( feature = "log" ) ]
451
449
log:: debug!( target: M :: NAME , "Starting handshake protocol {}" , M :: NAME ) ;
@@ -641,6 +639,9 @@ mod impl_noise {
641
639
}
642
640
643
641
mod impl_socks5 {
642
+ use cyphernet:: addr:: Host ;
643
+ #[ cfg( not( feature = "eidolon" ) ) ]
644
+ use cyphernet:: addr:: { HostName , NetAddr } ;
644
645
use cyphernet:: proxy:: socks5;
645
646
use cyphernet:: proxy:: socks5:: Socks5 ;
646
647
@@ -649,7 +650,7 @@ mod impl_socks5 {
649
650
impl NetStateMachine for Socks5 {
650
651
const NAME : & ' static str = "socks5" ;
651
652
type Init = ZeroInit ;
652
- type Artifact = ( ) ;
653
+ type Artifact = NetAddr < HostName > ;
653
654
type Error = socks5:: Error ;
654
655
655
656
fn init ( & mut self , _: Self :: Init ) { }
@@ -658,10 +659,14 @@ mod impl_socks5 {
658
659
659
660
fn advance ( & mut self , input : & [ u8 ] ) -> Result < Vec < u8 > , Self :: Error > { self . advance ( input) }
660
661
661
- fn artifact ( & self ) -> Option < Self :: Artifact > { Some ( ( ) ) }
662
+ fn artifact ( & self ) -> Option < Self :: Artifact > {
663
+ match self {
664
+ Socks5 :: Initial ( addr, false ) if !addr. requires_proxy ( ) => Some ( addr. clone ( ) ) ,
665
+ Socks5 :: Active ( addr) => Some ( addr. clone ( ) ) ,
666
+ _ => None ,
667
+ }
668
+ }
662
669
663
670
fn is_init ( & self ) -> bool { true }
664
-
665
- fn is_complete ( & self ) -> bool { matches ! ( self , Socks5 :: Active ( _) ) && self . artifact ( ) . is_some ( ) }
666
671
}
667
672
}
0 commit comments