mirror of
https://github.com/yudai/gotty.git
synced 2025-12-28 21:28:50 +01:00
Refactor
This commit is contained in:
parent
54403dd678
commit
a6133f34b7
54 changed files with 2140 additions and 1334 deletions
21
server/run_option.go
Normal file
21
server/run_option.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// RunOptions holds a set of configurations for Server.Run().
|
||||
type RunOptions struct {
|
||||
gracefullCtx context.Context
|
||||
}
|
||||
|
||||
// RunOption is an option of Server.Run().
|
||||
type RunOption func(*RunOptions)
|
||||
|
||||
// WithGracefullContext accepts a context to shutdown a Server
|
||||
// with care for existing client connections.
|
||||
func WithGracefullContext(ctx context.Context) RunOption {
|
||||
return func(options *RunOptions) {
|
||||
options.gracefullCtx = ctx
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue