Documentation
¶
Index ¶
Constants ¶
View Source
const ( ServerMode = 1 // OpenVPN running in server mode ClientMode = 2 // OpenVPN running in client mode )
Variables ¶
View Source
var (
ClientListReg, _ = regexp.Compile("(?ms)OpenVPN CLIENT LIST\n" +
"Updated,([^\n]*)\n" +
"(.*)\n" +
"ROUTING TABLE\n" +
"(.*)\n" +
"GLOBAL STATS\n" +
"(.*)" +
"\nEND\n")
ClientEnv, _ = regexp.Compile("([^=\r\n]+)=([^\r\n]*)")
)
Functions ¶
This section is empty.
Types ¶
type CommandParser ¶
type CommandParser struct { ClientListReg *regexp.Regexp // contains filtered or unexported fields }
func NewCommandParser ¶
func NewCommandParser() CommandParser
func (CommandParser) Join ¶
func (cp CommandParser) Join(evt []string, start int, sep string) string
func (*CommandParser) ParseClient ¶
func (cp *CommandParser) ParseClient(data *EventData) error
func (*CommandParser) ParseEvent ¶
func (cp *CommandParser) ParseEvent(evt string) *EventData
func (*CommandParser) ParseStatus ¶
func (cp *CommandParser) ParseStatus(out string) ([]utils.Client, error)
type EventData ¶
type OpenVpnConnector ¶
type OpenVpnConnector interface { Connect() error SendCommand(string) (string, error) Listen(events chan string) Close() error }
func NewSocketConnector ¶
func NewSocketConnector(socket string, password string, mode int) OpenVpnConnector
func NewTcpConnector ¶
func NewTcpConnector(ipAddress string, port int, password string, mode int) OpenVpnConnector
type SocketConnector ¶
type SocketConnector struct {
// contains filtered or unexported fields
}
func (*SocketConnector) Close ¶
func (s *SocketConnector) Close() error
func (*SocketConnector) Connect ¶
func (s *SocketConnector) Connect() error
func (*SocketConnector) Listen ¶
func (s *SocketConnector) Listen(events chan string)
func (*SocketConnector) SendCommand ¶
func (s *SocketConnector) SendCommand(command string) (string, error)
type TcpConnector ¶
type TcpConnector struct {
// contains filtered or unexported fields
}
func (TcpConnector) Close ¶
func (s TcpConnector) Close() error
func (*TcpConnector) Connect ¶
func (s *TcpConnector) Connect() error
func (TcpConnector) GetManagementAddress ¶
func (s TcpConnector) GetManagementAddress() string
func (*TcpConnector) Listen ¶
func (s *TcpConnector) Listen(events chan string)
func (*TcpConnector) SendCommand ¶
func (s *TcpConnector) SendCommand(command string) (string, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.