mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
chore: use interfaces for all other services
This commit is contained in:
@@ -13,6 +13,8 @@ import (
|
||||
//go:embed tpl_files/*
|
||||
var TemplateFiles embed.FS
|
||||
|
||||
// TemplateHandler is responsible for rendering the WireGuard configuration files
|
||||
// based on the provided templates.
|
||||
type TemplateHandler struct {
|
||||
templates *template.Template
|
||||
}
|
||||
@@ -34,6 +36,7 @@ func newTemplateHandler() (*TemplateHandler, error) {
|
||||
return handler, nil
|
||||
}
|
||||
|
||||
// GetInterfaceConfig returns the rendered configuration file for a WireGuard interface.
|
||||
func (c TemplateHandler) GetInterfaceConfig(cfg *domain.Interface, peers []domain.Peer) (io.Reader, error) {
|
||||
var tplBuff bytes.Buffer
|
||||
|
||||
@@ -51,6 +54,7 @@ func (c TemplateHandler) GetInterfaceConfig(cfg *domain.Interface, peers []domai
|
||||
return &tplBuff, nil
|
||||
}
|
||||
|
||||
// GetPeerConfig returns the rendered configuration file for a WireGuard peer.
|
||||
func (c TemplateHandler) GetPeerConfig(peer *domain.Peer) (io.Reader, error) {
|
||||
var tplBuff bytes.Buffer
|
||||
|
||||
|
Reference in New Issue
Block a user