Skip to content

Commit ace3b0a

Browse files
committed
docs: add more doc comments
1 parent 7162d18 commit ace3b0a

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
// spell-checker:words myevents bgapi noevents nixevent sendevent
1414

15+
// Client represents a client FreeSWITCH connection.
1516
type Client struct {
1617
conn *conn
1718
chErr chan error

cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
)
1111

12+
// command defines a structure of a ESL command.
1213
type command struct {
1314
name string
1415
params string

event.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"time"
1616
)
1717

18+
// Event represents an ESL event with headers and a body.
1819
type Event struct {
1920
headers map[string]string
2021
body []byte

events.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"strings"
66
)
77

8+
// eventNames is a map that contains the predefined names of various events as keys.
89
var eventNames = map[string]struct{}{
910
// spell-checker:disable
1011
"CUSTOM": {},

options.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import (
66
"log/slog"
77
)
88

9+
// Option is a function type used to modify configuration options.
910
type Option func(*config)
1011

1112
// WithEvents returns an Option that sets the events channel of a config.
13+
//
14+
// If the autoClose parameter is specified, the channel will be automatically
15+
// closed when the connection to the server is closed.
1216
func WithEvents(events chan<- Event, autoClose ...bool) Option {
1317
return func(c *config) {
1418
c.events = events
@@ -23,12 +27,16 @@ func WithLog(log *slog.Logger) Option {
2327
}
2428
}
2529

30+
// WithDumpIn sets the writer to record all incoming messages.
31+
// It is used for logging during debugging.
2632
func WithDumpIn(w io.Writer) Option {
2733
return func(c *config) {
2834
c.r = w
2935
}
3036
}
3137

38+
// WithDumpOut sets the writer to record all outgoing commands.
39+
// It is used for logging during debugging.
3240
func WithDumpOut(w io.Writer) Option {
3341
return func(c *config) {
3442
c.w = w

0 commit comments

Comments
 (0)