Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Scan files when a single server is online #42

Merged
merged 6 commits into from
Aug 18, 2023
Merged

Commits on Aug 2, 2023

  1. FIX: Scan files when a single server is online

    This commits makes sure that even when a single server is online,
    the plugin is available. This commit also makes sure that a random
    and online server is chosen when using with_session without any
    specified socket. It used to use the first one.
    nbianca committed Aug 2, 2023
    Configuration menu
    Copy the full SHA
    d1b2050 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    df594da View commit details
    Browse the repository at this point in the history
  3. FIX: Add a 3 second timeout

    nbianca committed Aug 2, 2023
    Configuration menu
    Copy the full SHA
    e7cf158 View commit details
    Browse the repository at this point in the history
  4. Fix lint

    nbianca committed Aug 2, 2023
    Configuration menu
    Copy the full SHA
    ccf90bc View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2023

  1. Refactor ClamAV service pool

    nbianca committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    aabb12a View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2023

  1. Redistribute responsibilities.

    This change builds upon Bianca's idea of create the `ClamAVService` class and reorganized the code based on the following rationale:
    
    `ClamAV` is what glues everything together. It knows how to talk to the S3 store, the plugin store and the `ClamAVService` to display the version, check availability, and scan files. It gets the raw response from ClamAV and translates to a different format which the rest of the plugin relies on.
    `ClamAVService` defines an interface of which operations are possible (`online?`, `scan_file`, `version`) and takes care of the socket and session managemente, as well as writting/reading from the socket.
    `ClamAVServicePool` resolves the SRV record and instantiates existing services. It tells them how to open a connection.
    
    While working on this, I tried to remove the latter and do everything using only the first two, but I decided to keep it in the end because this design is handy for testing. We rely on the `FakeTCPSocket` for spying on the communication and returning specific responses, and this design let us use without relying on a mocking framework, just dependency injection.
    romanrizzi committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    dd145fd View commit details
    Browse the repository at this point in the history