Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/panjf2000/gnet
/ functions
Functions
759 in github.com/panjf2000/gnet
⨍
Functions
759
◇
Types & classes
122
↓ 5 callers
Function
Cleanup
Cleanup does something windup for logger, like closing, flushing, etc.
pkg/logging/logger.go:229
↓ 5 callers
Function
Error
Error prints err if it's not nil.
pkg/logging/logger.go:238
↓ 5 callers
Method
Fd
Gfd returns the gfd of socket. Gfd() gfd.GFD Fd returns the underlying file descriptor.
gnet.go:317
↓ 5 callers
Function
FromContext
FromContext retrieves context value of the Conn stored in ctx, if any.
context.go:34
↓ 5 callers
Method
GC
(secs int)
eventloop_unix_test.go:266
↓ 5 callers
Method
InboundBuffered
InboundBuffered returns the number of bytes that can be read from the current buffer.
gnet.go:256
↓ 5 callers
Method
ModReadWrite
ModReadWrite modifies the given file descriptor with readable and writable events in the poller.
pkg/netpoll/poller_epoll_default.go:229
↓ 5 callers
Function
OpenPoller
OpenPoller instantiates a poller.
pkg/netpoll/poller_kqueue_ultimate.go:44
↓ 5 callers
Method
Validate
Validate checks whether the engine is available.
gnet.go:60
↓ 5 callers
Function
WithBindToDevice
WithBindToDevice sets the name of the interface to which the listening socket will be bound. It is only available on Linux at the moment, an error wi
options.go:307
↓ 5 callers
Function
WithTCPNoDelay
WithTCPNoDelay enable/disable the TCP_NODELAY socket option.
options.go:248
↓ 5 callers
Function
cas
(p *unsafe.Pointer, old, new *node)
pkg/queue/lock_free_queue.go:169
↓ 5 callers
Method
close
(c *conn, err error)
eventloop_windows.go:282
↓ 5 callers
Method
closeEventLoops
()
engine_unix.go:63
↓ 5 callers
Method
getConn
(fd int)
conn_map.go:63
↓ 5 callers
Method
instance
()
pkg/buffer/elastic/elastic_ring_buffer.go:30
↓ 5 callers
Method
read
(c *conn)
eventloop_unix.go:255
↓ 5 callers
Method
ticker
(ctx context.Context)
eventloop_unix.go:416
↓ 4 callers
Function
CreateLoggerAsLocalFile
CreateLoggerAsLocalFile setups the logger by local file path.
pkg/logging/logger.go:201
↓ 4 callers
Method
Delete
Delete removes the given file descriptor from the poller.
pkg/netpoll/poller_epoll_default.go:239
↓ 4 callers
Function
Dup
Dup duplicates the given fd and marks it close-on-exec.
pkg/socket/fd_unix.go:27
↓ 4 callers
Function
Get
Get returns a byte slice with given length from the built-in pool.
pkg/pool/byteslice/byteslice.go:34
↓ 4 callers
Function
GetTask
GetTask gets a cached Task from pool.
pkg/queue/queue.go:32
↓ 4 callers
Function
Infof
Infof logs messages at INFO level.
pkg/logging/logger.go:254
↓ 4 callers
Method
Len
Len returns the length of the underlying buffer.
pkg/buffer/elastic/elastic_ring_buffer.go:129
↓ 4 callers
Method
Length
()
pkg/queue/queue.go:47
↓ 4 callers
Function
NewClient
NewClient creates an instance of Client.
client_unix.go:45
↓ 4 callers
Method
OnBoot
OnBoot fires when the engine is ready for accepting connections. The parameter engine has information and various utilities.
gnet.go:489
↓ 4 callers
Method
OnShutdown
OnShutdown fires when the engine is being shut down, it is called right after all event-loops and connections are closed.
gnet.go:493
↓ 4 callers
Method
Printf
Printf implements the ants.Logger interface.
pkg/pool/goroutine/goroutine.go:54
↓ 4 callers
Method
ReadByte
ReadByte reads and returns the next byte from the input or ErrIsEmpty.
pkg/buffer/ring/ring_buffer.go:195
↓ 4 callers
Method
Release
Release frees all resource of this buffer.
pkg/buffer/elastic/elastic_ring_list_buffer.go:173
↓ 4 callers
Method
SetReadBuffer
SetReadBuffer sets the size of the operating system's receive buffer associated with the connection.
gnet.go:330
↓ 4 callers
Method
SetWriteBuffer
SetWriteBuffer sets the size of the operating system's transmit buffer associated with the connection.
gnet.go:334
↓ 4 callers
Method
Start
Start starts the client event-loop, handing IO events.
client_unix.go:106
↓ 4 callers
Function
WithEdgeTriggeredIOChunk
WithEdgeTriggeredIOChunk sets the number of bytes that `gnet` can read/write up to in one event loop of ET.
options.go:322
↓ 4 callers
Function
WithLoadBalancing
WithLoadBalancing picks the load-balancing algorithm for gnet engine.
options.go:198
↓ 4 callers
Function
WithLogger
WithLogger specifies a customized logger.
options.go:290
↓ 4 callers
Function
WithNumEventLoop
WithNumEventLoop sets the number of event loops for gnet engine.
options.go:205
↓ 4 callers
Function
WithReadBufferCap
WithReadBufferCap sets ReadBufferCap for reading bytes.
options.go:184
↓ 4 callers
Function
WithSocketRecvBuffer
WithSocketRecvBuffer sets the maximum socket receive buffer of kernel in bytes.
options.go:255
↓ 4 callers
Function
WithTCPKeepCount
WithTCPKeepCount sets the number of keep-alive probes that will be sent before the connection is considered dead and dropped.
options.go:241
↓ 4 callers
Function
WithTCPKeepInterval
WithTCPKeepInterval sets the interval between TCP keep-alive probes.
options.go:233
↓ 4 callers
Function
WithWriteBufferCap
WithWriteBufferCap sets WriteBufferCap for pending bytes.
options.go:191
↓ 4 callers
Method
WriteTo
(w io.Writer)
connection_unix.go:439
↓ 4 callers
Method
closeConns
()
eventloop_unix.go:100
↓ 4 callers
Function
determineEventLoops
(opts *Options)
gnet.go:801
↓ 4 callers
Method
done
()
pkg/buffer/elastic/elastic_ring_buffer.go:46
↓ 4 callers
Method
expand
()
pkg/netpoll/defs_poller_epoll.go:70
↓ 4 callers
Function
findLoopbackInterface
()
os_unix_test.go:65
↓ 4 callers
Method
getLogger
()
eventloop_windows.go:82
↓ 4 callers
Method
incCount
(row int, delta int32)
conn_matrix.go:52
↓ 4 callers
Method
init
()
conn_map.go:30
↓ 4 callers
Function
ipToSockaddr
(family int, ip net.IP, port int, zone string)
pkg/socket/sock_posix.go:72
↓ 4 callers
Function
newEventList
(size int)
pkg/netpoll/defs_poller_epoll.go:66
↓ 4 callers
Function
packTCPConn
(c *conn, buf []byte)
connection_windows.go:67
↓ 4 callers
Method
pushFront
pushFront adds the new node to the head of l.
pkg/buffer/linkedlist/linked_list_buffer.go:288
↓ 4 callers
Function
setKeepAlive
(fd int, enabled bool, idle, intvl time.Duration, cnt int)
engine_unix.go:281
↓ 4 callers
Method
shrink
()
pkg/netpoll/defs_poller_epoll.go:77
↓ 4 callers
Function
testConnMatrix
(t *testing.T, n int)
conn_matrix_test.go:48
↓ 4 callers
Method
wakePoller
()
pkg/netpoll/poller_kqueue_wakeup.go:34
↓ 3 callers
Method
AddRead
AddRead registers the given file descriptor with readable event to the poller.
pkg/netpoll/poller_epoll_default.go:199
↓ 3 callers
Method
AsyncWritev
AsyncWritev writes multiple byte slices to remote asynchronously, you don't have to invoke it within any method in EventHandler, usually you would cal
gnet.go:297
↓ 3 callers
Method
Bytes
Bytes returns all available read bytes. It does not move the read pointer and only copy the available data.
pkg/buffer/elastic/elastic_ring_buffer.go:161
↓ 3 callers
Method
CountConnections
CountConnections counts the number of currently active connections and returns it.
gnet.go:71
↓ 3 callers
Method
DialContext
DialContext is like Dial but also accepts an empty interface ctx that can be obtained later via Conn.Context.
client_unix.go:185
↓ 3 callers
Method
Enroll
Enroll is like Register, but it accepts an established net.Conn instead of a net.Addr, it's concurrency-safe.
gnet.go:407
↓ 3 callers
Method
EnrollContext
EnrollContext is like Enroll but also accepts an empty interface ctx that can be obtained later via Conn.Context.
client_unix.go:199
↓ 3 callers
Method
Execute
Execute will execute the given runnable on the event-loop at some time in the future, it's concurrency-safe.
gnet.go:410
↓ 3 callers
Function
GetTCPSockAddr
GetTCPSockAddr the structured addresses based on the protocol and raw address.
pkg/socket/tcp_socket.go:33
↓ 3 callers
Function
GetUDPSockAddr
GetUDPSockAddr the structured addresses based on the protocol and raw address.
pkg/socket/udp_socket.go:31
↓ 3 callers
Function
GetUnixSockAddr
GetUnixSockAddr the structured addresses based on the protocol and raw address.
pkg/socket/unix_socket.go:30
↓ 3 callers
Function
IPToSockaddr
IPToSockaddr converts a net.IP (with optional IPv6 Zone) to a Sockaddr Returns nil if conversion fails.
pkg/socket/sockaddr.go:68
↓ 3 callers
Method
Len
Len returns the length of the list.
pkg/buffer/linkedlist/linked_list_buffer.go:246
↓ 3 callers
Method
ListenUDP
(pc net.PacketConn)
acceptor_windows.go:63
↓ 3 callers
Function
LogLevel
LogLevel tells what the default logging level is.
pkg/logging/logger.go:196
↓ 3 callers
Function
New
New instantiates an elastic.Buffer and returns it.
pkg/buffer/elastic/elastic_ring_list_buffer.go:36
↓ 3 callers
Function
NewGFD
NewGFD creates a new GFD.
internal/gfd/gfd.go:93
↓ 3 callers
Function
Put
Put returns the byte slice to the built-in pool.
pkg/pool/byteslice/byteslice.go:39
↓ 3 callers
Method
ReadFrom
ReadFrom implements io.ReaderFrom.
pkg/buffer/ring/ring_buffer.go:343
↓ 3 callers
Method
SendTo
not concurrency-safe SendTo transmits a message to the given address, it's not concurrency-safe. It is available only for UDP sockets, an ErrUnsupport
gnet.go:269
↓ 3 callers
Function
SetKeepAlive
SetKeepAlive enables/disables the TCP keepalive feature on the socket.
pkg/socket/sockopts_darwin.go:43
↓ 3 callers
Method
SetKeepAlivePeriod
SetKeepAlivePeriod tells the operating system to send keep-alive messages on the connection and sets period between TCP keep-alive probes.
gnet.go:352
↓ 3 callers
Method
SetNoDelay
SetNoDelay controls whether the operating system should delay packet transmission in hopes of sending fewer packets (Nagle's algorithm). The default i
gnet.go:373
↓ 3 callers
Method
Stop
Stop stops the client event-loop.
client_unix.go:153
↓ 3 callers
Method
Warnf
Warnf logs messages at WARN level.
pkg/logging/logger.go:288
↓ 3 callers
Function
WithMulticastInterfaceIndex
WithMulticastInterfaceIndex sets the interface name where UDP multicast sockets will be bound to.
options.go:297
↓ 3 callers
Function
WithReuseAddr
WithReuseAddr sets SO_REUSEADDR socket option.
options.go:219
↓ 3 callers
Function
WithSocketSendBuffer
WithSocketSendBuffer sets the maximum socket send buffer of kernel in bytes.
options.go:262
↓ 3 callers
Method
WriteByte
WriteByte writes one byte into buffer.
pkg/buffer/ring/ring_buffer.go:254
↓ 3 callers
Method
WriteString
WriteString writes the contents of the string s to buffer, which accepts a slice of bytes.
pkg/buffer/ring/ring_buffer.go:312
↓ 3 callers
Method
WriteTo
WriteTo implements io.WriterTo.
pkg/buffer/ring/ring_buffer.go:395
↓ 3 callers
Method
addConn
(c *conn, index int)
conn_map.go:52
↓ 3 callers
Function
benchServeGC
(b *testing.B, network, addr string, async bool, elNum int, initConnCount int32)
eventloop_unix_test.go:91
↓ 3 callers
Method
countConn
()
eventloop_unix.go:96
↓ 3 callers
Function
errnoErr
errnoErr returns common boxed Errno values, to prevent allocations at runtime.
pkg/netpoll/syscall_errors_linux.go:21
↓ 3 callers
Function
getInterfaceIP
(ifname string, ipv4 bool)
os_unix_test.go:218
↓ 3 callers
Method
grow
(newCap int)
pkg/buffer/ring/ring_buffer.go:487
↓ 3 callers
Method
handleAction
(c *conn, action Action)
eventloop_unix.go:477
↓ 3 callers
Method
handleAction
(c *conn, action Action)
eventloop_windows.go:299
← previous
next →
101–200 of 759, ranked by callers