client

package
v2.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Overview

********************************************************************

  • Copyright (c) Intel Corporation 2024
  • SPDX-License-Identifier: Apache-2.0 *********************************************************************

Index

Constants

View Source
const (
	ContentType           = "application/soap+xml; charset=utf-8"
	NSWSMAN               = "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
	NSWSMID               = "http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd"
	TLSPort               = "16993"
	NonTLSPort            = "16992"
	RedirectionTLSPort    = "16995"
	RedirectionNonTLSPort = "16994"
	WSManPath             = "/wsman"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APFChannel added in v2.35.0

type APFChannel struct {
	SenderChannel    uint32
	RecipientChannel uint32
	TXWindow         uint32
	DataChan         chan []byte // Incoming data from device
	OpenChan         chan error  // Signals channel open result
	WindowChan       chan uint32 // Window adjust notifications
	Closed           bool
	// contains filtered or unexported fields
}

APFChannel represents an active APF channel for CIRA connections. It implements the CIRAChannel interface.

func NewAPFChannel added in v2.35.0

func NewAPFChannel(senderChannel uint32) *APFChannel

NewAPFChannel creates a new APF channel with the given sender channel ID.

func (*APFChannel) AddTXWindow added in v2.35.0

func (c *APFChannel) AddTXWindow(bytes uint32)

AddTXWindow adds to the transmit window.

func (*APFChannel) Close added in v2.35.0

func (c *APFChannel) Close()

Close marks the channel as closed and closes the data channel.

func (*APFChannel) GetRecipientChannel added in v2.35.0

func (c *APFChannel) GetRecipientChannel() uint32

GetRecipientChannel returns the device's channel ID.

func (*APFChannel) GetSenderChannel added in v2.35.0

func (c *APFChannel) GetSenderChannel() uint32

GetSenderChannel returns our channel ID.

func (*APFChannel) GetTXWindow added in v2.35.0

func (c *APFChannel) GetTXWindow() uint32

GetTXWindow returns the current transmit window.

func (*APFChannel) IsClosed added in v2.35.0

func (c *APFChannel) IsClosed() bool

IsClosed returns true if the channel is closed.

func (*APFChannel) ReceiveData added in v2.35.0

func (c *APFChannel) ReceiveData(timeout time.Duration) ([]byte, error)

ReceiveData receives data from the channel with timeout.

func (*APFChannel) ReceiveWindowAdjust added in v2.35.0

func (c *APFChannel) ReceiveWindowAdjust(timeout time.Duration) (uint32, error)

ReceiveWindowAdjust receives a window adjust notification with timeout.

func (*APFChannel) SendData added in v2.35.0

func (c *APFChannel) SendData(data []byte)

SendData sends data to the channel's data buffer.

func (*APFChannel) SendWindowAdjust added in v2.35.0

func (c *APFChannel) SendWindowAdjust(bytes uint32)

SendWindowAdjust sends a window adjust notification.

func (*APFChannel) SetRecipientChannel added in v2.35.0

func (c *APFChannel) SetRecipientChannel(channel uint32)

SetRecipientChannel sets the device's channel ID.

func (*APFChannel) SetTXWindow added in v2.35.0

func (c *APFChannel) SetTXWindow(window uint32)

SetTXWindow sets the transmit window.

func (*APFChannel) SignalOpen added in v2.35.0

func (c *APFChannel) SignalOpen(err error)

SignalOpen signals that the channel has been opened (or failed to open).

func (*APFChannel) SubtractTXWindow added in v2.35.0

func (c *APFChannel) SubtractTXWindow(bytes uint32)

SubtractTXWindow subtracts from the transmit window.

func (*APFChannel) WaitForOpen added in v2.35.0

func (c *APFChannel) WaitForOpen(timeout time.Duration) error

WaitForOpen waits for the channel open result with timeout.

type APFChannelStore added in v2.35.0

type APFChannelStore struct {
	// contains filtered or unexported fields
}

APFChannelStore manages APF channels for a CIRA connection. It implements the CIRAChannelManager interface.

func NewAPFChannelStore added in v2.35.0

func NewAPFChannelStore(conn net.Conn) *APFChannelStore

NewAPFChannelStore creates a new APF channel store.

func (*APFChannelStore) CloseAll added in v2.35.0

func (s *APFChannelStore) CloseAll()

CloseAll closes all channels in the store.

func (*APFChannelStore) GetChannel added in v2.35.0

func (s *APFChannelStore) GetChannel(senderChannel uint32) *APFChannel

GetChannel retrieves an APF channel by sender channel ID.

func (*APFChannelStore) GetConnection added in v2.35.0

func (s *APFChannelStore) GetConnection() net.Conn

GetConnection returns the underlying network connection. Implements CIRAChannelManager interface.

func (*APFChannelStore) RegisterAPFChannel added in v2.35.0

func (s *APFChannelStore) RegisterAPFChannel() CIRAChannel

RegisterAPFChannel creates and registers a new APF channel. Implements CIRAChannelManager interface.

func (*APFChannelStore) SetConnection added in v2.35.0

func (s *APFChannelStore) SetConnection(conn net.Conn)

SetConnection updates the underlying network connection.

func (*APFChannelStore) UnregisterAPFChannel added in v2.35.0

func (s *APFChannelStore) UnregisterAPFChannel(senderChannel uint32)

UnregisterAPFChannel removes an APF channel. Implements CIRAChannelManager interface.

type AuthChallenge

type AuthChallenge struct {
	Username   string
	Password   string
	Realm      string
	CSRFToken  string
	Domain     string
	Nonce      string
	Opaque     string
	Stale      string
	Algorithm  string
	Qop        string
	CNonce     string
	NonceCount int
}

func (*AuthChallenge) ComputeDigestHash

func (c *AuthChallenge) ComputeDigestHash(method, uri, nonceData string) string

func (*AuthChallenge) GetFormattedNonceData

func (c *AuthChallenge) GetFormattedNonceData(nonceData string) string

func (*AuthChallenge) HashCredentials

func (c *AuthChallenge) HashCredentials() string

type CIRAChannel added in v2.35.0

type CIRAChannel interface {
	// GetSenderChannel returns our channel ID.
	GetSenderChannel() uint32
	// GetRecipientChannel returns the device's channel ID (set after open confirmation).
	GetRecipientChannel() uint32
	// SetRecipientChannel sets the device's channel ID.
	SetRecipientChannel(channel uint32)
	// GetTXWindow returns the current transmit window.
	GetTXWindow() uint32
	// SetTXWindow sets the transmit window.
	SetTXWindow(window uint32)
	// AddTXWindow adds to the transmit window.
	AddTXWindow(bytes uint32)
	// SubtractTXWindow subtracts from the transmit window.
	SubtractTXWindow(bytes uint32)
	// WaitForOpen waits for the channel open result.
	WaitForOpen(timeout time.Duration) error
	// ReceiveData receives data from the channel with timeout.
	ReceiveData(timeout time.Duration) ([]byte, error)
	// ReceiveWindowAdjust receives a window adjust notification with timeout.
	ReceiveWindowAdjust(timeout time.Duration) (uint32, error)
	// IsClosed returns true if the channel is closed.
	IsClosed() bool
}

CIRAChannel represents an APF channel that can send/receive data.

type CIRAChannelManager added in v2.35.0

type CIRAChannelManager interface {
	// RegisterAPFChannel creates and registers a new APF channel.
	RegisterAPFChannel() CIRAChannel
	// UnregisterAPFChannel removes an APF channel.
	UnregisterAPFChannel(senderChannel uint32)
	// GetConnection returns the underlying network connection for writes.
	GetConnection() net.Conn
}

CIRAChannelManager is an interface that must be implemented by the console to manage APF channels through the CIRA tunnel.

type CIRATransport added in v2.35.0

type CIRATransport struct {
	// contains filtered or unexported fields
}

CIRATransport implements http.RoundTripper for CIRA APF tunnels. It routes HTTP requests through an APF (Application Protocol Forwarder) connection to an AMT device.

func NewCIRATransport added in v2.35.0

func NewCIRATransport(manager CIRAChannelManager, logMessages bool) *CIRATransport

NewCIRATransport creates a new CIRA transport that routes HTTP requests through an APF tunnel connection.

func (*CIRATransport) RoundTrip added in v2.35.0

func (c *CIRATransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP request through the CIRA APF tunnel.

type Message

type Message struct {
	XMLInput  string
	XMLOutput string
}

type Parameters

type Parameters struct {
	Target                    string
	Username                  string
	Password                  string
	UseDigest                 bool
	UseTLS                    bool
	SelfSignedAllowed         bool
	LogAMTMessages            bool
	Transport                 http.RoundTripper
	IsRedirection             bool
	PinnedCert                string
	Connection                net.Conn
	TlsConfig                 *tls.Config
	AllowInsecureCipherSuites bool
	IsCIRA                    bool               // Flag to indicate CIRA APF tunnel connection
	CIRAManager               CIRAChannelManager // Manager for CIRA channel operations
}

Parameters struct defines the connection settings for wsman client.

type Target

type Target struct {
	http.Client

	UseTLS             bool
	InsecureSkipVerify bool
	PinnedCert         string
	// contains filtered or unexported fields
}

Target is a thin wrapper around http.Target.

func NewWsman

func NewWsman(cp Parameters) *Target

func NewWsmanTCP

func NewWsmanTCP(cp Parameters) *Target

func (*Target) CloseConnection

func (t *Target) CloseConnection() error

CloseConnection cleanly closes the TCP connection.

func (*Target) Connect

func (t *Target) Connect() error

Connect establishes a TCP connection to the endpoint specified in the Target struct.

func (*Target) GetServerCertificate

func (t *Target) GetServerCertificate() (*tls.Certificate, error)

func (*Target) IsAuthenticated

func (t *Target) IsAuthenticated() bool

func (*Target) Post

func (t *Target) Post(msg string) (response []byte, err error)

Post overrides http.Client's Post method.

func (*Target) ProxyURL

func (t *Target) ProxyURL(proxyStr string) (err error)

ProxyURL sets proxy address for the underlying Transport if supported.

func (*Target) Receive

func (t *Target) Receive() ([]byte, error)

Receive reads data from the connected TCP endpoint in the Target struct.

func (*Target) Send

func (t *Target) Send(data []byte) error

Send sends data to the connected TCP endpoint in the Target struct.

type WSMan

type WSMan interface {
	// HTTP Methods
	Post(msg string) (response []byte, err error)
	// TCP Methods
	Connect() error
	Send(data []byte) error
	Receive() ([]byte, error)
	CloseConnection() error
	IsAuthenticated() bool
	GetServerCertificate() (*tls.Certificate, error)
}

WSMan is an interface for the wsman.Client.

type WsTransport

type WsTransport struct {
	// contains filtered or unexported fields
}

WsTransport is an implementation of http.Transport which uses websocket relay.

func NewWsTransport

func NewWsTransport(wsurl string, protocol int, host, username, password string, port int, tls, tls1only bool, token string, tlsconfig *tls.Config) *WsTransport

NewTransport creates a new Websocket RoundTripper.

func (*WsTransport) RoundTrip

func (t *WsTransport) RoundTrip(r *http.Request) (resp *http.Response, err error)

RoundTrip makes a low level text exchange over websocket. This is supposed to be used by high level round tripper.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL