Documentation
¶
Index ¶
- Constants
- func GetIP() (net.IP, error)
- type PortMapping
- type SoracomClient
- func (c *SoracomClient) Connect(login, identity string, portMapping *PortMapping) error
- func (c *SoracomClient) CreatePortMappingsForSubscriber(subscriber Subscriber, port, duration int) (*PortMapping, error)
- func (c *SoracomClient) FindPortMappings() ([]PortMapping, error)
- func (c *SoracomClient) FindPortMappingsForSubscriber(subscriber Subscriber) ([]PortMapping, error)
- func (c *SoracomClient) FindSubscribersByName(name string) ([]Subscriber, error)
- func (c *SoracomClient) GetSubscriber(imsi string) (*Subscriber, error)
- type Subscriber
Constants ¶
const SIGWINCH = syscall.SIGWINCH
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PortMapping ¶
type PortMapping struct {
Duration int `json:"duration"` // duration in seconds
Endpoint string `json:"endpoint"` // SORACOM Napter endpoint
Hostname string `json:"hostname"` // SORACOM Napter hostname
IPAddress string `json:"ipAddress"` // SORACOM Napter IP address
Port int `json:"port"` // SORACOM Napter port number
TLSRequired bool `json:"tlsRequired"` // is TLS required
Destination struct {
Imsi string `json:"imsi"` // target IMSI
Port int `json:"port"` // target port
} `json:"destination"`
Source struct {
IPRanges []string `json:"ipRanges"` // permitted source CIDRs
} `json:"source"`
}
A PortMapping represents SORACOM Napter port mapping
func (PortMapping) String ¶
func (pm PortMapping) String() string
type SoracomClient ¶
type SoracomClient struct {
APIKey string // API key
Token string // API token
Client *http.Client
Endpoint string
}
A SoracomClient represents an API client for SORACOM API. See https://developers.soracom.io/en/docs/tools/api-reference/ or https://dev.soracom.io/jp/docs/api_guide/
func NewSoracomClient ¶
func NewSoracomClient(coverageType, profileName string) (*SoracomClient, error)
NewSoracomClient returns new SoracomClient for caller
func (*SoracomClient) Connect ¶
func (c *SoracomClient) Connect(login, identity string, portMapping *PortMapping) error
Connect connects to specified port mapping with login name and identity. If identity is specified, use it for public key authentication. If not, use password authentication instead.
func (*SoracomClient) CreatePortMappingsForSubscriber ¶
func (c *SoracomClient) CreatePortMappingsForSubscriber(subscriber Subscriber, port, duration int) (*PortMapping, error)
CreatePortMappingsForSubscriber creates port mappings for specified subscriber, port, and duration
func (*SoracomClient) FindPortMappings ¶ added in v0.2.0
func (c *SoracomClient) FindPortMappings() ([]PortMapping, error)
FindPortMappings finds all port mappings
func (*SoracomClient) FindPortMappingsForSubscriber ¶
func (c *SoracomClient) FindPortMappingsForSubscriber(subscriber Subscriber) ([]PortMapping, error)
FindPortMappingsForSubscriber finds port mappings for specified subscriber
func (*SoracomClient) FindSubscribersByName ¶
func (c *SoracomClient) FindSubscribersByName(name string) ([]Subscriber, error)
FindSubscribersByName finds subscribers which has the specified name
func (*SoracomClient) GetSubscriber ¶ added in v0.2.0
func (c *SoracomClient) GetSubscriber(imsi string) (*Subscriber, error)
GetSubscriber gets subscriber information for specified IMSI
type Subscriber ¶
type Subscriber struct {
Imsi string `json:"imsi"` // IMSI of the subscriber
Subscription string `json:"subscription"` // subscription e.g. plan01s, plan-D
Type string `json:"type"` // speed class e.g. s1.4xfast
SessionStatus struct {
Online bool `json:"online"` // represents subscriber is online or not
} `json:"sessionStatus"`
Tags struct {
Name string `json:"name,omitempty"` // name of the subscriber
} `json:"tags"`
}
A Subscriber represents a SORACOM IoT SIM
func (Subscriber) String ¶
func (s Subscriber) String() string
