platform: modularize api/gui, add docs-tests-web foundation, and refresh root config
This commit is contained in:
49
selective-vpn-api/app/transport_backends_runtime_modes.go
Normal file
49
selective-vpn-api/app/transport_backends_runtime_modes.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package app
|
||||
|
||||
import "strings"
|
||||
|
||||
type transportUnsupportedRuntimeBackend struct {
|
||||
mode string
|
||||
}
|
||||
|
||||
func (b transportUnsupportedRuntimeBackend) ID() string {
|
||||
return "unsupported"
|
||||
}
|
||||
|
||||
type transportMockBackend struct{}
|
||||
|
||||
func (transportMockBackend) ID() string { return "mock" }
|
||||
|
||||
func (transportMockBackend) Action(_ TransportClient, action string) transportBackendActionResult {
|
||||
action = strings.ToLower(strings.TrimSpace(action))
|
||||
return transportBackendActionResult{
|
||||
OK: true,
|
||||
ExitCode: 0,
|
||||
Message: "mock backend " + action + " done",
|
||||
}
|
||||
}
|
||||
|
||||
func (transportMockBackend) Health(client TransportClient) transportBackendHealthResult {
|
||||
status := normalizeTransportStatus(client.Status)
|
||||
return transportBackendHealthResult{
|
||||
OK: true,
|
||||
Status: status,
|
||||
LatencyMS: client.Health.LatencyMS,
|
||||
}
|
||||
}
|
||||
|
||||
func (transportMockBackend) Provision(client TransportClient) transportBackendActionResult {
|
||||
return transportBackendActionResult{
|
||||
OK: true,
|
||||
ExitCode: 0,
|
||||
Message: "mock backend provision skipped for " + client.ID,
|
||||
}
|
||||
}
|
||||
|
||||
func (transportMockBackend) Cleanup(client TransportClient) transportBackendActionResult {
|
||||
return transportBackendActionResult{
|
||||
OK: true,
|
||||
ExitCode: 0,
|
||||
Message: "no cleanup required for backend mock (" + client.ID + ")",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user