Exemplo n.º 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
}
Exemplo n.º 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)
}
Exemplo n.º 3
0
func UnpackAuthExtra(extra interface{}) (authExtra *AuthExtra, err error) {
	authExtra = new(AuthExtra)
	err = proto.UnpackInterfaceField(extra, authExtra)
	return
}