Allocation is tied to a FiveTuple and relays traffic
use CreateAllocation and GetAllocation to operate.ProtocolProtocolRelayAddrnet.AddrRelaySocketnet.PacketConnTurnSocketnet.PacketConn AddChannelBind adds a new ChannelBind to the allocation, it also updates the
permissions needed for this ChannelBind. AddPermission adds a new permission to the allocation. Close closes the allocation. GetChannelByAddr gets the ChannelBind from this allocation by net.Addr. GetChannelByNumber gets the ChannelBind from this allocation by id. GetPermission gets the Permission from the allocation. GetResponseCache return response cache for retransmit allocation request. Refresh updates the allocations lifetime. RemoveChannelBind removes the ChannelBind from this allocation by id. RemovePermission removes the net.Addr's fingerprint from the allocation's permissions. SetResponseCache cache allocation response for retransmit allocation request.
*Allocation : github.com/prometheus/common/expfmt.Closer
*Allocation : io.Closer
func NewAllocation(turnSocket net.PacketConn, fiveTuple *FiveTuple, log logging.LeveledLogger) *Allocation
func (*Manager).CreateAllocation(fiveTuple *FiveTuple, turnSocket net.PacketConn, requestedPort int, lifetime time.Duration) (*Allocation, error)
func (*Manager).GetAllocation(fiveTuple *FiveTuple) *Allocation
FiveTupleFingerprint is a comparable representation of a FiveTuple.
func (*FiveTuple).Fingerprint() (fp FiveTupleFingerprint)
Manager is used to hold active allocations. AllocationCount returns the number of existing allocations. Close closes the manager and closes all allocations it manages. CreateAllocation creates a new allocation and starts relaying. CreateReservation stores the reservation for the token+port. DeleteAllocation removes an allocation. GetAllocation fetches the allocation matching the passed FiveTuple. GetRandomEvenPort returns a random un-allocated udp4 port. GetReservation returns the port for a given reservation if it exists. GrantPermission handles permission requests by calling the permission handler callback
associated with the TURN server listener socket.
*Manager : github.com/prometheus/common/expfmt.Closer
*Manager : io.Closer
func NewManager(config ManagerConfig) (*Manager, error)
Protocol is an enum for relay protocol.
const TCP
const UDP
Package-Level Functions (total 4)
NewAllocation creates a new instance of NewAllocation.
NewChannelBind creates a new ChannelBind.
NewManager creates a new instance of Manager.
NewPermission create a new Permission.
Package-Level Constants (total 2)
Network protocols for relay.
Network protocols for relay.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.