@@ -67,10 +67,18 @@ public IPFS(MultiAddress addr) {
67
67
}
68
68
69
69
public IPFS (String host , int port , String version , boolean ssl ) {
70
- this (host , port , version , DEFAULT_CONNECT_TIMEOUT_MILLIS , DEFAULT_READ_TIMEOUT_MILLIS , ssl );
70
+ this (host , port , version , true , DEFAULT_CONNECT_TIMEOUT_MILLIS , DEFAULT_READ_TIMEOUT_MILLIS , ssl );
71
+ }
72
+
73
+ public IPFS (String host , int port , String version , boolean enforceMinVersion , boolean ssl ) {
74
+ this (host , port , version , enforceMinVersion , DEFAULT_CONNECT_TIMEOUT_MILLIS , DEFAULT_READ_TIMEOUT_MILLIS , ssl );
71
75
}
72
76
73
77
public IPFS (String host , int port , String version , int connectTimeoutMillis , int readTimeoutMillis , boolean ssl ) {
78
+ this (host , port , version , true , connectTimeoutMillis , readTimeoutMillis , ssl );
79
+ }
80
+
81
+ public IPFS (String host , int port , String version , boolean enforceMinVersion , int connectTimeoutMillis , int readTimeoutMillis , boolean ssl ) {
74
82
if (connectTimeoutMillis < 0 ) throw new IllegalArgumentException ("connect timeout must be zero or positive" );
75
83
if (readTimeoutMillis < 0 ) throw new IllegalArgumentException ("read timeout must be zero or positive" );
76
84
this .host = host ;
@@ -86,12 +94,14 @@ public IPFS(String host, int port, String version, int connectTimeoutMillis, int
86
94
87
95
this .apiVersion = version ;
88
96
// Check IPFS is sufficiently recent
89
- try {
90
- Version detected = Version .parse (version ());
91
- if (detected .isBefore (MIN_VERSION ))
92
- throw new IllegalStateException ("You need to use a more recent version of IPFS! >= " + MIN_VERSION );
93
- } catch (IOException e ) {
94
- throw new RuntimeException (e );
97
+ if (enforceMinVersion ) {
98
+ try {
99
+ Version detected = Version .parse (version ());
100
+ if (detected .isBefore (MIN_VERSION ))
101
+ throw new IllegalStateException ("You need to use a more recent version of IPFS! >= " + MIN_VERSION );
102
+ } catch (IOException e ) {
103
+ throw new RuntimeException (e );
104
+ }
95
105
}
96
106
}
97
107
0 commit comments