test_caddy

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCaddyContext

func NewCaddyContext(t testing.TB, base context.Context, cfg caddy.Config) (caddy.Context, context.CancelFunc)

Types

type TestConn

type TestConn struct {
	ReadFn             func([]byte) (int, error)
	WriteFn            func([]byte) (int, error)
	CloseFn            func() error
	LocalAddrFn        func() net.Addr
	RemoteAddrFn       func() net.Addr
	SetDeadlineFn      func(time.Time) error
	SetReadDeadlineFn  func(time.Time) error
	SetWriteDeadlineFn func(time.Time) error
	// contains filtered or unexported fields
}

func NewTestConn

func NewTestConn(t testing.TB) *TestConn

func (*TestConn) Close

func (tc *TestConn) Close() error

func (*TestConn) LocalAddr

func (tc *TestConn) LocalAddr() net.Addr

func (*TestConn) Read

func (tc *TestConn) Read(b []byte) (int, error)

func (*TestConn) RemoteAddr

func (tc *TestConn) RemoteAddr() net.Addr

func (*TestConn) SetDeadline

func (tc *TestConn) SetDeadline(t time.Time) error

func (*TestConn) SetReadDeadline

func (tc *TestConn) SetReadDeadline(t time.Time) error

func (*TestConn) SetWriteDeadline

func (tc *TestConn) SetWriteDeadline(t time.Time) error

func (*TestConn) Write

func (tc *TestConn) Write(b []byte) (int, error)

type TestDialer

type TestDialer struct {
	DialFn       func(context.Context, *net.TCPAddr) (net.Conn, error)
	DialPacketFn func(*net.UDPAddr) (net.PacketConn, error)
	// contains filtered or unexported fields
}

func NewTestDialer

func NewTestDialer(t testing.TB) *TestDialer

func (*TestDialer) Dial

func (td *TestDialer) Dial(ctx context.Context, addr *net.TCPAddr) (net.Conn, error)

func (*TestDialer) DialPacket

func (td *TestDialer) DialPacket(addr *net.UDPAddr) (net.PacketConn, error)

type TestListener

type TestListener struct {
	AcceptFn func() (net.Conn, error) `json:"-"`
	CloseFn  func() error             `json:"-"`
	AddrFn   func() net.Addr          `json:"-"`
	// contains filtered or unexported fields
}

func NewTestListener

func NewTestListener(t testing.TB) *TestListener

func (*TestListener) Accept

func (tl *TestListener) Accept() (net.Conn, error)

func (*TestListener) Addr

func (tl *TestListener) Addr() net.Addr

func (*TestListener) Close

func (tl *TestListener) Close() error

type TestListenerModule added in v0.0.3

type TestListenerModule[T any] struct {
	TestListener
	TestModule[T]
}

func NewTestListenerModule added in v0.0.3

func NewTestListenerModule[T any](t testing.TB) *TestListenerModule[T]

type TestModule added in v0.0.3

type TestModule[T any] struct {
	ID                   string                           `json:"-"`
	Module               caddy.ModuleID                   `json:"-"`
	ProvisionerFn        func(caddy.Context) error        `json:"-"`
	ValidateFn           func() error                     `json:"-"`
	UnmarshalCaddyfileFn func(*caddyfile.Dispenser) error `json:"-"`
	StartFn              func(T) error                    `json:"-"`
	CleanupFn            func() error                     `json:"-"`
	// contains filtered or unexported fields
}

func NewTestModule added in v0.0.3

func NewTestModule[T any](t testing.TB, module string) *TestModule[T]

func (*TestModule[T]) CaddyModule added in v0.0.3

func (t *TestModule[T]) CaddyModule() caddy.ModuleInfo

func (*TestModule[T]) Cleanup added in v0.0.3

func (t *TestModule[T]) Cleanup() error

func (*TestModule[T]) Provision added in v0.0.3

func (t *TestModule[T]) Provision(ctx caddy.Context) error

func (*TestModule[T]) Register added in v0.0.3

func (t *TestModule[T]) Register()

func (*TestModule[T]) Start added in v0.0.3

func (t *TestModule[T]) Start(v T) error

func (*TestModule[T]) UnmarshalCaddyfile added in v0.0.3

func (t *TestModule[T]) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

func (*TestModule[T]) Validate added in v0.0.3

func (t *TestModule[T]) Validate() error

type TestNet

type TestNet struct {
	ListenFn       func(*net.TCPAddr) (net.Listener, error)
	ListenPacketFn func(*net.UDPAddr) (net.PacketConn, error)
	DialerFn       func(net.IP, uint16) pointc.Dialer
	LocalAddrFn    func() net.IP
	// contains filtered or unexported fields
}

func NewTestNet

func NewTestNet(t testing.TB) *TestNet

func (*TestNet) Dialer

func (tn *TestNet) Dialer(laddr net.IP, port uint16) pointc.Dialer

func (*TestNet) Listen

func (tn *TestNet) Listen(addr *net.TCPAddr) (net.Listener, error)

func (*TestNet) ListenPacket

func (tn *TestNet) ListenPacket(addr *net.UDPAddr) (net.PacketConn, error)

func (*TestNet) LocalAddr

func (tn *TestNet) LocalAddr() net.IP

type TestNetLookup

type TestNetLookup struct {
	LookupFn func(string) (pointc.Net, bool)
	// contains filtered or unexported fields
}

func NewTestNetLookup

func NewTestNetLookup(t testing.TB) *TestNetLookup

func (*TestNetLookup) Lookup

func (tnl *TestNetLookup) Lookup(name string) (pointc.Net, bool)

type TestNetOp

type TestNetOp struct {
	StartFn              func(pointc.NetLookup) error     `json:"-"`
	StopFn               func() error                     `json:"-"`
	UnmarshalCaddyfileFn func(*caddyfile.Dispenser) error `json:"-"`
	UnmarshalJSONFn      func(b []byte) error             `json:"-"`
	// contains filtered or unexported fields
}

func NewTestNetOp

func NewTestNetOp(t testing.TB) *TestNetOp

func (*TestNetOp) CaddyModule

func (t *TestNetOp) CaddyModule() caddy.ModuleInfo

func (*TestNetOp) Id

func (t *TestNetOp) Id() string

func (*TestNetOp) Start

func (t *TestNetOp) Start(l pointc.NetLookup) error

func (*TestNetOp) Stop

func (t *TestNetOp) Stop() error

func (*TestNetOp) UnmarshalCaddyfile

func (t *TestNetOp) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

func (*TestNetOp) UnmarshalJSON

func (t *TestNetOp) UnmarshalJSON(b []byte) error

type TestNetwork

type TestNetwork struct {
	UnmarshalCaddyfileFn func(*caddyfile.Dispenser) error `json:"-"`
	UnmarshalJSONFn      func([]byte) error               `json:"-"`
	StartFn              func(pointc.RegisterFunc) error  `json:"-"`
	StopFn               func() error                     `json:"-"`
	// contains filtered or unexported fields
}

func NewTestNetwork

func NewTestNetwork(t testing.TB) *TestNetwork

func (*TestNetwork) CaddyModule

func (t *TestNetwork) CaddyModule() caddy.ModuleInfo

func (*TestNetwork) ID

func (t *TestNetwork) ID() caddy.ModuleID

func (*TestNetwork) Id

func (t *TestNetwork) Id() string

func (*TestNetwork) Start

func (t *TestNetwork) Start(fn pointc.RegisterFunc) error

func (*TestNetwork) Stop

func (t *TestNetwork) Stop() error

func (*TestNetwork) UnmarshalCaddyfile

func (t *TestNetwork) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

func (*TestNetwork) UnmarshalJSON

func (t *TestNetwork) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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