@@ -2,8 +2,8 @@ import { CodeError, ERR_INVALID_MESSAGE, ERR_INVALID_PARAMETERS, ERR_TIMEOUT, se
22import  {  pbStream  }  from  'it-protobuf-stream' 
33import  {  fromString  as  uint8arrayFromString  }  from  'uint8arrays/from-string' 
44import  {  toString  as  uint8arrayToString  }  from  'uint8arrays/to-string' 
5- import  {  object ,  number  }  from  'yup' 
6- import  {  MAX_INBOUND_STREAMS ,  MAX_OUTBOUND_STREAMS ,  PROTOCOL_NAME ,  PROTOCOL_VERSION ,  TIMEOUT  }  from  './constants.js' 
5+ import  {  object ,  number ,   string  }  from  'yup' 
6+ import  {  MAX_INBOUND_STREAMS ,  MAX_OUTBOUND_STREAMS ,  PROTOCOL_NAME ,  PROTOCOL_PREFIX ,   PROTOCOL_VERSION ,  TIMEOUT  }  from  './constants.js' 
77import  {  FetchRequest ,  FetchResponse  }  from  './pb/proto.js' 
88import  type  {  Fetch  as  FetchInterface ,  FetchComponents ,  FetchInit ,  LookupFunction  }  from  './index.js' 
99import  type  {  AbortOptions ,  Logger ,  Stream ,  PeerId ,  Startable  }  from  '@libp2p/interface' 
@@ -19,8 +19,10 @@ import type { IncomingStreamData } from '@libp2p/interface-internal'
1919const  configValidator  =  object ( { 
2020  timeout : number ( ) . integer ( ) . default ( TIMEOUT ) , 
2121  maxInboundStreams : number ( ) . integer ( ) . min ( 0 ) . default ( MAX_INBOUND_STREAMS ) , 
22-   maxOutboundStreams : number ( ) . integer ( ) . min ( 0 ) . default ( MAX_OUTBOUND_STREAMS ) 
22+   maxOutboundStreams : number ( ) . integer ( ) . min ( 0 ) . default ( MAX_OUTBOUND_STREAMS ) , 
23+   protocolPrefix : string ( ) . default ( PROTOCOL_PREFIX ) 
2324} ) 
25+ 
2426export  class  Fetch  implements  Startable ,  FetchInterface  { 
2527  public  readonly  protocol : string 
2628  private  readonly  components : FetchComponents 
@@ -40,7 +42,7 @@ export class Fetch implements Startable, FetchInterface {
4042
4143    const  config  =  configValidator . validateSync ( init ) 
4244
43-     this . protocol  =  `/${ init . protocolPrefix   ??   'libp2p' } ${ PROTOCOL_NAME } ${ PROTOCOL_VERSION }  
45+     this . protocol  =  `/${ config . protocolPrefix } ${ PROTOCOL_NAME } ${ PROTOCOL_VERSION }  
4446    this . timeout  =  config . timeout 
4547    this . maxInboundStreams  =  config . maxInboundStreams 
4648    this . maxOutboundStreams  =  config . maxOutboundStreams 
0 commit comments