Updated vendored dependencies

This commit is contained in:
Matthieu Grieger 2016-07-11 16:03:02 -07:00
parent 66be67719a
commit f918d2397d
27 changed files with 781 additions and 266 deletions

View file

@ -1,6 +1,9 @@
MumbleDJ Changelog
==================
### July 11, 2016 -- `v3.1.1`
* Updated vendored dependencies to hopefully address the following issue: https://github.com/matthieugrieger/mumbledj/issues/169.
### July 10, 2016 -- `v3.1.0`
* File path for user `p12` certificate can now be provided for authenticating as a registered user via the `--p12` commandline flag or the `connection.user_p12` configuration value.
* Added `!register` command for registering the bot on the server.

10
glide.lock generated
View file

@ -1,5 +1,5 @@
hash: 092daa9c068b920c11d1e8d72da8f9e908b15810a75407b8337c1f8154ef0dee
updated: 2016-07-04T10:05:43.753074408-07:00
hash: b68f7c8a3b59d7dac3e12321ed6a2265b553c2856ae70e0ed5e960ba8412f8d8
updated: 2016-07-11T16:01:20.19606261-07:00
imports:
- name: github.com/antonholmquist/jason
version: c23cef7eaa75a6a5b8810120e167bd590d8fd2ab
@ -14,7 +14,7 @@ imports:
subpackages:
- proto
- name: github.com/hashicorp/hcl
version: 61f5143284c041681f76a5b63efcb232aaa94737
version: 364df430845abef160a0bfb3a59979f746bf4956
subpackages:
- hcl/ast
- hcl/parser
@ -27,7 +27,7 @@ imports:
- name: github.com/layeh/gopus
version: 867541549ca5f8b4db2b92fd1dded8711256a27d
- name: github.com/layeh/gumble
version: b26208eca4b75d9efdacb068241c68912437bd69
version: f0a4a2992fa9a969ef90d673374bc63a9b7948ad
subpackages:
- gumble
- gumbleffmpeg
@ -36,7 +36,7 @@ imports:
- gumble/MumbleProto
- gumble/varint
- name: github.com/magiconair/properties
version: c265cfa48dda6474e208715ca93e987829f572f8
version: e2f061ecfdaca9f35b2e2c12346ffc526f138137
- name: github.com/mitchellh/mapstructure
version: d2dd0262208475919e1a362f675cfc0e7c10e905
- name: github.com/Sirupsen/logrus

View file

@ -32,7 +32,7 @@ func init() {
services.DJ = DJ
bot.DJ = DJ
DJ.Version = "v3.1.0"
DJ.Version = "v3.1.1"
logrus.SetLevel(logrus.WarnLevel)
}

View file

@ -81,9 +81,20 @@ FOO
* Boolean values: `true`, `false`
* Arrays can be made by wrapping it in `[]`. Example:
`["foo", "bar", 42]`. Arrays can contain primitives
and other arrays, but cannot contain objects. Objects must
use the block syntax shown below.
`["foo", "bar", 42]`. Arrays can contain primitives,
other arrays, and objects. As an alternative, lists
of objects can be created with repeated blocks, using
this structure:
```hcl
service {
key = "value"
}
service {
key = "value"
}
```
Objects and nested objects are created using the structure shown below:

View file

@ -194,6 +194,27 @@ func TestDecode_interface(t *testing.T) {
},
},
},
{
"list_of_maps.hcl",
false,
map[string]interface{}{
"foo": []interface{}{
map[string]interface{}{"somekey1": "someval1"},
map[string]interface{}{"somekey2": "someval2", "someextrakey": "someextraval"},
},
},
},
{
"assign_deep.hcl",
false,
map[string]interface{}{
"resource": []interface{}{
map[string]interface{}{
"foo": []interface{}{
map[string]interface{}{
"bar": []map[string]interface{}{
map[string]interface{}{}}}}}}},
},
{
"structure_list.hcl",
false,

View file

@ -79,6 +79,13 @@ func (p *Parser) objectList() (*ast.ObjectList, error) {
}
node.Add(n)
// object lists can be optionally comma-delimited e.g. when a list of maps
// is being expressed, so a comma is allowed here - it's simply consumed
tok := p.scan()
if tok.Type != token.COMMA {
p.unscan()
}
}
return node, nil
}
@ -311,15 +318,20 @@ func (p *Parser) listType() (*ast.ListType, error) {
needComma := false
for {
tok := p.scan()
switch tok.Type {
case token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC:
if needComma {
if needComma {
switch tok.Type {
case token.COMMA, token.RBRACK:
default:
return nil, &PosError{
Pos: tok.Pos,
Err: fmt.Errorf("unexpected token: %s. Expecting %s", tok.Type, token.COMMA),
Err: fmt.Errorf(
"error parsing list, expected comma or list end, got: %s",
tok.Type),
}
}
}
switch tok.Type {
case token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC:
node, err := p.literalType()
if err != nil {
return nil, err
@ -343,6 +355,18 @@ func (p *Parser) listType() (*ast.ListType, error) {
needComma = false
continue
case token.LBRACE:
// Looks like a nested object, so parse it out
node, err := p.objectType()
if err != nil {
return nil, &PosError{
Pos: tok.Pos,
Err: fmt.Errorf(
"error while trying to parse object within list: %s", err),
}
}
l.Add(node)
needComma = true
case token.BOOL:
// TODO(arslan) should we support? not supported by HCL yet
case token.LBRACK:

View file

@ -6,6 +6,7 @@ import (
"path/filepath"
"reflect"
"runtime"
"strings"
"testing"
"github.com/hashicorp/hcl/hcl/ast"
@ -99,6 +100,58 @@ EOF
}
}
func TestListOfMaps(t *testing.T) {
src := `foo = [
{key = "bar"},
{key = "baz", key2 = "qux"},
]`
p := newParser([]byte(src))
file, err := p.Parse()
if err != nil {
t.Fatalf("err: %s", err)
}
// Here we make all sorts of assumptions about the input structure w/ type
// assertions. The intent is only for this to be a "smoke test" ensuring
// parsing actually performed its duty - giving this test something a bit
// more robust than _just_ "no error occurred".
expected := []string{`"bar"`, `"baz"`, `"qux"`}
actual := make([]string, 0, 3)
ol := file.Node.(*ast.ObjectList)
objItem := ol.Items[0]
list := objItem.Val.(*ast.ListType)
for _, node := range list.List {
obj := node.(*ast.ObjectType)
for _, item := range obj.List.Items {
val := item.Val.(*ast.LiteralType)
actual = append(actual, val.Token.Text)
}
}
if !reflect.DeepEqual(expected, actual) {
t.Fatalf("Expected: %#v, got %#v", expected, actual)
}
}
func TestListOfMaps_requiresComma(t *testing.T) {
src := `foo = [
{key = "bar"}
{key = "baz"}
]`
p := newParser([]byte(src))
_, err := p.Parse()
if err == nil {
t.Fatalf("Expected error, got none!")
}
expected := "error parsing list, expected comma or list end"
if !strings.Contains(err.Error(), expected) {
t.Fatalf("Expected err:\n %s\nTo contain:\n %s\n", err, expected)
}
}
func TestObjectType(t *testing.T) {
var literals = []struct {
src string
@ -263,6 +316,10 @@ func TestParse(t *testing.T) {
"multiple.hcl",
false,
},
{
"object_list_comma.hcl",
false,
},
{
"structure.hcl",
false,
@ -279,10 +336,6 @@ func TestParse(t *testing.T) {
"complex.hcl",
false,
},
{
"assign_deep.hcl",
true,
},
{
"types.hcl",
false,

View file

@ -0,0 +1 @@
foo = {one = 1, two = 2}

View file

@ -35,6 +35,7 @@ var data = []entry{
{"comment_aligned.input", "comment_aligned.golden"},
{"comment_standalone.input", "comment_standalone.golden"},
{"empty_block.input", "empty_block.golden"},
{"list_of_objects.input", "list_of_objects.golden"},
}
func TestFiles(t *testing.T) {

View file

@ -0,0 +1,10 @@
list_of_objects = [
{
key1 = "value1"
key2 = "value2"
},
{
key3 = "value3"
key4 = "value4"
},
]

View file

@ -0,0 +1,10 @@
list_of_objects = [
{
key1 = "value1"
key2 = "value2"
},
{
key3 = "value3"
key4 = "value4"
}
]

View file

@ -525,16 +525,27 @@ func (s *Scanner) scanEscape() rune {
// scanDigits scans a rune with the given base for n times. For example an
// octal notation \184 would yield in scanDigits(ch, 8, 3)
func (s *Scanner) scanDigits(ch rune, base, n int) rune {
start := n
for n > 0 && digitVal(ch) < base {
ch = s.next()
if ch == eof {
// If we see an EOF, we halt any more scanning of digits
// immediately.
break
}
n--
}
if n > 0 {
s.err("illegal char escape")
}
// we scanned all digits, put the last non digit char back
s.unread()
if n != start {
// we scanned all digits, put the last non digit char back,
// only if we read anything at all
s.unread()
}
return ch
}

View file

@ -283,6 +283,11 @@ func TestPosition(t *testing.T) {
}
}
func TestNullChar(t *testing.T) {
s := New([]byte("\"\\0"))
s.Scan() // Used to panic
}
func TestComment(t *testing.T) {
testTokenList(t, tokenLists["comment"])
}

View file

@ -0,0 +1,4 @@
foo = [
{somekey1 = "someval1"},
{somekey2 = "someval2", someextrakey = "someextraval"},
]

View file

@ -47,10 +47,17 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Reject_RejectType int32
const (
// TODO ??
// The rejection reason is unknown (details should be available
// in Reject.reason).
Reject_None Reject_RejectType = 0
// The client attempted to connect with an incompatible version.
Reject_WrongVersion Reject_RejectType = 1
@ -110,6 +117,7 @@ func (x *Reject_RejectType) UnmarshalJSON(data []byte) error {
*x = Reject_RejectType(value)
return nil
}
func (Reject_RejectType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0} }
type PermissionDenied_DenyType int32
@ -180,6 +188,9 @@ func (x *PermissionDenied_DenyType) UnmarshalJSON(data []byte) error {
*x = PermissionDenied_DenyType(value)
return nil
}
func (PermissionDenied_DenyType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{12, 0}
}
type ContextActionModify_Context int32
@ -219,6 +230,9 @@ func (x *ContextActionModify_Context) UnmarshalJSON(data []byte) error {
*x = ContextActionModify_Context(value)
return nil
}
func (ContextActionModify_Context) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{16, 0}
}
type ContextActionModify_Operation int32
@ -252,6 +266,9 @@ func (x *ContextActionModify_Operation) UnmarshalJSON(data []byte) error {
*x = ContextActionModify_Operation(value)
return nil
}
func (ContextActionModify_Operation) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{16, 1}
}
type Version struct {
// 2-byte Major, 1-byte Minor and 1-byte Patch version number.
@ -261,13 +278,14 @@ type Version struct {
// Client OS name.
Os *string `protobuf:"bytes,3,opt,name=os" json:"os,omitempty"`
// Client OS version.
OsVersion *string `protobuf:"bytes,4,opt,name=os_version" json:"os_version,omitempty"`
OsVersion *string `protobuf:"bytes,4,opt,name=os_version,json=osVersion" json:"os_version,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Version) Reset() { *m = Version{} }
func (m *Version) String() string { return proto.CompactTextString(m) }
func (*Version) ProtoMessage() {}
func (m *Version) Reset() { *m = Version{} }
func (m *Version) String() string { return proto.CompactTextString(m) }
func (*Version) ProtoMessage() {}
func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Version) GetVersion() uint32 {
if m != nil && m.Version != nil {
@ -304,9 +322,10 @@ type UDPTunnel struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *UDPTunnel) Reset() { *m = UDPTunnel{} }
func (m *UDPTunnel) String() string { return proto.CompactTextString(m) }
func (*UDPTunnel) ProtoMessage() {}
func (m *UDPTunnel) Reset() { *m = UDPTunnel{} }
func (m *UDPTunnel) String() string { return proto.CompactTextString(m) }
func (*UDPTunnel) ProtoMessage() {}
func (*UDPTunnel) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *UDPTunnel) GetPacket() []byte {
if m != nil {
@ -324,14 +343,15 @@ type Authenticate struct {
// Additional access tokens for server ACL groups.
Tokens []string `protobuf:"bytes,3,rep,name=tokens" json:"tokens,omitempty"`
// A list of CELT bitstream version constants supported by the client.
CeltVersions []int32 `protobuf:"varint,4,rep,name=celt_versions" json:"celt_versions,omitempty"`
CeltVersions []int32 `protobuf:"varint,4,rep,name=celt_versions,json=celtVersions" json:"celt_versions,omitempty"`
Opus *bool `protobuf:"varint,5,opt,name=opus,def=0" json:"opus,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Authenticate) Reset() { *m = Authenticate{} }
func (m *Authenticate) String() string { return proto.CompactTextString(m) }
func (*Authenticate) ProtoMessage() {}
func (m *Authenticate) Reset() { *m = Authenticate{} }
func (m *Authenticate) String() string { return proto.CompactTextString(m) }
func (*Authenticate) ProtoMessage() {}
func (*Authenticate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
const Default_Authenticate_Opus bool = false
@ -385,23 +405,24 @@ type Ping struct {
// The amount of nonce resyncs.
Resync *uint32 `protobuf:"varint,5,opt,name=resync" json:"resync,omitempty"`
// The total amount of UDP packets received.
UdpPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets" json:"udp_packets,omitempty"`
UdpPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets,json=udpPackets" json:"udp_packets,omitempty"`
// The total amount of TCP packets received.
TcpPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets" json:"tcp_packets,omitempty"`
TcpPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets,json=tcpPackets" json:"tcp_packets,omitempty"`
// UDP ping average.
UdpPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg" json:"udp_ping_avg,omitempty"`
UdpPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg,json=udpPingAvg" json:"udp_ping_avg,omitempty"`
// UDP ping variance.
UdpPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var" json:"udp_ping_var,omitempty"`
UdpPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var,json=udpPingVar" json:"udp_ping_var,omitempty"`
// TCP ping average.
TcpPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg" json:"tcp_ping_avg,omitempty"`
TcpPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg,json=tcpPingAvg" json:"tcp_ping_avg,omitempty"`
// TCP ping variance.
TcpPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var" json:"tcp_ping_var,omitempty"`
TcpPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var,json=tcpPingVar" json:"tcp_ping_var,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Ping) Reset() { *m = Ping{} }
func (m *Ping) String() string { return proto.CompactTextString(m) }
func (*Ping) ProtoMessage() {}
func (m *Ping) Reset() { *m = Ping{} }
func (m *Ping) String() string { return proto.CompactTextString(m) }
func (*Ping) ProtoMessage() {}
func (*Ping) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *Ping) GetTimestamp() uint64 {
if m != nil && m.Timestamp != nil {
@ -489,9 +510,10 @@ type Reject struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *Reject) Reset() { *m = Reject{} }
func (m *Reject) String() string { return proto.CompactTextString(m) }
func (*Reject) ProtoMessage() {}
func (m *Reject) Reset() { *m = Reject{} }
func (m *Reject) String() string { return proto.CompactTextString(m) }
func (*Reject) ProtoMessage() {}
func (*Reject) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *Reject) GetType() Reject_RejectType {
if m != nil && m.Type != nil {
@ -513,17 +535,18 @@ type ServerSync struct {
// The session of the current user.
Session *uint32 `protobuf:"varint,1,opt,name=session" json:"session,omitempty"`
// Maximum bandwidth that the user should use.
MaxBandwidth *uint32 `protobuf:"varint,2,opt,name=max_bandwidth" json:"max_bandwidth,omitempty"`
MaxBandwidth *uint32 `protobuf:"varint,2,opt,name=max_bandwidth,json=maxBandwidth" json:"max_bandwidth,omitempty"`
// Server welcome text.
WelcomeText *string `protobuf:"bytes,3,opt,name=welcome_text" json:"welcome_text,omitempty"`
// Current user permissions TODO: Confirm??
WelcomeText *string `protobuf:"bytes,3,opt,name=welcome_text,json=welcomeText" json:"welcome_text,omitempty"`
// Current user permissions in the root channel.
Permissions *uint64 `protobuf:"varint,4,opt,name=permissions" json:"permissions,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *ServerSync) Reset() { *m = ServerSync{} }
func (m *ServerSync) String() string { return proto.CompactTextString(m) }
func (*ServerSync) ProtoMessage() {}
func (m *ServerSync) Reset() { *m = ServerSync{} }
func (m *ServerSync) String() string { return proto.CompactTextString(m) }
func (*ServerSync) ProtoMessage() {}
func (*ServerSync) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *ServerSync) GetSession() uint32 {
if m != nil && m.Session != nil {
@ -556,13 +579,14 @@ func (m *ServerSync) GetPermissions() uint64 {
// Sent by the client when it wants a channel removed. Sent by the server when
// a channel has been removed and clients should be notified.
type ChannelRemove struct {
ChannelId *uint32 `protobuf:"varint,1,req,name=channel_id" json:"channel_id,omitempty"`
ChannelId *uint32 `protobuf:"varint,1,req,name=channel_id,json=channelId" json:"channel_id,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *ChannelRemove) Reset() { *m = ChannelRemove{} }
func (m *ChannelRemove) String() string { return proto.CompactTextString(m) }
func (*ChannelRemove) ProtoMessage() {}
func (m *ChannelRemove) Reset() { *m = ChannelRemove{} }
func (m *ChannelRemove) String() string { return proto.CompactTextString(m) }
func (*ChannelRemove) ProtoMessage() {}
func (*ChannelRemove) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *ChannelRemove) GetChannelId() uint32 {
if m != nil && m.ChannelId != nil {
@ -576,7 +600,7 @@ func (m *ChannelRemove) GetChannelId() uint32 {
// updated. Client may use this message to update said channel properties.
type ChannelState struct {
// Unique ID for the channel within the server.
ChannelId *uint32 `protobuf:"varint,1,opt,name=channel_id" json:"channel_id,omitempty"`
ChannelId *uint32 `protobuf:"varint,1,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"`
// channel_id of the parent channel.
Parent *uint32 `protobuf:"varint,2,opt,name=parent" json:"parent,omitempty"`
// UTF-8 encoded channel name.
@ -588,25 +612,26 @@ type ChannelState struct {
// 128 bytes
Description *string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"`
// A collection of channel_id values that should be added to links.
LinksAdd []uint32 `protobuf:"varint,6,rep,name=links_add" json:"links_add,omitempty"`
LinksAdd []uint32 `protobuf:"varint,6,rep,name=links_add,json=linksAdd" json:"links_add,omitempty"`
// A collection of channel_id values that should be removed from links.
LinksRemove []uint32 `protobuf:"varint,7,rep,name=links_remove" json:"links_remove,omitempty"`
LinksRemove []uint32 `protobuf:"varint,7,rep,name=links_remove,json=linksRemove" json:"links_remove,omitempty"`
// True if the channel is temporary.
Temporary *bool `protobuf:"varint,8,opt,name=temporary,def=0" json:"temporary,omitempty"`
// Position weight to tweak the channel position in the channel list.
Position *int32 `protobuf:"varint,9,opt,name=position,def=0" json:"position,omitempty"`
// SHA1 hash of the description if the description is 128 bytes or more.
DescriptionHash []byte `protobuf:"bytes,10,opt,name=description_hash" json:"description_hash,omitempty"`
DescriptionHash []byte `protobuf:"bytes,10,opt,name=description_hash,json=descriptionHash" json:"description_hash,omitempty"`
// Maximum number of users allowed in the channel. If this value is zero,
// the maximum number of users allowed in the channel is given by the
// server's "usersperchannel" setting.
MaxUsers *uint32 `protobuf:"varint,11,opt,name=max_users" json:"max_users,omitempty"`
MaxUsers *uint32 `protobuf:"varint,11,opt,name=max_users,json=maxUsers" json:"max_users,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *ChannelState) Reset() { *m = ChannelState{} }
func (m *ChannelState) String() string { return proto.CompactTextString(m) }
func (*ChannelState) ProtoMessage() {}
func (m *ChannelState) Reset() { *m = ChannelState{} }
func (m *ChannelState) String() string { return proto.CompactTextString(m) }
func (*ChannelState) ProtoMessage() {}
func (*ChannelState) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
const Default_ChannelState_Temporary bool = false
const Default_ChannelState_Position int32 = 0
@ -705,9 +730,10 @@ type UserRemove struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *UserRemove) Reset() { *m = UserRemove{} }
func (m *UserRemove) String() string { return proto.CompactTextString(m) }
func (*UserRemove) ProtoMessage() {}
func (m *UserRemove) Reset() { *m = UserRemove{} }
func (m *UserRemove) String() string { return proto.CompactTextString(m) }
func (*UserRemove) ProtoMessage() {}
func (*UserRemove) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *UserRemove) GetSession() uint32 {
if m != nil && m.Session != nil {
@ -749,9 +775,9 @@ type UserState struct {
// User name, UTF-8 encoded.
Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"`
// Registered user ID if the user is registered.
UserId *uint32 `protobuf:"varint,4,opt,name=user_id" json:"user_id,omitempty"`
UserId *uint32 `protobuf:"varint,4,opt,name=user_id,json=userId" json:"user_id,omitempty"`
// Channel on which the user is.
ChannelId *uint32 `protobuf:"varint,5,opt,name=channel_id" json:"channel_id,omitempty"`
ChannelId *uint32 `protobuf:"varint,5,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"`
// True if the user is muted by admin.
Mute *bool `protobuf:"varint,6,opt,name=mute" json:"mute,omitempty"`
// True if the user is deafened by admin.
@ -760,33 +786,39 @@ type UserState struct {
// being muted.
Suppress *bool `protobuf:"varint,8,opt,name=suppress" json:"suppress,omitempty"`
// True if the user has muted self.
SelfMute *bool `protobuf:"varint,9,opt,name=self_mute" json:"self_mute,omitempty"`
SelfMute *bool `protobuf:"varint,9,opt,name=self_mute,json=selfMute" json:"self_mute,omitempty"`
// True if the user has deafened self.
SelfDeaf *bool `protobuf:"varint,10,opt,name=self_deaf" json:"self_deaf,omitempty"`
SelfDeaf *bool `protobuf:"varint,10,opt,name=self_deaf,json=selfDeaf" json:"self_deaf,omitempty"`
// User image if it is less than 128 bytes.
Texture []byte `protobuf:"bytes,11,opt,name=texture" json:"texture,omitempty"`
// TODO ??
PluginContext []byte `protobuf:"bytes,12,opt,name=plugin_context" json:"plugin_context,omitempty"`
// TODO ??
PluginIdentity *string `protobuf:"bytes,13,opt,name=plugin_identity" json:"plugin_identity,omitempty"`
// The positional audio plugin identifier.
// Positional audio information is only sent to users who share
// identical plugin contexts.
//
// This value is not trasmitted to clients.
PluginContext []byte `protobuf:"bytes,12,opt,name=plugin_context,json=pluginContext" json:"plugin_context,omitempty"`
// The user's plugin-specific identity.
// This value is not transmitted to clients.
PluginIdentity *string `protobuf:"bytes,13,opt,name=plugin_identity,json=pluginIdentity" json:"plugin_identity,omitempty"`
// User comment if it is less than 128 bytes.
Comment *string `protobuf:"bytes,14,opt,name=comment" json:"comment,omitempty"`
// The hash of the user certificate.
Hash *string `protobuf:"bytes,15,opt,name=hash" json:"hash,omitempty"`
// SHA1 hash of the user comment if it 128 bytes or more.
CommentHash []byte `protobuf:"bytes,16,opt,name=comment_hash" json:"comment_hash,omitempty"`
CommentHash []byte `protobuf:"bytes,16,opt,name=comment_hash,json=commentHash" json:"comment_hash,omitempty"`
// SHA1 hash of the user picture if it 128 bytes or more.
TextureHash []byte `protobuf:"bytes,17,opt,name=texture_hash" json:"texture_hash,omitempty"`
TextureHash []byte `protobuf:"bytes,17,opt,name=texture_hash,json=textureHash" json:"texture_hash,omitempty"`
// True if the user is a priority speaker.
PrioritySpeaker *bool `protobuf:"varint,18,opt,name=priority_speaker" json:"priority_speaker,omitempty"`
PrioritySpeaker *bool `protobuf:"varint,18,opt,name=priority_speaker,json=prioritySpeaker" json:"priority_speaker,omitempty"`
// True if the user is currently recording.
Recording *bool `protobuf:"varint,19,opt,name=recording" json:"recording,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *UserState) Reset() { *m = UserState{} }
func (m *UserState) String() string { return proto.CompactTextString(m) }
func (*UserState) ProtoMessage() {}
func (m *UserState) Reset() { *m = UserState{} }
func (m *UserState) String() string { return proto.CompactTextString(m) }
func (*UserState) ProtoMessage() {}
func (*UserState) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *UserState) GetSession() uint32 {
if m != nil && m.Session != nil {
@ -933,9 +965,10 @@ type BanList struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *BanList) Reset() { *m = BanList{} }
func (m *BanList) String() string { return proto.CompactTextString(m) }
func (*BanList) ProtoMessage() {}
func (m *BanList) Reset() { *m = BanList{} }
func (m *BanList) String() string { return proto.CompactTextString(m) }
func (*BanList) ProtoMessage() {}
func (*BanList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
const Default_BanList_Query bool = false
@ -960,7 +993,7 @@ type BanList_BanEntry struct {
Mask *uint32 `protobuf:"varint,2,req,name=mask" json:"mask,omitempty"`
// User name for identification purposes (does not affect the ban).
Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"`
// TODO ??
// The certificate hash of the banned user.
Hash *string `protobuf:"bytes,4,opt,name=hash" json:"hash,omitempty"`
// Reason for the ban (does not affect the ban).
Reason *string `protobuf:"bytes,5,opt,name=reason" json:"reason,omitempty"`
@ -971,9 +1004,10 @@ type BanList_BanEntry struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *BanList_BanEntry) Reset() { *m = BanList_BanEntry{} }
func (m *BanList_BanEntry) String() string { return proto.CompactTextString(m) }
func (*BanList_BanEntry) ProtoMessage() {}
func (m *BanList_BanEntry) Reset() { *m = BanList_BanEntry{} }
func (m *BanList_BanEntry) String() string { return proto.CompactTextString(m) }
func (*BanList_BanEntry) ProtoMessage() {}
func (*BanList_BanEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10, 0} }
func (m *BanList_BanEntry) GetAddress() []byte {
if m != nil {
@ -1032,18 +1066,19 @@ type TextMessage struct {
Session []uint32 `protobuf:"varint,2,rep,name=session" json:"session,omitempty"`
// The channels to which the message is sent, identified by their
// channel_ids.
ChannelId []uint32 `protobuf:"varint,3,rep,name=channel_id" json:"channel_id,omitempty"`
ChannelId []uint32 `protobuf:"varint,3,rep,name=channel_id,json=channelId" json:"channel_id,omitempty"`
// The root channels when sending message recursively to several channels,
// identified by their channel_ids.
TreeId []uint32 `protobuf:"varint,4,rep,name=tree_id" json:"tree_id,omitempty"`
TreeId []uint32 `protobuf:"varint,4,rep,name=tree_id,json=treeId" json:"tree_id,omitempty"`
// The UTF-8 encoded message. May be HTML if the server allows.
Message *string `protobuf:"bytes,5,req,name=message" json:"message,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *TextMessage) Reset() { *m = TextMessage{} }
func (m *TextMessage) String() string { return proto.CompactTextString(m) }
func (*TextMessage) ProtoMessage() {}
func (m *TextMessage) Reset() { *m = TextMessage{} }
func (m *TextMessage) String() string { return proto.CompactTextString(m) }
func (*TextMessage) ProtoMessage() {}
func (*TextMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *TextMessage) GetActor() uint32 {
if m != nil && m.Actor != nil {
@ -1085,7 +1120,7 @@ type PermissionDenied struct {
Permission *uint32 `protobuf:"varint,1,opt,name=permission" json:"permission,omitempty"`
// channel_id for the channel where the permission was denied when type is
// Permission.
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id" json:"channel_id,omitempty"`
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"`
// The user who was denied permissions, identified by session.
Session *uint32 `protobuf:"varint,3,opt,name=session" json:"session,omitempty"`
// Textual reason for the denial.
@ -1097,9 +1132,10 @@ type PermissionDenied struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *PermissionDenied) Reset() { *m = PermissionDenied{} }
func (m *PermissionDenied) String() string { return proto.CompactTextString(m) }
func (*PermissionDenied) ProtoMessage() {}
func (m *PermissionDenied) Reset() { *m = PermissionDenied{} }
func (m *PermissionDenied) String() string { return proto.CompactTextString(m) }
func (*PermissionDenied) ProtoMessage() {}
func (*PermissionDenied) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
func (m *PermissionDenied) GetPermission() uint32 {
if m != nil && m.Permission != nil {
@ -1145,9 +1181,9 @@ func (m *PermissionDenied) GetName() string {
type ACL struct {
// Channel ID of the channel this message affects.
ChannelId *uint32 `protobuf:"varint,1,req,name=channel_id" json:"channel_id,omitempty"`
ChannelId *uint32 `protobuf:"varint,1,req,name=channel_id,json=channelId" json:"channel_id,omitempty"`
// True if the channel inherits its parent's ACLs.
InheritAcls *bool `protobuf:"varint,2,opt,name=inherit_acls,def=1" json:"inherit_acls,omitempty"`
InheritAcls *bool `protobuf:"varint,2,opt,name=inherit_acls,json=inheritAcls,def=1" json:"inherit_acls,omitempty"`
// User group specifications.
Groups []*ACL_ChanGroup `protobuf:"bytes,3,rep,name=groups" json:"groups,omitempty"`
// ACL specifications.
@ -1157,9 +1193,10 @@ type ACL struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *ACL) Reset() { *m = ACL{} }
func (m *ACL) String() string { return proto.CompactTextString(m) }
func (*ACL) ProtoMessage() {}
func (m *ACL) Reset() { *m = ACL{} }
func (m *ACL) String() string { return proto.CompactTextString(m) }
func (*ACL) ProtoMessage() {}
func (*ACL) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
const Default_ACL_InheritAcls bool = true
const Default_ACL_Query bool = false
@ -1214,13 +1251,14 @@ type ACL_ChanGroup struct {
// has been inherited, identified by user_id.
Remove []uint32 `protobuf:"varint,6,rep,name=remove" json:"remove,omitempty"`
// Users inherited, identified by user_id.
InheritedMembers []uint32 `protobuf:"varint,7,rep,name=inherited_members" json:"inherited_members,omitempty"`
InheritedMembers []uint32 `protobuf:"varint,7,rep,name=inherited_members,json=inheritedMembers" json:"inherited_members,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *ACL_ChanGroup) Reset() { *m = ACL_ChanGroup{} }
func (m *ACL_ChanGroup) String() string { return proto.CompactTextString(m) }
func (*ACL_ChanGroup) ProtoMessage() {}
func (m *ACL_ChanGroup) Reset() { *m = ACL_ChanGroup{} }
func (m *ACL_ChanGroup) String() string { return proto.CompactTextString(m) }
func (*ACL_ChanGroup) ProtoMessage() {}
func (*ACL_ChanGroup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 0} }
const Default_ACL_ChanGroup_Inherited bool = true
const Default_ACL_ChanGroup_Inherit bool = true
@ -1277,13 +1315,13 @@ func (m *ACL_ChanGroup) GetInheritedMembers() []uint32 {
type ACL_ChanACL struct {
// True if this ACL applies to the current channel.
ApplyHere *bool `protobuf:"varint,1,opt,name=apply_here,def=1" json:"apply_here,omitempty"`
ApplyHere *bool `protobuf:"varint,1,opt,name=apply_here,json=applyHere,def=1" json:"apply_here,omitempty"`
// True if this ACL applies to the sub channels.
ApplySubs *bool `protobuf:"varint,2,opt,name=apply_subs,def=1" json:"apply_subs,omitempty"`
ApplySubs *bool `protobuf:"varint,2,opt,name=apply_subs,json=applySubs,def=1" json:"apply_subs,omitempty"`
// True if the ACL has been inherited from the parent.
Inherited *bool `protobuf:"varint,3,opt,name=inherited,def=1" json:"inherited,omitempty"`
// ID of the user that is affected by this ACL.
UserId *uint32 `protobuf:"varint,4,opt,name=user_id" json:"user_id,omitempty"`
UserId *uint32 `protobuf:"varint,4,opt,name=user_id,json=userId" json:"user_id,omitempty"`
// ID of the group that is affected by this ACL.
Group *string `protobuf:"bytes,5,opt,name=group" json:"group,omitempty"`
// Bit flag field of the permissions granted by this ACL.
@ -1293,9 +1331,10 @@ type ACL_ChanACL struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *ACL_ChanACL) Reset() { *m = ACL_ChanACL{} }
func (m *ACL_ChanACL) String() string { return proto.CompactTextString(m) }
func (*ACL_ChanACL) ProtoMessage() {}
func (m *ACL_ChanACL) Reset() { *m = ACL_ChanACL{} }
func (m *ACL_ChanACL) String() string { return proto.CompactTextString(m) }
func (*ACL_ChanACL) ProtoMessage() {}
func (*ACL_ChanACL) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13, 1} }
const Default_ACL_ChanACL_ApplyHere bool = true
const Default_ACL_ChanACL_ApplySubs bool = true
@ -1361,9 +1400,10 @@ type QueryUsers struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *QueryUsers) Reset() { *m = QueryUsers{} }
func (m *QueryUsers) String() string { return proto.CompactTextString(m) }
func (*QueryUsers) ProtoMessage() {}
func (m *QueryUsers) Reset() { *m = QueryUsers{} }
func (m *QueryUsers) String() string { return proto.CompactTextString(m) }
func (*QueryUsers) ProtoMessage() {}
func (*QueryUsers) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
func (m *QueryUsers) GetIds() []uint32 {
if m != nil {
@ -1387,15 +1427,16 @@ type CryptSetup struct {
// Encryption key.
Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
// Client nonce.
ClientNonce []byte `protobuf:"bytes,2,opt,name=client_nonce" json:"client_nonce,omitempty"`
ClientNonce []byte `protobuf:"bytes,2,opt,name=client_nonce,json=clientNonce" json:"client_nonce,omitempty"`
// Server nonce.
ServerNonce []byte `protobuf:"bytes,3,opt,name=server_nonce" json:"server_nonce,omitempty"`
ServerNonce []byte `protobuf:"bytes,3,opt,name=server_nonce,json=serverNonce" json:"server_nonce,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *CryptSetup) Reset() { *m = CryptSetup{} }
func (m *CryptSetup) String() string { return proto.CompactTextString(m) }
func (*CryptSetup) ProtoMessage() {}
func (m *CryptSetup) Reset() { *m = CryptSetup{} }
func (m *CryptSetup) String() string { return proto.CompactTextString(m) }
func (*CryptSetup) ProtoMessage() {}
func (*CryptSetup) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
func (m *CryptSetup) GetKey() []byte {
if m != nil {
@ -1429,9 +1470,10 @@ type ContextActionModify struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *ContextActionModify) Reset() { *m = ContextActionModify{} }
func (m *ContextActionModify) String() string { return proto.CompactTextString(m) }
func (*ContextActionModify) ProtoMessage() {}
func (m *ContextActionModify) Reset() { *m = ContextActionModify{} }
func (m *ContextActionModify) String() string { return proto.CompactTextString(m) }
func (*ContextActionModify) ProtoMessage() {}
func (*ContextActionModify) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func (m *ContextActionModify) GetAction() string {
if m != nil && m.Action != nil {
@ -1466,15 +1508,16 @@ type ContextAction struct {
// The target User for the action, identified by session.
Session *uint32 `protobuf:"varint,1,opt,name=session" json:"session,omitempty"`
// The target Channel for the action, identified by channel_id.
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id" json:"channel_id,omitempty"`
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"`
// The action that should be executed.
Action *string `protobuf:"bytes,3,req,name=action" json:"action,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *ContextAction) Reset() { *m = ContextAction{} }
func (m *ContextAction) String() string { return proto.CompactTextString(m) }
func (*ContextAction) ProtoMessage() {}
func (m *ContextAction) Reset() { *m = ContextAction{} }
func (m *ContextAction) String() string { return proto.CompactTextString(m) }
func (*ContextAction) ProtoMessage() {}
func (*ContextAction) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
func (m *ContextAction) GetSession() uint32 {
if m != nil && m.Session != nil {
@ -1504,9 +1547,10 @@ type UserList struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *UserList) Reset() { *m = UserList{} }
func (m *UserList) String() string { return proto.CompactTextString(m) }
func (*UserList) ProtoMessage() {}
func (m *UserList) Reset() { *m = UserList{} }
func (m *UserList) String() string { return proto.CompactTextString(m) }
func (*UserList) ProtoMessage() {}
func (*UserList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (m *UserList) GetUsers() []*UserList_User {
if m != nil {
@ -1517,17 +1561,18 @@ func (m *UserList) GetUsers() []*UserList_User {
type UserList_User struct {
// Registered user ID.
UserId *uint32 `protobuf:"varint,1,req,name=user_id" json:"user_id,omitempty"`
UserId *uint32 `protobuf:"varint,1,req,name=user_id,json=userId" json:"user_id,omitempty"`
// Registered user name.
Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
LastSeen *string `protobuf:"bytes,3,opt,name=last_seen" json:"last_seen,omitempty"`
LastChannel *uint32 `protobuf:"varint,4,opt,name=last_channel" json:"last_channel,omitempty"`
LastSeen *string `protobuf:"bytes,3,opt,name=last_seen,json=lastSeen" json:"last_seen,omitempty"`
LastChannel *uint32 `protobuf:"varint,4,opt,name=last_channel,json=lastChannel" json:"last_channel,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *UserList_User) Reset() { *m = UserList_User{} }
func (m *UserList_User) String() string { return proto.CompactTextString(m) }
func (*UserList_User) ProtoMessage() {}
func (m *UserList_User) Reset() { *m = UserList_User{} }
func (m *UserList_User) String() string { return proto.CompactTextString(m) }
func (*UserList_User) ProtoMessage() {}
func (*UserList_User) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18, 0} }
func (m *UserList_User) GetUserId() uint32 {
if m != nil && m.UserId != nil {
@ -1569,9 +1614,10 @@ type VoiceTarget struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *VoiceTarget) Reset() { *m = VoiceTarget{} }
func (m *VoiceTarget) String() string { return proto.CompactTextString(m) }
func (*VoiceTarget) ProtoMessage() {}
func (m *VoiceTarget) Reset() { *m = VoiceTarget{} }
func (m *VoiceTarget) String() string { return proto.CompactTextString(m) }
func (*VoiceTarget) ProtoMessage() {}
func (*VoiceTarget) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
func (m *VoiceTarget) GetId() uint32 {
if m != nil && m.Id != nil {
@ -1590,9 +1636,9 @@ func (m *VoiceTarget) GetTargets() []*VoiceTarget_Target {
type VoiceTarget_Target struct {
// Users that are included as targets.
Session []uint32 `protobuf:"varint,1,rep,name=session" json:"session,omitempty"`
// Channels that are included as targets.
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id" json:"channel_id,omitempty"`
// TODO ??
// Channel that is included as a target.
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"`
// ACL group that is included as a target.
Group *string `protobuf:"bytes,3,opt,name=group" json:"group,omitempty"`
// True if the voice should follow links from the specified channel.
Links *bool `protobuf:"varint,4,opt,name=links,def=0" json:"links,omitempty"`
@ -1602,9 +1648,10 @@ type VoiceTarget_Target struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *VoiceTarget_Target) Reset() { *m = VoiceTarget_Target{} }
func (m *VoiceTarget_Target) String() string { return proto.CompactTextString(m) }
func (*VoiceTarget_Target) ProtoMessage() {}
func (m *VoiceTarget_Target) Reset() { *m = VoiceTarget_Target{} }
func (m *VoiceTarget_Target) String() string { return proto.CompactTextString(m) }
func (*VoiceTarget_Target) ProtoMessage() {}
func (*VoiceTarget_Target) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19, 0} }
const Default_VoiceTarget_Target_Links bool = false
const Default_VoiceTarget_Target_Children bool = false
@ -1649,7 +1696,7 @@ func (m *VoiceTarget_Target) GetChildren() bool {
// channel permissions.
type PermissionQuery struct {
// channel_id of the channel for which the permissions are queried.
ChannelId *uint32 `protobuf:"varint,1,opt,name=channel_id" json:"channel_id,omitempty"`
ChannelId *uint32 `protobuf:"varint,1,opt,name=channel_id,json=channelId" json:"channel_id,omitempty"`
// Channel permissions.
Permissions *uint32 `protobuf:"varint,2,opt,name=permissions" json:"permissions,omitempty"`
// True if the client should drop its current permission information for all
@ -1658,9 +1705,10 @@ type PermissionQuery struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *PermissionQuery) Reset() { *m = PermissionQuery{} }
func (m *PermissionQuery) String() string { return proto.CompactTextString(m) }
func (*PermissionQuery) ProtoMessage() {}
func (m *PermissionQuery) Reset() { *m = PermissionQuery{} }
func (m *PermissionQuery) String() string { return proto.CompactTextString(m) }
func (*PermissionQuery) ProtoMessage() {}
func (*PermissionQuery) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
const Default_PermissionQuery_Flush bool = false
@ -1693,14 +1741,15 @@ type CodecVersion struct {
// The version of the CELT Beta codec.
Beta *int32 `protobuf:"varint,2,req,name=beta" json:"beta,omitempty"`
// True if the user should prefer Alpha over Beta.
PreferAlpha *bool `protobuf:"varint,3,req,name=prefer_alpha,def=1" json:"prefer_alpha,omitempty"`
PreferAlpha *bool `protobuf:"varint,3,req,name=prefer_alpha,json=preferAlpha,def=1" json:"prefer_alpha,omitempty"`
Opus *bool `protobuf:"varint,4,opt,name=opus,def=0" json:"opus,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *CodecVersion) Reset() { *m = CodecVersion{} }
func (m *CodecVersion) String() string { return proto.CompactTextString(m) }
func (*CodecVersion) ProtoMessage() {}
func (m *CodecVersion) Reset() { *m = CodecVersion{} }
func (m *CodecVersion) String() string { return proto.CompactTextString(m) }
func (*CodecVersion) ProtoMessage() {}
func (*CodecVersion) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
const Default_CodecVersion_PreferAlpha bool = true
const Default_CodecVersion_Opus bool = false
@ -1738,30 +1787,30 @@ type UserStats struct {
// User whose stats these are.
Session *uint32 `protobuf:"varint,1,opt,name=session" json:"session,omitempty"`
// True if the message contains only mutable stats (packets, ping).
StatsOnly *bool `protobuf:"varint,2,opt,name=stats_only,def=0" json:"stats_only,omitempty"`
StatsOnly *bool `protobuf:"varint,2,opt,name=stats_only,json=statsOnly,def=0" json:"stats_only,omitempty"`
// Full user certificate chain of the user certificate in DER format.
Certificates [][]byte `protobuf:"bytes,3,rep,name=certificates" json:"certificates,omitempty"`
// Packet statistics for packets received from the client.
FromClient *UserStats_Stats `protobuf:"bytes,4,opt,name=from_client" json:"from_client,omitempty"`
FromClient *UserStats_Stats `protobuf:"bytes,4,opt,name=from_client,json=fromClient" json:"from_client,omitempty"`
// Packet statistics for packets sent by the server.
FromServer *UserStats_Stats `protobuf:"bytes,5,opt,name=from_server" json:"from_server,omitempty"`
FromServer *UserStats_Stats `protobuf:"bytes,5,opt,name=from_server,json=fromServer" json:"from_server,omitempty"`
// Amount of UDP packets sent.
UdpPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets" json:"udp_packets,omitempty"`
UdpPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets,json=udpPackets" json:"udp_packets,omitempty"`
// Amount of TCP packets sent.
TcpPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets" json:"tcp_packets,omitempty"`
TcpPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets,json=tcpPackets" json:"tcp_packets,omitempty"`
// UDP ping average.
UdpPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg" json:"udp_ping_avg,omitempty"`
UdpPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg,json=udpPingAvg" json:"udp_ping_avg,omitempty"`
// UDP ping variance.
UdpPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var" json:"udp_ping_var,omitempty"`
UdpPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var,json=udpPingVar" json:"udp_ping_var,omitempty"`
// TCP ping average.
TcpPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg" json:"tcp_ping_avg,omitempty"`
TcpPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg,json=tcpPingAvg" json:"tcp_ping_avg,omitempty"`
// TCP ping variance.
TcpPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var" json:"tcp_ping_var,omitempty"`
TcpPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var,json=tcpPingVar" json:"tcp_ping_var,omitempty"`
// Client version.
Version *Version `protobuf:"bytes,12,opt,name=version" json:"version,omitempty"`
// A list of CELT bitstream version constants supported by the client of this
// user.
CeltVersions []int32 `protobuf:"varint,13,rep,name=celt_versions" json:"celt_versions,omitempty"`
CeltVersions []int32 `protobuf:"varint,13,rep,name=celt_versions,json=celtVersions" json:"celt_versions,omitempty"`
// Client IP address.
Address []byte `protobuf:"bytes,14,opt,name=address" json:"address,omitempty"`
// Bandwith used by this client.
@ -1771,14 +1820,15 @@ type UserStats struct {
// Duration since last activity.
Idlesecs *uint32 `protobuf:"varint,17,opt,name=idlesecs" json:"idlesecs,omitempty"`
// True if the user has a strong certificate.
StrongCertificate *bool `protobuf:"varint,18,opt,name=strong_certificate,def=0" json:"strong_certificate,omitempty"`
StrongCertificate *bool `protobuf:"varint,18,opt,name=strong_certificate,json=strongCertificate,def=0" json:"strong_certificate,omitempty"`
Opus *bool `protobuf:"varint,19,opt,name=opus,def=0" json:"opus,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *UserStats) Reset() { *m = UserStats{} }
func (m *UserStats) String() string { return proto.CompactTextString(m) }
func (*UserStats) ProtoMessage() {}
func (m *UserStats) Reset() { *m = UserStats{} }
func (m *UserStats) String() string { return proto.CompactTextString(m) }
func (*UserStats) ProtoMessage() {}
func (*UserStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
const Default_UserStats_StatsOnly bool = false
const Default_UserStats_StrongCertificate bool = false
@ -1929,9 +1979,10 @@ type UserStats_Stats struct {
XXX_unrecognized []byte `json:"-"`
}
func (m *UserStats_Stats) Reset() { *m = UserStats_Stats{} }
func (m *UserStats_Stats) String() string { return proto.CompactTextString(m) }
func (*UserStats_Stats) ProtoMessage() {}
func (m *UserStats_Stats) Reset() { *m = UserStats_Stats{} }
func (m *UserStats_Stats) String() string { return proto.CompactTextString(m) }
func (*UserStats_Stats) ProtoMessage() {}
func (*UserStats_Stats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22, 0} }
func (m *UserStats_Stats) GetGood() uint32 {
if m != nil && m.Good != nil {
@ -1971,17 +2022,18 @@ func (m *UserStats_Stats) GetResync() uint32 {
// normally be transmitted as hashes.
type RequestBlob struct {
// sessions of the requested UserState textures.
SessionTexture []uint32 `protobuf:"varint,1,rep,name=session_texture" json:"session_texture,omitempty"`
SessionTexture []uint32 `protobuf:"varint,1,rep,name=session_texture,json=sessionTexture" json:"session_texture,omitempty"`
// sessions of the requested UserState comments.
SessionComment []uint32 `protobuf:"varint,2,rep,name=session_comment" json:"session_comment,omitempty"`
SessionComment []uint32 `protobuf:"varint,2,rep,name=session_comment,json=sessionComment" json:"session_comment,omitempty"`
// channel_ids of the requested ChannelState descriptions.
ChannelDescription []uint32 `protobuf:"varint,3,rep,name=channel_description" json:"channel_description,omitempty"`
ChannelDescription []uint32 `protobuf:"varint,3,rep,name=channel_description,json=channelDescription" json:"channel_description,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *RequestBlob) Reset() { *m = RequestBlob{} }
func (m *RequestBlob) String() string { return proto.CompactTextString(m) }
func (*RequestBlob) ProtoMessage() {}
func (m *RequestBlob) Reset() { *m = RequestBlob{} }
func (m *RequestBlob) String() string { return proto.CompactTextString(m) }
func (*RequestBlob) ProtoMessage() {}
func (*RequestBlob) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
func (m *RequestBlob) GetSessionTexture() []uint32 {
if m != nil {
@ -2008,23 +2060,24 @@ func (m *RequestBlob) GetChannelDescription() []uint32 {
// details.
type ServerConfig struct {
// The maximum bandwidth the clients should use.
MaxBandwidth *uint32 `protobuf:"varint,1,opt,name=max_bandwidth" json:"max_bandwidth,omitempty"`
MaxBandwidth *uint32 `protobuf:"varint,1,opt,name=max_bandwidth,json=maxBandwidth" json:"max_bandwidth,omitempty"`
// Server welcome text.
WelcomeText *string `protobuf:"bytes,2,opt,name=welcome_text" json:"welcome_text,omitempty"`
WelcomeText *string `protobuf:"bytes,2,opt,name=welcome_text,json=welcomeText" json:"welcome_text,omitempty"`
// True if the server allows HTML.
AllowHtml *bool `protobuf:"varint,3,opt,name=allow_html" json:"allow_html,omitempty"`
AllowHtml *bool `protobuf:"varint,3,opt,name=allow_html,json=allowHtml" json:"allow_html,omitempty"`
// Maximum text message length.
MessageLength *uint32 `protobuf:"varint,4,opt,name=message_length" json:"message_length,omitempty"`
MessageLength *uint32 `protobuf:"varint,4,opt,name=message_length,json=messageLength" json:"message_length,omitempty"`
// Maximum image message length.
ImageMessageLength *uint32 `protobuf:"varint,5,opt,name=image_message_length" json:"image_message_length,omitempty"`
ImageMessageLength *uint32 `protobuf:"varint,5,opt,name=image_message_length,json=imageMessageLength" json:"image_message_length,omitempty"`
// The maximum number of users allowed on the server.
MaxUsers *uint32 `protobuf:"varint,6,opt,name=max_users" json:"max_users,omitempty"`
MaxUsers *uint32 `protobuf:"varint,6,opt,name=max_users,json=maxUsers" json:"max_users,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *ServerConfig) Reset() { *m = ServerConfig{} }
func (m *ServerConfig) String() string { return proto.CompactTextString(m) }
func (*ServerConfig) ProtoMessage() {}
func (m *ServerConfig) Reset() { *m = ServerConfig{} }
func (m *ServerConfig) String() string { return proto.CompactTextString(m) }
func (*ServerConfig) ProtoMessage() {}
func (*ServerConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
func (m *ServerConfig) GetMaxBandwidth() uint32 {
if m != nil && m.MaxBandwidth != nil {
@ -2077,13 +2130,14 @@ type SuggestConfig struct {
// server.
Positional *bool `protobuf:"varint,2,opt,name=positional" json:"positional,omitempty"`
// True if the administrator suggests push to talk to be used on this server.
PushToTalk *bool `protobuf:"varint,3,opt,name=push_to_talk" json:"push_to_talk,omitempty"`
PushToTalk *bool `protobuf:"varint,3,opt,name=push_to_talk,json=pushToTalk" json:"push_to_talk,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *SuggestConfig) Reset() { *m = SuggestConfig{} }
func (m *SuggestConfig) String() string { return proto.CompactTextString(m) }
func (*SuggestConfig) ProtoMessage() {}
func (m *SuggestConfig) Reset() { *m = SuggestConfig{} }
func (m *SuggestConfig) String() string { return proto.CompactTextString(m) }
func (*SuggestConfig) ProtoMessage() {}
func (*SuggestConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (m *SuggestConfig) GetVersion() uint32 {
if m != nil && m.Version != nil {
@ -2107,8 +2161,198 @@ func (m *SuggestConfig) GetPushToTalk() bool {
}
func init() {
proto.RegisterType((*Version)(nil), "MumbleProto.Version")
proto.RegisterType((*UDPTunnel)(nil), "MumbleProto.UDPTunnel")
proto.RegisterType((*Authenticate)(nil), "MumbleProto.Authenticate")
proto.RegisterType((*Ping)(nil), "MumbleProto.Ping")
proto.RegisterType((*Reject)(nil), "MumbleProto.Reject")
proto.RegisterType((*ServerSync)(nil), "MumbleProto.ServerSync")
proto.RegisterType((*ChannelRemove)(nil), "MumbleProto.ChannelRemove")
proto.RegisterType((*ChannelState)(nil), "MumbleProto.ChannelState")
proto.RegisterType((*UserRemove)(nil), "MumbleProto.UserRemove")
proto.RegisterType((*UserState)(nil), "MumbleProto.UserState")
proto.RegisterType((*BanList)(nil), "MumbleProto.BanList")
proto.RegisterType((*BanList_BanEntry)(nil), "MumbleProto.BanList.BanEntry")
proto.RegisterType((*TextMessage)(nil), "MumbleProto.TextMessage")
proto.RegisterType((*PermissionDenied)(nil), "MumbleProto.PermissionDenied")
proto.RegisterType((*ACL)(nil), "MumbleProto.ACL")
proto.RegisterType((*ACL_ChanGroup)(nil), "MumbleProto.ACL.ChanGroup")
proto.RegisterType((*ACL_ChanACL)(nil), "MumbleProto.ACL.ChanACL")
proto.RegisterType((*QueryUsers)(nil), "MumbleProto.QueryUsers")
proto.RegisterType((*CryptSetup)(nil), "MumbleProto.CryptSetup")
proto.RegisterType((*ContextActionModify)(nil), "MumbleProto.ContextActionModify")
proto.RegisterType((*ContextAction)(nil), "MumbleProto.ContextAction")
proto.RegisterType((*UserList)(nil), "MumbleProto.UserList")
proto.RegisterType((*UserList_User)(nil), "MumbleProto.UserList.User")
proto.RegisterType((*VoiceTarget)(nil), "MumbleProto.VoiceTarget")
proto.RegisterType((*VoiceTarget_Target)(nil), "MumbleProto.VoiceTarget.Target")
proto.RegisterType((*PermissionQuery)(nil), "MumbleProto.PermissionQuery")
proto.RegisterType((*CodecVersion)(nil), "MumbleProto.CodecVersion")
proto.RegisterType((*UserStats)(nil), "MumbleProto.UserStats")
proto.RegisterType((*UserStats_Stats)(nil), "MumbleProto.UserStats.Stats")
proto.RegisterType((*RequestBlob)(nil), "MumbleProto.RequestBlob")
proto.RegisterType((*ServerConfig)(nil), "MumbleProto.ServerConfig")
proto.RegisterType((*SuggestConfig)(nil), "MumbleProto.SuggestConfig")
proto.RegisterEnum("MumbleProto.Reject_RejectType", Reject_RejectType_name, Reject_RejectType_value)
proto.RegisterEnum("MumbleProto.PermissionDenied_DenyType", PermissionDenied_DenyType_name, PermissionDenied_DenyType_value)
proto.RegisterEnum("MumbleProto.ContextActionModify_Context", ContextActionModify_Context_name, ContextActionModify_Context_value)
proto.RegisterEnum("MumbleProto.ContextActionModify_Operation", ContextActionModify_Operation_name, ContextActionModify_Operation_value)
}
func init() { proto.RegisterFile("Mumble.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 2418 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xdc, 0x58, 0x4b, 0x73, 0x23, 0x49,
0x11, 0xa6, 0xf5, 0xb2, 0x94, 0x92, 0x6c, 0xb9, 0x67, 0x58, 0x84, 0xf7, 0xdd, 0x0b, 0xcb, 0x00,
0x1b, 0x66, 0x71, 0xec, 0x65, 0x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 0x92, 0xc6, 0xb6, 0x0d, 0x7c, 0x61, 0x2e, 0xaf, 0x35, 0xc1, 0xe2, 0xd2, 0xd9, 0x6a,
0x08, 0x1e, 0x99, 0xbb, 0xe7, 0xf7, 0xe0, 0x5e, 0x91, 0x6e, 0xea, 0xaf, 0x2c, 0x72, 0x31, 0xb1,
0x0d, 0xeb, 0x71, 0xc5, 0x71, 0xfe, 0x65, 0xc1, 0x48, 0xdc, 0x1b, 0x8b, 0xd8, 0x55, 0x38, 0xbf,
0xfb, 0x56, 0x65, 0x7d, 0x89, 0xb7, 0xaa, 0xd6, 0xdd, 0xb7, 0x2a, 0x4c, 0x7c, 0x7e, 0x14, 0x25,
0xcf, 0xbd, 0x45, 0xbe, 0x8c, 0x24, 0x79, 0x61, 0x1b, 0x45, 0xc8, 0x31, 0x02, 0x74, 0x1d, 0x37,
0x37, 0x1e, 0x2f, 0x52, 0xf1, 0x3c, 0x5f, 0x18, 0x53, 0x8d, 0x0d, 0xfa, 0x94, 0x41, 0xac, 0x76,
0xf7, 0xc3, 0x25, 0x09, 0xdd, 0x12, 0x96, 0x67, 0x07, 0x9b, 0x79, 0x27, 0x8d, 0x2f, 0x1a, 0xcf,
0x31, 0xbd, 0x5b, 0xcf, 0x31, 0xd7, 0x30, 0x3e, 0x5f, 0xcd, 0xe7, 0x68, 0x7f, 0xb3, 0xdb, 0x17,
0x3f, 0x9c, 0xd3, 0x95, 0xcb, 0xbc, 0x06, 0xf9, 0x91, 0x24, 0x2d, 0xb7, 0x86, 0x50, 0x90, 0xa1,
0xbf, 0x2c, 0xbc, 0x3c, 0xf1, 0x72, 0x3f, 0xba, 0x36, 0x3b, 0x04, 0xc2, 0x2e, 0x92, 0x0b, 0x44,
0x1e, 0xb5, 0x8e, 0xad, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x85, 0xe0, 0xf0, 0x3c, 0xbf, 0x17,
0x00, 0x00,
}

View file

@ -94,11 +94,12 @@ func (c *Client) handleUDPTunnel(buffer []byte) error {
}
// Session
buffer = buffer[1:]
session, n := varint.Decode(buffer)
if n <= 0 {
return errInvalidProtobuf
}
buff := buffer[n:]
buffer = buffer[n:]
user := c.Users[uint32(session)]
if user == nil {
return errInvalidProtobuf
@ -117,25 +118,25 @@ func (c *Client) handleUDPTunnel(buffer []byte) error {
// Sequence
// TODO: use in jitter buffer
_, n = varint.Decode(buff)
_, n = varint.Decode(buffer)
if n <= 0 {
return errInvalidProtobuf
}
buff = buff[n:]
buffer = buffer[n:]
// Length
length, n := varint.Decode(buff)
length, n := varint.Decode(buffer)
if n <= 0 {
return errInvalidProtobuf
}
buff = buff[n:]
buffer = buffer[n:]
// Opus audio packets set the 13th bit in the size field as the terminator.
audioLength := int(length) &^ 0x2000
if audioLength > len(buff) {
if audioLength > len(buffer) {
return errInvalidProtobuf
}
pcm, err := decoder.Decode(buff[:audioLength], AudioMaximumFrameSize)
pcm, err := decoder.Decode(buffer[:audioLength], AudioMaximumFrameSize)
if err != nil {
return err
}
@ -149,13 +150,13 @@ func (c *Client) handleUDPTunnel(buffer []byte) error {
AudioBuffer: AudioBuffer(pcm),
}
if len(buff)-audioLength == 3*4 {
if len(buffer)-audioLength == 3*4 {
// the packet has positional audio data; 3x float32
buff = buff[audioLength:]
buffer = buffer[audioLength:]
event.X = math.Float32frombits(binary.LittleEndian.Uint32(buff))
event.Y = math.Float32frombits(binary.LittleEndian.Uint32(buff[4:]))
event.Z = math.Float32frombits(binary.LittleEndian.Uint32(buff[8:]))
event.X = math.Float32frombits(binary.LittleEndian.Uint32(buffer))
event.Y = math.Float32frombits(binary.LittleEndian.Uint32(buffer[4:]))
event.Z = math.Float32frombits(binary.LittleEndian.Uint32(buffer[8:]))
event.HasPosition = true
}

View file

@ -37,15 +37,13 @@ func Ping(address string, interval, timeout time.Duration) (*PingResponse, error
if timeout < 0 {
return nil, errors.New("gumble: timeout must be positive")
}
addr, err := net.ResolveUDPAddr("udp", address)
if err != nil {
return nil, err
}
conn, err := net.DialUDP("udp", nil, addr)
deadline := time.Now().Add(timeout)
conn, err := net.DialTimeout("udp", address, timeout)
if err != nil {
return nil, err
}
defer conn.Close()
conn.SetReadDeadline(deadline)
var (
idsLock sync.Mutex
@ -83,7 +81,6 @@ func Ping(address string, interval, timeout time.Duration) (*PingResponse, error
buildSendPacket()
conn.SetReadDeadline(time.Now().Add(timeout))
for {
var incoming [24]byte
if _, err := io.ReadFull(conn, incoming[:]); err != nil {
@ -98,7 +95,7 @@ func Ping(address string, interval, timeout time.Duration) (*PingResponse, error
}
return &PingResponse{
Address: addr,
Address: conn.RemoteAddr().(*net.UDPAddr),
Ping: time.Since(sendTime),
Version: Version{
Version: binary.BigEndian.Uint32(incoming[0:]),

View file

@ -36,7 +36,17 @@ func Decode(b []byte) (int64, int) {
if (b[0]&0xFC) == 0xF4 && len(b) >= 9 {
return int64(binary.BigEndian.Uint64(b[1:])), 9
}
// TODO: 111110__ + varint Negative recursive varint
// TODO: 111111xx Byte-inverted negative two bit number (~xx)
// 111110__ + varint Negative recursive varint
if b[0]&0xFC == 0xF8 {
if v, n := Decode(b[1:]); n > 0 {
return -v, n + 1
}
return 0, 0
}
// 111111xx Byte-inverted negative two bit number (~xx)
if b[0]&0xFC == 0xFC {
return ^int64(b[0] & 0x03), 1
}
return 0, 0
}

View file

@ -0,0 +1,32 @@
package varint
import "testing"
func TestRange(t *testing.T) {
fn := func(i int64) {
var b [MaxVarintLen]byte
size := Encode(b[:], i)
if size == 0 {
t.Errorf("Encode returned size 0\n")
}
s := b[:size]
val, size := Decode(s)
if size == 0 {
t.Errorf("Decode return size 0\n")
}
if i != val {
t.Errorf("Encoded %d (%v) equals decoded %d\n", i, s, val)
}
}
for i := int64(-10000); i <= 10000; i++ {
fn(i)
}
fn(134342525)
fn(10282934828342)
fn(1028293482834200000)
}

View file

@ -11,7 +11,11 @@ const MaxVarintLen = 10
// Encode encodes the given value to varint format.
func Encode(b []byte, value int64) int {
// TODO: 111111xx Byte-inverted negative two bit number (~xx)
// 111111xx Byte-inverted negative two bit number (~xx)
if value <= -1 && value >= -4 {
b[0] = 0xFC | byte(^value&0xFF)
return 1
}
// 111110__ + varint Negative recursive varint
if value < 0 {
b[0] = 0xF8

View file

@ -2,3 +2,5 @@
*.sublime-workspace
*.un~
*.swp
.idea/
*.iml

View file

@ -5,7 +5,6 @@
package properties
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
@ -36,14 +35,14 @@ func LoadString(s string) (*Properties, error) {
// LoadFile reads a file into a Properties struct.
func LoadFile(filename string, enc Encoding) (*Properties, error) {
return loadFiles([]string{filename}, enc, false)
return loadAll([]string{filename}, enc, false)
}
// LoadFiles reads multiple files in the given order into
// a Properties struct. If 'ignoreMissing' is true then
// non-existent files will not be reported as error.
func LoadFiles(filenames []string, enc Encoding, ignoreMissing bool) (*Properties, error) {
return loadFiles(filenames, enc, ignoreMissing)
return loadAll(filenames, enc, ignoreMissing)
}
// LoadURL reads the content of the URL into a Properties struct.
@ -55,7 +54,7 @@ func LoadFiles(filenames []string, enc Encoding, ignoreMissing bool) (*Propertie
// encoding is set to UTF-8. A missing content type header is
// interpreted as 'text/plain; charset=utf-8'.
func LoadURL(url string) (*Properties, error) {
return loadURLs([]string{url}, false)
return loadAll([]string{url}, UTF8, false)
}
// LoadURLs reads the content of multiple URLs in the given order into a
@ -63,7 +62,15 @@ func LoadURL(url string) (*Properties, error) {
// not be reported as error. See LoadURL for the Content-Type header
// and the encoding.
func LoadURLs(urls []string, ignoreMissing bool) (*Properties, error) {
return loadURLs(urls, ignoreMissing)
return loadAll(urls, UTF8, ignoreMissing)
}
// LoadAll reads the content of multiple URLs or files in the given order into a
// Properties struct. If 'ignoreMissing' is true then a 404 status code or missing file will
// not be reported as error. Encoding sets the encoding for files. For the URLs please see
// LoadURL for the Content-Type header and the encoding.
func LoadAll(names []string, enc Encoding, ignoreMissing bool) (*Properties, error) {
return loadAll(names, enc, ignoreMissing)
}
// MustLoadString reads an UTF8 string into a Properties struct and
@ -98,6 +105,14 @@ func MustLoadURLs(urls []string, ignoreMissing bool) *Properties {
return must(LoadURLs(urls, ignoreMissing))
}
// MustLoadAll reads the content of multiple URLs or files in the given order into a
// Properties struct. If 'ignoreMissing' is true then a 404 status code or missing file will
// not be reported as error. Encoding sets the encoding for files. For the URLs please see
// LoadURL for the Content-Type header and the encoding. It panics on error.
func MustLoadAll(names []string, enc Encoding, ignoreMissing bool) *Properties {
return must(LoadAll(names, enc, ignoreMissing))
}
func loadBuf(buf []byte, enc Encoding) (*Properties, error) {
p, err := parse(convert(buf, enc))
if err != nil {
@ -106,66 +121,78 @@ func loadBuf(buf []byte, enc Encoding) (*Properties, error) {
return p, p.check()
}
func loadFiles(filenames []string, enc Encoding, ignoreMissing bool) (*Properties, error) {
var buf bytes.Buffer
for _, filename := range filenames {
f, err := expandFilename(filename)
func loadAll(names []string, enc Encoding, ignoreMissing bool) (*Properties, error) {
result := NewProperties()
for _, name := range names {
n, err := expandName(name)
if err != nil {
return nil, err
}
data, err := ioutil.ReadFile(f)
var p *Properties
if strings.HasPrefix(n, "http://") || strings.HasPrefix(n, "https://") {
p, err = loadURL(n, ignoreMissing)
} else {
p, err = loadFile(n, enc, ignoreMissing)
}
if err != nil {
if ignoreMissing && os.IsNotExist(err) {
LogPrintf("properties: %s not found. skipping", filename)
continue
}
return nil, err
}
result.Merge(p)
// concatenate the buffers and add a new line in case
// the previous file didn't end with a new line
buf.Write(data)
buf.WriteRune('\n')
}
return loadBuf(buf.Bytes(), enc)
return result, result.check()
}
func loadURLs(urls []string, ignoreMissing bool) (*Properties, error) {
var buf bytes.Buffer
for _, u := range urls {
resp, err := http.Get(u)
if err != nil {
return nil, fmt.Errorf("properties: error fetching %q. %s", u, err)
func loadFile(filename string, enc Encoding, ignoreMissing bool) (*Properties, error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
if ignoreMissing && os.IsNotExist(err) {
LogPrintf("properties: %s not found. skipping", filename)
return NewProperties(), nil
}
if resp.StatusCode == 404 && ignoreMissing {
LogPrintf("properties: %s returned %d. skipping", u, resp.StatusCode)
continue
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("properties: %s returned %d", u, resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, fmt.Errorf("properties: %s error reading response. %s", u, err)
}
ct := resp.Header.Get("Content-Type")
var enc Encoding
switch strings.ToLower(ct) {
case "text/plain", "text/plain; charset=iso-8859-1", "text/plain; charset=latin1":
enc = ISO_8859_1
case "", "text/plain; charset=utf-8":
enc = UTF8
default:
return nil, fmt.Errorf("properties: invalid content type %s", ct)
}
buf.WriteString(convert(body, enc))
buf.WriteRune('\n')
return nil, err
}
return loadBuf(buf.Bytes(), UTF8)
p, err := parse(convert(data, enc))
if err != nil {
return nil, err
}
return p, nil
}
func loadURL(url string, ignoreMissing bool) (*Properties, error) {
resp, err := http.Get(url)
if err != nil {
return nil, fmt.Errorf("properties: error fetching %q. %s", url, err)
}
if resp.StatusCode == 404 && ignoreMissing {
LogPrintf("properties: %s returned %d. skipping", url, resp.StatusCode)
return NewProperties(), nil
}
if resp.StatusCode != 200 {
return nil, fmt.Errorf("properties: %s returned %d", url, resp.StatusCode)
}
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, fmt.Errorf("properties: %s error reading response. %s", url, err)
}
ct := resp.Header.Get("Content-Type")
var enc Encoding
switch strings.ToLower(ct) {
case "text/plain", "text/plain; charset=iso-8859-1", "text/plain; charset=latin1":
enc = ISO_8859_1
case "", "text/plain; charset=utf-8":
enc = UTF8
default:
return nil, fmt.Errorf("properties: invalid content type %s", ct)
}
p, err := parse(convert(body, enc))
if err != nil {
return nil, err
}
return p, nil
}
func must(p *Properties, err error) *Properties {
@ -175,12 +202,12 @@ func must(p *Properties, err error) *Properties {
return p
}
// expandFilename expands ${ENV_VAR} expressions in a filename.
// expandName expands ${ENV_VAR} expressions in a name.
// If the environment variable does not exist then it will be replaced
// with an empty string. Malformed expressions like "${ENV_VAR" will
// be reported as error.
func expandFilename(filename string) (string, error) {
return expand(filename, make(map[string]bool), "${", "}", make(map[string]string))
func expandName(name string) (string, error) {
return expand(name, make(map[string]bool), "${", "}", make(map[string]string))
}
// Interprets a byte buffer either as an ISO-8859-1 or UTF-8 encoded string.

View file

@ -124,6 +124,16 @@ func (s *LoadSuite) TestLoadURLFailInvalidEncoding(c *C) {
c.Assert(err, ErrorMatches, ".*invalid content type.*")
}
func (s *LoadSuite) TestLoadAll(c *C) {
filename := s.makeFile(c, "key=value")
filename2 := s.makeFile(c, "key2=value3")
filename3 := s.makeFile(c, "key=value4")
srv := testServer()
defer srv.Close()
p := MustLoadAll([]string{filename, filename2, srv.URL + "/a", srv.URL + "/b", filename3}, UTF8, false)
assertKeyValues(c, "", p, "key", "value4", "key2", "value2")
}
func (s *LoadSuite) SetUpSuite(c *C) {
s.tempFiles = make([]string, 0)
}

View file

@ -630,6 +630,26 @@ func (p *Properties) Delete(key string) {
p.k = newKeys
}
// Merge merges properties, comments and keys from other *Properties into p
func (p *Properties) Merge(other *Properties) {
for k,v := range other.m {
p.m[k] = v
}
for k,v := range other.c {
p.c[k] = v
}
outer:
for _, otherKey := range other.k {
for _, key := range p.k {
if otherKey == key {
continue outer
}
}
p.k = append(p.k, otherKey)
}
}
// ----------------------------------------------------------------------------
// check expands all values and returns an error if a circular reference or

View file

@ -842,6 +842,20 @@ func (s *TestSuite) TestDeleteUnknownKey(c *C) {
c.Check(len(p.k), Equals, 1)
}
func (s *TestSuite) TestMerge(c *C) {
input1 := "#comment\nkey=value\nkey2=value2"
input2 := "#another comment\nkey=another value\nkey3=value3"
p1, err := parse(input1)
c.Assert(err, IsNil)
p2, err := parse(input2)
p1.Merge(p2)
c.Check(len(p1.m), Equals, 3)
c.Check(len(p1.c), Equals, 1)
c.Check(len(p1.k), Equals, 3)
c.Check(p1.MustGet("key"), Equals, "another value")
c.Check(p1.GetComment("key"), Equals, "another comment")
}
// ----------------------------------------------------------------------------
// tests all combinations of delimiters, leading and/or trailing whitespace and newlines.