78 lines
2.1 KiB
Go
78 lines
2.1 KiB
Go
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)
|
|
}
|