Versions in this module Expand all Collapse all v0 v0.0.10 Sep 5, 2023 Changes in this version + const ChangedActionCreated + const ChangedActionDeleted + const ChangedActionInterfaceStatsUpdated + const ChangedActionStarted + const ChangedActionStopped + const ChangedActionUpdated + type ChangedEvent struct + Action string + Server *Server type CreateOptions + Running bool + Stats Stats type Server + Stats Stats type Service + HasSubscribers func() bool + Subscribe func(ctx context.Context) (<-chan *ChangedEvent, error) + type Stats struct + Collisions uint64 + Multicast uint64 + RxBytes uint64 + RxCompressed uint64 + RxCrcErrors uint64 + RxDropped uint64 + RxErrors uint64 + RxFifoErrors uint64 + RxFrameErrors uint64 + RxLengthErrors uint64 + RxMissedErrors uint64 + RxOverErrors uint64 + RxPackets uint64 + TxAbortedErrors uint64 + TxBytes uint64 + TxCarrierErrors uint64 + TxCompressed uint64 + TxDropped uint64 + TxErrors uint64 + TxFifoErrors uint64 + TxHeartbeatErrors uint64 + TxPackets uint64 + TxWindowErrors uint64 type UpdateFieldMask + CreateUserId bool + Stats bool type UpdateOptions + CreateUserId string + Stats Stats + UpdateUserId string v0.0.9 Aug 27, 2023 v0.0.8 Jul 7, 2023 v0.0.7 Jul 7, 2023 v0.0.6 Jun 21, 2023 v0.0.5 Jun 13, 2023 v0.0.4 May 5, 2023 v0.0.3 May 2, 2023 v0.0.2 May 2, 2023 Changes in this version + var ErrCreateServerOptionsRequired = errors.New("create server options are required") + var ErrIdRequired = errors.New("id is required") + var ErrInvalidMtu = errors.New("invalid MTU must be between 1280 and 1500") + var ErrInvalidName = errors.New("name is invalid") + var ErrNameRequired = errors.New("name is required") + var ErrOneOptionRequired = errors.New("one option is required") + var ErrOnlyOneOptionAllowed = errors.New("only one option is allowed") + var ErrServerIdAlreadyExists = errors.New("server id already exists") + var ErrServerNameAlreadyInUse = errors.New("name is already in use") + var ErrServerNotFound = errors.New("server not found") + var ErrUpdateServerFieldMaskRequired = errors.New("update server field mask are required") + var ErrUpdateServerOptionsRequired = errors.New("update server options are required") + type CreateOptions struct + Address string + DNS []string + Description string + Enabled bool + FirewallMark *int + Hooks []*Hook + ListenPort *int + MTU int + Name string + PrivateKey string + PublicKey string + type FindOneOptions struct + IdOption *IdOption + NameOption *NameOption + func (options *FindOneOptions) Validate() error + type FindOptions struct + CreateUserId *string + Enabled *bool + Ids []string + Query string + UpdateUserId *string + type Hook struct + Command string + RunOnCreate bool + RunOnDelete bool + RunOnStart bool + RunOnStop bool + RunOnUpdate bool + func (h *Hook) ShouldExecute(action HookAction) bool + type HookAction string + var HookActionCreate HookAction = "CREATE" + var HookActionDelete HookAction = "DELETE" + var HookActionStart HookAction = "START" + var HookActionStop HookAction = "STOP" + var HookActionUpdate HookAction = "UPDATE" + type IdOption struct + Id string + func (option *IdOption) Validate() error + type NameOption struct + Name string + func (option *NameOption) Validate() error + type Repository interface + Create func(ctx context.Context, server *Server) (*Server, error) + Delete func(ctx context.Context, serverId string, deleteUserId string) (*Server, error) + FindAll func(ctx context.Context, options *FindOptions) ([]*Server, error) + FindOne func(ctx context.Context, options *FindOneOptions) (*Server, error) + Update func(ctx context.Context, server *Server, fieldMask *UpdateFieldMask) (*Server, error) + type Server struct + Address string + CreateUserId string + CreatedAt time.Time + DNS []string + DeleteUserId string + DeletedAt *time.Time + Description string + Enabled bool + FirewallMark *int + Hooks []*Hook + Id string + ListenPort *int + MTU int + Name string + PrivateKey string + PublicKey string + Running bool + UpdateUserId string + UpdatedAt time.Time + func (s *Server) RunHooks(action HookAction) error + type Service interface + CreateServer func(ctx context.Context, options *CreateOptions, userId string) (*Server, error) + DeleteServer func(ctx context.Context, serverId string, userId string) (*Server, error) + FindServer func(ctx context.Context, options *FindOneOptions) (*Server, error) + FindServers func(ctx context.Context, options *FindOptions) ([]*Server, error) + UpdateServer func(ctx context.Context, serverId string, options *UpdateOptions, ...) (*Server, error) + func NewService(serverRepository Repository) Service + type UpdateFieldMask struct + Address bool + DNS bool + Description bool + Enabled bool + FirewallMark bool + Hooks bool + ListenPort bool + MTU bool + PrivateKey bool + PublicKey bool + Running bool + UpdateUserId bool + type UpdateOptions struct + Address string + DNS []string + Description string + Enabled bool + FirewallMark *int + Hooks []*Hook + ListenPort *int + MTU int + PrivateKey string + PublicKey string + Running bool v0.0.1 Apr 17, 2023