Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupRandomAddr ¶
SetupRandomAddr generates a random address for testing purposes.
Types ¶
type ChatService ¶
type ChatService struct {
TCPTransport *network.TCPTransport // Reference to the TCPTransport instance
}
ChatService represents the chat service responsible for managing the chat system. It provides methods for sending and receiving messages, as well as managing connections with peers.
func NewChatService ¶
func NewChatService(transport *network.TCPTransport) *ChatService
NewChatService creates a new instance of ChatService with the provided transport layer. It initializes the chat service with the specified transport for communication.
type MockTransport ¶
type MockTransport struct { SendFunc func(data []byte, peer *network.Peer) error ReceiveFn func() ([]byte, *network.Peer, error) ListenFn func(address string) error CloseFn func() error ConnectFunc func(address string) (*network.Peer, error) // Add Connect function JoinRoomFunc func(roomID string) error // Add JoinRoom function LeaveRoomFunc func() error // Add LeaveRoom function CreateRoomFunc func() (string, error) // Add CreateRoom function }
Click to show internal directories.
Click to hide internal directories.