Versions in this module Expand all Collapse all v0 v0.0.26 Feb 13, 2025 v0.0.25 Jan 22, 2025 v0.0.24 Nov 21, 2024 v0.0.23 Aug 15, 2024 v0.0.22 Jun 16, 2024 v0.0.21 May 23, 2024 v0.0.20 Mar 18, 2024 v0.0.19 Feb 12, 2024 v0.0.18 Dec 19, 2023 v0.0.17 Oct 22, 2023 v0.0.16 Oct 11, 2023 v0.0.15 Sep 15, 2023 v0.0.14 Sep 15, 2023 v0.0.13 Sep 8, 2023 v0.0.12 Sep 7, 2023 v0.0.11 Sep 6, 2023 Changes in this version + const ChangedActionCreated + const ChangedActionDeleted + const ChangedActionInterfaceStatsUpdated + const ChangedActionStarted + const ChangedActionStopped + const ChangedActionUpdated + 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 ChangedEvent struct + Action string + Server *Server + 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 + Running bool + Stats Stats + 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 + 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 + Stats Stats + UpdateUserId string + UpdatedAt time.Time + 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) + HasSubscribers func() bool + Subscribe func(ctx context.Context) (<-chan *ChangedEvent, error) + UpdateServer func(ctx context.Context, serverId string, options *UpdateOptions, ...) (*Server, error) + func NewService(serverRepository Repository, subscription subscription.Subscription) Service + 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 struct + Address bool + CreateUserId bool + DNS bool + Description bool + Enabled bool + FirewallMark bool + Hooks bool + ListenPort bool + MTU bool + PrivateKey bool + PublicKey bool + Running bool + Stats bool + UpdateUserId bool + type UpdateOptions struct + Address string + CreateUserId string + DNS []string + Description string + Enabled bool + FirewallMark *int + Hooks []*Hook + ListenPort *int + MTU int + PrivateKey string + PublicKey string + Running bool + Stats Stats + UpdateUserId string