Documentation ¶
Index ¶
Constants ¶
View Source
const ( ChangedActionCreated = "CREATED" ChangedActionUpdated = "UPDATED" ChangedActionDeleted = "DELETED" ChangedActionInterfaceStatsUpdated = "INTERFACE_STATS_UPDATED" ChangedActionStarted = "STARTED" ChangedActionStopped = "STOPPED" )
Variables ¶
View Source
var ( ErrIdRequired = errors.New("id is required") ErrNameRequired = errors.New("name is required") ErrInvalidName = errors.New("name is invalid") ErrOneOptionRequired = errors.New("one option is required") ErrOnlyOneOptionAllowed = errors.New("only one option is allowed") ErrServerNotFound = errors.New("server not found") ErrServerIdAlreadyExists = errors.New("server id already exists") ErrServerNameAlreadyInUse = errors.New("name is already in use") ErrInvalidMtu = errors.New("invalid MTU must be between 1280 and 1500") ErrCreateServerOptionsRequired = errors.New("create server options are required") ErrUpdateServerOptionsRequired = errors.New("update server options are required") ErrUpdateServerFieldMaskRequired = errors.New("update server field mask are required") )
Functions ¶
This section is empty.
Types ¶
type ChangedEvent ¶
type CreateOptions ¶
type FindOneOptions ¶
type FindOneOptions struct { IdOption *IdOption NameOption *NameOption }
func (*FindOneOptions) Validate ¶
func (options *FindOneOptions) Validate() error
type FindOptions ¶
type HookAction ¶
type HookAction string
var ( HookActionCreate HookAction = "CREATE" HookActionUpdate HookAction = "UPDATE" HookActionDelete HookAction = "DELETE" HookActionStart HookAction = "START" HookActionStop HookAction = "STOP" )
type NameOption ¶
type NameOption struct {
Name string
}
func (*NameOption) Validate ¶
func (option *NameOption) Validate() error
type Repository ¶
type Repository interface { FindOne(ctx context.Context, options *FindOneOptions) (*Server, error) FindAll(ctx context.Context, options *FindOptions) ([]*Server, error) Create(ctx context.Context, server *Server) (*Server, error) Update(ctx context.Context, server *Server, fieldMask *UpdateFieldMask) (*Server, error) Delete(ctx context.Context, serverId string, deleteUserId string) (*Server, error) }
type Server ¶
type Server struct { Id string Name string Description string Enabled bool Running bool PublicKey string PrivateKey string ListenPort *int FirewallMark *int Address string DNS []string MTU int Stats Stats Hooks []*Hook CreateUserId string UpdateUserId string DeleteUserId string CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time }
type Service ¶
type Service interface { FindServer(ctx context.Context, options *FindOneOptions) (*Server, error) FindServers(ctx context.Context, options *FindOptions) ([]*Server, error) CreateServer(ctx context.Context, options *CreateOptions, userId string) (*Server, error) UpdateServer(ctx context.Context, serverId string, options *UpdateOptions, fieldMask *UpdateFieldMask, userId string) (*Server, error) DeleteServer(ctx context.Context, serverId string, userId string) (*Server, error) Subscribe(ctx context.Context) (<-chan *ChangedEvent, error) HasSubscribers() bool }
func NewService ¶
func NewService(serverRepository Repository, transactionScoper dbx.TransactionScoper, subscription subscription.Subscription) Service
type Stats ¶
type Stats struct { RxPackets uint64 TxPackets uint64 RxBytes uint64 TxBytes uint64 RxErrors uint64 TxErrors uint64 RxDropped uint64 TxDropped uint64 Multicast uint64 Collisions uint64 RxLengthErrors uint64 RxOverErrors uint64 RxCrcErrors uint64 RxFrameErrors uint64 RxFifoErrors uint64 RxMissedErrors uint64 TxAbortedErrors uint64 TxCarrierErrors uint64 TxFifoErrors uint64 TxHeartbeatErrors uint64 TxWindowErrors uint64 RxCompressed uint64 TxCompressed uint64 }
type UpdateFieldMask ¶
Click to show internal directories.
Click to hide internal directories.