kylefarris / clamscan

A robust ClamAV virus scanning library supporting scanning files, directories, and streams with local sockets, local/remote TCP, and local clamscan/clamdscan binaries (with failover).
MIT License
230 stars 68 forks source link

Support `port` only connection #123

Closed tamil-rss closed 2 months ago

tamil-rss commented 3 months ago

Current version doesn't support port only connection (expecting host option) by default.

The _initSocket method has the option to connect using port alone,

client = net.createConnection({ port: this.settings.clamdscan.port, timeout });

But, init method has a validation that restricts to use port-only connection,

 if ( !this.settings.clamdscan.socket && !this.settings.clamdscan.host) {
      const err = new NodeClamError('No valid & active virus scanning binaries are active and available and no socket/port/host option provided!');
      return hasCb ? cb(err, null) : reject(err);
}