code: func (*TeleportTunnelMarshaler) MarshalReverseTunnel(rt ReverseTunnel, opts ...MarshalOption) ([]byte, error) {
  	cfg, err := collectOptions(opts)
  	if err != nil {
  		return nil, trace.Wrap(err)
  	}
  	type tunv1 interface {
  		V1() *ReverseTunnelV1
  	}
  	type tunv2 interface {
  		V2() *ReverseTunnelV2
  	}
  	version := cfg.GetVersion()
  	switch version {
  	case V1:
  		v, ok := rt.(tunv1)
  		if !ok {
  			return nil, trace.BadParameter("don't know how to marshal %v", V1)
  		}
  		return json.Marshal(v.V1())
  	case V2:
  		v, ok := rt.(tunv2)
  		if !ok {
  			return nil, trace.BadParameter("don't know how to marshal %v", V2)
  		}
  		v2 := v.V2()
  		if !cfg.PreserveResourceID {
  			// avoid modifying the original object
  			// to prevent unexpected data races
  			copy := *v2
  			copy.SetResourceID(0)
  			v2 = &copy
  		}
  		return utils.FastMarshal(v2)
  	default:
  		return nil, trace.BadParameter("version %v is not supported", version)
  	}
  }
docs: // MarshalRole marshalls role into JSON