WithConnection sets an existing secrets runtime connection to use.
(conn net.Conn)
| 54 | |
| 55 | // WithConnection sets an existing secrets runtime connection to use. |
| 56 | func WithConnection(conn net.Conn) ManualLaunchOption { |
| 57 | return func(s *cfg) error { |
| 58 | if s.conn != nil { |
| 59 | return errors.New("connection already set") |
| 60 | } |
| 61 | hijackedConn, err := ipc.Hijackify(conn, hijackTimeout) |
| 62 | if err != nil { |
| 63 | return fmt.Errorf("external plugin rejected: %w", err) |
| 64 | } |
| 65 | s.conn = hijackedConn |
| 66 | return nil |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | type cfg struct { |
| 71 | Config |