mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-20 06:10:00 -08:00
Update for Go 1.
This commit is contained in:
parent
4114a83d64
commit
e46a65109f
31 changed files with 901 additions and 202 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -22,6 +22,5 @@ _testmain.go
|
||||||
build.out
|
build.out
|
||||||
test.out
|
test.out
|
||||||
goinstall.log
|
goinstall.log
|
||||||
*.pb.go
|
|
||||||
*.sqlite
|
*.sqlite
|
||||||
build/
|
build/
|
||||||
|
|
@ -14,7 +14,6 @@ type Channel struct {
|
||||||
Name string
|
Name string
|
||||||
Position int
|
Position int
|
||||||
|
|
||||||
|
|
||||||
temporary bool
|
temporary bool
|
||||||
clients map[uint32]*Client
|
clients map[uint32]*Client
|
||||||
parent *Channel
|
parent *Channel
|
||||||
|
|
|
||||||
16
client.go
16
client.go
|
|
@ -7,16 +7,16 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"code.google.com/p/goprotobuf/proto"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"goprotobuf.googlecode.com/hg/proto"
|
"github.com/mkrautz/grumble/pkg/blobstore"
|
||||||
"grumble/blobstore"
|
"github.com/mkrautz/grumble/pkg/cryptstate"
|
||||||
"grumble/cryptstate"
|
"github.com/mkrautz/grumble/pkg/mumbleproto"
|
||||||
"grumble/mumbleproto"
|
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"packetdatastream"
|
"github.com/mkrautz/grumble/pkg/packetdatastream"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
@ -567,11 +567,11 @@ func (client *Client) sendChannelTree(channel *Channel) {
|
||||||
|
|
||||||
// Try to do a crypto resync
|
// Try to do a crypto resync
|
||||||
func (client *Client) cryptResync() {
|
func (client *Client) cryptResync() {
|
||||||
goodElapsed := time.Seconds() - client.crypt.LastGoodTime
|
goodElapsed := time.Now().Unix() - client.crypt.LastGoodTime
|
||||||
if goodElapsed > 5 {
|
if goodElapsed > 5 {
|
||||||
requestElapsed := time.Seconds() - client.lastResync
|
requestElapsed := time.Now().Unix() - client.lastResync
|
||||||
if requestElapsed > 5 {
|
if requestElapsed > 5 {
|
||||||
client.lastResync = time.Seconds()
|
client.lastResync = time.Now().Unix()
|
||||||
cryptsetup := &mumbleproto.CryptSetup{}
|
cryptsetup := &mumbleproto.CryptSetup{}
|
||||||
err := client.sendMessage(cryptsetup)
|
err := client.sendMessage(cryptsetup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
23
freeze.go
23
freeze.go
|
|
@ -5,12 +5,12 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"code.google.com/p/goprotobuf/proto"
|
||||||
"errors"
|
"errors"
|
||||||
"goprotobuf.googlecode.com/hg/proto"
|
"github.com/mkrautz/grumble/pkg/ban"
|
||||||
"grumble/ban"
|
"github.com/mkrautz/grumble/pkg/freezer"
|
||||||
"grumble/freezer"
|
"github.com/mkrautz/grumble/pkg/mumbleproto"
|
||||||
"grumble/mumbleproto"
|
"github.com/mkrautz/grumble/pkg/serverconf"
|
||||||
"grumble/serverconf"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
|
@ -36,7 +36,7 @@ func (server *Server) FreezeToFile() (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
f, err := ioutil.TempFile(filepath.Join(Args.DataDir, "servers", strconv.Itoa64(server.Id)), ".main.fz_")
|
f, err := ioutil.TempFile(filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10)), ".main.fz_")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ func (server *Server) FreezeToFile() (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = os.Rename(f.Name(), filepath.Join(Args.DataDir, "servers", strconv.Itoa64(server.Id), "main.fz"))
|
err = os.Rename(f.Name(), filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "main.fz"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +72,7 @@ func (server *Server) FreezeToFile() (err error) {
|
||||||
|
|
||||||
// Open a new freeze log
|
// Open a new freeze log
|
||||||
func (server *Server) openFreezeLog() (err error) {
|
func (server *Server) openFreezeLog() (err error) {
|
||||||
logfn := filepath.Join(Args.DataDir, "servers", strconv.Itoa64(server.Id), "log.fz")
|
logfn := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "log.fz")
|
||||||
err = os.Remove(logfn)
|
err = os.Remove(logfn)
|
||||||
if pe, ok := err.(*os.PathError); ok && pe.Err == os.ENOENT {
|
if pe, ok := err.(*os.PathError); ok && pe.Err == os.ENOENT {
|
||||||
// OK. File does not exist...
|
// OK. File does not exist...
|
||||||
|
|
@ -399,7 +399,7 @@ func (group *Group) Freeze() (fgrp *freezer.Group, err error) {
|
||||||
// in memory, a new full seralized server will be written and synced to
|
// in memory, a new full seralized server will be written and synced to
|
||||||
// disk, and the existing log file will be removed.
|
// disk, and the existing log file will be removed.
|
||||||
func NewServerFromFrozen(name string) (s *Server, err error) {
|
func NewServerFromFrozen(name string) (s *Server, err error) {
|
||||||
id, err := strconv.Atoi64(name)
|
id, err := strconv.ParseInt(name, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +695,7 @@ func (server *Server) UpdateFrozenUser(client *Client, state *mumbleproto.UserSt
|
||||||
// Full sync If there's no userstate messgae provided, or if there is one, and
|
// Full sync If there's no userstate messgae provided, or if there is one, and
|
||||||
// it includes a registration operation.
|
// it includes a registration operation.
|
||||||
user := client.user
|
user := client.user
|
||||||
nanos := time.Nanoseconds()
|
nanos := time.Now().Unix()
|
||||||
if state == nil || state.UserId != nil {
|
if state == nil || state.UserId != nil {
|
||||||
fu, err := user.Freeze()
|
fu, err := user.Freeze()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -735,7 +735,7 @@ func (server *Server) UpdateFrozenUserLastChannel(client *Client) {
|
||||||
fu := &freezer.User{}
|
fu := &freezer.User{}
|
||||||
fu.Id = proto.Uint32(user.Id)
|
fu.Id = proto.Uint32(user.Id)
|
||||||
fu.LastChannelId = proto.Uint32(uint32(client.Channel.Id))
|
fu.LastChannelId = proto.Uint32(uint32(client.Channel.Id))
|
||||||
fu.LastActive = proto.Uint64(uint64(time.Nanoseconds()))
|
fu.LastActive = proto.Uint64(uint64(time.Now().Unix()))
|
||||||
|
|
||||||
err := server.freezelog.Put(fu)
|
err := server.freezelog.Put(fu)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -746,7 +746,6 @@ func (server *Server) UpdateFrozenUserLastChannel(client *Client) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Mark a user as deleted in the datstore.
|
// Mark a user as deleted in the datstore.
|
||||||
func (server *Server) DeleteFrozenUser(user *User) {
|
func (server *Server) DeleteFrozenUser(user *User) {
|
||||||
err := server.freezelog.Put(&freezer.UserRemove{Id: proto.Uint32(user.Id)})
|
err := server.freezelog.Put(&freezer.UserRemove{Id: proto.Uint32(user.Id)})
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,15 @@ import (
|
||||||
// certificate. Output PEM-encoded DER representations of the resulting
|
// certificate. Output PEM-encoded DER representations of the resulting
|
||||||
// certificate and private key to certpath and keypath.
|
// certificate and private key to certpath and keypath.
|
||||||
func GenerateSelfSignedCert(certpath, keypath string) (err error) {
|
func GenerateSelfSignedCert(certpath, keypath string) (err error) {
|
||||||
now := time.Seconds()
|
now := time.Now()
|
||||||
tmpl := &x509.Certificate{
|
tmpl := &x509.Certificate{
|
||||||
SerialNumber: big.NewInt(0),
|
SerialNumber: big.NewInt(0),
|
||||||
Subject: pkix.Name{
|
Subject: pkix.Name{
|
||||||
CommonName: "Grumble Autogenerated Certificate",
|
CommonName: "Grumble Autogenerated Certificate",
|
||||||
},
|
},
|
||||||
NotBefore: time.SecondsToUTC(now - 300),
|
NotBefore: now.Add(-300 * time.Second),
|
||||||
NotAfter: time.SecondsToUTC(now + 60*60*24*365), // valid for 1 year.
|
// Valid for 1 year.
|
||||||
|
NotAfter: now.Add(24 * time.Hour * 365),
|
||||||
|
|
||||||
SubjectKeyId: []byte{1, 2, 3, 4},
|
SubjectKeyId: []byte{1, 2, 3, 4},
|
||||||
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
|
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grumble/blobstore"
|
"github.com/mkrautz/grumble/pkg/blobstore"
|
||||||
"grumble/logtarget"
|
"github.com/mkrautz/grumble/pkg/logtarget"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
|
||||||
12
message.go
12
message.go
|
|
@ -5,14 +5,14 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"code.google.com/p/goprotobuf/proto"
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"goprotobuf.googlecode.com/hg/proto"
|
"github.com/mkrautz/grumble/pkg/ban"
|
||||||
"grumble/ban"
|
"github.com/mkrautz/grumble/pkg/blobstore"
|
||||||
"grumble/blobstore"
|
"github.com/mkrautz/grumble/pkg/freezer"
|
||||||
"grumble/freezer"
|
"github.com/mkrautz/grumble/pkg/mumbleproto"
|
||||||
"grumble/mumbleproto"
|
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
@ -519,7 +519,7 @@ func (server *Server) handleUserRemoveMessage(client *Client, msg *Message) {
|
||||||
}
|
}
|
||||||
ban.Username = removeClient.ShownName()
|
ban.Username = removeClient.ShownName()
|
||||||
ban.CertHash = removeClient.CertHash
|
ban.CertHash = removeClient.CertHash
|
||||||
ban.Start = time.Seconds()
|
ban.Start = time.Now().Unix()
|
||||||
ban.Duration = 0
|
ban.Duration = 0
|
||||||
|
|
||||||
server.banlock.Lock()
|
server.banlock.Lock()
|
||||||
|
|
|
||||||
112
murmurdb.go
112
murmurdb.go
|
|
@ -11,9 +11,9 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"grumble/ban"
|
"github.com/mkrautz/grumble/pkg/ban"
|
||||||
"grumble/blobstore"
|
"github.com/mkrautz/grumble/pkg/blobstore"
|
||||||
"grumble/sqlite"
|
"database/sql"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -39,20 +39,23 @@ const SQLiteSupport = true
|
||||||
|
|
||||||
// Import the structure of an existing Murmur SQLite database.
|
// Import the structure of an existing Murmur SQLite database.
|
||||||
func MurmurImport(filename string) (err error) {
|
func MurmurImport(filename string) (err error) {
|
||||||
db, err := sqlite.Open(filename)
|
db, err := sql.Open("sqlite", filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt, err := db.Prepare("SELECT server_id FROM servers")
|
rows, err := db.Query("SELECT server_id FROM servers")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
var serverids []int64
|
var serverids []int64
|
||||||
var sid int64
|
var sid int64
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
stmt.Scan(&sid)
|
err = rows.Scan(&sid)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
serverids = append(serverids, sid)
|
serverids = append(serverids, sid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,7 +67,7 @@ func MurmurImport(filename string) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.Mkdir(filepath.Join(Args.DataDir, strconv.Itoa64(sid)), 0750)
|
err = os.Mkdir(filepath.Join(Args.DataDir, strconv.FormatInt(sid, 10)), 0750)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +84,8 @@ func MurmurImport(filename string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new Server from a Murmur SQLite database
|
// Create a new Server from a Murmur SQLite database
|
||||||
func NewServerFromSQLite(id int64, db *sqlite.Conn) (s *Server, err error) {
|
func NewServerFromSQLite(id int64, db *sql.DB) (s *Server, err error) {
|
||||||
s, err = NewServer(id, "", int(DefaultPort+id-1))
|
s, err = NewServer(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -126,19 +129,20 @@ func NewServerFromSQLite(id int64, db *sqlite.Conn) (s *Server, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add channel metadata (channel_info table from SQLite) by reading the SQLite database.
|
// Add channel metadata (channel_info table from SQLite) by reading the SQLite database.
|
||||||
func populateChannelInfoFromDatabase(server *Server, c *Channel, db *sqlite.Conn) error {
|
func populateChannelInfoFromDatabase(server *Server, c *Channel, db *sql.DB) error {
|
||||||
stmt, err := db.Prepare("SELECT value FROM channel_info WHERE server_id=? AND channel_id=? AND key=?")
|
stmt, err := db.Prepare("SELECT value FROM channel_info WHERE server_id=? AND channel_id=? AND key=?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch description
|
// Fetch description
|
||||||
if err := stmt.Exec(server.Id, c.Id, ChannelInfoDescription); err != nil {
|
rows, err := stmt.Query(server.Id, c.Id, ChannelInfoDescription)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var description string
|
var description string
|
||||||
err = stmt.Scan(&description)
|
err = rows.Scan(&description)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -152,17 +156,14 @@ func populateChannelInfoFromDatabase(server *Server, c *Channel, db *sqlite.Conn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := stmt.Reset(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch position
|
// Fetch position
|
||||||
if err := stmt.Exec(server.Id, c.Id, ChannelInfoPosition); err != nil {
|
rows, err = stmt.Query(server.Id, c.Id, ChannelInfoPosition)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var pos int
|
var pos int
|
||||||
if err := stmt.Scan(&pos); err != nil {
|
if err := rows.Scan(&pos); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,17 +174,18 @@ func populateChannelInfoFromDatabase(server *Server, c *Channel, db *sqlite.Conn
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate channel with its ACLs by reading the SQLite databse.
|
// Populate channel with its ACLs by reading the SQLite databse.
|
||||||
func populateChannelACLFromDatabase(server *Server, c *Channel, db *sqlite.Conn) error {
|
func populateChannelACLFromDatabase(server *Server, c *Channel, db *sql.DB) error {
|
||||||
stmt, err := db.Prepare("SELECT user_id, group_name, apply_here, apply_sub, grantpriv, revokepriv FROM acl WHERE server_id=? AND channel_id=? ORDER BY priority")
|
stmt, err := db.Prepare("SELECT user_id, group_name, apply_here, apply_sub, grantpriv, revokepriv FROM acl WHERE server_id=? AND channel_id=? ORDER BY priority")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := stmt.Exec(server.Id, c.Id); err != nil {
|
rows, err := stmt.Query(server.Id, c.Id)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var (
|
var (
|
||||||
UserId string
|
UserId string
|
||||||
Group string
|
Group string
|
||||||
|
|
@ -192,7 +194,7 @@ func populateChannelACLFromDatabase(server *Server, c *Channel, db *sqlite.Conn)
|
||||||
Allow int64
|
Allow int64
|
||||||
Deny int64
|
Deny int64
|
||||||
)
|
)
|
||||||
if err := stmt.Scan(&UserId, &Group, &ApplyHere, &ApplySub, &Allow, &Deny); err != nil {
|
if err := rows.Scan(&UserId, &Group, &ApplyHere, &ApplySub, &Allow, &Deny); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,19 +221,20 @@ func populateChannelACLFromDatabase(server *Server, c *Channel, db *sqlite.Conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate channel with groups by reading the SQLite database.
|
// Populate channel with groups by reading the SQLite database.
|
||||||
func populateChannelGroupsFromDatabase(server *Server, c *Channel, db *sqlite.Conn) error {
|
func populateChannelGroupsFromDatabase(server *Server, c *Channel, db *sql.DB) error {
|
||||||
stmt, err := db.Prepare("SELECT group_id, name, inherit, inheritable FROM groups WHERE server_id=? AND channel_id=?")
|
stmt, err := db.Prepare("SELECT group_id, name, inherit, inheritable FROM groups WHERE server_id=? AND channel_id=?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := stmt.Exec(server.Id, c.Id); err != nil {
|
rows, err := stmt.Query(server.Id, c.Id)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
groups := make(map[int64]*Group)
|
groups := make(map[int64]*Group)
|
||||||
|
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var (
|
var (
|
||||||
GroupId int64
|
GroupId int64
|
||||||
Name string
|
Name string
|
||||||
|
|
@ -239,7 +242,7 @@ func populateChannelGroupsFromDatabase(server *Server, c *Channel, db *sqlite.Co
|
||||||
Inheritable bool
|
Inheritable bool
|
||||||
)
|
)
|
||||||
|
|
||||||
if err := stmt.Scan(&GroupId, &Name, &Inherit, &Inheritable); err != nil {
|
if err := rows.Scan(&GroupId, &Name, &Inherit, &Inheritable); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,17 +259,18 @@ func populateChannelGroupsFromDatabase(server *Server, c *Channel, db *sqlite.Co
|
||||||
}
|
}
|
||||||
|
|
||||||
for gid, grp := range groups {
|
for gid, grp := range groups {
|
||||||
if err = stmt.Exec(server.Id, gid); err != nil {
|
rows, err = stmt.Query(server.Id, gid)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var (
|
var (
|
||||||
UserId int64
|
UserId int64
|
||||||
Add bool
|
Add bool
|
||||||
)
|
)
|
||||||
|
|
||||||
if err := stmt.Scan(&UserId, &Add); err != nil {
|
if err := rows.Scan(&UserId, &Add); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,7 +286,7 @@ func populateChannelGroupsFromDatabase(server *Server, c *Channel, db *sqlite.Co
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate the Server with Channels from the database.
|
// Populate the Server with Channels from the database.
|
||||||
func populateChannelsFromDatabase(server *Server, db *sqlite.Conn, parentId int) error {
|
func populateChannelsFromDatabase(server *Server, db *sql.DB, parentId int) error {
|
||||||
parent, exists := server.Channels[parentId]
|
parent, exists := server.Channels[parentId]
|
||||||
if !exists {
|
if !exists {
|
||||||
return errors.New("Non-existant parent")
|
return errors.New("Non-existant parent")
|
||||||
|
|
@ -293,18 +297,18 @@ func populateChannelsFromDatabase(server *Server, db *sqlite.Conn, parentId int)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = stmt.Exec(server.Id, parentId)
|
rows, err := stmt.Query(server.Id, parentId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var (
|
var (
|
||||||
name string
|
name string
|
||||||
chanid int
|
chanid int
|
||||||
inherit bool
|
inherit bool
|
||||||
)
|
)
|
||||||
err = stmt.Scan(&chanid, &name, &inherit)
|
err = rows.Scan(&chanid, &name, &inherit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -351,22 +355,23 @@ func populateChannelsFromDatabase(server *Server, db *sqlite.Conn, parentId int)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link a Server's channels together
|
// Link a Server's channels together
|
||||||
func populateChannelLinkInfo(server *Server, db *sqlite.Conn) (err error) {
|
func populateChannelLinkInfo(server *Server, db *sql.DB) (err error) {
|
||||||
stmt, err := db.Prepare("SELECT channel_id, link_id FROM channel_links WHERE server_id=?")
|
stmt, err := db.Prepare("SELECT channel_id, link_id FROM channel_links WHERE server_id=?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := stmt.Exec(server.Id); err != nil {
|
rows, err := stmt.Query(server.Id)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var (
|
var (
|
||||||
ChannelId int
|
ChannelId int
|
||||||
LinkId int
|
LinkId int
|
||||||
)
|
)
|
||||||
if err := stmt.Scan(&ChannelId, &LinkId); err != nil {
|
if err := rows.Scan(&ChannelId, &LinkId); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -386,19 +391,19 @@ func populateChannelLinkInfo(server *Server, db *sqlite.Conn) (err error) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func populateUsers(server *Server, db *sqlite.Conn) (err error) {
|
func populateUsers(server *Server, db *sql.DB) (err error) {
|
||||||
// Populate the server with regular user data
|
// Populate the server with regular user data
|
||||||
stmt, err := db.Prepare("SELECT user_id, name, pw, lastchannel, texture, strftime('%s', last_active) FROM users WHERE server_id=?")
|
stmt, err := db.Prepare("SELECT user_id, name, pw, lastchannel, texture, strftime('%s', last_active) FROM users WHERE server_id=?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = stmt.Exec(server.Id)
|
rows, err := stmt.Query(server.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var (
|
var (
|
||||||
UserId int64
|
UserId int64
|
||||||
UserName string
|
UserName string
|
||||||
|
|
@ -408,7 +413,7 @@ func populateUsers(server *Server, db *sqlite.Conn) (err error) {
|
||||||
LastActive int64
|
LastActive int64
|
||||||
)
|
)
|
||||||
|
|
||||||
err = stmt.Scan(&UserId, &UserName, &SHA1Password, &LastChannel, &Texture, &LastActive)
|
err = rows.Scan(&UserId, &UserName, &SHA1Password, &LastChannel, &Texture, &LastActive)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
@ -443,23 +448,18 @@ func populateUsers(server *Server, db *sqlite.Conn) (err error) {
|
||||||
|
|
||||||
// Populate users with any new-style UserInfo records
|
// Populate users with any new-style UserInfo records
|
||||||
for uid, user := range server.Users {
|
for uid, user := range server.Users {
|
||||||
err = stmt.Reset()
|
rows, err = stmt.Query(server.Id, uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = stmt.Exec(server.Id, uid)
|
for rows.Next() {
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
for stmt.Next() {
|
|
||||||
var (
|
var (
|
||||||
Key int
|
Key int
|
||||||
Value string
|
Value string
|
||||||
)
|
)
|
||||||
|
|
||||||
err = stmt.Scan(&Key, &Value)
|
err = rows.Scan(&Key, &Value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -489,18 +489,18 @@ func populateUsers(server *Server, db *sqlite.Conn) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate bans
|
// Populate bans
|
||||||
func populateBans(server *Server, db *sqlite.Conn) (err error) {
|
func populateBans(server *Server, db *sql.DB) (err error) {
|
||||||
stmt, err := db.Prepare("SELECT base, mask, name, hash, reason, start, duration FROM bans WHERE server_id=?")
|
stmt, err := db.Prepare("SELECT base, mask, name, hash, reason, start, duration FROM bans WHERE server_id=?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = stmt.Exec(server.Id)
|
rows, err := stmt.Query(server.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for stmt.Next() {
|
for rows.Next() {
|
||||||
var (
|
var (
|
||||||
Ban ban.Ban
|
Ban ban.Ban
|
||||||
IP []byte
|
IP []byte
|
||||||
|
|
@ -508,7 +508,7 @@ func populateBans(server *Server, db *sqlite.Conn) (err error) {
|
||||||
Duration int64
|
Duration int64
|
||||||
)
|
)
|
||||||
|
|
||||||
err = stmt.Scan(&IP, &Ban.Mask, &Ban.Username, &Ban.CertHash, &Ban.Reason, &StartDate, &Duration)
|
err = rows.Scan(&IP, &Ban.Mask, &Ban.Username, &Ban.CertHash, &Ban.Reason, &StartDate, &Duration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright (c) 2011 The Grumble Authors
|
|
||||||
// The use of this source code is goverened by a BSD-style
|
|
||||||
// license that can be found in the LICENSE-file.
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import "errors"
|
|
||||||
|
|
||||||
const SQLiteSupport = false
|
|
||||||
|
|
||||||
func MurmurImport(filename string) (err error) {
|
|
||||||
return errors.New("no sqlite support built in")
|
|
||||||
}
|
|
||||||
|
|
@ -54,14 +54,14 @@ func (ban *Ban) SetISOStartDate(isodate string) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ban.Start = 0
|
ban.Start = 0
|
||||||
} else {
|
} else {
|
||||||
ban.Start = startTime.Seconds()
|
ban.Start = startTime.Unix()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the currently set start date as an ISO 8601-formatted
|
// Return the currently set start date as an ISO 8601-formatted
|
||||||
// date (in UTC).
|
// date (in UTC).
|
||||||
func (ban Ban) ISOStartDate() string {
|
func (ban Ban) ISOStartDate() string {
|
||||||
startTime := time.SecondsToUTC(ban.Start)
|
startTime := time.Unix(ban.Start, 0).UTC()
|
||||||
return startTime.Format(ISODate)
|
return startTime.Format(ISODate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ func (ban Ban) IsExpired() bool {
|
||||||
|
|
||||||
// Expiry check
|
// Expiry check
|
||||||
expiryTime := ban.Start + int64(ban.Duration)
|
expiryTime := ban.Start + int64(ban.Duration)
|
||||||
if time.Seconds() > expiryTime {
|
if time.Now().Unix() > expiryTime {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ func TestMaksPowerOf2(t *testing.T) {
|
||||||
func TestMatchV4(t *testing.T) {
|
func TestMatchV4(t *testing.T) {
|
||||||
b := Ban{}
|
b := Ban{}
|
||||||
b.IP = net.ParseIP("192.168.1.1")
|
b.IP = net.ParseIP("192.168.1.1")
|
||||||
b.Mask = 24+96 // ipv4 /24
|
b.Mask = 24 + 96 // ipv4 /24
|
||||||
if len(b.IP) == 0 {
|
if len(b.IP) == 0 {
|
||||||
t.Errorf("Invalid IP")
|
t.Errorf("Invalid IP")
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ func TestMatchV4(t *testing.T) {
|
||||||
func TestMismatchV4(t *testing.T) {
|
func TestMismatchV4(t *testing.T) {
|
||||||
b := Ban{}
|
b := Ban{}
|
||||||
b.IP = net.ParseIP("192.168.1.1")
|
b.IP = net.ParseIP("192.168.1.1")
|
||||||
b.Mask = 24+96 // ipv4 /24
|
b.Mask = 24 + 96 // ipv4 /24
|
||||||
if len(b.IP) == 0 {
|
if len(b.IP) == 0 {
|
||||||
t.Errorf("Invalid IP")
|
t.Errorf("Invalid IP")
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ func TestMismatchV4(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMatchV6(t *testing.T) {
|
func TestMatchV6(t *testing.T) {
|
||||||
b := Ban {}
|
b := Ban{}
|
||||||
b.IP = net.ParseIP("2a00:1450:400b:c00::63")
|
b.IP = net.ParseIP("2a00:1450:400b:c00::63")
|
||||||
b.Mask = 64
|
b.Mask = 64
|
||||||
if len(b.IP) == 0 {
|
if len(b.IP) == 0 {
|
||||||
|
|
@ -109,7 +109,7 @@ func TestISODate(t *testing.T) {
|
||||||
|
|
||||||
func TestInfiniteExpiry(t *testing.T) {
|
func TestInfiniteExpiry(t *testing.T) {
|
||||||
b := Ban{}
|
b := Ban{}
|
||||||
b.Start = time.Seconds()-10
|
b.Start = time.Now().Add(-10 * time.Second).Unix()
|
||||||
b.Duration = 0
|
b.Duration = 0
|
||||||
|
|
||||||
if b.IsExpired() {
|
if b.IsExpired() {
|
||||||
|
|
@ -119,7 +119,7 @@ func TestInfiniteExpiry(t *testing.T) {
|
||||||
|
|
||||||
func TestExpired(t *testing.T) {
|
func TestExpired(t *testing.T) {
|
||||||
b := Ban{}
|
b := Ban{}
|
||||||
b.Start = time.Seconds()-10
|
b.Start = time.Now().Add(-10 * time.Second).Unix()
|
||||||
b.Duration = 9
|
b.Duration = 9
|
||||||
|
|
||||||
if !b.IsExpired() {
|
if !b.IsExpired() {
|
||||||
|
|
@ -129,8 +129,8 @@ func TestExpired(t *testing.T) {
|
||||||
|
|
||||||
func TestNotExpired(t *testing.T) {
|
func TestNotExpired(t *testing.T) {
|
||||||
b := Ban{}
|
b := Ban{}
|
||||||
b.Start = time.Seconds()
|
b.Start = time.Now().Unix()
|
||||||
b.Duration = 60*60*24
|
b.Duration = 60 * 60 * 24
|
||||||
|
|
||||||
if b.IsExpired() {
|
if b.IsExpired() {
|
||||||
t.Errorf("Should expire in 24 hours")
|
t.Errorf("Should expire in 24 hours")
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ func (r *blobReader) Read(b []byte) (n int, err error) {
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !bytes.Equal(r.sum, r.hash.Sum()) {
|
if !bytes.Equal(r.sum, r.hash.Sum(nil)) {
|
||||||
err = ErrHashMismatch
|
err = ErrHashMismatch
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BlobStore struct {
|
type BlobStore struct {
|
||||||
|
|
@ -117,8 +118,9 @@ func NewBlobStore(path string) (bs *BlobStore, err error) {
|
||||||
dirStructureExists = false
|
dirStructureExists = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
bsf.Close()
|
bsf.Close()
|
||||||
|
}
|
||||||
|
|
||||||
if !dirStructureExists {
|
if !dirStructureExists {
|
||||||
for i := 0; i < 256; i++ {
|
for i := 0; i < 256; i++ {
|
||||||
|
|
@ -132,7 +134,7 @@ func NewBlobStore(path string) (bs *BlobStore, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !fi.IsDirectory() {
|
if !fi.IsDir() {
|
||||||
return nil, ErrBadFile
|
return nil, ErrBadFile
|
||||||
}
|
}
|
||||||
} else if e.Err == os.ENOTDIR {
|
} else if e.Err == os.ENOTDIR {
|
||||||
|
|
@ -152,7 +154,7 @@ func NewBlobStore(path string) (bs *BlobStore, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !fi.IsDirectory() {
|
if !fi.IsDir() {
|
||||||
return nil, ErrBadFile
|
return nil, ErrBadFile
|
||||||
}
|
}
|
||||||
} else if e.Err == os.ENOTDIR {
|
} else if e.Err == os.ENOTDIR {
|
||||||
|
|
@ -256,7 +258,7 @@ func (bs *BlobStore) Put(buf []byte) (key string, err error) {
|
||||||
// disk.
|
// disk.
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
h.Write(buf)
|
h.Write(buf)
|
||||||
key = hex.EncodeToString(h.Sum())
|
key = hex.EncodeToString(h.Sum(nil))
|
||||||
|
|
||||||
// Get the components that make up the on-disk
|
// Get the components that make up the on-disk
|
||||||
// path for the blob.
|
// path for the blob.
|
||||||
|
|
@ -319,7 +321,7 @@ func (bs *BlobStore) Put(buf []byte) (key string, err error) {
|
||||||
// On Unix, it checks for EEXIST. On Windows, it checks for EEXIST
|
// On Unix, it checks for EEXIST. On Windows, it checks for EEXIST
|
||||||
// and Errno code 183 (ERROR_ALREADY_EXISTS)
|
// and Errno code 183 (ERROR_ALREADY_EXISTS)
|
||||||
func isExistError(err *os.PathError) (exists bool) {
|
func isExistError(err *os.PathError) (exists bool) {
|
||||||
if e, ok := err.Err.(os.Errno); ok && e == win32AlreadyExists {
|
if e, ok := err.Err.(syscall.Errno); ok && e == win32AlreadyExists {
|
||||||
exists = true
|
exists = true
|
||||||
}
|
}
|
||||||
if err.Err == os.EEXIST {
|
if err.Err == os.EEXIST {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ func TestMakeAllCreateAll(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if !fi.IsDirectory() {
|
if !fi.IsDir() {
|
||||||
t.Errorf("Not a directory")
|
t.Errorf("Not a directory")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +145,7 @@ func TestReadNonExistantKey(t *testing.T) {
|
||||||
|
|
||||||
h := sha1.New()
|
h := sha1.New()
|
||||||
h.Write([]byte{0x42})
|
h.Write([]byte{0x42})
|
||||||
key := hex.EncodeToString(h.Sum())
|
key := hex.EncodeToString(h.Sum(nil))
|
||||||
buf, err := bs.Get(key)
|
buf, err := bs.Get(key)
|
||||||
if err != ErrNoSuchKey {
|
if err != ErrNoSuchKey {
|
||||||
t.Error("Expected no such key %v, found it anyway. (buf=%v, err=%v)", key, buf, err)
|
t.Error("Expected no such key %v, found it anyway. (buf=%v, err=%v)", key, buf, err)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,8 @@ func AcquireLockFile(path string) error {
|
||||||
|
|
||||||
pid, err := strconv.Atoi(string(content))
|
pid, err := strconv.Atoi(string(content))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if syscall.Kill(pid, 0) == 0 {
|
err = syscall.Kill(pid, 0)
|
||||||
|
if err != nil {
|
||||||
return ErrLocked
|
return ErrLocked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ func (cs *CryptState) Decrypt(dst, src []byte) (err error) {
|
||||||
cs.Lost = uint32(-lost)
|
cs.Lost = uint32(-lost)
|
||||||
}
|
}
|
||||||
|
|
||||||
cs.LastGoodTime = time.Seconds()
|
cs.LastGoodTime = time.Now().Unix()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ package freezer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"code.google.com/p/goprotobuf/proto"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"goprotobuf.googlecode.com/hg/proto"
|
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
|
|
||||||
129
pkg/freezer/types.pb.go
Normal file
129
pkg/freezer/types.pb.go
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
// Code generated by protoc-gen-go from "types.proto"
|
||||||
|
// DO NOT EDIT!
|
||||||
|
|
||||||
|
package freezer
|
||||||
|
|
||||||
|
import proto "code.google.com/p/goprotobuf/proto"
|
||||||
|
import "math"
|
||||||
|
|
||||||
|
// Reference proto & math imports to suppress error if they are not otherwise used.
|
||||||
|
var _ = proto.GetString
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
Config []*ConfigKeyValuePair `protobuf:"bytes,2,rep,name=config" json:"config,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"`
|
||||||
|
Users []*User `protobuf:"bytes,5,rep,name=users" json:"users,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Server) Reset() { *this = Server{} }
|
||||||
|
func (this *Server) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ConfigKeyValuePair struct {
|
||||||
|
Key *string `protobuf:"bytes,1,req,name=key" json:"key,omitempty"`
|
||||||
|
Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ConfigKeyValuePair) Reset() { *this = ConfigKeyValuePair{} }
|
||||||
|
func (this *ConfigKeyValuePair) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type Ban struct {
|
||||||
|
Ip []byte `protobuf:"bytes,1,opt,name=ip" json:"ip,omitempty"`
|
||||||
|
Mask *uint32 `protobuf:"varint,2,opt,name=mask" json:"mask,omitempty"`
|
||||||
|
Username *string `protobuf:"bytes,3,opt,name=username" json:"username,omitempty"`
|
||||||
|
CertHash *string `protobuf:"bytes,4,opt,name=cert_hash" json:"cert_hash,omitempty"`
|
||||||
|
Reason *string `protobuf:"bytes,5,opt,name=reason" json:"reason,omitempty"`
|
||||||
|
Start *int64 `protobuf:"varint,6,opt,name=start" json:"start,omitempty"`
|
||||||
|
Duration *uint32 `protobuf:"varint,7,opt,name=duration" json:"duration,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Ban) Reset() { *this = Ban{} }
|
||||||
|
func (this *Ban) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type BanList struct {
|
||||||
|
Bans []*Ban `protobuf:"bytes,1,rep,name=bans" json:"bans,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BanList) Reset() { *this = BanList{} }
|
||||||
|
func (this *BanList) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
|
Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
|
||||||
|
Password *string `protobuf:"bytes,3,opt,name=password" json:"password,omitempty"`
|
||||||
|
CertHash *string `protobuf:"bytes,4,opt,name=cert_hash" json:"cert_hash,omitempty"`
|
||||||
|
Email *string `protobuf:"bytes,5,opt,name=email" json:"email,omitempty"`
|
||||||
|
TextureBlob *string `protobuf:"bytes,6,opt,name=texture_blob" json:"texture_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"`
|
||||||
|
LastActive *uint64 `protobuf:"varint,9,opt,name=last_active" json:"last_active,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *User) Reset() { *this = User{} }
|
||||||
|
func (this *User) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type UserRemove struct {
|
||||||
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UserRemove) Reset() { *this = UserRemove{} }
|
||||||
|
func (this *UserRemove) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type Channel struct {
|
||||||
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
|
Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
|
||||||
|
ParentId *uint32 `protobuf:"varint,3,opt,name=parent_id" json:"parent_id,omitempty"`
|
||||||
|
Position *int64 `protobuf:"varint,4,opt,name=position" json:"position,omitempty"`
|
||||||
|
InheritAcl *bool `protobuf:"varint,5,opt,name=inherit_acl" json:"inherit_acl,omitempty"`
|
||||||
|
Links []uint32 `protobuf:"varint,6,rep,name=links" json:"links,omitempty"`
|
||||||
|
Acl []*ACL `protobuf:"bytes,7,rep,name=acl" json:"acl,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"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Channel) Reset() { *this = Channel{} }
|
||||||
|
func (this *Channel) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ChannelRemove struct {
|
||||||
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ChannelRemove) Reset() { *this = ChannelRemove{} }
|
||||||
|
func (this *ChannelRemove) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ACL struct {
|
||||||
|
UserId *uint32 `protobuf:"varint,1,opt,name=user_id" json:"user_id,omitempty"`
|
||||||
|
Group *string `protobuf:"bytes,2,opt,name=group" json:"group,omitempty"`
|
||||||
|
ApplyHere *bool `protobuf:"varint,3,opt,name=apply_here" json:"apply_here,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"`
|
||||||
|
Deny *uint32 `protobuf:"varint,6,opt,name=deny" json:"deny,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL) Reset() { *this = ACL{} }
|
||||||
|
func (this *ACL) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type Group struct {
|
||||||
|
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||||
|
Inherit *bool `protobuf:"varint,2,opt,name=inherit" json:"inherit,omitempty"`
|
||||||
|
Inheritable *bool `protobuf:"varint,3,opt,name=inheritable" json:"inheritable,omitempty"`
|
||||||
|
Add []uint32 `protobuf:"varint,4,rep,name=add" json:"add,omitempty"`
|
||||||
|
Remove []uint32 `protobuf:"varint,5,rep,name=remove" json:"remove,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Group) Reset() { *this = Group{} }
|
||||||
|
func (this *Group) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ package freezer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"goprotobuf.googlecode.com/hg/proto"
|
"code.google.com/p/goprotobuf/proto"
|
||||||
"hash"
|
"hash"
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
"io"
|
"io"
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ package freezer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"code.google.com/p/goprotobuf/proto"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"goprotobuf.googlecode.com/hg/proto"
|
|
||||||
"hash"
|
"hash"
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
"io"
|
"io"
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ func Filter(text string, options *Options) (filtered string, err error) {
|
||||||
// Strip away all HTML
|
// Strip away all HTML
|
||||||
out := bytes.NewBuffer(nil)
|
out := bytes.NewBuffer(nil)
|
||||||
buf := bytes.NewBufferString(text)
|
buf := bytes.NewBufferString(text)
|
||||||
parser := xml.NewParser(buf)
|
parser := xml.NewDecoder(buf)
|
||||||
parser.Strict = false
|
parser.Strict = false
|
||||||
parser.AutoClose = xml.HTMLAutoClose
|
parser.AutoClose = xml.HTMLAutoClose
|
||||||
parser.Entity = xml.HTMLEntity
|
parser.Entity = xml.HTMLEntity
|
||||||
|
|
@ -112,7 +112,7 @@ func Filter(text string, options *Options) (filtered string, err error) {
|
||||||
// Simplify the received HTML data by stripping away data URIs
|
// Simplify the received HTML data by stripping away data URIs
|
||||||
out := bytes.NewBuffer(nil)
|
out := bytes.NewBuffer(nil)
|
||||||
buf := bytes.NewBufferString(text)
|
buf := bytes.NewBufferString(text)
|
||||||
parser := xml.NewParser(buf)
|
parser := xml.NewDecoder(buf)
|
||||||
parser.Strict = false
|
parser.Strict = false
|
||||||
parser.AutoClose = xml.HTMLAutoClose
|
parser.AutoClose = xml.HTMLAutoClose
|
||||||
parser.Entity = xml.HTMLEntity
|
parser.Entity = xml.HTMLEntity
|
||||||
|
|
|
||||||
576
pkg/mumbleproto/Mumble.pb.go
Normal file
576
pkg/mumbleproto/Mumble.pb.go
Normal file
|
|
@ -0,0 +1,576 @@
|
||||||
|
// Code generated by protoc-gen-go from "Mumble.proto"
|
||||||
|
// DO NOT EDIT!
|
||||||
|
|
||||||
|
package mumbleproto
|
||||||
|
|
||||||
|
import proto "code.google.com/p/goprotobuf/proto"
|
||||||
|
import "math"
|
||||||
|
|
||||||
|
// Reference proto & math imports to suppress error if they are not otherwise used.
|
||||||
|
var _ = proto.GetString
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
type Reject_RejectType int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
Reject_None Reject_RejectType = 0
|
||||||
|
Reject_WrongVersion Reject_RejectType = 1
|
||||||
|
Reject_InvalidUsername Reject_RejectType = 2
|
||||||
|
Reject_WrongUserPW Reject_RejectType = 3
|
||||||
|
Reject_WrongServerPW Reject_RejectType = 4
|
||||||
|
Reject_UsernameInUse Reject_RejectType = 5
|
||||||
|
Reject_ServerFull Reject_RejectType = 6
|
||||||
|
Reject_NoCertificate Reject_RejectType = 7
|
||||||
|
)
|
||||||
|
|
||||||
|
var Reject_RejectType_name = map[int32]string{
|
||||||
|
0: "None",
|
||||||
|
1: "WrongVersion",
|
||||||
|
2: "InvalidUsername",
|
||||||
|
3: "WrongUserPW",
|
||||||
|
4: "WrongServerPW",
|
||||||
|
5: "UsernameInUse",
|
||||||
|
6: "ServerFull",
|
||||||
|
7: "NoCertificate",
|
||||||
|
}
|
||||||
|
var Reject_RejectType_value = map[string]int32{
|
||||||
|
"None": 0,
|
||||||
|
"WrongVersion": 1,
|
||||||
|
"InvalidUsername": 2,
|
||||||
|
"WrongUserPW": 3,
|
||||||
|
"WrongServerPW": 4,
|
||||||
|
"UsernameInUse": 5,
|
||||||
|
"ServerFull": 6,
|
||||||
|
"NoCertificate": 7,
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewReject_RejectType(x Reject_RejectType) *Reject_RejectType {
|
||||||
|
e := Reject_RejectType(x)
|
||||||
|
return &e
|
||||||
|
}
|
||||||
|
func (x Reject_RejectType) String() string {
|
||||||
|
return proto.EnumName(Reject_RejectType_name, int32(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
type PermissionDenied_DenyType int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
PermissionDenied_Text PermissionDenied_DenyType = 0
|
||||||
|
PermissionDenied_Permission PermissionDenied_DenyType = 1
|
||||||
|
PermissionDenied_SuperUser PermissionDenied_DenyType = 2
|
||||||
|
PermissionDenied_ChannelName PermissionDenied_DenyType = 3
|
||||||
|
PermissionDenied_TextTooLong PermissionDenied_DenyType = 4
|
||||||
|
PermissionDenied_H9K PermissionDenied_DenyType = 5
|
||||||
|
PermissionDenied_TemporaryChannel PermissionDenied_DenyType = 6
|
||||||
|
PermissionDenied_MissingCertificate PermissionDenied_DenyType = 7
|
||||||
|
PermissionDenied_UserName PermissionDenied_DenyType = 8
|
||||||
|
PermissionDenied_ChannelFull PermissionDenied_DenyType = 9
|
||||||
|
)
|
||||||
|
|
||||||
|
var PermissionDenied_DenyType_name = map[int32]string{
|
||||||
|
0: "Text",
|
||||||
|
1: "Permission",
|
||||||
|
2: "SuperUser",
|
||||||
|
3: "ChannelName",
|
||||||
|
4: "TextTooLong",
|
||||||
|
5: "H9K",
|
||||||
|
6: "TemporaryChannel",
|
||||||
|
7: "MissingCertificate",
|
||||||
|
8: "UserName",
|
||||||
|
9: "ChannelFull",
|
||||||
|
}
|
||||||
|
var PermissionDenied_DenyType_value = map[string]int32{
|
||||||
|
"Text": 0,
|
||||||
|
"Permission": 1,
|
||||||
|
"SuperUser": 2,
|
||||||
|
"ChannelName": 3,
|
||||||
|
"TextTooLong": 4,
|
||||||
|
"H9K": 5,
|
||||||
|
"TemporaryChannel": 6,
|
||||||
|
"MissingCertificate": 7,
|
||||||
|
"UserName": 8,
|
||||||
|
"ChannelFull": 9,
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPermissionDenied_DenyType(x PermissionDenied_DenyType) *PermissionDenied_DenyType {
|
||||||
|
e := PermissionDenied_DenyType(x)
|
||||||
|
return &e
|
||||||
|
}
|
||||||
|
func (x PermissionDenied_DenyType) String() string {
|
||||||
|
return proto.EnumName(PermissionDenied_DenyType_name, int32(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContextActionModify_Context int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
ContextActionModify_Server ContextActionModify_Context = 1
|
||||||
|
ContextActionModify_Channel ContextActionModify_Context = 2
|
||||||
|
ContextActionModify_User ContextActionModify_Context = 4
|
||||||
|
)
|
||||||
|
|
||||||
|
var ContextActionModify_Context_name = map[int32]string{
|
||||||
|
1: "Server",
|
||||||
|
2: "Channel",
|
||||||
|
4: "User",
|
||||||
|
}
|
||||||
|
var ContextActionModify_Context_value = map[string]int32{
|
||||||
|
"Server": 1,
|
||||||
|
"Channel": 2,
|
||||||
|
"User": 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewContextActionModify_Context(x ContextActionModify_Context) *ContextActionModify_Context {
|
||||||
|
e := ContextActionModify_Context(x)
|
||||||
|
return &e
|
||||||
|
}
|
||||||
|
func (x ContextActionModify_Context) String() string {
|
||||||
|
return proto.EnumName(ContextActionModify_Context_name, int32(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContextActionModify_Operation int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
ContextActionModify_Add ContextActionModify_Operation = 0
|
||||||
|
ContextActionModify_Remove ContextActionModify_Operation = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
var ContextActionModify_Operation_name = map[int32]string{
|
||||||
|
0: "Add",
|
||||||
|
1: "Remove",
|
||||||
|
}
|
||||||
|
var ContextActionModify_Operation_value = map[string]int32{
|
||||||
|
"Add": 0,
|
||||||
|
"Remove": 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewContextActionModify_Operation(x ContextActionModify_Operation) *ContextActionModify_Operation {
|
||||||
|
e := ContextActionModify_Operation(x)
|
||||||
|
return &e
|
||||||
|
}
|
||||||
|
func (x ContextActionModify_Operation) String() string {
|
||||||
|
return proto.EnumName(ContextActionModify_Operation_name, int32(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
type Version struct {
|
||||||
|
Version *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
|
||||||
|
Release *string `protobuf:"bytes,2,opt,name=release" json:"release,omitempty"`
|
||||||
|
Os *string `protobuf:"bytes,3,opt,name=os" json:"os,omitempty"`
|
||||||
|
OsVersion *string `protobuf:"bytes,4,opt,name=os_version" json:"os_version,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Version) Reset() { *this = Version{} }
|
||||||
|
func (this *Version) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type UDPTunnel struct {
|
||||||
|
Packet []byte `protobuf:"bytes,1,req,name=packet" json:"packet,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UDPTunnel) Reset() { *this = UDPTunnel{} }
|
||||||
|
func (this *UDPTunnel) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type Authenticate struct {
|
||||||
|
Username *string `protobuf:"bytes,1,opt,name=username" json:"username,omitempty"`
|
||||||
|
Password *string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"`
|
||||||
|
Tokens []string `protobuf:"bytes,3,rep,name=tokens" json:"tokens,omitempty"`
|
||||||
|
CeltVersions []int32 `protobuf:"varint,4,rep,name=celt_versions" json:"celt_versions,omitempty"`
|
||||||
|
Opus *bool `protobuf:"varint,5,opt,name=opus,def=0" json:"opus,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Authenticate) Reset() { *this = Authenticate{} }
|
||||||
|
func (this *Authenticate) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_Authenticate_Opus bool = false
|
||||||
|
|
||||||
|
type Ping struct {
|
||||||
|
Timestamp *uint64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"`
|
||||||
|
Good *uint32 `protobuf:"varint,2,opt,name=good" json:"good,omitempty"`
|
||||||
|
Late *uint32 `protobuf:"varint,3,opt,name=late" json:"late,omitempty"`
|
||||||
|
Lost *uint32 `protobuf:"varint,4,opt,name=lost" json:"lost,omitempty"`
|
||||||
|
Resync *uint32 `protobuf:"varint,5,opt,name=resync" json:"resync,omitempty"`
|
||||||
|
UdpPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets" json:"udp_packets,omitempty"`
|
||||||
|
TcpPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets" json:"tcp_packets,omitempty"`
|
||||||
|
UdpPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg" json:"udp_ping_avg,omitempty"`
|
||||||
|
UdpPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var" json:"udp_ping_var,omitempty"`
|
||||||
|
TcpPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg" json:"tcp_ping_avg,omitempty"`
|
||||||
|
TcpPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var" json:"tcp_ping_var,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Ping) Reset() { *this = Ping{} }
|
||||||
|
func (this *Ping) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type Reject struct {
|
||||||
|
Type *Reject_RejectType `protobuf:"varint,1,opt,name=type,enum=mumbleproto.Reject_RejectType" json:"type,omitempty"`
|
||||||
|
Reason *string `protobuf:"bytes,2,opt,name=reason" json:"reason,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Reject) Reset() { *this = Reject{} }
|
||||||
|
func (this *Reject) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ServerConfig struct {
|
||||||
|
MaxBandwidth *uint32 `protobuf:"varint,1,opt,name=max_bandwidth" json:"max_bandwidth,omitempty"`
|
||||||
|
WelcomeText *string `protobuf:"bytes,2,opt,name=welcome_text" json:"welcome_text,omitempty"`
|
||||||
|
AllowHtml *bool `protobuf:"varint,3,opt,name=allow_html" json:"allow_html,omitempty"`
|
||||||
|
MessageLength *uint32 `protobuf:"varint,4,opt,name=message_length" json:"message_length,omitempty"`
|
||||||
|
ImageMessageLength *uint32 `protobuf:"varint,5,opt,name=image_message_length" json:"image_message_length,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ServerConfig) Reset() { *this = ServerConfig{} }
|
||||||
|
func (this *ServerConfig) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ServerSync struct {
|
||||||
|
Session *uint32 `protobuf:"varint,1,opt,name=session" json:"session,omitempty"`
|
||||||
|
MaxBandwidth *uint32 `protobuf:"varint,2,opt,name=max_bandwidth" json:"max_bandwidth,omitempty"`
|
||||||
|
WelcomeText *string `protobuf:"bytes,3,opt,name=welcome_text" json:"welcome_text,omitempty"`
|
||||||
|
Permissions *uint64 `protobuf:"varint,4,opt,name=permissions" json:"permissions,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ServerSync) Reset() { *this = ServerSync{} }
|
||||||
|
func (this *ServerSync) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ChannelRemove struct {
|
||||||
|
ChannelId *uint32 `protobuf:"varint,1,req,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ChannelRemove) Reset() { *this = ChannelRemove{} }
|
||||||
|
func (this *ChannelRemove) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ChannelState struct {
|
||||||
|
ChannelId *uint32 `protobuf:"varint,1,opt,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
Parent *uint32 `protobuf:"varint,2,opt,name=parent" json:"parent,omitempty"`
|
||||||
|
Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"`
|
||||||
|
Links []uint32 `protobuf:"varint,4,rep,name=links" json:"links,omitempty"`
|
||||||
|
Description *string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"`
|
||||||
|
LinksAdd []uint32 `protobuf:"varint,6,rep,name=links_add" json:"links_add,omitempty"`
|
||||||
|
LinksRemove []uint32 `protobuf:"varint,7,rep,name=links_remove" json:"links_remove,omitempty"`
|
||||||
|
Temporary *bool `protobuf:"varint,8,opt,name=temporary,def=0" json:"temporary,omitempty"`
|
||||||
|
Position *int32 `protobuf:"varint,9,opt,name=position,def=0" json:"position,omitempty"`
|
||||||
|
DescriptionHash []byte `protobuf:"bytes,10,opt,name=description_hash" json:"description_hash,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ChannelState) Reset() { *this = ChannelState{} }
|
||||||
|
func (this *ChannelState) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_ChannelState_Temporary bool = false
|
||||||
|
const Default_ChannelState_Position int32 = 0
|
||||||
|
|
||||||
|
type UserRemove struct {
|
||||||
|
Session *uint32 `protobuf:"varint,1,req,name=session" json:"session,omitempty"`
|
||||||
|
Actor *uint32 `protobuf:"varint,2,opt,name=actor" json:"actor,omitempty"`
|
||||||
|
Reason *string `protobuf:"bytes,3,opt,name=reason" json:"reason,omitempty"`
|
||||||
|
Ban *bool `protobuf:"varint,4,opt,name=ban" json:"ban,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UserRemove) Reset() { *this = UserRemove{} }
|
||||||
|
func (this *UserRemove) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type UserState struct {
|
||||||
|
Session *uint32 `protobuf:"varint,1,opt,name=session" json:"session,omitempty"`
|
||||||
|
Actor *uint32 `protobuf:"varint,2,opt,name=actor" json:"actor,omitempty"`
|
||||||
|
Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"`
|
||||||
|
UserId *uint32 `protobuf:"varint,4,opt,name=user_id" json:"user_id,omitempty"`
|
||||||
|
ChannelId *uint32 `protobuf:"varint,5,opt,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
Mute *bool `protobuf:"varint,6,opt,name=mute" json:"mute,omitempty"`
|
||||||
|
Deaf *bool `protobuf:"varint,7,opt,name=deaf" json:"deaf,omitempty"`
|
||||||
|
Suppress *bool `protobuf:"varint,8,opt,name=suppress" json:"suppress,omitempty"`
|
||||||
|
SelfMute *bool `protobuf:"varint,9,opt,name=self_mute" json:"self_mute,omitempty"`
|
||||||
|
SelfDeaf *bool `protobuf:"varint,10,opt,name=self_deaf" json:"self_deaf,omitempty"`
|
||||||
|
Texture []byte `protobuf:"bytes,11,opt,name=texture" json:"texture,omitempty"`
|
||||||
|
PluginContext []byte `protobuf:"bytes,12,opt,name=plugin_context" json:"plugin_context,omitempty"`
|
||||||
|
PluginIdentity *string `protobuf:"bytes,13,opt,name=plugin_identity" json:"plugin_identity,omitempty"`
|
||||||
|
Comment *string `protobuf:"bytes,14,opt,name=comment" json:"comment,omitempty"`
|
||||||
|
Hash *string `protobuf:"bytes,15,opt,name=hash" json:"hash,omitempty"`
|
||||||
|
CommentHash []byte `protobuf:"bytes,16,opt,name=comment_hash" json:"comment_hash,omitempty"`
|
||||||
|
TextureHash []byte `protobuf:"bytes,17,opt,name=texture_hash" json:"texture_hash,omitempty"`
|
||||||
|
PrioritySpeaker *bool `protobuf:"varint,18,opt,name=priority_speaker" json:"priority_speaker,omitempty"`
|
||||||
|
Recording *bool `protobuf:"varint,19,opt,name=recording" json:"recording,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UserState) Reset() { *this = UserState{} }
|
||||||
|
func (this *UserState) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type BanList struct {
|
||||||
|
Bans []*BanList_BanEntry `protobuf:"bytes,1,rep,name=bans" json:"bans,omitempty"`
|
||||||
|
Query *bool `protobuf:"varint,2,opt,name=query,def=0" json:"query,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BanList) Reset() { *this = BanList{} }
|
||||||
|
func (this *BanList) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_BanList_Query bool = false
|
||||||
|
|
||||||
|
type BanList_BanEntry struct {
|
||||||
|
Address []byte `protobuf:"bytes,1,req,name=address" json:"address,omitempty"`
|
||||||
|
Mask *uint32 `protobuf:"varint,2,req,name=mask" json:"mask,omitempty"`
|
||||||
|
Name *string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"`
|
||||||
|
Hash *string `protobuf:"bytes,4,opt,name=hash" json:"hash,omitempty"`
|
||||||
|
Reason *string `protobuf:"bytes,5,opt,name=reason" json:"reason,omitempty"`
|
||||||
|
Start *string `protobuf:"bytes,6,opt,name=start" json:"start,omitempty"`
|
||||||
|
Duration *uint32 `protobuf:"varint,7,opt,name=duration" json:"duration,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BanList_BanEntry) Reset() { *this = BanList_BanEntry{} }
|
||||||
|
func (this *BanList_BanEntry) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type TextMessage struct {
|
||||||
|
Actor *uint32 `protobuf:"varint,1,opt,name=actor" json:"actor,omitempty"`
|
||||||
|
Session []uint32 `protobuf:"varint,2,rep,name=session" json:"session,omitempty"`
|
||||||
|
ChannelId []uint32 `protobuf:"varint,3,rep,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
TreeId []uint32 `protobuf:"varint,4,rep,name=tree_id" json:"tree_id,omitempty"`
|
||||||
|
Message *string `protobuf:"bytes,5,req,name=message" json:"message,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TextMessage) Reset() { *this = TextMessage{} }
|
||||||
|
func (this *TextMessage) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type PermissionDenied struct {
|
||||||
|
Permission *uint32 `protobuf:"varint,1,opt,name=permission" json:"permission,omitempty"`
|
||||||
|
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
Session *uint32 `protobuf:"varint,3,opt,name=session" json:"session,omitempty"`
|
||||||
|
Reason *string `protobuf:"bytes,4,opt,name=reason" json:"reason,omitempty"`
|
||||||
|
Type *PermissionDenied_DenyType `protobuf:"varint,5,opt,name=type,enum=mumbleproto.PermissionDenied_DenyType" json:"type,omitempty"`
|
||||||
|
Name *string `protobuf:"bytes,6,opt,name=name" json:"name,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *PermissionDenied) Reset() { *this = PermissionDenied{} }
|
||||||
|
func (this *PermissionDenied) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ACL struct {
|
||||||
|
ChannelId *uint32 `protobuf:"varint,1,req,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
InheritAcls *bool `protobuf:"varint,2,opt,name=inherit_acls,def=1" json:"inherit_acls,omitempty"`
|
||||||
|
Groups []*ACL_ChanGroup `protobuf:"bytes,3,rep,name=groups" json:"groups,omitempty"`
|
||||||
|
Acls []*ACL_ChanACL `protobuf:"bytes,4,rep,name=acls" json:"acls,omitempty"`
|
||||||
|
Query *bool `protobuf:"varint,5,opt,name=query,def=0" json:"query,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL) Reset() { *this = ACL{} }
|
||||||
|
func (this *ACL) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_ACL_InheritAcls bool = true
|
||||||
|
const Default_ACL_Query bool = false
|
||||||
|
|
||||||
|
type ACL_ChanGroup struct {
|
||||||
|
Name *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
|
||||||
|
Inherited *bool `protobuf:"varint,2,opt,name=inherited,def=1" json:"inherited,omitempty"`
|
||||||
|
Inherit *bool `protobuf:"varint,3,opt,name=inherit,def=1" json:"inherit,omitempty"`
|
||||||
|
Inheritable *bool `protobuf:"varint,4,opt,name=inheritable,def=1" json:"inheritable,omitempty"`
|
||||||
|
Add []uint32 `protobuf:"varint,5,rep,name=add" json:"add,omitempty"`
|
||||||
|
Remove []uint32 `protobuf:"varint,6,rep,name=remove" json:"remove,omitempty"`
|
||||||
|
InheritedMembers []uint32 `protobuf:"varint,7,rep,name=inherited_members" json:"inherited_members,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL_ChanGroup) Reset() { *this = ACL_ChanGroup{} }
|
||||||
|
func (this *ACL_ChanGroup) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_ACL_ChanGroup_Inherited bool = true
|
||||||
|
const Default_ACL_ChanGroup_Inherit bool = true
|
||||||
|
const Default_ACL_ChanGroup_Inheritable bool = true
|
||||||
|
|
||||||
|
type ACL_ChanACL struct {
|
||||||
|
ApplyHere *bool `protobuf:"varint,1,opt,name=apply_here,def=1" json:"apply_here,omitempty"`
|
||||||
|
ApplySubs *bool `protobuf:"varint,2,opt,name=apply_subs,def=1" json:"apply_subs,omitempty"`
|
||||||
|
Inherited *bool `protobuf:"varint,3,opt,name=inherited,def=1" json:"inherited,omitempty"`
|
||||||
|
UserId *uint32 `protobuf:"varint,4,opt,name=user_id" json:"user_id,omitempty"`
|
||||||
|
Group *string `protobuf:"bytes,5,opt,name=group" json:"group,omitempty"`
|
||||||
|
Grant *uint32 `protobuf:"varint,6,opt,name=grant" json:"grant,omitempty"`
|
||||||
|
Deny *uint32 `protobuf:"varint,7,opt,name=deny" json:"deny,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ACL_ChanACL) Reset() { *this = ACL_ChanACL{} }
|
||||||
|
func (this *ACL_ChanACL) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_ACL_ChanACL_ApplyHere bool = true
|
||||||
|
const Default_ACL_ChanACL_ApplySubs bool = true
|
||||||
|
const Default_ACL_ChanACL_Inherited bool = true
|
||||||
|
|
||||||
|
type QueryUsers struct {
|
||||||
|
Ids []uint32 `protobuf:"varint,1,rep,name=ids" json:"ids,omitempty"`
|
||||||
|
Names []string `protobuf:"bytes,2,rep,name=names" json:"names,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryUsers) Reset() { *this = QueryUsers{} }
|
||||||
|
func (this *QueryUsers) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type CryptSetup struct {
|
||||||
|
Key []byte `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
|
||||||
|
ClientNonce []byte `protobuf:"bytes,2,opt,name=client_nonce" json:"client_nonce,omitempty"`
|
||||||
|
ServerNonce []byte `protobuf:"bytes,3,opt,name=server_nonce" json:"server_nonce,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CryptSetup) Reset() { *this = CryptSetup{} }
|
||||||
|
func (this *CryptSetup) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ContextActionModify struct {
|
||||||
|
Action *string `protobuf:"bytes,1,req,name=action" json:"action,omitempty"`
|
||||||
|
Text *string `protobuf:"bytes,2,opt,name=text" json:"text,omitempty"`
|
||||||
|
Context *uint32 `protobuf:"varint,3,opt,name=context" json:"context,omitempty"`
|
||||||
|
Operation *ContextActionModify_Operation `protobuf:"varint,4,opt,name=operation,enum=mumbleproto.ContextActionModify_Operation" json:"operation,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ContextActionModify) Reset() { *this = ContextActionModify{} }
|
||||||
|
func (this *ContextActionModify) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type ContextAction struct {
|
||||||
|
Session *uint32 `protobuf:"varint,1,opt,name=session" json:"session,omitempty"`
|
||||||
|
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
Action *string `protobuf:"bytes,3,req,name=action" json:"action,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ContextAction) Reset() { *this = ContextAction{} }
|
||||||
|
func (this *ContextAction) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type UserList struct {
|
||||||
|
Users []*UserList_User `protobuf:"bytes,1,rep,name=users" json:"users,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UserList) Reset() { *this = UserList{} }
|
||||||
|
func (this *UserList) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type UserList_User struct {
|
||||||
|
UserId *uint32 `protobuf:"varint,1,req,name=user_id" json:"user_id,omitempty"`
|
||||||
|
Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UserList_User) Reset() { *this = UserList_User{} }
|
||||||
|
func (this *UserList_User) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type VoiceTarget struct {
|
||||||
|
Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
|
||||||
|
Targets []*VoiceTarget_Target `protobuf:"bytes,2,rep,name=targets" json:"targets,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *VoiceTarget) Reset() { *this = VoiceTarget{} }
|
||||||
|
func (this *VoiceTarget) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type VoiceTarget_Target struct {
|
||||||
|
Session []uint32 `protobuf:"varint,1,rep,name=session" json:"session,omitempty"`
|
||||||
|
ChannelId *uint32 `protobuf:"varint,2,opt,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
Group *string `protobuf:"bytes,3,opt,name=group" json:"group,omitempty"`
|
||||||
|
Links *bool `protobuf:"varint,4,opt,name=links,def=0" json:"links,omitempty"`
|
||||||
|
Children *bool `protobuf:"varint,5,opt,name=children,def=0" json:"children,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *VoiceTarget_Target) Reset() { *this = VoiceTarget_Target{} }
|
||||||
|
func (this *VoiceTarget_Target) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_VoiceTarget_Target_Links bool = false
|
||||||
|
const Default_VoiceTarget_Target_Children bool = false
|
||||||
|
|
||||||
|
type PermissionQuery struct {
|
||||||
|
ChannelId *uint32 `protobuf:"varint,1,opt,name=channel_id" json:"channel_id,omitempty"`
|
||||||
|
Permissions *uint32 `protobuf:"varint,2,opt,name=permissions" json:"permissions,omitempty"`
|
||||||
|
Flush *bool `protobuf:"varint,3,opt,name=flush,def=0" json:"flush,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *PermissionQuery) Reset() { *this = PermissionQuery{} }
|
||||||
|
func (this *PermissionQuery) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_PermissionQuery_Flush bool = false
|
||||||
|
|
||||||
|
type CodecVersion struct {
|
||||||
|
Alpha *int32 `protobuf:"varint,1,req,name=alpha" json:"alpha,omitempty"`
|
||||||
|
Beta *int32 `protobuf:"varint,2,req,name=beta" json:"beta,omitempty"`
|
||||||
|
PreferAlpha *bool `protobuf:"varint,3,req,name=prefer_alpha,def=1" json:"prefer_alpha,omitempty"`
|
||||||
|
Opus *bool `protobuf:"varint,4,opt,name=opus,def=0" json:"opus,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CodecVersion) Reset() { *this = CodecVersion{} }
|
||||||
|
func (this *CodecVersion) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_CodecVersion_PreferAlpha bool = true
|
||||||
|
const Default_CodecVersion_Opus bool = false
|
||||||
|
|
||||||
|
type UserStats struct {
|
||||||
|
Session *uint32 `protobuf:"varint,1,opt,name=session" json:"session,omitempty"`
|
||||||
|
StatsOnly *bool `protobuf:"varint,2,opt,name=stats_only,def=0" json:"stats_only,omitempty"`
|
||||||
|
Certificates [][]byte `protobuf:"bytes,3,rep,name=certificates" json:"certificates,omitempty"`
|
||||||
|
FromClient *UserStats_Stats `protobuf:"bytes,4,opt,name=from_client" json:"from_client,omitempty"`
|
||||||
|
FromServer *UserStats_Stats `protobuf:"bytes,5,opt,name=from_server" json:"from_server,omitempty"`
|
||||||
|
UdpPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets" json:"udp_packets,omitempty"`
|
||||||
|
TcpPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets" json:"tcp_packets,omitempty"`
|
||||||
|
UdpPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg" json:"udp_ping_avg,omitempty"`
|
||||||
|
UdpPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var" json:"udp_ping_var,omitempty"`
|
||||||
|
TcpPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg" json:"tcp_ping_avg,omitempty"`
|
||||||
|
TcpPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var" json:"tcp_ping_var,omitempty"`
|
||||||
|
Version *Version `protobuf:"bytes,12,opt,name=version" json:"version,omitempty"`
|
||||||
|
CeltVersions []int32 `protobuf:"varint,13,rep,name=celt_versions" json:"celt_versions,omitempty"`
|
||||||
|
Address []byte `protobuf:"bytes,14,opt,name=address" json:"address,omitempty"`
|
||||||
|
Bandwidth *uint32 `protobuf:"varint,15,opt,name=bandwidth" json:"bandwidth,omitempty"`
|
||||||
|
Onlinesecs *uint32 `protobuf:"varint,16,opt,name=onlinesecs" json:"onlinesecs,omitempty"`
|
||||||
|
Idlesecs *uint32 `protobuf:"varint,17,opt,name=idlesecs" json:"idlesecs,omitempty"`
|
||||||
|
StrongCertificate *bool `protobuf:"varint,18,opt,name=strong_certificate,def=0" json:"strong_certificate,omitempty"`
|
||||||
|
Opus *bool `protobuf:"varint,19,opt,name=opus,def=0" json:"opus,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UserStats) Reset() { *this = UserStats{} }
|
||||||
|
func (this *UserStats) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
const Default_UserStats_StatsOnly bool = false
|
||||||
|
const Default_UserStats_StrongCertificate bool = false
|
||||||
|
const Default_UserStats_Opus bool = false
|
||||||
|
|
||||||
|
type UserStats_Stats struct {
|
||||||
|
Good *uint32 `protobuf:"varint,1,opt,name=good" json:"good,omitempty"`
|
||||||
|
Late *uint32 `protobuf:"varint,2,opt,name=late" json:"late,omitempty"`
|
||||||
|
Lost *uint32 `protobuf:"varint,3,opt,name=lost" json:"lost,omitempty"`
|
||||||
|
Resync *uint32 `protobuf:"varint,4,opt,name=resync" json:"resync,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UserStats_Stats) Reset() { *this = UserStats_Stats{} }
|
||||||
|
func (this *UserStats_Stats) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type SuggestConfig struct {
|
||||||
|
Version *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
|
||||||
|
Positional *bool `protobuf:"varint,2,opt,name=positional" json:"positional,omitempty"`
|
||||||
|
PushToTalk *bool `protobuf:"varint,3,opt,name=push_to_talk" json:"push_to_talk,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SuggestConfig) Reset() { *this = SuggestConfig{} }
|
||||||
|
func (this *SuggestConfig) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
type RequestBlob struct {
|
||||||
|
SessionTexture []uint32 `protobuf:"varint,1,rep,name=session_texture" json:"session_texture,omitempty"`
|
||||||
|
SessionComment []uint32 `protobuf:"varint,2,rep,name=session_comment" json:"session_comment,omitempty"`
|
||||||
|
ChannelDescription []uint32 `protobuf:"varint,3,rep,name=channel_description" json:"channel_description,omitempty"`
|
||||||
|
XXX_unrecognized []byte `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RequestBlob) Reset() { *this = RequestBlob{} }
|
||||||
|
func (this *RequestBlob) String() string { return proto.CompactTextString(this) }
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
@ -90,13 +90,13 @@ func (cfg *Config) IntValue(key string) (intval int) {
|
||||||
// Get the value of a specific config key as a uint32
|
// Get the value of a specific config key as a uint32
|
||||||
func (cfg *Config) Uint32Value(key string) (uint32val uint32) {
|
func (cfg *Config) Uint32Value(key string) (uint32val uint32) {
|
||||||
str := cfg.StringValue(key)
|
str := cfg.StringValue(key)
|
||||||
uintval, _ := strconv.Atoui(str)
|
uintval, _ := strconv.ParseUint(str, 10, 0)
|
||||||
return uint32(uintval)
|
return uint32(uintval)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the value fo a sepcific config key as a bool
|
// Get the value fo a sepcific config key as a bool
|
||||||
func (cfg *Config) BoolValue(key string) (boolval bool) {
|
func (cfg *Config) BoolValue(key string) (boolval bool) {
|
||||||
str := cfg.StringValue(key)
|
str := cfg.StringValue(key)
|
||||||
boolval, _ = strconv.Atob(str)
|
boolval, _ = strconv.ParseBool(str)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ func (c *Conn) Prepare(cmd string) (*Stmt, error) {
|
||||||
if rv != 0 {
|
if rv != 0 {
|
||||||
return nil, c.error(rv)
|
return nil, c.error(rv)
|
||||||
}
|
}
|
||||||
return &Stmt{c: c, stmt: stmt, sql: cmd, t0: time.Nanoseconds()}, nil
|
return &Stmt{c: c, stmt: stmt, sql: cmd, t0: time.Now()}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stmt) Exec(args ...interface{}) error {
|
func (s *Stmt) Exec(args ...interface{}) error {
|
||||||
|
|
@ -356,13 +356,13 @@ func (s *Stmt) Scan(args ...interface{}) error {
|
||||||
}
|
}
|
||||||
*v = x
|
*v = x
|
||||||
case *int64:
|
case *int64:
|
||||||
x, err := strconv.Atoi64(string(data))
|
x, err := strconv.ParseInt(string(data), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("arg " + strconv.Itoa(i) + " as int64: " + err.Error())
|
return errors.New("arg " + strconv.Itoa(i) + " as int64: " + err.Error())
|
||||||
}
|
}
|
||||||
*v = x
|
*v = x
|
||||||
case *float64:
|
case *float64:
|
||||||
x, err := strconv.Atof64(string(data))
|
x, err := strconv.ParseFloat(string(data), 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("arg " + strconv.Itoa(i) + " as float64: " + err.Error())
|
return errors.New("arg " + strconv.Itoa(i) + " as float64: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
@ -379,7 +379,7 @@ func (s *Stmt) SQL() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stmt) Nanoseconds() int64 {
|
func (s *Stmt) Nanoseconds() int64 {
|
||||||
return time.Nanoseconds() - s.t0
|
return time.Now().Sub(s.t0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stmt) Finalize() error {
|
func (s *Stmt) Finalize() error {
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ func (server *Server) RegisterPublicServer() {
|
||||||
|
|
||||||
hasher := sha1.New()
|
hasher := sha1.New()
|
||||||
hasher.Write(config.Certificates[0].Certificate[0])
|
hasher.Write(config.Certificates[0].Certificate[0])
|
||||||
digest := hex.EncodeToString(hasher.Sum())
|
digest := hex.EncodeToString(hasher.Sum(nil))
|
||||||
|
|
||||||
// Render registration XML template
|
// Render registration XML template
|
||||||
reg := Register{
|
reg := Register{
|
||||||
|
|
@ -93,7 +93,7 @@ func (server *Server) RegisterPublicServer() {
|
||||||
Release: "Grumble Git",
|
Release: "Grumble Git",
|
||||||
}
|
}
|
||||||
buf := bytes.NewBuffer(nil)
|
buf := bytes.NewBuffer(nil)
|
||||||
err := xml.Marshal(buf, reg)
|
err := xml.NewEncoder(buf).Encode(reg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
server.Printf("register: unable to marshal xml: %v", err)
|
server.Printf("register: unable to marshal xml: %v", err)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
42
server.go
42
server.go
|
|
@ -7,6 +7,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"code.google.com/p/goprotobuf/proto"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
|
@ -14,16 +15,15 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"goprotobuf.googlecode.com/hg/proto"
|
"github.com/mkrautz/grumble/pkg/ban"
|
||||||
"grumble/ban"
|
"github.com/mkrautz/grumble/pkg/blobstore"
|
||||||
"grumble/blobstore"
|
"github.com/mkrautz/grumble/pkg/cryptstate"
|
||||||
"grumble/cryptstate"
|
"github.com/mkrautz/grumble/pkg/freezer"
|
||||||
"grumble/freezer"
|
"github.com/mkrautz/grumble/pkg/htmlfilter"
|
||||||
"grumble/htmlfilter"
|
"github.com/mkrautz/grumble/pkg/logtarget"
|
||||||
"grumble/logtarget"
|
"github.com/mkrautz/grumble/pkg/mumbleproto"
|
||||||
"grumble/mumbleproto"
|
"github.com/mkrautz/grumble/pkg/serverconf"
|
||||||
"grumble/serverconf"
|
"github.com/mkrautz/grumble/pkg/sessionpool"
|
||||||
"grumble/sessionpool"
|
|
||||||
"hash"
|
"hash"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
|
@ -59,7 +59,7 @@ type Server struct {
|
||||||
Id int64
|
Id int64
|
||||||
|
|
||||||
tcpl *net.TCPListener
|
tcpl *net.TCPListener
|
||||||
tlsl *tls.Listener
|
tlsl net.Listener
|
||||||
udpconn *net.UDPConn
|
udpconn *net.UDPConn
|
||||||
tlscfg *tls.Config
|
tlscfg *tls.Config
|
||||||
bye chan bool
|
bye chan bool
|
||||||
|
|
@ -178,7 +178,7 @@ func (server *Server) SetSuperUserPassword(password string) {
|
||||||
hasher := sha1.New()
|
hasher := sha1.New()
|
||||||
hasher.Write(saltBytes)
|
hasher.Write(saltBytes)
|
||||||
hasher.Write([]byte(password))
|
hasher.Write([]byte(password))
|
||||||
digest := hex.EncodeToString(hasher.Sum())
|
digest := hex.EncodeToString(hasher.Sum(nil))
|
||||||
|
|
||||||
// Could be racy, but shouldn't really matter...
|
// Could be racy, but shouldn't really matter...
|
||||||
key := "SuperUserPassword"
|
key := "SuperUserPassword"
|
||||||
|
|
@ -219,7 +219,7 @@ func (server *Server) CheckSuperUserPassword(password string) bool {
|
||||||
// password
|
// password
|
||||||
h.Write([]byte(password))
|
h.Write([]byte(password))
|
||||||
|
|
||||||
sum := hex.EncodeToString(h.Sum())
|
sum := hex.EncodeToString(h.Sum(nil))
|
||||||
if parts[2] == sum {
|
if parts[2] == sum {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -267,7 +267,7 @@ func (server *Server) handleIncomingClient(conn net.Conn) (err error) {
|
||||||
if len(state.PeerCertificates) > 0 {
|
if len(state.PeerCertificates) > 0 {
|
||||||
hash := sha1.New()
|
hash := sha1.New()
|
||||||
hash.Write(state.PeerCertificates[0].Raw)
|
hash.Write(state.PeerCertificates[0].Raw)
|
||||||
sum := hash.Sum()
|
sum := hash.Sum(nil)
|
||||||
client.CertHash = hex.EncodeToString(sum)
|
client.CertHash = hex.EncodeToString(sum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -360,7 +360,7 @@ func (server *Server) UnlinkChannels(channel *Channel, other *Channel) {
|
||||||
// Important control channel messages are routed through this Goroutine
|
// Important control channel messages are routed through this Goroutine
|
||||||
// to keep server state synchronized.
|
// to keep server state synchronized.
|
||||||
func (server *Server) handlerLoop() {
|
func (server *Server) handlerLoop() {
|
||||||
regtick := time.Tick((3600 + ((server.Id * 60) % 600)) * 1e9)
|
regtick := time.Tick(time.Hour)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
// We're done. Stop the server's event handler
|
// We're done. Stop the server's event handler
|
||||||
|
|
@ -391,7 +391,7 @@ func (server *Server) handlerLoop() {
|
||||||
target.SendVoiceBroadcast(vb)
|
target.SendVoiceBroadcast(vb)
|
||||||
}
|
}
|
||||||
// Remove a temporary channel
|
// Remove a temporary channel
|
||||||
case tempChannel := <- server.tempRemove:
|
case tempChannel := <-server.tempRemove:
|
||||||
if tempChannel.IsEmpty() {
|
if tempChannel.IsEmpty() {
|
||||||
server.RemoveChannel(tempChannel)
|
server.RemoveChannel(tempChannel)
|
||||||
}
|
}
|
||||||
|
|
@ -517,7 +517,7 @@ func (server *Server) handleAuthenticate(client *Client, msg *Message) {
|
||||||
|
|
||||||
// Send CryptState information to the client so it can establish an UDP connection,
|
// Send CryptState information to the client so it can establish an UDP connection,
|
||||||
// if it wishes.
|
// if it wishes.
|
||||||
client.lastResync = time.Seconds()
|
client.lastResync = time.Now().Unix()
|
||||||
err = client.sendMessage(&mumbleproto.CryptSetup{
|
err = client.sendMessage(&mumbleproto.CryptSetup{
|
||||||
Key: client.crypt.RawKey[0:],
|
Key: client.crypt.RawKey[0:],
|
||||||
ClientNonce: client.crypt.DecryptIV[0:],
|
ClientNonce: client.crypt.DecryptIV[0:],
|
||||||
|
|
@ -1335,20 +1335,24 @@ func (server *Server) Start() (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
err = server.udpconn.SetReadTimeout(1e9)
|
err = server.udpconn.SetReadTimeout(1e9)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Set up our TCP connection
|
// Set up our TCP connection
|
||||||
server.tcpl, err = net.ListenTCP("tcp", &net.TCPAddr{net.ParseIP(host), port})
|
server.tcpl, err = net.ListenTCP("tcp", &net.TCPAddr{net.ParseIP(host), port})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
err = server.tcpl.SetTimeout(1e9)
|
err = server.tcpl.SetTimeout(1e9)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Wrap a TLS listener around the TCP connection
|
// Wrap a TLS listener around the TCP connection
|
||||||
certFn := filepath.Join(Args.DataDir, "cert.pem")
|
certFn := filepath.Join(Args.DataDir, "cert.pem")
|
||||||
|
|
@ -1359,7 +1363,7 @@ func (server *Server) Start() (err error) {
|
||||||
}
|
}
|
||||||
server.tlscfg = &tls.Config{
|
server.tlscfg = &tls.Config{
|
||||||
Certificates: []tls.Certificate{cert},
|
Certificates: []tls.Certificate{cert},
|
||||||
AuthenticateClient: true,
|
ClientAuth: tls.RequestClientCert,
|
||||||
}
|
}
|
||||||
server.tlsl = tls.NewListener(server.tcpl, server.tlscfg)
|
server.tlsl = tls.NewListener(server.tcpl, server.tlscfg)
|
||||||
|
|
||||||
|
|
@ -1392,7 +1396,7 @@ func (server *Server) Start() (err error) {
|
||||||
|
|
||||||
// Schedule a server registration update (if needed)
|
// Schedule a server registration update (if needed)
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep((60 + server.Id*10) * 1e9)
|
time.Sleep(1 * time.Minute)
|
||||||
server.RegisterPublicServer()
|
server.RegisterPublicServer()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,18 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"exp/signal"
|
||||||
"fmt"
|
"fmt"
|
||||||
"grumble/logtarget"
|
"github.com/mkrautz/grumble/pkg/logtarget"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SignalHandler() {
|
func SignalHandler() {
|
||||||
for {
|
for {
|
||||||
sig := <-signal.Incoming
|
sig := <-signal.Incoming
|
||||||
|
|
||||||
if sig == os.SIGUSR2 {
|
if sig == os.UnixSignal(syscall.SIGUSR2) {
|
||||||
err := logtarget.Target.Rotate()
|
err := logtarget.Target.Rotate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Unable to rotate log file: %v", err)
|
fmt.Fprintf(os.Stderr, "Unable to rotate log file: %v", err)
|
||||||
|
|
@ -23,7 +24,7 @@ func SignalHandler() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if sig == os.SIGINT || sig == os.SIGTERM {
|
if sig == os.UnixSignal(syscall.SIGINT) || sig == os.UnixSignal(syscall.SIGTERM) {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
ssh.go
19
ssh.go
|
|
@ -2,9 +2,10 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"code.google.com/p/go.crypto/ssh"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
"exp/ssh"
|
"exp/terminal"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
@ -133,7 +134,7 @@ func RunSSH() {
|
||||||
func handleChannel(channel ssh.Channel) {
|
func handleChannel(channel ssh.Channel) {
|
||||||
if channel.ChannelType() == "session" {
|
if channel.ChannelType() == "session" {
|
||||||
channel.Accept()
|
channel.Accept()
|
||||||
shell := ssh.NewServerShell(channel, "G> ")
|
shell := terminal.NewTerminal(channel, "> ")
|
||||||
go func() {
|
go func() {
|
||||||
defer channel.Close()
|
defer channel.Close()
|
||||||
for {
|
for {
|
||||||
|
|
@ -225,7 +226,7 @@ func StartServerCmd(reply SshCmdReply, args []string) error {
|
||||||
return errors.New("argument count mismatch")
|
return errors.New("argument count mismatch")
|
||||||
}
|
}
|
||||||
|
|
||||||
serverId, err := strconv.Atoi64(args[1])
|
serverId, err := strconv.ParseInt(args[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("bad server id")
|
return errors.New("bad server id")
|
||||||
}
|
}
|
||||||
|
|
@ -250,7 +251,7 @@ func StopServerCmd(reply SshCmdReply, args []string) error {
|
||||||
return errors.New("argument count mismatch")
|
return errors.New("argument count mismatch")
|
||||||
}
|
}
|
||||||
|
|
||||||
serverId, err := strconv.Atoi64(args[1])
|
serverId, err := strconv.ParseInt(args[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("bad server id")
|
return errors.New("bad server id")
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +276,7 @@ func RestartServerCmd(reply SshCmdReply, args []string) error {
|
||||||
return errors.New("argument count mismatch")
|
return errors.New("argument count mismatch")
|
||||||
}
|
}
|
||||||
|
|
||||||
serverId, err := strconv.Atoi64(args[1])
|
serverId, err := strconv.ParseInt(args[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("bad server id")
|
return errors.New("bad server id")
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +308,7 @@ func SetSuperUserPasswordCmd(reply SshCmdReply, args []string) error {
|
||||||
return errors.New("argument count mismatch")
|
return errors.New("argument count mismatch")
|
||||||
}
|
}
|
||||||
|
|
||||||
serverId, err := strconv.Atoi64(args[1])
|
serverId, err := strconv.ParseInt(args[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("bad server id")
|
return errors.New("bad server id")
|
||||||
}
|
}
|
||||||
|
|
@ -328,7 +329,7 @@ func SetConfCmd(reply SshCmdReply, args []string) error {
|
||||||
return errors.New("argument count mismatch")
|
return errors.New("argument count mismatch")
|
||||||
}
|
}
|
||||||
|
|
||||||
serverId, err := strconv.Atoi64(args[1])
|
serverId, err := strconv.ParseInt(args[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("bad server id")
|
return errors.New("bad server id")
|
||||||
}
|
}
|
||||||
|
|
@ -352,7 +353,7 @@ func GetConfCmd(reply SshCmdReply, args []string) error {
|
||||||
return errors.New("argument count mismatch")
|
return errors.New("argument count mismatch")
|
||||||
}
|
}
|
||||||
|
|
||||||
serverId, err := strconv.Atoi64(args[1])
|
serverId, err := strconv.ParseInt(args[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("bad server id")
|
return errors.New("bad server id")
|
||||||
}
|
}
|
||||||
|
|
@ -374,7 +375,7 @@ func ClearConfCmd(reply SshCmdReply, args []string) error {
|
||||||
return errors.New("argument count mismatch")
|
return errors.New("argument count mismatch")
|
||||||
}
|
}
|
||||||
|
|
||||||
serverId, err := strconv.Atoi64(args[1])
|
serverId, err := strconv.ParseInt(args[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("bad server id")
|
return errors.New("bad server id")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue