You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 4. Always close the client to release resources
72
+
client.close();
69
73
}
70
74
} catch (AMaasException err) {
71
75
info("Exception {0}", err.getMessage());
@@ -218,6 +222,26 @@ Scan a file for malware, add a list of tags to the scan result and retrieves res
218
222
**_Return_**
219
223
String the scanned result in JSON format.
220
224
225
+
#### ```public String scanRun(final AMaasReader reader, final String[] tagList, final boolean pml, final boolean feedback, final boolean verbose, final boolean digest) throws AMaasException```
226
+
227
+
Scan an AMaasReader for malware and retrieves response data from the API. This is the core scanning method that provides the most flexibility by accepting an AMaasReader interface, allowing for different types of data sources.
| reader |`AMaasReader` to be scanned. This can be an `AMaasFileReader` or any custom implementation you develop to support your specific data sources. |
234
+
| tagList | A list of strings to be used to tag the scan result. At most 8 tags with the maximum length of 63 characters. |
235
+
| pml | A flag to indicate whether to use predictive machine learning detection. |
236
+
| feedback | A flag to indicate whether to use Trend Micro Smart Protection Network's Smart Feedback. |
237
+
| verbose | A flag to enable log verbose mode. |
238
+
| digest | A flag to enable calculation of digests for cache search and result lookup. |
239
+
240
+
**_Return_**
241
+
String the scanned result in JSON format.
242
+
243
+
**_Note_**: For an example of implementing a custom AMaasReader, please refer to the `examples/s3stream/S3Stream.java` code which demonstrates a streaming implementation of the AMaasReader interface.
Scan a buffer for malware and retrieves response data from the API.
@@ -360,3 +384,72 @@ The File Security SDK consistently adopts TLS as the default communication chann
360
384
For customers who need to enable TLS channel encryption without verifying the provided CA certificate, the `TM_AM_DISABLE_CERT_VERIFY` environment variable can be set. However, this option is only recommended for use in testing environments.
361
385
362
386
When `TM_AM_DISABLE_CERT_VERIFY` is set to `1`, certificate verification is disabled. By default, the certificate will be verified.
387
+
388
+
## Proxy Configuration
389
+
390
+
The File Security Java SDK supports HTTP and SOCKS5 proxy configurations through environment variables. This allows the SDK to work in enterprise environments that require proxy servers for internet access.
|`HTTPS_PROXY`| Optional | Proxy URL for HTTPS connections (e.g., `https://proxy.example.com:8443` or `socks5://socks.example.com:1080`) |
398
+
|`NO_PROXY`| Optional | Comma-separated list of host names to bypass proxy (e.g., `localhost,127.0.0.1,*.local`). Use `*` to bypass proxy for all hosts |
399
+
|`PROXY_USER`| Optional | Username for proxy authentication (used with `Proxy-Authorization` header) |
400
+
|`PROXY_PASS`| Optional | Password for proxy authentication (used only when `PROXY_USER` is configured) |
**Important:** When using SOCKS5 proxy, ensure you call `client.close()` to properly release network resources. The SDK creates background threads for SOCKS5 connections that must be explicitly closed.
- The SDK automatically detects and uses proxy settings from environment variables
450
+
- For HTTPS connections, `HTTPS_PROXY` takes precedence over `HTTP_PROXY`
451
+
- SOCKS5 proxies are supported by specifying `socks5://` in the proxy URL
452
+
- Proxy authentication requires both `PROXY_USER` and `PROXY_PASS` to be set
453
+
- The `NO_PROXY` variable supports wildcards (e.g., `*.local`) and exact matches
454
+
- No code changes are required - simply set the appropriate environment variables before running your application
455
+
-**Resource Management:** Always call `client.close()` when finished, especially when using SOCKS5 proxies, to ensure proper cleanup of network resources and prevent applications from hanging
Copy file name to clipboardExpand all lines: examples/README.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,23 @@ There are 4 examples under the following sub-folders:
34
34
35
35
3. After a build, the targeted jar(s) will be created under a newly created `target` folder under the respective example folder. For instance, `examples/filescan/target`.
36
36
37
+
## Important: Resource Management
38
+
39
+
All examples have been updated to properly manage AMaasClient resources. When using the SDK in your own applications, especially with SOCKS5 proxies, always ensure you call `client.close()` to release network resources:
**Note:** Failure to properly close the client, particularly when using SOCKS5 proxies, may cause your application to hang as background network threads remain active.
53
+
37
54
### Use CLI examples
38
55
39
56
-`filescan`: This example is to scan a file or a folder sequentially. It takes 4 input options:
0 commit comments