client

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Overview

Package client provides a docreader gRPC client and the shared TLS / token authentication helpers used by both the standalone Go SDK in this package and the internal docparser wrapper. Keep all auth/TLS construction here so the two call sites cannot drift on security defaults.

Index

Constants

This section is empty.

Variables

View Source
var Logger = log.New(os.Stdout, "[DocReader] ", log.LstdFlags|log.Lmicroseconds)

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	TLSEnabled bool
	CertFile   string
	KeyFile    string
	CAFile     string
	// ServerName overrides the SNI / certificate-host check on the client.
	// When empty, the address passed to Dial is used by Go's TLS stack.
	ServerName string

	AuthToken string
}

AuthConfig holds the docreader gRPC client TLS / token configuration.

func LoadAuthConfigFromEnv

func LoadAuthConfigFromEnv() *AuthConfig

LoadAuthConfigFromEnv reads docreader gRPC auth knobs from the process environment. The caller must pass the result to BuildDialOptions to apply them to a gRPC connection.

func (*AuthConfig) BuildDialOptions

func (c *AuthConfig) BuildDialOptions(maxMsgSize int) ([]grpc.DialOption, error)

BuildDialOptions returns the gRPC DialOptions that apply the configured transport credentials and per-RPC token. Callers should append their own per-call options (load balancer, message size, etc.).

type Client

type Client struct {
	proto.DocReaderClient
	// contains filtered or unexported fields
}

Client represents a DocReader service client.

func NewClient

func NewClient(addr string) (*Client, error)

func NewClientWithAuth

func NewClientWithAuth(addr string, authConfig *AuthConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Log

func (c *Client) Log(level string, format string, args ...interface{})

func (*Client) SetDebug

func (c *Client) SetDebug(debug bool)

type ImageRefInfo

type ImageRefInfo struct {
	Filename    string
	OriginalRef string
	MimeType    string
	StorageKey  string
}

ImageRefInfo represents an image reference from a converted document.

func GetImageRefsFromResponse

func GetImageRefsFromResponse(resp *proto.ReadResponse) []ImageRefInfo

GetImageRefsFromResponse extracts image references from a ReadResponse.

Jump to

Keyboard shortcuts

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