@@ -19,7 +19,7 @@ use crate::services::{
1919 dump_peer_store:: DumpPeerStoreService , outbound_peer:: OutboundPeerService ,
2020 protocol_type_checker:: ProtocolTypeCheckerService ,
2121} ;
22- use crate :: { Behaviour , CKBProtocol , Peer , PeerIndex , ProtocolId , ServiceControl } ;
22+ use crate :: { proxy , Behaviour , CKBProtocol , Peer , PeerIndex , ProtocolId , ServiceControl } ;
2323use ckb_app_config:: { default_support_all_protocols, NetworkConfig , SupportProtocol } ;
2424use ckb_logger:: { debug, error, info, trace, warn} ;
2525use ckb_spawn:: Spawn ;
@@ -122,6 +122,12 @@ impl NetworkState {
122122 let peer_store = Mutex :: new ( PeerStore :: load_from_dir_or_default (
123123 config. peer_store_path ( ) ,
124124 ) ) ;
125+ info ! ( "Loaded the peer store." ) ;
126+ if config. proxy_config . enable {
127+ proxy:: check_proxy_url ( & config. proxy_config . proxy_url )
128+ . map_err ( |reason| Error :: Config ( reason) ) ?;
129+ }
130+
125131 let bootnodes = config. bootnodes ( ) ;
126132
127133 let peer_registry = PeerRegistry :: new (
@@ -1018,11 +1024,11 @@ impl NetworkService {
10181024 service_builder = service_builder. tcp_config ( bind_fn) ;
10191025
10201026 if config. proxy_config . enable {
1021- let proxy_config = Some ( ProxyConfig {
1027+ let proxy_config = ProxyConfig {
10221028 proxy_url : config. proxy_config . proxy_url . clone ( ) ,
1023- } ) ;
1029+ } ;
10241030 service_builder =
1025- service_builder. tcp_proxy_config ( proxy_config) ;
1031+ service_builder. tcp_proxy_config ( Some ( proxy_config) ) ;
10261032 }
10271033 }
10281034 }
0 commit comments