Example #1
0
func extractSession(s *server.Session) (*proto.Auth, *srvdir_proto.AuthExtra, error) {
	var auth proto.Auth
	if err := proto.UnpackInterfaceField(s.Auth(), &auth); err != nil {
		return nil, nil, err
	}

	var authExtra srvdir_proto.AuthExtra
	if err := proto.UnpackInterfaceField(s.Auth().Extra, &authExtra); err != nil {
		return nil, nil, err
	}

	return &auth, &authExtra, nil
}
Example #2
0
func (b *HTTPBinder) Bind(rawOpts interface{}) (net.Listener, string, error) {
	var opts proto.HTTPOptions
	if err := proto.UnpackInterfaceField(rawOpts, &opts); err != nil {
		return nil, "", err
	}

	return b.BindOpts(&opts)
}
Example #3
0
func UnpackAuthExtra(extra interface{}) (authExtra *AuthExtra, err error) {
	authExtra = new(AuthExtra)
	err = proto.UnpackInterfaceField(extra, authExtra)
	return
}