Documentation
¶
Index ¶
- type Allocator
- func (a *Allocator) Allocate(protocol Protocol) int
- func (a *Allocator) AllocateAvailable(protocol Protocol) int
- func (a *Allocator) AllocateAvailableString(protocol string) int
- func (a *Allocator) AllocateString(protocol string) int
- func (a *Allocator) AllocatedCount() int
- func (a *Allocator) GetBasePorts() (modbus, mqtt, ocpp int)
- func (a *Allocator) IsAllocated(port int) bool
- func (a *Allocator) IsAvailable(port int) bool
- func (a *Allocator) Release(port int)
- func (a *Allocator) Reserve(port int) bool
- type Protocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
Allocator manages dynamic port allocation for simulators
func NewAllocator ¶
NewAllocator creates a new port allocator with the given base ports
func (*Allocator) Allocate ¶
Allocate allocates the next available port for the given protocol Returns 0 if no port is available
func (*Allocator) AllocateAvailable ¶
AllocateAvailable allocates the next available port that is free on the OS Returns 0 if no port is available
func (*Allocator) AllocateAvailableString ¶
AllocateAvailableString allocates a port using a string protocol name and checks OS availability
func (*Allocator) AllocateString ¶
AllocateString allocates a port using a string protocol name This maintains backward compatibility with existing code
func (*Allocator) AllocatedCount ¶
AllocatedCount returns the number of currently allocated ports
func (*Allocator) GetBasePorts ¶
GetBasePorts returns the configured base ports for each protocol
func (*Allocator) IsAllocated ¶
IsAllocated returns whether a port is currently allocated
func (*Allocator) IsAvailable ¶
IsAvailable returns true if the port is free on the OS