mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-24 13:04:24 +00:00
22 lines
474 B
Go
22 lines
474 B
Go
|
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
|
||
|
}
|
||
|
}
|