forked from External/grumble
grumble: build fixes.
This commit is contained in:
parent
bb74f0485b
commit
5a3b9cc76a
6 changed files with 1412 additions and 82 deletions
21
client.go
21
client.go
|
|
@ -10,13 +10,14 @@ import (
|
||||||
"code.google.com/p/goprotobuf/proto"
|
"code.google.com/p/goprotobuf/proto"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
"mumbleapp.com/grumble/pkg/blobstore"
|
"mumbleapp.com/grumble/pkg/blobstore"
|
||||||
"mumbleapp.com/grumble/pkg/cryptstate"
|
"mumbleapp.com/grumble/pkg/cryptstate"
|
||||||
"mumbleapp.com/grumble/pkg/mumbleproto"
|
"mumbleapp.com/grumble/pkg/mumbleproto"
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"mumbleapp.com/grumble/pkg/packetdatastream"
|
"mumbleapp.com/grumble/pkg/packetdatastream"
|
||||||
|
"net"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
@ -197,7 +198,7 @@ func (client *Client) RejectAuth(rejectType mumbleproto.Reject_RejectType, reaso
|
||||||
}
|
}
|
||||||
|
|
||||||
client.sendMessage(&mumbleproto.Reject{
|
client.sendMessage(&mumbleproto.Reject{
|
||||||
Type: mumbleproto.NewReject_RejectType(rejectType),
|
Type: rejectType.Enum(),
|
||||||
Reason: reasonString,
|
Reason: reasonString,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -246,7 +247,7 @@ func (c *Client) sendPermissionDeniedType(denyType mumbleproto.PermissionDenied_
|
||||||
// Send permission denied by type (and user)
|
// Send permission denied by type (and user)
|
||||||
func (c *Client) sendPermissionDeniedTypeUser(denyType mumbleproto.PermissionDenied_DenyType, user *Client) {
|
func (c *Client) sendPermissionDeniedTypeUser(denyType mumbleproto.PermissionDenied_DenyType, user *Client) {
|
||||||
pd := &mumbleproto.PermissionDenied{
|
pd := &mumbleproto.PermissionDenied{
|
||||||
Type: mumbleproto.NewPermissionDenied_DenyType(denyType),
|
Type: denyType.Enum(),
|
||||||
}
|
}
|
||||||
if user != nil {
|
if user != nil {
|
||||||
pd.Session = proto.Uint32(uint32(user.Session))
|
pd.Session = proto.Uint32(uint32(user.Session))
|
||||||
|
|
@ -264,7 +265,7 @@ func (c *Client) sendPermissionDenied(who *Client, where *Channel, what Permissi
|
||||||
Permission: proto.Uint32(uint32(what)),
|
Permission: proto.Uint32(uint32(what)),
|
||||||
ChannelId: proto.Uint32(uint32(where.Id)),
|
ChannelId: proto.Uint32(uint32(where.Id)),
|
||||||
Session: proto.Uint32(who.Session),
|
Session: proto.Uint32(who.Session),
|
||||||
Type: mumbleproto.NewPermissionDenied_DenyType(mumbleproto.PermissionDenied_Permission),
|
Type: mumbleproto.PermissionDenied_Permission.Enum(),
|
||||||
}
|
}
|
||||||
err := c.sendMessage(pd)
|
err := c.sendMessage(pd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -276,7 +277,7 @@ func (c *Client) sendPermissionDenied(who *Client, where *Channel, what Permissi
|
||||||
// Send permission denied fallback
|
// Send permission denied fallback
|
||||||
func (client *Client) sendPermissionDeniedFallback(denyType mumbleproto.PermissionDenied_DenyType, version uint32, text string) {
|
func (client *Client) sendPermissionDeniedFallback(denyType mumbleproto.PermissionDenied_DenyType, version uint32, text string) {
|
||||||
pd := &mumbleproto.PermissionDenied{
|
pd := &mumbleproto.PermissionDenied{
|
||||||
Type: mumbleproto.NewPermissionDenied_DenyType(denyType),
|
Type: denyType.Enum(),
|
||||||
}
|
}
|
||||||
if client.Version < version {
|
if client.Version < version {
|
||||||
pd.Reason = proto.String(text)
|
pd.Reason = proto.String(text)
|
||||||
|
|
@ -381,7 +382,11 @@ func (client *Client) sendMessage(msg interface{}) error {
|
||||||
if kind == mumbleproto.MessageUDPTunnel {
|
if kind == mumbleproto.MessageUDPTunnel {
|
||||||
msgData = msg.([]byte)
|
msgData = msg.([]byte)
|
||||||
} else {
|
} else {
|
||||||
msgData, err = proto.Marshal(msg)
|
protoMsg, ok := (msg).(proto.Message)
|
||||||
|
if !ok {
|
||||||
|
return errors.New("client: exepcted a proto.Message")
|
||||||
|
}
|
||||||
|
msgData, err = proto.Marshal(protoMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,16 @@
|
||||||
// Code generated by protoc-gen-go from "types.proto"
|
// Code generated by protoc-gen-go.
|
||||||
|
// source: types.proto
|
||||||
// DO NOT EDIT!
|
// DO NOT EDIT!
|
||||||
|
|
||||||
package freezer
|
package freezer
|
||||||
|
|
||||||
import proto "code.google.com/p/goprotobuf/proto"
|
import proto "code.google.com/p/goprotobuf/proto"
|
||||||
import "math"
|
import json "encoding/json"
|
||||||
|
import math "math"
|
||||||
|
|
||||||
// Reference proto & math imports to suppress error if they are not otherwise used.
|
// Reference proto, json, and math imports to suppress error if they are not otherwise used.
|
||||||
var _ = proto.GetString
|
var _ = proto.Marshal
|
||||||
|
var _ = &json.SyntaxError{}
|
||||||
var _ = math.Inf
|
var _ = math.Inf
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
|
@ -15,20 +18,43 @@ type Server struct {
|
||||||
BanList *BanList `protobuf:"bytes,3,opt,name=ban_list" json:"ban_list,omitempty"`
|
BanList *BanList `protobuf:"bytes,3,opt,name=ban_list" json:"ban_list,omitempty"`
|
||||||
Channels []*Channel `protobuf:"bytes,4,rep,name=channels" json:"channels,omitempty"`
|
Channels []*Channel `protobuf:"bytes,4,rep,name=channels" json:"channels,omitempty"`
|
||||||
Users []*User `protobuf:"bytes,5,rep,name=users" json:"users,omitempty"`
|
Users []*User `protobuf:"bytes,5,rep,name=users" json:"users,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Server) Reset() { *this = Server{} }
|
func (this *Server) Reset() { *this = Server{} }
|
||||||
func (this *Server) String() string { return proto.CompactTextString(this) }
|
func (this *Server) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*Server) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *Server) GetBanList() *BanList {
|
||||||
|
if this != nil {
|
||||||
|
return this.BanList
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type ConfigKeyValuePair struct {
|
type ConfigKeyValuePair struct {
|
||||||
Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
|
Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
|
||||||
Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
|
Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ConfigKeyValuePair) Reset() { *this = ConfigKeyValuePair{} }
|
func (this *ConfigKeyValuePair) Reset() { *this = ConfigKeyValuePair{} }
|
||||||
func (this *ConfigKeyValuePair) String() string { return proto.CompactTextString(this) }
|
func (this *ConfigKeyValuePair) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*ConfigKeyValuePair) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *ConfigKeyValuePair) GetKey() string {
|
||||||
|
if this != nil && this.Key != nil {
|
||||||
|
return *this.Key
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ConfigKeyValuePair) GetValue() string {
|
||||||
|
if this != nil && this.Value != nil {
|
||||||
|
return *this.Value
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type Ban struct {
|
type Ban struct {
|
||||||
Ip []byte `protobuf:"bytes,1,opt,name=ip" json:"ip,omitempty"`
|
Ip []byte `protobuf:"bytes,1,opt,name=ip" json:"ip,omitempty"`
|
||||||
|
|
@ -38,19 +64,70 @@ type Ban struct {
|
||||||
Reason *string `protobuf:"bytes,5,opt,name=reason" json:"reason,omitempty"`
|
Reason *string `protobuf:"bytes,5,opt,name=reason" json:"reason,omitempty"`
|
||||||
Start *int64 `protobuf:"varint,6,opt,name=start" json:"start,omitempty"`
|
Start *int64 `protobuf:"varint,6,opt,name=start" json:"start,omitempty"`
|
||||||
Duration *uint32 `protobuf:"varint,7,opt,name=duration" json:"duration,omitempty"`
|
Duration *uint32 `protobuf:"varint,7,opt,name=duration" json:"duration,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Ban) Reset() { *this = Ban{} }
|
func (this *Ban) Reset() { *this = Ban{} }
|
||||||
func (this *Ban) String() string { return proto.CompactTextString(this) }
|
func (this *Ban) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*Ban) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *Ban) GetIp() []byte {
|
||||||
|
if this != nil {
|
||||||
|
return this.Ip
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Ban) GetMask() uint32 {
|
||||||
|
if this != nil && this.Mask != nil {
|
||||||
|
return *this.Mask
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Ban) GetUsername() string {
|
||||||
|
if this != nil && this.Username != nil {
|
||||||
|
return *this.Username
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Ban) GetCertHash() string {
|
||||||
|
if this != nil && this.CertHash != nil {
|
||||||
|
return *this.CertHash
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Ban) GetReason() string {
|
||||||
|
if this != nil && this.Reason != nil {
|
||||||
|
return *this.Reason
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Ban) GetStart() int64 {
|
||||||
|
if this != nil && this.Start != nil {
|
||||||
|
return *this.Start
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Ban) GetDuration() uint32 {
|
||||||
|
if this != nil && this.Duration != nil {
|
||||||
|
return *this.Duration
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type BanList struct {
|
type BanList struct {
|
||||||
Bans []*Ban `protobuf:"bytes,1,rep,name=bans" json:"bans,omitempty"`
|
Bans []*Ban `protobuf:"bytes,1,rep,name=bans" json:"bans,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *BanList) Reset() { *this = BanList{} }
|
func (this *BanList) Reset() { *this = BanList{} }
|
||||||
func (this *BanList) String() string { return proto.CompactTextString(this) }
|
func (this *BanList) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*BanList) ProtoMessage() {}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
|
|
@ -62,19 +139,91 @@ type User struct {
|
||||||
CommentBlob *string `protobuf:"bytes,7,opt,name=comment_blob" json:"comment_blob,omitempty"`
|
CommentBlob *string `protobuf:"bytes,7,opt,name=comment_blob" json:"comment_blob,omitempty"`
|
||||||
LastChannelId *uint32 `protobuf:"varint,8,opt,name=last_channel_id" json:"last_channel_id,omitempty"`
|
LastChannelId *uint32 `protobuf:"varint,8,opt,name=last_channel_id" json:"last_channel_id,omitempty"`
|
||||||
LastActive *uint64 `protobuf:"varint,9,opt,name=last_active" json:"last_active,omitempty"`
|
LastActive *uint64 `protobuf:"varint,9,opt,name=last_active" json:"last_active,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *User) Reset() { *this = User{} }
|
func (this *User) Reset() { *this = User{} }
|
||||||
func (this *User) String() string { return proto.CompactTextString(this) }
|
func (this *User) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*User) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *User) GetId() uint32 {
|
||||||
|
if this != nil && this.Id != nil {
|
||||||
|
return *this.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) GetName() string {
|
||||||
|
if this != nil && this.Name != nil {
|
||||||
|
return *this.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) GetPassword() string {
|
||||||
|
if this != nil && this.Password != nil {
|
||||||
|
return *this.Password
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) GetCertHash() string {
|
||||||
|
if this != nil && this.CertHash != nil {
|
||||||
|
return *this.CertHash
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) GetEmail() string {
|
||||||
|
if this != nil && this.Email != nil {
|
||||||
|
return *this.Email
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) GetTextureBlob() string {
|
||||||
|
if this != nil && this.TextureBlob != nil {
|
||||||
|
return *this.TextureBlob
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) GetCommentBlob() string {
|
||||||
|
if this != nil && this.CommentBlob != nil {
|
||||||
|
return *this.CommentBlob
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) GetLastChannelId() uint32 {
|
||||||
|
if this != nil && this.LastChannelId != nil {
|
||||||
|
return *this.LastChannelId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) GetLastActive() uint64 {
|
||||||
|
if this != nil && this.LastActive != nil {
|
||||||
|
return *this.LastActive
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type UserRemove struct {
|
type UserRemove struct {
|
||||||
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *UserRemove) Reset() { *this = UserRemove{} }
|
func (this *UserRemove) Reset() { *this = UserRemove{} }
|
||||||
func (this *UserRemove) String() string { return proto.CompactTextString(this) }
|
func (this *UserRemove) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*UserRemove) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *UserRemove) GetId() uint32 {
|
||||||
|
if this != nil && this.Id != nil {
|
||||||
|
return *this.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
|
|
@ -86,19 +235,70 @@ type Channel struct {
|
||||||
Acl []*ACL `protobuf:"bytes,7,rep,name=acl" json:"acl,omitempty"`
|
Acl []*ACL `protobuf:"bytes,7,rep,name=acl" json:"acl,omitempty"`
|
||||||
Groups []*Group `protobuf:"bytes,8,rep,name=groups" json:"groups,omitempty"`
|
Groups []*Group `protobuf:"bytes,8,rep,name=groups" json:"groups,omitempty"`
|
||||||
DescriptionBlob *string `protobuf:"bytes,9,opt,name=description_blob" json:"description_blob,omitempty"`
|
DescriptionBlob *string `protobuf:"bytes,9,opt,name=description_blob" json:"description_blob,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Channel) Reset() { *this = Channel{} }
|
func (this *Channel) Reset() { *this = Channel{} }
|
||||||
func (this *Channel) String() string { return proto.CompactTextString(this) }
|
func (this *Channel) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*Channel) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *Channel) GetId() uint32 {
|
||||||
|
if this != nil && this.Id != nil {
|
||||||
|
return *this.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Channel) GetName() string {
|
||||||
|
if this != nil && this.Name != nil {
|
||||||
|
return *this.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Channel) GetParentId() uint32 {
|
||||||
|
if this != nil && this.ParentId != nil {
|
||||||
|
return *this.ParentId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Channel) GetPosition() int64 {
|
||||||
|
if this != nil && this.Position != nil {
|
||||||
|
return *this.Position
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Channel) GetInheritAcl() bool {
|
||||||
|
if this != nil && this.InheritAcl != nil {
|
||||||
|
return *this.InheritAcl
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Channel) GetDescriptionBlob() string {
|
||||||
|
if this != nil && this.DescriptionBlob != nil {
|
||||||
|
return *this.DescriptionBlob
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type ChannelRemove struct {
|
type ChannelRemove struct {
|
||||||
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ChannelRemove) Reset() { *this = ChannelRemove{} }
|
func (this *ChannelRemove) Reset() { *this = ChannelRemove{} }
|
||||||
func (this *ChannelRemove) String() string { return proto.CompactTextString(this) }
|
func (this *ChannelRemove) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*ChannelRemove) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *ChannelRemove) GetId() uint32 {
|
||||||
|
if this != nil && this.Id != nil {
|
||||||
|
return *this.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type ACL struct {
|
type ACL struct {
|
||||||
UserId *uint32 `protobuf:"varint,1,opt,name=user_id" json:"user_id,omitempty"`
|
UserId *uint32 `protobuf:"varint,1,opt,name=user_id" json:"user_id,omitempty"`
|
||||||
|
|
@ -107,11 +307,54 @@ type ACL struct {
|
||||||
ApplySubs *bool `protobuf:"varint,4,opt,name=apply_subs" json:"apply_subs,omitempty"`
|
ApplySubs *bool `protobuf:"varint,4,opt,name=apply_subs" json:"apply_subs,omitempty"`
|
||||||
Allow *uint32 `protobuf:"varint,5,opt,name=allow" json:"allow,omitempty"`
|
Allow *uint32 `protobuf:"varint,5,opt,name=allow" json:"allow,omitempty"`
|
||||||
Deny *uint32 `protobuf:"varint,6,opt,name=deny" json:"deny,omitempty"`
|
Deny *uint32 `protobuf:"varint,6,opt,name=deny" json:"deny,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ACL) Reset() { *this = ACL{} }
|
func (this *ACL) Reset() { *this = ACL{} }
|
||||||
func (this *ACL) String() string { return proto.CompactTextString(this) }
|
func (this *ACL) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*ACL) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *ACL) GetUserId() uint32 {
|
||||||
|
if this != nil && this.UserId != nil {
|
||||||
|
return *this.UserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL) GetGroup() string {
|
||||||
|
if this != nil && this.Group != nil {
|
||||||
|
return *this.Group
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL) GetApplyHere() bool {
|
||||||
|
if this != nil && this.ApplyHere != nil {
|
||||||
|
return *this.ApplyHere
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL) GetApplySubs() bool {
|
||||||
|
if this != nil && this.ApplySubs != nil {
|
||||||
|
return *this.ApplySubs
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL) GetAllow() uint32 {
|
||||||
|
if this != nil && this.Allow != nil {
|
||||||
|
return *this.Allow
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL) GetDeny() uint32 {
|
||||||
|
if this != nil && this.Deny != nil {
|
||||||
|
return *this.Deny
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type Group struct {
|
type Group struct {
|
||||||
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||||
|
|
@ -119,11 +362,33 @@ type Group struct {
|
||||||
Inheritable *bool `protobuf:"varint,3,opt,name=inheritable" json:"inheritable,omitempty"`
|
Inheritable *bool `protobuf:"varint,3,opt,name=inheritable" json:"inheritable,omitempty"`
|
||||||
Add []uint32 `protobuf:"varint,4,rep,name=add" json:"add,omitempty"`
|
Add []uint32 `protobuf:"varint,4,rep,name=add" json:"add,omitempty"`
|
||||||
Remove []uint32 `protobuf:"varint,5,rep,name=remove" json:"remove,omitempty"`
|
Remove []uint32 `protobuf:"varint,5,rep,name=remove" json:"remove,omitempty"`
|
||||||
XXX_unrecognized []byte `json:",omitempty"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Group) Reset() { *this = Group{} }
|
func (this *Group) Reset() { *this = Group{} }
|
||||||
func (this *Group) String() string { return proto.CompactTextString(this) }
|
func (this *Group) String() string { return proto.CompactTextString(this) }
|
||||||
|
func (*Group) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (this *Group) GetName() string {
|
||||||
|
if this != nil && this.Name != nil {
|
||||||
|
return *this.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Group) GetInherit() bool {
|
||||||
|
if this != nil && this.Inherit != nil {
|
||||||
|
return *this.Inherit
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Group) GetInheritable() bool {
|
||||||
|
if this != nil && this.Inheritable != nil {
|
||||||
|
return *this.Inheritable
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ func (walker *Walker) Next() (entries []interface{}, err error) {
|
||||||
switch typeKind(kind) {
|
switch typeKind(kind) {
|
||||||
case ServerType:
|
case ServerType:
|
||||||
server := &Server{}
|
server := &Server{}
|
||||||
err = proto.Unmarshal(buf, &server)
|
err = proto.Unmarshal(buf, server)
|
||||||
if isEOF(err) {
|
if isEOF(err) {
|
||||||
break
|
break
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -145,6 +145,7 @@ message PermissionDenied {
|
||||||
MissingCertificate = 7;
|
MissingCertificate = 7;
|
||||||
UserName = 8;
|
UserName = 8;
|
||||||
ChannelFull = 9;
|
ChannelFull = 9;
|
||||||
|
NestingLimit = 10;
|
||||||
}
|
}
|
||||||
optional uint32 permission = 1;
|
optional uint32 permission = 1;
|
||||||
optional uint32 channel_id = 2;
|
optional uint32 channel_id = 2;
|
||||||
|
|
|
||||||
2
ssh.go
2
ssh.go
|
|
@ -3,9 +3,9 @@ package main
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"code.google.com/p/go.crypto/ssh"
|
"code.google.com/p/go.crypto/ssh"
|
||||||
|
"code.google.com/p/go.crypto/ssh/terminal"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
"exp/terminal"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue