Maintenance: refactor servers updater code
- Require at least 80% of number of servers now to pass - Each provider is in its own package with a common structure - Unzip package with unzipper interface - Openvpn package with extraction and download functions
This commit is contained in:
22
internal/updater/unzip/unzip.go
Normal file
22
internal/updater/unzip/unzip.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Package unzip defines the Unzipper which fetches and extract a zip file
|
||||
// containing multiple files.
|
||||
package unzip
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Unzipper interface {
|
||||
FetchAndExtract(ctx context.Context, url string) (contents map[string][]byte, err error)
|
||||
}
|
||||
|
||||
type unzipper struct {
|
||||
client *http.Client
|
||||
}
|
||||
|
||||
func New(client *http.Client) Unzipper {
|
||||
return &unzipper{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user