Documentation ¶
Index ¶
- func ParseDuration(str string) (time.Duration, error)
- type AuthType
- type BitNum
- type ByteNum
- type CRL
- type Callback
- type Cert
- type CertsGetter
- type CertsReader
- type Child
- type ChildSA
- type Connection
- type ConnectionMode
- type ConnectionsGetter
- type ConnectionsReader
- type IKESA
- type IKEVersion
- type IPsecProto
- type Info
- type IpsecCertsReader
- type IpsecConnReader
- type IpsecPoolsReader
- type IpsecSummaryReader
- type Observable
- type PeriodicObservableRoutine
- type Pool
- type PoolsGetter
- type PoolsReader
- type Revokation
- type RevokationReason
- type SA
- type Summary
- type SwanctlSummaryReader
- type UptimeGetter
- type UptimeReader
- type ViciCertsReader
- type ViciConnReader
- type ViciOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthType ¶
type AuthType uint
AuthType is type to enumerate types of peers/hosts authentication
Types of peers/hosts authentication
func ParseAuthType ¶
ParseAuthType returns AuthType according to str
type BitNum ¶
type BitNum uint64
BitNum is Stringer type for handling bit numbers
const ( BitMultiplier BitNum = 1000 KBit BitNum = BitMultiplier MBit BitNum = KBit * BitMultiplier GBit BitNum = MBit * BitMultiplier TBit BitNum = GBit * BitMultiplier )
BitNum units
type ByteNum ¶
type ByteNum uint64
ByteNum is Stringer type for handling byte numbers
const ( ByteMultiplier ByteNum = 1024 KiByte ByteNum = ByteMultiplier MiByte ByteNum = KiByte * ByteMultiplier GiByte ByteNum = MiByte * ByteMultiplier TiByte ByteNum = GiByte * ByteMultiplier )
ByteNum units
type CRL ¶
type CRL struct { Issuer *Cert UpdateThis time.Time UpdateNext time.Time Serial uint64 AuthKeyID string Revokations []*Revokation }
CRL is a struct storing CRL data
type Cert ¶
type Cert struct { Cert *x509.Certificate Issued []*Cert Issuer *Cert CRL *CRL }
Cert is a struct storing Certificate and CA-tree info
type CertsGetter ¶
type CertsGetter struct {
// contains filtered or unexported fields
}
CertsGetter is a struct to handle with Certs getting
func NewCertsGetter ¶
func NewCertsGetter() (*CertsGetter, error)
NewCertsGetter return instance of CertsGetter or error if it is not possible to init any CertsReader
func (*CertsGetter) GetCerts ¶
func (cg *CertsGetter) GetCerts() ([]*Cert, error)
GetCerts is function which returns *Cert slice or error
type CertsReader ¶
CertsReader is interface for types which can read slice of Certs from io.Reader
type Child ¶
type Child struct { Mode ConnectionMode Rekeying, Reauth time.Duration Local, Remote []string }
Child is type for storing info about child association of connection
type ChildSA ¶
type ChildSA struct { Mode ConnectionMode Proto IPsecProto UDPEncaps bool ReqID int64 InputSPI, OutputSPI string LocalNet, RemoteNet string IsLocalInitiator bool Security string BytesIn, BytesOut ByteNum PktsIn, PktsOut uint64 LastInAgo, LastOutAgo string UntilRekey string Installed bool }
ChildSA is struct to store info about Child SA
type Connection ¶
type Connection struct { Name string LocalAddr, RemoteAddr []string LocalAuth, RemoteAuth []AuthType LocalID, RemoteID []string Children []Child Version IKEVersion SAs []*SA }
Connection is type for storing info about connection
type ConnectionMode ¶
type ConnectionMode uint
ConnectionMode is type to enumerate connection modes
const ( UnknownMode ConnectionMode = iota TransportMode TunnelMode PassMode )
There is two connection modes: TRANSPORT and TUNNEL
func ParseConnectionMode ¶
func ParseConnectionMode(str string) ConnectionMode
ParseConnectionMode returns ConnectionMode according to str
func (ConnectionMode) String ¶
func (cm ConnectionMode) String() string
type ConnectionsGetter ¶
type ConnectionsGetter struct {
// contains filtered or unexported fields
}
ConnectionsGetter is a struct to handle with Connections getting
func NewConnectionsGetter ¶
func NewConnectionsGetter() (*ConnectionsGetter, error)
NewConnectionsGetter return instance of ConnectionsGetter or error if it is not possible to init any ConnectionsReader
func (*ConnectionsGetter) GetConns ¶
func (cg *ConnectionsGetter) GetConns() ([]*Connection, error)
GetConns is function which returns *Connection slice or error
type ConnectionsReader ¶
type ConnectionsReader interface {
Read(io.Reader) ([]*Connection, error)
}
ConnectionsReader is interface for types which can read slice of Connections from io.Reader
type IKESA ¶
type IKESA struct { Alive string LocalAddr, RemoteAddr string LocalID, RemoteID string InitiatorSPI, ResponderSPI string IsInitiator bool Version IKEVersion Auth AuthType UntilReauth string Security string Established bool Deleting bool }
IKESA is struct to store info about IKE SA
type IKEVersion ¶
type IKEVersion uint
IKEVersion is type to enumerate version of IKE protocol
const ( IKEUnknown IKEVersion = 0 IKEv1 IKEVersion = 1 IKEv2 IKEVersion = 1 << 1 )
There is two versions of IKE: IKEv1 and IKEv2
func ParseIKEVersion ¶
func ParseIKEVersion(str string) IKEVersion
ParseIKEVersion parses IKEVersion from string
func (IKEVersion) String ¶
func (i IKEVersion) String() string
type IPsecProto ¶
type IPsecProto uint
IPsecProto is type to enumerate IPsec Phase2 protocols
const ( UnknownProto IPsecProto = iota AHProto ESPProto )
There is two IPsec Phase2 protocols: AH and ESP
func ParseIPsecProto ¶
func ParseIPsecProto(str string) IPsecProto
ParseIPsecProto returns IPsecProto according to str
func (IPsecProto) String ¶
func (p IPsecProto) String() string
type Info ¶
type Info struct { sync.RWMutex Uptime time.Duration Since time.Time Connections []*Connection Pools []Pool Certs []*Cert UptimeRoutine *PeriodicObservableRoutine ConnsRoutine *PeriodicObservableRoutine CertsRoutine *PeriodicObservableRoutine PoolsRoutine *PeriodicObservableRoutine // contains filtered or unexported fields }
Info is type to store all StrongSwan daemon info
type IpsecCertsReader ¶
type IpsecCertsReader struct {
// contains filtered or unexported fields
}
IpsecCertsReader is type to Read slice of Certs with `ipsec listall` format
type IpsecConnReader ¶
type IpsecConnReader struct {
// contains filtered or unexported fields
}
IpsecConnReader is type to Read slice of Connections with `ipsec statusall` format
func (*IpsecConnReader) Read ¶
func (icr *IpsecConnReader) Read(r io.Reader) ([]*Connection, error)
type IpsecPoolsReader ¶
type IpsecPoolsReader struct {
// contains filtered or unexported fields
}
IpsecPoolsReader is type to Read slice of Pools with `ipsec statusall` format
type IpsecSummaryReader ¶
type IpsecSummaryReader struct {
// contains filtered or unexported fields
}
IpsecSummaryReader is type to Read Summary struct with `ipsec statusall` format
type Observable ¶
Observable is interface for types who can register and unregister observers callbacks
type PeriodicObservableRoutine ¶
type PeriodicObservableRoutine struct {
// contains filtered or unexported fields
}
PeriodicObservableRoutine is type which is observable and can start goroutine with periodic-executable function
func NewPeriodicObservableRoutine ¶
func NewPeriodicObservableRoutine(period time.Duration, routine func(*PeriodicObservableRoutine)) *PeriodicObservableRoutine
NewPeriodicObservableRoutine returns pointer to new instance of PeriodicObservableRoutine
func (*PeriodicObservableRoutine) Go ¶
func (por *PeriodicObservableRoutine) Go()
Go starts gorotine which runs PeriodicObservableRoutine.routine every PeriodicObservableRoutine.period and can be stopped by writing some data to PeriodicObservableRoutine.stopChan
func (*PeriodicObservableRoutine) Notify ¶
func (por *PeriodicObservableRoutine) Notify(val int)
Notify implements Observable interface
func (*PeriodicObservableRoutine) RegObserver ¶
func (por *PeriodicObservableRoutine) RegObserver() chan int
RegObserver implements Observable interface
func (*PeriodicObservableRoutine) UnregObserver ¶
func (por *PeriodicObservableRoutine) UnregObserver(ch chan int)
UnregObserver implements Observable interface
type PoolsGetter ¶
type PoolsGetter struct {
// contains filtered or unexported fields
}
PoolsGetter is a struct to handle with Pools getting
func NewPoolsGetter ¶
func NewPoolsGetter() (*PoolsGetter, error)
NewPoolsGetter return instance of PoolsGetter or error if it is not possible to init any PoolsReader
func (*PoolsGetter) GetPools ¶
func (pg *PoolsGetter) GetPools() ([]Pool, error)
GetPools is function which returns Pools slice or error
type PoolsReader ¶
PoolsReader is interface for types which can read slice of Pools from io.Reader
type Revokation ¶
type Revokation struct { Serial uint64 Time time.Time Reaseon RevokationReason }
Revokation is a struct storing info about revoked certificate
type RevokationReason ¶
type RevokationReason int
RevokationReason is a type enumerating revokation reasons of certificates
const ( UnknownReason RevokationReason = iota CACompromisedReason KeyCompromisedReason )
RevokationReason enumeration
type Summary ¶
type Summary struct { Uptime string Since time.Time SATotal, SAHalfOpened int TotalBytesIn, TotalBytesOut int64 TotalPktsIn, TotalPktsOut int64 }
Summary is struct to store summary strongswan daemon info
type SwanctlSummaryReader ¶
type SwanctlSummaryReader struct {
// contains filtered or unexported fields
}
SwanctlSummaryReader is type to Read Summary struct with `swanctl --stats` format
type UptimeGetter ¶
type UptimeGetter struct {
// contains filtered or unexported fields
}
UptimeGetter is a struct to handle with Uptime getting
func NewUptimeGetter ¶
func NewUptimeGetter() (*UptimeGetter, error)
NewUptimeGetter return instance of UptimeGetter or error if it is not possible to init any UptimeReader
type UptimeReader ¶
UptimeReader is interface for types which can read Summary struct from io.Reader
type ViciCertsReader ¶
type ViciCertsReader struct {
// contains filtered or unexported fields
}
ViciCertsReader is CertReader which reads from vici socket
func NewViciCertsReader ¶
func NewViciCertsReader() (*ViciCertsReader, error)
NewViciCertsReader creates new ViciCertsReader
type ViciConnReader ¶
type ViciConnReader struct {
// contains filtered or unexported fields
}
ViciConnReader is ConnectionsReader which reads from vici socket
func NewViciConnReader ¶
func NewViciConnReader() (*ViciConnReader, error)
NewViciConnReader creates new ViciConnReader
func (*ViciConnReader) Read ¶
func (vcr *ViciConnReader) Read(io.Reader) ([]*Connection, error)
type ViciOptions ¶
type ViciOptions struct {
IKE string `vici:"ike"`
}
ViciOptions is struct representing vici message sending to vici socket