client

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package client provides a high-level TACACS+ client that drives complete authentication, authorization and accounting exchanges over a transport.Conn.

The Client composes the packet, protocol and transport layers: it builds the correct minor version for each authen_type, manages the session id and sequence numbers, obfuscates bodies (legacy) or leaves them cleartext (TLS), and follows interactive CONTINUE/REPLY loops until a terminal status is reached.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcctRequest

type AcctRequest struct {
	Flags   types.AcctFlags
	Method  types.AuthenMethod
	PrivLvl types.PrivLevel
	Type    types.AuthenType
	Service types.AuthenService
	User    string
	Port    string
	RemAddr string
	Args    []types.Argument
}

AcctRequest is the high-level accounting request.

type AcctResult

type AcctResult struct {
	Status    types.AcctStatus
	ServerMsg string
}

AcctResult is the high-level accounting result.

type AuthenReply

type AuthenReply struct {
	Status    types.AuthenStatus
	Flags     byte
	ServerMsg string
	Data      []byte
}

AuthenReply is the high-level authentication reply.

type AuthenRequest

type AuthenRequest struct {
	Action  types.AuthenAction
	PrivLvl types.PrivLevel
	Type    types.AuthenType
	Service types.AuthenService
	User    string
	Port    string
	RemAddr string
	Data    []byte
}

AuthenRequest is the high-level authentication request for a client.

type AuthorRequest

type AuthorRequest struct {
	Method  types.AuthenMethod
	PrivLvl types.PrivLevel
	Type    types.AuthenType
	Service types.AuthenService
	User    string
	Port    string
	RemAddr string
	Args    []types.Argument
}

AuthorRequest is the high-level authorization request.

type AuthorResult

type AuthorResult struct {
	Status    types.AuthorStatus
	Args      []types.Argument
	ServerMsg string
}

AuthorResult is the high-level authorization result.

type Client

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

Client is a high-level TACACS+ client bound to an established transport.Conn.

func New

func New(c *transport.Conn) (*Client, error)

New creates a Client over an established connection, starting a fresh client session (odd sequence numbers from 1).

func (*Client) Account

func (c *Client) Account(ctx context.Context, req AcctRequest) (AcctResult, error)

Account performs a single accounting request/reply.

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context, req AuthenRequest, contFn func(reply AuthenReply) (string, error)) (AuthenReply, error)

Authenticate performs a single authentication exchange. For ASCII it follows the interactive CONTINUE/REPLY loop driven by contFn, which is called with each non-terminal REPLY to produce the next CONTINUE's user message. For PAP/CHAP/MSCHAP/MSCHAPv2 the exchange is a single START+REPLY and contFn is not called.

func (*Client) Authorize

func (c *Client) Authorize(ctx context.Context, req AuthorRequest) (AuthorResult, error)

Authorize performs a single authorization request/reply.

func (*Client) Conn

func (c *Client) Conn() *transport.Conn

Conn returns the underlying transport connection.

Jump to

Keyboard shortcuts

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