示例#1
0
func NewFaultDetector(client protocols.Client, server string) (*FaultDetector, error) {
	pingClient, err := NewClient(client)
	if err != nil {
		return nil, err
	}
	err = pingClient.SetServer(server)
	if err != nil {
		_ = pingClient.Close()
		return nil, err
	}
	return &FaultDetector{
		FaultDetectorBase: protocols.NewFaultDetectorBase(client.Protocol(), pingClient.Server()),
		client:            pingClient,
	}, nil
}
示例#2
0
func NewClient(client protocols.Client) (*Client, error) {
	if err := client.Protocol().CheckIncludesFragment(Protocol.Name()); err != nil {
		return nil, err
	}
	return &Client{client}, nil
}