Documentation
¶
Overview ¶
Copyright (C) 2026 by saba <contact me via issue>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
In addition, no derivative work may use the name or imply association with this application without prior consent.
Copyright (C) 2026 by saba <contact me via issue>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
In addition, no derivative work may use the name or imply association with this application without prior consent.
Copyright (C) 2026 by saba <contact me via issue>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
In addition, no derivative work may use the name or imply association with this application without prior consent.
Copyright (C) 2026 by saba <contact me via issue>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
In addition, no derivative work may use the name or imply association with this application without prior consent.
Index ¶
- func AbsInt64(x int64) int64
- func PipeConn(a, b net.Conn)
- func RunClosers(closers ...func() error) error
- func TryCloseRead(target any) error
- func TryCloseWrite(target any) error
- func WriteFull(w io.Writer, b []byte) error
- type CloseReader
- type CloseWriter
- type ReadOnlyConn
- func (c *ReadOnlyConn) Close() error
- func (c *ReadOnlyConn) LocalAddr() net.Addr
- func (c *ReadOnlyConn) RemoteAddr() net.Addr
- func (c *ReadOnlyConn) SetDeadline(time.Time) error
- func (c *ReadOnlyConn) SetReadDeadline(time.Time) error
- func (c *ReadOnlyConn) SetWriteDeadline(time.Time) error
- func (c *ReadOnlyConn) Write([]byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PipeConn ¶
PipeConn copies data bidirectionally between a and b, then closes both.
It attempts half-close when supported:
- after copying src->dst: CloseWrite(dst) and CloseRead(src)
func RunClosers ¶
RunClosers executes closers in order and returns the first error.
func TryCloseRead ¶
TryCloseRead calls CloseRead when supported.
func TryCloseWrite ¶
TryCloseWrite calls CloseWrite when supported. If half-close isn't supported, it falls back to Close() when available to avoid deadlocks (e.g. WebSocket net.Conn wrappers without CloseWrite).
Types ¶
type CloseReader ¶
type CloseReader interface {
CloseRead() error
}
CloseReader is implemented by conns that support half-close on the read side.
type CloseWriter ¶
type CloseWriter interface {
CloseWrite() error
}
CloseWriter is implemented by conns that support half-close on the write side.
type ReadOnlyConn ¶
ReadOnlyConn wraps a bytes.Reader as a net.Conn for probing/parsing code paths. Writes always fail with io.ErrClosedPipe.
func (*ReadOnlyConn) Close ¶
func (c *ReadOnlyConn) Close() error
func (*ReadOnlyConn) LocalAddr ¶
func (c *ReadOnlyConn) LocalAddr() net.Addr
func (*ReadOnlyConn) RemoteAddr ¶
func (c *ReadOnlyConn) RemoteAddr() net.Addr
func (*ReadOnlyConn) SetDeadline ¶
func (c *ReadOnlyConn) SetDeadline(time.Time) error
func (*ReadOnlyConn) SetReadDeadline ¶
func (c *ReadOnlyConn) SetReadDeadline(time.Time) error
func (*ReadOnlyConn) SetWriteDeadline ¶
func (c *ReadOnlyConn) SetWriteDeadline(time.Time) error