remote_http

package
v0.0.0-...-3525705 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 59 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRoundTripper http.RoundTripper

Functions

func MakeClient

func MakeClient(
	envUI env_ui.Env,
	transport http.RoundTripper,
	repo *local_working_copy.Repo,
	typedBlobStore inventory_list_coders.Closet,
) *client

func MakeStdioListener

func MakeStdioListener() net.Listener

func ReadErrorFromBody

func ReadErrorFromBody(response *http.Response) (err error)

func ReadErrorFromBodyOnGreaterOrEqual

func ReadErrorFromBodyOnGreaterOrEqual(
	response *http.Response,
	status int,
) (err error)

func ReadErrorFromBodyOnNot

func ReadErrorFromBodyOnNot(
	response *http.Response,
	statuses ...int,
) (err error)

Types

type HTTPPort

type HTTPPort struct {
	net.Listener
	Port int
}

type MethodPath

type MethodPath struct {
	Method string
	Path   string
}

type Request

type Request struct {
	MethodPath
	Headers http.Header
	Body    io.ReadCloser
	// contains filtered or unexported fields
}

func (Request) Vars

func (request Request) Vars() map[string]string

type Response

type Response struct {
	StatusCode int

	Body io.ReadCloser
	// contains filtered or unexported fields
}

func (*Response) Error

func (response *Response) Error(err error)

func (*Response) ErrorWithStatus

func (response *Response) ErrorWithStatus(status int, err error)

func (*Response) Headers

func (response *Response) Headers() http.Header

func (*Response) MCPError

func (response *Response) MCPError(
	status int,
	id any,
	code int,
	message string,
	data any,
)

type RoundTripperBufioWrappedSigner

type RoundTripperBufioWrappedSigner struct {
	PublicKey interfaces.MarklId
	// contains filtered or unexported fields
}

func (*RoundTripperBufioWrappedSigner) RoundTrip

func (roundTripper *RoundTripperBufioWrappedSigner) RoundTrip(
	request *http.Request,
) (response *http.Response, err error)

TODO extract signing into an agnostic middleware

type RoundTripperHost

type RoundTripperHost struct {
	UrlData
	http.RoundTripper
}

A round tripper that decorates another round tripper and always populates the http requests with given UrlData template.

func (*RoundTripperHost) RoundTrip

func (roundTripper *RoundTripperHost) RoundTrip(
	request *http.Request,
) (response *http.Response, err error)

type RoundTripperRetry

type RoundTripperRetry struct {
	RetryFunc  func(error) bool
	RetryCount int
	http.RoundTripper
}

func MakeRoundTripperRetry

func MakeRoundTripperRetry(
	inner http.RoundTripper,
	count int,
	retryFunc func(error) bool,
) RoundTripperRetry

func MakeRoundTripperRetryTimeouts

func MakeRoundTripperRetryTimeouts(
	inner http.RoundTripper,
	count int,
) RoundTripperRetry

func (RoundTripperRetry) RoundTrip

func (roundTripper RoundTripperRetry) RoundTrip(
	request *http.Request,
) (response *http.Response, err error)

type RoundTripperStdio

type RoundTripperStdio struct {
	exec.Cmd
	io.WriteCloser
	io.ReadCloser
	RoundTripperBufioWrappedSigner
}

func (*RoundTripperStdio) InitializeWithLocal

func (roundTripper *RoundTripperStdio) InitializeWithLocal(
	envRepo env_repo.Env,
	config store_config.Config,
	pubkey interfaces.MarklId,
) (err error)

func (*RoundTripperStdio) InitializeWithSSH

func (roundTripper *RoundTripperStdio) InitializeWithSSH(
	envUI env_ui.Env,
	arg string,
) (err error)

type RoundTripperUnixSocket

type RoundTripperUnixSocket struct {
	repo.UnixSocket
	net.Conn
	RoundTripperBufioWrappedSigner
}

func (*RoundTripperUnixSocket) Initialize

func (roundTripper *RoundTripperUnixSocket) Initialize(
	remote *Server,
	pubkey markl.Id,
) (err error)

TODO add public key

type Server

type Server struct {
	EnvLocal env_local.Env
	Repo     *local_working_copy.Repo

	GetCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error)
	// contains filtered or unexported fields
}

func (*Server) InitializeHTTP

func (server *Server) InitializeHTTP(
	config net.ListenConfig,
	port int,
) (httpPort HTTPPort, err error)

func (*Server) InitializeListener

func (server *Server) InitializeListener(
	network, address string,
) (listener net.Listener, err error)

TODO switch to not return error

func (*Server) InitializeUnixSocket

func (server *Server) InitializeUnixSocket(
	config net.ListenConfig,
	path string,
) (sock repo.UnixSocket, err error)

func (*Server) Serve

func (server *Server) Serve(listener net.Listener) (err error)

TODO remove error return and use context

func (*Server) ServeStdio

func (server *Server) ServeStdio()

type StdioConn

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

func (*StdioConn) Close

func (conn *StdioConn) Close() error

func (*StdioConn) LocalAddr

func (conn *StdioConn) LocalAddr() net.Addr

func (*StdioConn) Read

func (conn *StdioConn) Read(b []byte) (n int, err error)

func (*StdioConn) RemoteAddr

func (conn *StdioConn) RemoteAddr() net.Addr

func (*StdioConn) SetDeadline

func (conn *StdioConn) SetDeadline(t time.Time) error

func (*StdioConn) SetReadDeadline

func (conn *StdioConn) SetReadDeadline(t time.Time) error

func (*StdioConn) SetWriteDeadline

func (conn *StdioConn) SetWriteDeadline(t time.Time) error

func (*StdioConn) Write

func (conn *StdioConn) Write(b []byte) (n int, err error)

type StdioListener

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

func (*StdioListener) Accept

func (listener *StdioListener) Accept() (conn net.Conn, err error)

func (*StdioListener) Addr

func (listener *StdioListener) Addr() net.Addr

func (*StdioListener) Close

func (listener *StdioListener) Close() error

type UrlData

type UrlData struct {
	Scheme string
	Opaque string        // encoded opaque data
	User   *url.Userinfo // username and password information
	Host   string        // host or host:port (see Hostname and Port methods)
}

func MakeUrlDataFromUri

func MakeUrlDataFromUri(uri values.Uri) UrlData

func (UrlData) Apply

func (urlData UrlData) Apply(ur *url.URL)

Source Files

  • client.go
  • client_blob_store.go
  • client_closet.go
  • client_inventory_list_store.go
  • listener_stdio.go
  • request_response.go
  • round_tripper_bufio.go
  • round_tripper_host.go
  • round_tripper_retry.go
  • round_tripper_stdio.go
  • round_tripper_unix_socket.go
  • round_tripper_wrapped_signer.go
  • server.go
  • server_blob_cache.go
  • server_mcp.go
  • server_repo.go
  • server_working_copy.go

Jump to

Keyboard shortcuts

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