feat: complete cmpp platform phases 0-5
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package cmppadapter
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
cmpp "github.com/bigwhite/gocmpp"
|
||||
)
|
||||
|
||||
type Version string
|
||||
|
||||
const (
|
||||
Version20 Version = "2.0"
|
||||
Version30 Version = "3.0"
|
||||
)
|
||||
|
||||
type ClientConfig struct {
|
||||
Version Version
|
||||
Address string
|
||||
User string
|
||||
Password string
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
raw *cmpp.Client
|
||||
}
|
||||
|
||||
func NewClient(config ClientConfig) *Client {
|
||||
return &Client{raw: cmpp.NewClient(toProtocolType(config.Version))}
|
||||
}
|
||||
|
||||
func (c *Client) Raw() *cmpp.Client {
|
||||
return c.raw
|
||||
}
|
||||
|
||||
func toProtocolType(version Version) cmpp.Type {
|
||||
if version == Version20 {
|
||||
return cmpp.V20
|
||||
}
|
||||
return cmpp.V30
|
||||
}
|
||||
Reference in New Issue
Block a user