summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/openvpn/init.go
blob: cba0c86e29623717489af2941ca0ffe2f3afc35d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// SPDX-License-Identifier: GPL-3.0-or-later

package openvpn

import (
	"github.com/netdata/netdata/go/go.d.plugin/modules/openvpn/client"
	"github.com/netdata/netdata/go/go.d.plugin/pkg/matcher"
	"github.com/netdata/netdata/go/go.d.plugin/pkg/socket"
)

func (o *OpenVPN) validateConfig() error {
	return nil
}

func (o *OpenVPN) initPerUserMatcher() (matcher.Matcher, error) {
	if o.PerUserStats.Empty() {
		return nil, nil
	}
	return o.PerUserStats.Parse()
}

func (o *OpenVPN) initClient() *client.Client {
	config := socket.Config{
		Address:        o.Address,
		ConnectTimeout: o.Timeout.Duration(),
		ReadTimeout:    o.Timeout.Duration(),
		WriteTimeout:   o.Timeout.Duration(),
	}
	return &client.Client{Client: socket.New(config)}
}