1 // RPC primitives for safcm: basic connection implementation
3 // SPDX-License-Identifier: GPL-3.0-or-later
4 // Copyright (C) 2021-2024 Simon Ruderich
18 func NewGobConn(r io.Reader, w io.Writer) *GobConn {
20 enc: gob.NewEncoder(w),
21 dec: gob.NewDecoder(r),
25 func (c *GobConn) Send(x Msg) error {
26 // & lets Encode send the interface itself and not a concrete type
27 // which is necessary to Decode as an interface
28 return c.enc.Encode(&x)
31 func (c *GobConn) Recv() (Msg, error) {
33 err := c.dec.Decode(&x)