platform: modularize api/gui, add docs-tests-web foundation, and refresh root config
This commit is contained in:
77
selective-vpn-api/app/transport_backends_adapter_systemd.go
Normal file
77
selective-vpn-api/app/transport_backends_adapter_systemd.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package app
|
||||
|
||||
import transportcfg "selective-vpn-api/app/transportcfg"
|
||||
|
||||
type transportSystemdBackend struct{}
|
||||
|
||||
type transportSystemdServiceTuning = transportcfg.SystemdServiceTuning
|
||||
|
||||
type transportSystemdHardening = transportcfg.SystemdHardening
|
||||
|
||||
func validSystemdUnitName(unit string) bool {
|
||||
return transportcfg.ValidSystemdUnitName(unit)
|
||||
}
|
||||
|
||||
func transportSystemdUnitPath(unit string) string {
|
||||
return transportcfg.SystemdUnitPath(transportSystemdUnitsDir, unit)
|
||||
}
|
||||
|
||||
func transportSystemdUnitOwnedByClient(path, clientID string) (bool, error) {
|
||||
return transportcfg.SystemdUnitOwnedByClient(path, clientID)
|
||||
}
|
||||
|
||||
func writeTransportSystemdUnitFile(unit string, content string) error {
|
||||
return transportcfg.WriteSystemdUnitFile(transportSystemdUnitsDir, unit, content)
|
||||
}
|
||||
|
||||
func renderTransportSystemdUnit(
|
||||
client TransportClient,
|
||||
unit string,
|
||||
execStart string,
|
||||
requiresSSH bool,
|
||||
sshUnit string,
|
||||
tuning transportSystemdServiceTuning,
|
||||
hardening transportSystemdHardening,
|
||||
) string {
|
||||
return transportcfg.RenderSystemdUnit(
|
||||
transportCfgClient(client),
|
||||
stateDir,
|
||||
unit,
|
||||
execStart,
|
||||
requiresSSH,
|
||||
sshUnit,
|
||||
transportcfg.SystemdServiceTuning(tuning),
|
||||
transportcfg.SystemdHardening(hardening),
|
||||
shellQuoteArg,
|
||||
)
|
||||
}
|
||||
|
||||
func renderTransportSSHOverlayUnit(
|
||||
client TransportClient,
|
||||
unit string,
|
||||
execStart string,
|
||||
tuning transportSystemdServiceTuning,
|
||||
hardening transportSystemdHardening,
|
||||
) string {
|
||||
return transportcfg.RenderSSHOverlayUnit(
|
||||
transportCfgClient(client),
|
||||
stateDir,
|
||||
unit,
|
||||
execStart,
|
||||
transportcfg.SystemdServiceTuning(tuning),
|
||||
transportcfg.SystemdHardening(hardening),
|
||||
shellQuoteArg,
|
||||
)
|
||||
}
|
||||
|
||||
func transportSystemdServiceTuningFromConfig(cfg map[string]any, prefix string) transportSystemdServiceTuning {
|
||||
return transportcfg.SystemdServiceTuningFromConfig(cfg, prefix, transportConfigInt)
|
||||
}
|
||||
|
||||
func transportSystemdHardeningFromConfig(cfg map[string]any, prefix string) transportSystemdHardening {
|
||||
return transportcfg.SystemdHardeningFromConfig(cfg, prefix)
|
||||
}
|
||||
|
||||
func transportConfigHasKey(cfg map[string]any, key string) bool {
|
||||
return transportcfg.ConfigHasKey(cfg, key)
|
||||
}
|
||||
Reference in New Issue
Block a user