stream

package
v0.9.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	EndpointID int `json:"endpointId" db:"endpoint_id"`
	// Application defines which RTMP application this is valid for
	Application string `json:"application"`
	// Name is the unique name given in an application
	Name string `json:"name"`
	// Pwd defines an extra layer of security for authentication
	Pwd *string `json:"pwd,omitempty"`
	// StartValid defines the optional start time that this endpoint becomes valid
	StartValid *time.Time `json:"startValid,omitempty"`
	// EndValid defines the optional end time that this endpoint stops being valid
	EndValid *time.Time `json:"endValid,omitempty"`
	// Notes is an optional internal note for the endpoint
	Notes *string `json:"notes,omitempty"`
	// Active indicates if this endpoint is currently being used
	Active bool `json:"active"`
	// Blocked prevents the endpoint from going live
	Blocked bool `json:"blocked"`
	// AutoRemove indicates that this endpoint can be automatically removed when the end valid time comes, optional
	AutoRemove bool `json:"autoRemove,omitempty"`
}

Endpoint returned endpoint value

type EndpointAddEditDTO added in v0.9.6

type EndpointAddEditDTO struct {
	// Application defines which RTMP application this is valid for
	Application string `json:"application"`
	// Name is the unique name given in an application
	Name string `json:"name"`
	// Pwd defines an extra layer of security for authentication
	Pwd *string `json:"pwd,omitempty"`
	// StartValid defines the optional start time that this endpoint becomes valid, RFC3339
	StartValid *time.Time `json:"startValid,omitempty"`
	// EndValid defines the optional end time that this endpoint stops being valid, RFC3339
	EndValid *time.Time `json:"endValid,omitempty"`
	// Notes is an optional internal note for the endpoint
	Notes *string `json:"notes,omitempty"`
	// Blocked prevents the endpoint from going live, optional defaults to false
	Blocked bool `json:"blocked,omitempty"`
	// AutoRemove indicates that this endpoint can be automatically removed when the end valid time comes, optional
	AutoRemove bool `json:"autoRemove,omitempty"`
}

EndpointAddEditDTO encapsulates the creation of a stream endpoint

type EndpointDB

type EndpointDB struct {
	EndpointID  int         `json:"endpointId" db:"endpoint_id"`
	Application string      `json:"application" db:"application"`
	Name        string      `json:"name" db:"name"`
	Pwd         null.String `json:"pwd" db:"pwd"`
	StartValid  null.Time   `json:"startValid" db:"start_valid"`
	EndValid    null.Time   `json:"endValid" db:"end_valid"`
	Notes       null.String `json:"notes" db:"notes"`
	Active      bool        `json:"active" db:"active"`
	Blocked     bool        `json:"blocked" db:"blocked"`
	AutoRemove  bool        `json:"autoRemove" db:"auto_remove"`
}

EndpointDB stores a stream endpoint value

type FindEndpoint

type FindEndpoint struct {
	// EndpointID is the unique database id of the stream
	EndpointID *int `json:"endpointId,omitempty"`
	// Application defines which RTMP application this is valid for
	Application *string `json:"application,omitempty"`
	// Name is the unique name given in an application
	Name *string `json:"name,omitempty"`
	// Pwd defines an extra layer of security for authentication
	Pwd *string `json:"pwd,omitempty"`
}

FindEndpoint used to find an endpoint

type Repo

type Repo interface {
	ListEndpoints(ctx context.Context) ([]EndpointDB, error)
	FindEndpoint(ctx context.Context, findEndpoint FindEndpoint) (EndpointDB, error)
	GetEndpointByID(ctx context.Context, endpointID int) (EndpointDB, error)
	GetEndpointByApplicationNamePwd(ctx context.Context, application, name, pwd string) (EndpointDB, error)

	SetEndpointActiveByID(ctx context.Context, endpointID int) error
	SetEndpointInactiveByApplicationNamePwd(ctx context.Context, application, name, pwd string) error

	AddEndpoint(ctx context.Context, endpointNew EndpointAddEditDTO) (EndpointDB, error)
	EditEndpoint(ctx context.Context, endpointID int, endpointEdit EndpointAddEditDTO) (EndpointDB, error)
	DeleteEndpoint(ctx context.Context, endpointID int) error
}

Repo represents all stream endpoint interactions

func NewStore

func NewStore(db *sqlx.DB) Repo

NewStore creates our data store

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store encapsulates our dependency

func (*Store) AddEndpoint added in v0.9.6

func (s *Store) AddEndpoint(ctx context.Context, endpointNew EndpointAddEditDTO) (EndpointDB, error)

func (*Store) DeleteEndpoint

func (s *Store) DeleteEndpoint(ctx context.Context, endpointID int) error

func (*Store) EditEndpoint

func (s *Store) EditEndpoint(ctx context.Context, endpointID int, endpointEdit EndpointAddEditDTO) (EndpointDB, error)

func (*Store) FindEndpoint

func (s *Store) FindEndpoint(ctx context.Context, findEndpoint FindEndpoint) (EndpointDB, error)

func (*Store) GetEndpointByApplicationNamePwd

func (s *Store) GetEndpointByApplicationNamePwd(ctx context.Context, app, name, pwd string) (EndpointDB, error)

func (*Store) GetEndpointByID

func (s *Store) GetEndpointByID(ctx context.Context, endpointID int) (EndpointDB, error)

func (*Store) ListEndpoints

func (s *Store) ListEndpoints(ctx context.Context) ([]EndpointDB, error)

func (*Store) SetEndpointActiveByID

func (s *Store) SetEndpointActiveByID(ctx context.Context, endpointID int) error

func (*Store) SetEndpointInactiveByApplicationNamePwd

func (s *Store) SetEndpointInactiveByApplicationNamePwd(ctx context.Context, application, name, pwd string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL