2018-02-01 03:30:00 +01:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
// ErrNotImplemented gets thrown if some action was not attempted,
|
|
|
|
// because it is not implemented in the code yet.
|
|
|
|
ErrNotImplemented = errors.New("Not implemented")
|
|
|
|
)
|
|
|
|
|
|
|
|
// Client represent the OpenVPN client configuration
|
|
|
|
type Client struct {
|
2018-02-03 18:14:47 +01:00
|
|
|
ID uint
|
|
|
|
CreatedAt time.Time
|
|
|
|
Name string
|
|
|
|
User string
|
2018-02-01 03:30:00 +01:00
|
|
|
Cert []byte
|
|
|
|
PrivateKey []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type ClientProvider interface {
|
|
|
|
CountClients() (uint, error)
|
2018-02-01 09:31:06 +01:00
|
|
|
CreateClient(*Client) (*Client, error)
|
|
|
|
ListClients(count, offset int) ([]*Client, error)
|
|
|
|
ListClientsForUser(user string, count, offset int) ([]*Client, error)
|
|
|
|
GetClientByID(id uint) (*Client, error)
|
2018-02-01 03:30:00 +01:00
|
|
|
DeleteClient(id uint) error
|
|
|
|
}
|