logranger/connection.go
Winni Neessen 0a3f8780c5
Add copyright notice to connection.go
A copyright notice for Winni Neessen has been added at the top of connection.go. The license specified is MIT.
2023-12-22 15:26:31 +01:00

31 lines
729 B
Go

// SPDX-FileCopyrightText: 2023 Winni Neessen <wn@neessen.dev>
//
// SPDX-License-Identifier: MIT
package logranger
import (
"bufio"
"net"
)
// Connection represents a connection to a network resource.
type Connection struct {
conn net.Conn
id string
rb *bufio.Reader
wb *bufio.Writer
}
// NewConnection creates a new Connection object with the provided net.Conn.
// The Connection object holds a reference to the provided net.Conn, along with an ID string,
// bufio.Reader, and bufio.Writer. It returns a pointer to the created Connection object.
func NewConnection(nc net.Conn) *Connection {
c := &Connection{
conn: nc,
id: "foo",
rb: bufio.NewReader(nc),
wb: bufio.NewWriter(nc),
}
return c
}