proxy

package
v0.0.0-...-b1e68b0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PruneRegistry

func PruneRegistry(file string) (pruned []string, err error)

PruneRegistry removes entries whose processes are no longer running. Returns the list of pruned target names.

func StopAll

func StopAll(file string) error

StopAll stops every proxy currently recorded in the registry.

func WorkloadPort

func WorkloadPort(name string) int

WorkloadPort returns a deterministic port in the range [10000, 19999] for the given workload name, derived via FNV-32a.

Types

type RunningProxy

type RunningProxy struct {
	TargetName string    `json:"target_name"`
	LocalPort  string    `json:"local_port"`
	Pid        int       `json:"pid"`
	Pid2       int       `json:"pid2,omitempty"` // Optional second PID for azure proxy sessions
	StartTime  time.Time `json:"start_time"`

	File string `json:"-"` // Registry file path so Store/DeleteFile know where to write
}

func GetRunningProxy

func GetRunningProxy(file, targetName string) (*RunningProxy, error)

GetRunningProxy loads the registry at file and returns the entry for targetName. Returns an empty RunningProxy (not an error) when no entry exists.

func ListRunningProxies

func ListRunningProxies(file string) ([]*RunningProxy, error)

ListRunningProxies returns all entries currently in the registry.

func NewRunningProxy

func NewRunningProxy(targetName, localPort string, pid int, pid2 int, file string) *RunningProxy

NewRunningProxy creates a new RunningProxy instance and initializes its fields.

func Preflight

func Preflight(file string, targetName string, localPort string) (existingRunningProxy *RunningProxy, active bool, err error)

func (*RunningProxy) DeleteFile

func (r *RunningProxy) DeleteFile() error

DeleteFile removes this proxy's entry from the registry.

func (*RunningProxy) IsRunning

func (r *RunningProxy) IsRunning() bool

func (*RunningProxy) KillProcess

func (r *RunningProxy) KillProcess() error

func (*RunningProxy) Stop

func (r *RunningProxy) Stop() error

func (*RunningProxy) Store

func (r *RunningProxy) Store() error

Store upserts this RunningProxy into the registry file.

func (*RunningProxy) WaitForPortOpen

func (r *RunningProxy) WaitForPortOpen(seconds int) bool

Jump to

Keyboard shortcuts

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