Documentation ¶
Index ¶
- Constants
- func NewTimestamp(sec uint32, nsec uint32) time.Time
- type PingResultStats
- type PingResults
- type RequestTwSession
- type TwampAcceptSession
- type TwampClient
- type TwampClientSetUpResponse
- type TwampConnection
- type TwampResults
- type TwampServerGreeting
- type TwampServerStart
- type TwampSession
- type TwampSessionConfig
- type TwampTest
- func (t *TwampTest) FormatJSON(r *PingResults)
- func (t *TwampTest) GetConnection() *net.UDPConn
- func (t *TwampTest) GetLocalTestHost() string
- func (t *TwampTest) GetRemoteTestHost() string
- func (t *TwampTest) GetRemoteTestPort() uint16
- func (t *TwampTest) GetSession() *TwampSession
- func (t *TwampTest) Ping(count int, isRapid bool, interval int) *PingResults
- func (t *TwampTest) RemoteAddr() (*net.UDPAddr, error)
- func (t *TwampTest) ReturnJSON(r *PingResults) string
- func (t *TwampTest) Run() (*TwampResults, error)
- func (t *TwampTest) RunX(count int) *PingResults
- func (t *TwampTest) SetConnection(conn *net.UDPConn)
- type TwampTimestamp
Constants ¶
const ( ModeUnspecified = 0 ModeUnauthenticated = 1 ModeAuthenticated = 2 ModeEncypted = 4 )
Security modes for TWAMP session.
const ( OK = 0 Failed = 1 InternalError = 2 NotSupported = 3 PermanentResourceLimitation = 4 TemporaryResourceLimitation = 5 )
TWAMP Accept Field Status Code
const ( BE = 0x00 CS1 = 0x20 AF11 = 0x28 AF12 = 0x30 AF13 = 0x38 CS2 = 0x40 AF21 = 0x48 AF22 = 0x50 AF23 = 0x58 CS3 = 0x60 AF31 = 0x68 AF32 = 0x70 AF33 = 0x78 CS4 = 0x80 AF41 = 0x88 AF42 = 0x90 AF43 = 0x98 CS5 = 0xA0 EF = 0xB8 CS6 = 0xC0 CS7 = 0xE0 )
const TwampControlPort int = 862
Default TCP port for remote TWAMP server.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PingResultStats ¶
type PingResults ¶
type PingResults struct { Results []*TwampResults `json:"results"` Stat *PingResultStats `json:"stats"` }
type RequestTwSession ¶
type RequestTwSession []byte
func (RequestTwSession) Encode ¶
func (b RequestTwSession) Encode(c TwampSessionConfig)
type TwampAcceptSession ¶
type TwampAcceptSession struct {
// contains filtered or unexported fields
}
func NewTwampAcceptSession ¶
func NewTwampAcceptSession(buf bytes.Buffer) *TwampAcceptSession
type TwampClient ¶
type TwampClient struct{}
func NewClient ¶
func NewClient() *TwampClient
func (*TwampClient) Connect ¶
func (c *TwampClient) Connect(hostname string) (*TwampConnection, error)
type TwampClientSetUpResponse ¶
type TwampClientSetUpResponse struct { Mode uint32 KeyID [80]byte Token [64]byte ClientIV [16]byte }
TWAMP client session negotiation message.
type TwampConnection ¶
type TwampConnection struct {
// contains filtered or unexported fields
}
func NewTwampConnection ¶
func NewTwampConnection(conn net.Conn) *TwampConnection
func (*TwampConnection) Close ¶
func (c *TwampConnection) Close()
func (*TwampConnection) CreateSession ¶
func (c *TwampConnection) CreateSession(config TwampSessionConfig) (*TwampSession, error)
func (*TwampConnection) GetConnection ¶
func (c *TwampConnection) GetConnection() net.Conn
func (*TwampConnection) LocalAddr ¶
func (c *TwampConnection) LocalAddr() net.Addr
func (*TwampConnection) RemoteAddr ¶
func (c *TwampConnection) RemoteAddr() net.Addr
type TwampResults ¶
type TwampResults struct { SeqNum uint32 `json:"seqnum"` Timestamp time.Time `json:"timestamp"` ErrorEstimate uint16 `json:"errorEstimate"` ReceiveTimestamp time.Time `json:"receiveTimestamp"` SenderSeqNum uint32 `json:"senderSeqnum"` SenderTimestamp time.Time `json:"senderTimestamp"` SenderErrorEstimate uint16 `json:"senderErrorEstimate"` SenderTTL byte `json:"senderTTL"` FinishedTimestamp time.Time `json:"finishedTimestamp"` SenderSize int `json:"senderSize"` }
TWAMP test result timestamps have been normalized to UNIX epoch time.
func (*TwampResults) GetRTT ¶
func (r *TwampResults) GetRTT() time.Duration
func (*TwampResults) GetWait ¶
func (r *TwampResults) GetWait() time.Duration
func (*TwampResults) PrintResults ¶
func (r *TwampResults) PrintResults()
type TwampServerGreeting ¶
type TwampServerGreeting struct { Mode uint32 // modes (4 bytes) Challenge [16]byte // challenge (16 bytes) Salt [16]byte // salt (16 bytes) Count uint32 // count (4 bytes) }
TWAMP server greeting message.
type TwampServerStart ¶
type TwampServerStart struct { Accept byte ServerIV [16]byte StartTime TwampTimestamp }
type TwampSession ¶
type TwampSession struct {
// contains filtered or unexported fields
}
func (*TwampSession) CreateTest ¶
func (s *TwampSession) CreateTest() (*TwampTest, error)
func (*TwampSession) GetConfig ¶
func (s *TwampSession) GetConfig() TwampSessionConfig
func (*TwampSession) GetConnection ¶
func (s *TwampSession) GetConnection() net.Conn
func (*TwampSession) Stop ¶
func (s *TwampSession) Stop()
func (*TwampSession) Write ¶
func (s *TwampSession) Write(buf []byte)
type TwampSessionConfig ¶
type TwampTest ¶
type TwampTest struct {
// contains filtered or unexported fields
}
TWAMP test connection used for running TWAMP tests.
func (*TwampTest) FormatJSON ¶
func (t *TwampTest) FormatJSON(r *PingResults)
func (*TwampTest) GetConnection ¶
Get TWAMP Test UDP connection.
func (*TwampTest) GetLocalTestHost ¶
Get the local IP address for the TWAMP control session.
func (*TwampTest) GetRemoteTestHost ¶
Get the remote IP address for the TWAMP control session.
func (*TwampTest) GetRemoteTestPort ¶
Get the remote TWAMP UDP port number.
func (*TwampTest) GetSession ¶
func (t *TwampTest) GetSession() *TwampSession
Get the underlying TWAMP control session for the TWAMP test.
func (*TwampTest) Ping ¶
func (t *TwampTest) Ping(count int, isRapid bool, interval int) *PingResults
func (*TwampTest) RemoteAddr ¶
Get the remote TWAMP IP/UDP address.
func (*TwampTest) ReturnJSON ¶
func (t *TwampTest) ReturnJSON(r *PingResults) string
func (*TwampTest) Run ¶
func (t *TwampTest) Run() (*TwampResults, error)
Run a TWAMP test and return a pointer to the TwampResults.
func (*TwampTest) RunX ¶
func (t *TwampTest) RunX(count int) *PingResults
func (*TwampTest) SetConnection ¶
type TwampTimestamp ¶
func NewTwampTimestamp ¶
func NewTwampTimestamp(t time.Time) *TwampTimestamp
Converts a UNIX epoch time time.Time object into an RFC 1305 compliant time.
func (*TwampTimestamp) GetTime ¶
func (t *TwampTimestamp) GetTime() time.Time
Return a time.Time object representing Unix Epoch time since January 1st, 1970.
func (*TwampTimestamp) String ¶
func (t *TwampTimestamp) String() string