Help us shape the future of Go! Take the 2026 Go Developer Survey

sgtest

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package sgtest provides an in-memory sgfilter.Source for service tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Loopback

func Loopback() net.Addr

Loopback is a client address on 127.0.0.1.

func OpenTo

func OpenTo(id string, port int, cidr string) sgfilter.Group

OpenTo is group id admitting TCP port from cidr.

Types

type Source

type Source struct {

	// DefaultID is returned for every VPC; empty means no default group.
	DefaultID string
	// contains filtered or unexported fields
}

Source serves security groups that tests replace at will, so rule edits can be applied between connections.

func New

func New(groups ...sgfilter.Group) *Source

New returns a Source holding groups.

func (*Source) DefaultGroupID

func (s *Source) DefaultGroupID(string) string

DefaultGroupID implements sgfilter.DefaultGroupSource.

func (*Source) Enforcer

func (s *Source) Enforcer() *sgfilter.Enforcer

Enforcer returns an enforcer reading from s.

func (*Source) GroupsOfAddr

func (s *Source) GroupsOfAddr(a netip.Addr) []string

GroupsOfAddr implements sgfilter.Source.

func (*Source) SecurityGroups

func (s *Source) SecurityGroups(ids []string) []sgfilter.Group

SecurityGroups implements sgfilter.Source.

func (*Source) Set

func (s *Source) Set(groups ...sgfilter.Group)

Set replaces every group.

func (*Source) SetMembers

func (s *Source) SetMembers(m map[netip.Addr][]string)

SetMembers declares which groups the interface owning each address belongs to.

Jump to

Keyboard shortcuts

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