mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-06-25 17:16:34 +00:00

## Summary In order to make cloudflared behavior more predictable and prevent an exhaustion of resources, we have decided to add session limits that can be configured by the user. This first commit introduces the session limiter and adds it to the UDP handling path. For now the limiter is set to run only in unlimited mode.
22 lines
338 B
Go
22 lines
338 B
Go
package main
|
|
|
|
import (
|
|
"encoding/gob"
|
|
"os"
|
|
|
|
"go.uber.org/mock/mockgen/model"
|
|
)
|
|
|
|
func gobMode(path string) (*model.Package, error) {
|
|
in, err := os.Open(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer in.Close()
|
|
var pkg model.Package
|
|
if err := gob.NewDecoder(in).Decode(&pkg); err != nil {
|
|
return nil, err
|
|
}
|
|
return &pkg, nil
|
|
}
|