fix(custom-openvpn): remove comments before parsing file

This commit is contained in:
Quentin McGaw
2024-08-03 13:37:57 +00:00
parent 2e63dba817
commit dea4080a7b

View File

@@ -18,6 +18,11 @@ var (
func extractDataFromLines(lines []string) ( func extractDataFromLines(lines []string) (
connection models.Connection, err error) { connection models.Connection, err error) {
for i, line := range lines { for i, line := range lines {
hashSymbolIndex := strings.Index(line, "#")
if hashSymbolIndex >= 0 {
line = line[:hashSymbolIndex]
}
ip, port, protocol, err := extractDataFromLine(line) ip, port, protocol, err := extractDataFromLine(line)
if err != nil { if err != nil {
return connection, fmt.Errorf("on line %d: %w", i+1, err) return connection, fmt.Errorf("on line %d: %w", i+1, err)