Documentation
¶
Index ¶
Constants ¶
View Source
const AuthorizationHeader = "Authorization"
View Source
const ChannelParam = "channel"
channel the client wants to connect to
View Source
const ClientName = "clientName"
The user friendly name of the client
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationError ¶
type AuthenticationError struct {
Message string
}
func NewAuthenticationError ¶
func NewAuthenticationError(message string) *AuthenticationError
func (*AuthenticationError) Error ¶
func (e *AuthenticationError) Error() string
type Packet ¶
type Packet struct { Type PacketType Target Endpoint Source Endpoint Data []byte }
func NewPacketFromBytes ¶
FromBytes creates a new packet from a byte array
func NewPacketFromStruct ¶
func NewPacketFromStruct(obj any, typ PacketType) (*Packet, error)
NewPacketFromStruct creates a new packet from a struct with the given packet type
func (*Packet) DecodeJsonData ¶
DecodeJsonData inside this packet.
type PacketType ¶
type PacketType int
const ( Data PacketType = iota Error CriticalError // update all clients with the current channel state info. e.g. list of channel members // and other channel specific information ChannelState // sent by a channel member to update their info // The server will then emit a ChannelState packet to all clients in the channel // to let them know about the new member info MemberInfo SocketConnect SocketDisconnect )
This enum indicates to the receiver what the packet is for
type ProxyClient ¶
type ProxyClient struct { Id uuid.UUID WsCon *websocket.Conn InputChannel chan Packet OutputChannel chan Packet CloseChannel chan bool Closed bool Settings ProxyClientSettings }
func NewOutgoingSocket ¶
func NewOutgoingSocket(url url.URL, settings ProxyClientSettings) (*ProxyClient, error)
NewOutgoingSocket creates a new outgoing websocket connection to the given url
func UpgradeConnection ¶
func UpgradeConnection(context *gin.Context, settings ProxyClientSettings) (*ProxyClient, error)
func (*ProxyClient) Close ¶
func (client *ProxyClient) Close() error
func (*ProxyClient) Read ¶
func (client *ProxyClient) Read() (Packet, bool)
func (*ProxyClient) Write ¶
func (client *ProxyClient) Write(packet Packet)
type ProxyClientSettings ¶
Click to show internal directories.
Click to hide internal directories.