Documentation
¶
Overview ¶
Package npm provides a client for Nginx Proxy Manager API integration.
Package npm provides NPM integration services including auto-proxy.
Index ¶
- type APIError
- type AccessList
- type AccessListClient
- type AccessListCreate
- type AccessListItem
- type Certificate
- type CertificateRequest
- type Client
- func (c *Client) CreateAccessList(ctx context.Context, list *AccessList) (*AccessList, error)
- func (c *Client) CreateDeadHost(ctx context.Context, host *DeadHost) (*DeadHost, error)
- func (c *Client) CreateProxyHost(ctx context.Context, host *ProxyHost) (*ProxyHost, error)
- func (c *Client) CreateRedirectionHost(ctx context.Context, host *RedirectionHost) (*RedirectionHost, error)
- func (c *Client) CreateStream(ctx context.Context, stream *Stream) (*Stream, error)
- func (c *Client) DeleteAccessList(ctx context.Context, id int) error
- func (c *Client) DeleteCertificate(ctx context.Context, id int) error
- func (c *Client) DeleteDeadHost(ctx context.Context, id int) error
- func (c *Client) DeleteProxyHost(ctx context.Context, id int) error
- func (c *Client) DeleteRedirectionHost(ctx context.Context, id int) error
- func (c *Client) DeleteStream(ctx context.Context, id int) error
- func (c *Client) DisableProxyHost(ctx context.Context, id int) error
- func (c *Client) EnableProxyHost(ctx context.Context, id int) error
- func (c *Client) GetAccessList(ctx context.Context, id int) (*AccessList, error)
- func (c *Client) GetCertificate(ctx context.Context, id int) (*Certificate, error)
- func (c *Client) GetHostsCount(ctx context.Context) (*HostsCount, error)
- func (c *Client) GetProxyHost(ctx context.Context, id int) (*ProxyHost, error)
- func (c *Client) GetRedirectionHost(ctx context.Context, id int) (*RedirectionHost, error)
- func (c *Client) GetSettings(ctx context.Context) ([]*Setting, error)
- func (c *Client) GetStream(ctx context.Context, id int) (*Stream, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) ListAccessLists(ctx context.Context) ([]*AccessList, error)
- func (c *Client) ListCertificates(ctx context.Context) ([]*Certificate, error)
- func (c *Client) ListDeadHosts(ctx context.Context) ([]*DeadHost, error)
- func (c *Client) ListProxyHosts(ctx context.Context) ([]*ProxyHost, error)
- func (c *Client) ListRedirectionHosts(ctx context.Context) ([]*RedirectionHost, error)
- func (c *Client) ListStreams(ctx context.Context) ([]*Stream, error)
- func (c *Client) ReloadNginx(ctx context.Context) error
- func (c *Client) RenewCertificate(ctx context.Context, id int) (*Certificate, error)
- func (c *Client) RequestLetsEncryptCertificate(ctx context.Context, req *CertificateRequest) (*Certificate, error)
- func (c *Client) UpdateAccessList(ctx context.Context, id int, list *AccessList) (*AccessList, error)
- func (c *Client) UpdateProxyHost(ctx context.Context, id int, host *ProxyHost) (*ProxyHost, error)
- func (c *Client) UpdateRedirectionHost(ctx context.Context, id int, host *RedirectionHost) (*RedirectionHost, error)
- func (c *Client) UpdateSetting(ctx context.Context, id string, value interface{}) (*Setting, error)
- func (c *Client) UpdateStream(ctx context.Context, id int, stream *Stream) (*Stream, error)
- func (c *Client) UploadCustomCertificate(ctx context.Context, niceName string, cert, key, intermediate []byte) (*Certificate, error)
- type Config
- type ConnectionCreate
- type ConnectionUpdate
- type DeadHost
- type HostsCount
- type ProxyHost
- type ProxyHostCreate
- type ProxyHostLocation
- type ProxyHostUpdate
- type RedirectionCreate
- type RedirectionHost
- type Service
- func (s *Service) AutoConnect(ctx context.Context, hostID, baseURL, email, password, userID string) (bool, error)
- func (s *Service) CheckHealth(ctx context.Context, hostID string) (bool, error)
- func (s *Service) ConfigureConnection(ctx context.Context, hostID string, create *ConnectionCreate, userID string) (*models.NPMConnection, error)
- func (s *Service) CreateAccessList(ctx context.Context, hostID string, list *AccessListCreate, userID string) (*AccessList, error)
- func (s *Service) CreateAutoProxy(ctx context.Context, hostID string, config *models.AutoProxyConfig, ...) (*ProxyHost, error)
- func (s *Service) CreateProxyHost(ctx context.Context, hostID string, host *ProxyHostCreate, userID string) (*ProxyHost, error)
- func (s *Service) CreateRedirection(ctx context.Context, hostID string, redir *RedirectionCreate, userID string) (*RedirectionHost, error)
- func (s *Service) DeleteAccessList(ctx context.Context, hostID string, listID int, userID string) error
- func (s *Service) DeleteAutoProxy(ctx context.Context, hostID, containerID string, userID string) error
- func (s *Service) DeleteCertificate(ctx context.Context, hostID string, certID int) error
- func (s *Service) DeleteConnection(ctx context.Context, id string) error
- func (s *Service) DeleteProxyHost(ctx context.Context, hostID string, proxyID int, userID string) error
- func (s *Service) DeleteRedirection(ctx context.Context, hostID string, redirID int, userID string) error
- func (s *Service) DisableProxyHost(ctx context.Context, hostID string, proxyID int, userID string) error
- func (s *Service) EnableProxyHost(ctx context.Context, hostID string, proxyID int, userID string) error
- func (s *Service) ExtractProxyConfig(containerInfo *container.InspectResponse) *models.AutoProxyConfig
- func (s *Service) GetAuditLogs(ctx context.Context, hostID string, limit, offset int) ([]*models.NPMAuditLog, int, error)
- func (s *Service) GetClient(ctx context.Context, hostID string) (*Client, error)
- func (s *Service) GetConnection(ctx context.Context, hostID string) (*models.NPMConnection, error)
- func (s *Service) GetContainerMappings(ctx context.Context, hostID string) ([]*models.ContainerProxyMapping, error)
- func (s *Service) GetProxyHost(ctx context.Context, hostID string, proxyID int) (*ProxyHost, error)
- func (s *Service) ListAccessLists(ctx context.Context, hostID string) ([]*AccessList, error)
- func (s *Service) ListAuditLogs(ctx context.Context, hostID string, limit, offset int) ([]*models.NPMAuditLog, int, error)
- func (s *Service) ListCertificates(ctx context.Context, hostID string) ([]*Certificate, error)
- func (s *Service) ListProxyHosts(ctx context.Context, hostID string) ([]*ProxyHost, error)
- func (s *Service) ListRedirections(ctx context.Context, hostID string) ([]*RedirectionHost, error)
- func (s *Service) RequestLetsEncrypt(ctx context.Context, hostID string, domainNames []string, email string) (*Certificate, error)
- func (s *Service) StartHealthCheckWorker(ctx context.Context, interval time.Duration)
- func (s *Service) TestConnection(ctx context.Context, hostID string) error
- func (s *Service) UpdateAutoProxy(ctx context.Context, hostID string, config *models.AutoProxyConfig, ...) (*ProxyHost, error)
- func (s *Service) UpdateConnection(ctx context.Context, id string, update *ConnectionUpdate, userID string) (*models.NPMConnection, error)
- func (s *Service) UpdateProxyHost(ctx context.Context, hostID string, proxyID int, host *ProxyHostUpdate, ...) (*ProxyHost, error)
- type Setting
- type Stream
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Error interface{} `json:"error"`
Message string `json:"message"`
}
APIError represents an NPM API error.
type AccessList ¶
type AccessList struct {
ID int `json:"id,omitempty"`
CreatedOn string `json:"created_on,omitempty"`
ModifiedOn string `json:"modified_on,omitempty"`
Name string `json:"name"`
SatisfyAny bool `json:"satisfy_any"`
PassAuth bool `json:"pass_auth"`
Items []AccessListItem `json:"items,omitempty"`
Clients []AccessListClient `json:"clients,omitempty"`
Meta map[string]interface{} `json:"meta,omitempty"`
}
AccessList represents an NPM access list.
type AccessListClient ¶
type AccessListClient struct {
Address string `json:"address"`
Directive string `json:"directive"` // allow or deny
}
AccessListClient represents a client IP rule.
type AccessListCreate ¶
type AccessListCreate struct {
Name string `json:"name"`
SatisfyAny bool `json:"satisfy_any,omitempty"`
PassAuth bool `json:"pass_auth,omitempty"`
Items []AccessListItem `json:"items,omitempty"`
Clients []AccessListClient `json:"clients,omitempty"`
}
AccessListCreate is the input for creating an access list.
type AccessListItem ¶
AccessListItem represents an authorization item (username/password).
type Certificate ¶
type Certificate struct {
ID int `json:"id,omitempty"`
CreatedOn string `json:"created_on,omitempty"`
ModifiedOn string `json:"modified_on,omitempty"`
Provider string `json:"provider"` // letsencrypt, other
NiceName string `json:"nice_name"`
DomainNames []string `json:"domain_names"`
ExpiresOn string `json:"expires_on,omitempty"`
Meta map[string]interface{} `json:"meta,omitempty"`
}
Certificate represents an NPM certificate.
type CertificateRequest ¶
type CertificateRequest struct {
DomainNames []string `json:"domain_names"`
Meta map[string]interface{} `json:"meta,omitempty"`
LetsencryptEmail string `json:"letsencrypt_email,omitempty"`
LetsencryptAgree bool `json:"letsencrypt_agree,omitempty"`
DNSChallenge bool `json:"dns_challenge,omitempty"`
DNSProvider string `json:"dns_provider,omitempty"`
DNSProviderCredentials string `json:"dns_provider_credentials,omitempty"`
PropagationSeconds int `json:"propagation_seconds,omitempty"`
}
CertificateRequest represents a request to create a Let's Encrypt certificate.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for the Nginx Proxy Manager API.
func (*Client) CreateAccessList ¶
func (c *Client) CreateAccessList(ctx context.Context, list *AccessList) (*AccessList, error)
CreateAccessList creates a new access list.
func (*Client) CreateDeadHost ¶
CreateDeadHost creates a new dead host.
func (*Client) CreateProxyHost ¶
CreateProxyHost creates a new proxy host.
func (*Client) CreateRedirectionHost ¶
func (c *Client) CreateRedirectionHost(ctx context.Context, host *RedirectionHost) (*RedirectionHost, error)
CreateRedirectionHost creates a new redirection host.
func (*Client) CreateStream ¶
CreateStream creates a new stream.
func (*Client) DeleteAccessList ¶
DeleteAccessList deletes an access list.
func (*Client) DeleteCertificate ¶
DeleteCertificate deletes a certificate.
func (*Client) DeleteDeadHost ¶
DeleteDeadHost deletes a dead host.
func (*Client) DeleteProxyHost ¶
DeleteProxyHost deletes a proxy host.
func (*Client) DeleteRedirectionHost ¶
DeleteRedirectionHost deletes a redirection host.
func (*Client) DeleteStream ¶
DeleteStream deletes a stream.
func (*Client) DisableProxyHost ¶
DisableProxyHost disables a proxy host.
func (*Client) EnableProxyHost ¶
EnableProxyHost enables a proxy host.
func (*Client) GetAccessList ¶
GetAccessList returns an access list by ID.
func (*Client) GetCertificate ¶
GetCertificate returns a certificate by ID.
func (*Client) GetHostsCount ¶
func (c *Client) GetHostsCount(ctx context.Context) (*HostsCount, error)
GetHostsCount returns the count of hosts by type.
func (*Client) GetProxyHost ¶
GetProxyHost returns a proxy host by ID.
func (*Client) GetRedirectionHost ¶
GetRedirectionHost returns a redirection host by ID.
func (*Client) GetSettings ¶
GetSettings returns all settings.
func (*Client) ListAccessLists ¶
func (c *Client) ListAccessLists(ctx context.Context) ([]*AccessList, error)
ListAccessLists returns all access lists.
func (*Client) ListCertificates ¶
func (c *Client) ListCertificates(ctx context.Context) ([]*Certificate, error)
ListCertificates returns all certificates.
func (*Client) ListDeadHosts ¶
ListDeadHosts returns all dead hosts.
func (*Client) ListProxyHosts ¶
ListProxyHosts returns all proxy hosts.
func (*Client) ListRedirectionHosts ¶
func (c *Client) ListRedirectionHosts(ctx context.Context) ([]*RedirectionHost, error)
ListRedirectionHosts returns all redirection hosts.
func (*Client) ListStreams ¶
ListStreams returns all streams.
func (*Client) ReloadNginx ¶
ReloadNginx reloads the nginx configuration.
func (*Client) RenewCertificate ¶
RenewCertificate renews a certificate.
func (*Client) RequestLetsEncryptCertificate ¶
func (c *Client) RequestLetsEncryptCertificate(ctx context.Context, req *CertificateRequest) (*Certificate, error)
RequestLetsEncryptCertificate requests a new Let's Encrypt certificate.
func (*Client) UpdateAccessList ¶
func (c *Client) UpdateAccessList(ctx context.Context, id int, list *AccessList) (*AccessList, error)
UpdateAccessList updates an existing access list.
func (*Client) UpdateProxyHost ¶
UpdateProxyHost updates an existing proxy host.
func (*Client) UpdateRedirectionHost ¶
func (c *Client) UpdateRedirectionHost(ctx context.Context, id int, host *RedirectionHost) (*RedirectionHost, error)
UpdateRedirectionHost updates an existing redirection host.
func (*Client) UpdateSetting ¶
UpdateSetting updates a setting.
func (*Client) UpdateStream ¶
UpdateStream updates an existing stream.
func (*Client) UploadCustomCertificate ¶
func (c *Client) UploadCustomCertificate(ctx context.Context, niceName string, cert, key, intermediate []byte) (*Certificate, error)
UploadCustomCertificate uploads a custom SSL certificate to NPM.
type Config ¶
type Config struct {
BaseURL string // e.g., "http://npm:81"
Email string // NPM admin email
Password string // NPM admin password
Timeout time.Duration
}
Config holds the NPM client configuration.
type ConnectionCreate ¶
type ConnectionCreate = models.NPMConnectionCreate
ConnectionCreate is an alias for models.NPMConnectionCreate.
type ConnectionUpdate ¶
type ConnectionUpdate = models.NPMConnectionUpdate
ConnectionUpdate is an alias for models.NPMConnectionUpdate.
type DeadHost ¶
type DeadHost struct {
ID int `json:"id,omitempty"`
CreatedOn string `json:"created_on,omitempty"`
ModifiedOn string `json:"modified_on,omitempty"`
DomainNames []string `json:"domain_names"`
CertificateID interface{} `json:"certificate_id"`
SSLForced bool `json:"ssl_forced"`
HSTSEnabled bool `json:"hsts_enabled"`
HSTSSubdomains bool `json:"hsts_subdomains"`
HTTP2Support bool `json:"http2_support"`
AdvancedConfig string `json:"advanced_config"`
Enabled bool `json:"enabled"`
Meta map[string]interface{} `json:"meta,omitempty"`
Certificate *Certificate `json:"certificate,omitempty"`
}
DeadHost represents an NPM dead host (404 page).
type HostsCount ¶
type HostsCount struct {
Proxy int `json:"proxy"`
Redirection int `json:"redirection"`
Stream int `json:"stream"`
Dead int `json:"dead"`
}
HostsCount represents the count of hosts by type.
type ProxyHost ¶
type ProxyHost struct {
ID int `json:"id,omitempty"`
CreatedOn string `json:"created_on,omitempty"`
ModifiedOn string `json:"modified_on,omitempty"`
DomainNames []string `json:"domain_names"`
ForwardScheme string `json:"forward_scheme"`
ForwardHost string `json:"forward_host"`
ForwardPort int `json:"forward_port"`
CertificateID interface{} `json:"certificate_id"` // int, "new", or null
SSLForced bool `json:"ssl_forced"`
HSTSEnabled bool `json:"hsts_enabled"`
HSTSSubdomains bool `json:"hsts_subdomains"`
HTTP2Support bool `json:"http2_support"`
BlockExploits bool `json:"block_exploits"`
CachingEnabled bool `json:"caching_enabled"`
AllowWebsocketUpgrade bool `json:"allow_websocket_upgrade"`
AccessListID int `json:"access_list_id"`
AdvancedConfig string `json:"advanced_config"`
Enabled bool `json:"enabled"`
Locations []ProxyHostLocation `json:"locations,omitempty"`
Meta map[string]interface{} `json:"meta,omitempty"`
// Expanded fields (when using ?expand=...)
Certificate *Certificate `json:"certificate,omitempty"`
AccessList *AccessList `json:"access_list,omitempty"`
}
ProxyHost represents an NPM proxy host.
type ProxyHostCreate ¶
type ProxyHostCreate struct {
DomainNames []string `json:"domain_names"`
ForwardScheme string `json:"forward_scheme"`
ForwardHost string `json:"forward_host"`
ForwardPort int `json:"forward_port"`
CertificateID interface{} `json:"certificate_id,omitempty"`
SSLForced bool `json:"ssl_forced,omitempty"`
HSTSEnabled bool `json:"hsts_enabled,omitempty"`
HSTSSubdomains bool `json:"hsts_subdomains,omitempty"`
HTTP2Support bool `json:"http2_support,omitempty"`
BlockExploits bool `json:"block_exploits,omitempty"`
CachingEnabled bool `json:"caching_enabled,omitempty"`
AllowWebsocket bool `json:"allow_websocket_upgrade,omitempty"`
AccessListID int `json:"access_list_id,omitempty"`
AdvancedConfig string `json:"advanced_config,omitempty"`
}
ProxyHostCreate is the input for creating a proxy host.
type ProxyHostLocation ¶
type ProxyHostLocation struct {
Path string `json:"path"`
ForwardScheme string `json:"forward_scheme,omitempty"`
ForwardHost string `json:"forward_host,omitempty"`
ForwardPort int `json:"forward_port,omitempty"`
AdvancedConfig string `json:"advanced_config,omitempty"`
}
ProxyHostLocation represents a custom location in a proxy host.
type ProxyHostUpdate ¶
type ProxyHostUpdate struct {
DomainNames []string `json:"domain_names,omitempty"`
ForwardScheme *string `json:"forward_scheme,omitempty"`
ForwardHost *string `json:"forward_host,omitempty"`
ForwardPort *int `json:"forward_port,omitempty"`
CertificateID interface{} `json:"certificate_id,omitempty"`
SSLForced *bool `json:"ssl_forced,omitempty"`
HSTSEnabled *bool `json:"hsts_enabled,omitempty"`
HSTSSubdomains *bool `json:"hsts_subdomains,omitempty"`
HTTP2Support *bool `json:"http2_support,omitempty"`
BlockExploits *bool `json:"block_exploits,omitempty"`
CachingEnabled *bool `json:"caching_enabled,omitempty"`
AllowWebsocket *bool `json:"allow_websocket_upgrade,omitempty"`
AccessListID *int `json:"access_list_id,omitempty"`
AdvancedConfig *string `json:"advanced_config,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
ProxyHostUpdate is the input for updating a proxy host.
type RedirectionCreate ¶
type RedirectionCreate struct {
DomainNames []string `json:"domain_names"`
ForwardScheme string `json:"forward_scheme"`
ForwardDomain string `json:"forward_domain_name"`
ForwardHTTPCode int `json:"forward_http_code"`
PreservePath bool `json:"preserve_path"`
CertificateID interface{} `json:"certificate_id,omitempty"`
SSLForced bool `json:"ssl_forced,omitempty"`
HSTSEnabled bool `json:"hsts_enabled,omitempty"`
HSTSSubdomains bool `json:"hsts_subdomains,omitempty"`
HTTP2Support bool `json:"http2_support,omitempty"`
BlockExploits bool `json:"block_exploits,omitempty"`
AdvancedConfig string `json:"advanced_config,omitempty"`
}
RedirectionCreate is the input for creating a redirection host.
type RedirectionHost ¶
type RedirectionHost struct {
ID int `json:"id,omitempty"`
CreatedOn string `json:"created_on,omitempty"`
ModifiedOn string `json:"modified_on,omitempty"`
DomainNames []string `json:"domain_names"`
ForwardScheme string `json:"forward_scheme"`
ForwardDomainName string `json:"forward_domain_name"`
ForwardHTTPCode int `json:"forward_http_code"`
PreservePath bool `json:"preserve_path"`
CertificateID interface{} `json:"certificate_id"`
SSLForced bool `json:"ssl_forced"`
HSTSEnabled bool `json:"hsts_enabled"`
HSTSSubdomains bool `json:"hsts_subdomains"`
HTTP2Support bool `json:"http2_support"`
BlockExploits bool `json:"block_exploits"`
AdvancedConfig string `json:"advanced_config"`
Enabled bool `json:"enabled"`
Meta map[string]interface{} `json:"meta,omitempty"`
Certificate *Certificate `json:"certificate,omitempty"`
}
RedirectionHost represents an NPM redirection host.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides NPM integration functionality.
func NewService ¶
func NewService( npmConnRepo *postgres.NPMConnectionRepository, mappingRepo *postgres.ContainerProxyMappingRepository, auditRepo *postgres.NPMAuditLogRepository, encryptor *crypto.AESEncryptor, logger *zap.Logger, ) *Service
NewService creates a new NPM integration service.
func (*Service) AutoConnect ¶
func (s *Service) AutoConnect(ctx context.Context, hostID, baseURL, email, password, userID string) (bool, error)
StartHealthCheckWorker starts a background worker to check NPM health. AutoConnect attempts to establish an NPM connection from config credentials. If a connection already exists for the hostID, it verifies/updates it. Returns true if connection is active and healthy.
func (*Service) CheckHealth ¶
CheckHealth checks if the NPM instance for a host is healthy.
func (*Service) ConfigureConnection ¶
func (s *Service) ConfigureConnection(ctx context.Context, hostID string, create *ConnectionCreate, userID string) (*models.NPMConnection, error)
ConfigureConnection configures NPM connection for a Docker host.
func (*Service) CreateAccessList ¶
func (s *Service) CreateAccessList(ctx context.Context, hostID string, list *AccessListCreate, userID string) (*AccessList, error)
CreateAccessList creates a new access list in NPM.
func (*Service) CreateAutoProxy ¶
func (s *Service) CreateAutoProxy(ctx context.Context, hostID string, config *models.AutoProxyConfig, userID string) (*ProxyHost, error)
CreateAutoProxy creates an NPM proxy host from container configuration.
func (*Service) CreateProxyHost ¶
func (s *Service) CreateProxyHost(ctx context.Context, hostID string, host *ProxyHostCreate, userID string) (*ProxyHost, error)
CreateProxyHost creates a new proxy host in NPM.
func (*Service) CreateRedirection ¶
func (s *Service) CreateRedirection(ctx context.Context, hostID string, redir *RedirectionCreate, userID string) (*RedirectionHost, error)
CreateRedirection creates a new redirection in NPM.
func (*Service) DeleteAccessList ¶
func (s *Service) DeleteAccessList(ctx context.Context, hostID string, listID int, userID string) error
DeleteAccessList deletes an access list from NPM.
func (*Service) DeleteAutoProxy ¶
func (s *Service) DeleteAutoProxy(ctx context.Context, hostID, containerID string, userID string) error
DeleteAutoProxy deletes an auto-proxy when container is removed.
func (*Service) DeleteCertificate ¶
DeleteCertificate deletes a certificate from NPM.
func (*Service) DeleteConnection ¶
DeleteConnection deletes the NPM connection for a Docker host.
func (*Service) DeleteProxyHost ¶
func (s *Service) DeleteProxyHost(ctx context.Context, hostID string, proxyID int, userID string) error
DeleteProxyHost deletes a proxy host from NPM.
func (*Service) DeleteRedirection ¶
func (s *Service) DeleteRedirection(ctx context.Context, hostID string, redirID int, userID string) error
DeleteRedirection deletes a redirection from NPM.
func (*Service) DisableProxyHost ¶
func (s *Service) DisableProxyHost(ctx context.Context, hostID string, proxyID int, userID string) error
DisableProxyHost disables a proxy host in NPM.
func (*Service) EnableProxyHost ¶
func (s *Service) EnableProxyHost(ctx context.Context, hostID string, proxyID int, userID string) error
EnableProxyHost enables a proxy host in NPM.
func (*Service) ExtractProxyConfig ¶
func (s *Service) ExtractProxyConfig(containerInfo *container.InspectResponse) *models.AutoProxyConfig
ExtractProxyConfig extracts auto-proxy configuration from container labels.
func (*Service) GetAuditLogs ¶
func (s *Service) GetAuditLogs(ctx context.Context, hostID string, limit, offset int) ([]*models.NPMAuditLog, int, error)
GetAuditLogs returns audit logs for a host.
func (*Service) GetConnection ¶
GetConnection gets the NPM connection for a Docker host.
func (*Service) GetContainerMappings ¶
func (s *Service) GetContainerMappings(ctx context.Context, hostID string) ([]*models.ContainerProxyMapping, error)
GetContainerMappings returns all container-proxy mappings for a host.
func (*Service) GetProxyHost ¶
GetProxyHost returns a proxy host by ID.
func (*Service) ListAccessLists ¶
ListAccessLists returns all access lists from NPM.
func (*Service) ListAuditLogs ¶
func (s *Service) ListAuditLogs(ctx context.Context, hostID string, limit, offset int) ([]*models.NPMAuditLog, int, error)
ListAuditLogs returns NPM audit logs for a host.
func (*Service) ListCertificates ¶
ListCertificates returns all certificates from NPM.
func (*Service) ListProxyHosts ¶
ListProxyHosts returns all proxy hosts from NPM.
func (*Service) ListRedirections ¶
ListRedirections returns all redirections from NPM.
func (*Service) RequestLetsEncrypt ¶
func (s *Service) RequestLetsEncrypt(ctx context.Context, hostID string, domainNames []string, email string) (*Certificate, error)
RequestLetsEncrypt requests a Let's Encrypt certificate.
func (*Service) StartHealthCheckWorker ¶
func (*Service) TestConnection ¶
TestConnection tests the NPM connection.
func (*Service) UpdateAutoProxy ¶
func (s *Service) UpdateAutoProxy(ctx context.Context, hostID string, config *models.AutoProxyConfig, userID string) (*ProxyHost, error)
UpdateAutoProxy updates an existing auto-proxy.
func (*Service) UpdateConnection ¶
func (s *Service) UpdateConnection(ctx context.Context, id string, update *ConnectionUpdate, userID string) (*models.NPMConnection, error)
UpdateConnection updates the NPM connection for a Docker host.
type Setting ¶
type Setting struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Value interface{} `json:"value"`
Meta map[string]interface{} `json:"meta"`
}
Setting represents an NPM setting.
type Stream ¶
type Stream struct {
ID int `json:"id,omitempty"`
CreatedOn string `json:"created_on,omitempty"`
ModifiedOn string `json:"modified_on,omitempty"`
IncomingPort int `json:"incoming_port"`
ForwardingHost string `json:"forwarding_host"`
ForwardingPort int `json:"forwarding_port"`
TCPForwarding bool `json:"tcp_forwarding"`
UDPForwarding bool `json:"udp_forwarding"`
CertificateID interface{} `json:"certificate_id"`
Enabled bool `json:"enabled"`
Meta map[string]interface{} `json:"meta,omitempty"`
Certificate *Certificate `json:"certificate,omitempty"`
}
Stream represents an NPM stream.
type TokenResponse ¶
TokenResponse represents the NPM token response.