feat: implement codec

This commit is contained in:
2022-04-22 20:50:58 +08:00
parent 9083504cfc
commit cf8fa335a6
9 changed files with 332 additions and 0 deletions

21
client/option.go Normal file
View File

@ -0,0 +1,21 @@
package client
import "krwu.top/krpc.v1/codec"
type Options struct {
MagicNumber int
CodecType codec.Type
}
var DefaultOptions = &Options{
MagicNumber: codec.MagicNumber,
CodecType: codec.GobType,
}
type Option func(*Options)
func WithCodecType(t codec.Type) Option {
return func(o *Options) {
o.CodecType = t
}
}