Update for Go 1.

This commit is contained in:
Mikkel Krautz 2012-02-06 22:16:16 +01:00
parent 4114a83d64
commit e46a65109f
31 changed files with 901 additions and 202 deletions

View file

@ -54,14 +54,14 @@ func (ban *Ban) SetISOStartDate(isodate string) {
if err != nil {
ban.Start = 0
} else {
ban.Start = startTime.Seconds()
ban.Start = startTime.Unix()
}
}
// Return the currently set start date as an ISO 8601-formatted
// date (in UTC).
func (ban Ban) ISOStartDate() string {
startTime := time.SecondsToUTC(ban.Start)
startTime := time.Unix(ban.Start, 0).UTC()
return startTime.Format(ISODate)
}
@ -74,7 +74,7 @@ func (ban Ban) IsExpired() bool {
// Expiry check
expiryTime := ban.Start + int64(ban.Duration)
if time.Seconds() > expiryTime {
if time.Now().Unix() > expiryTime {
return true
}
return false

View file

@ -28,7 +28,7 @@ func TestMaksPowerOf2(t *testing.T) {
func TestMatchV4(t *testing.T) {
b := Ban{}
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 {
t.Errorf("Invalid IP")
}
@ -46,7 +46,7 @@ func TestMatchV4(t *testing.T) {
func TestMismatchV4(t *testing.T) {
b := Ban{}
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 {
t.Errorf("Invalid IP")
}
@ -62,7 +62,7 @@ func TestMismatchV4(t *testing.T) {
}
func TestMatchV6(t *testing.T) {
b := Ban {}
b := Ban{}
b.IP = net.ParseIP("2a00:1450:400b:c00::63")
b.Mask = 64
if len(b.IP) == 0 {
@ -109,7 +109,7 @@ func TestISODate(t *testing.T) {
func TestInfiniteExpiry(t *testing.T) {
b := Ban{}
b.Start = time.Seconds()-10
b.Start = time.Now().Add(-10 * time.Second).Unix()
b.Duration = 0
if b.IsExpired() {
@ -119,7 +119,7 @@ func TestInfiniteExpiry(t *testing.T) {
func TestExpired(t *testing.T) {
b := Ban{}
b.Start = time.Seconds()-10
b.Start = time.Now().Add(-10 * time.Second).Unix()
b.Duration = 9
if !b.IsExpired() {
@ -129,8 +129,8 @@ func TestExpired(t *testing.T) {
func TestNotExpired(t *testing.T) {
b := Ban{}
b.Start = time.Seconds()
b.Duration = 60*60*24
b.Start = time.Now().Unix()
b.Duration = 60 * 60 * 24
if b.IsExpired() {
t.Errorf("Should expire in 24 hours")

View file

@ -42,7 +42,7 @@ func (r *blobReader) Read(b []byte) (n int, err error) {
if err != io.EOF {
return
}
if !bytes.Equal(r.sum, r.hash.Sum()) {
if !bytes.Equal(r.sum, r.hash.Sum(nil)) {
err = ErrHashMismatch
}
return

View file

@ -14,11 +14,12 @@ import (
"os"
"path/filepath"
"sync"
"syscall"
)
type BlobStore struct {
dir string
lockfn string
dir string
lockfn string
}
const (
@ -117,8 +118,9 @@ func NewBlobStore(path string) (bs *BlobStore, err error) {
dirStructureExists = false
}
}
} else {
bsf.Close()
}
bsf.Close()
if !dirStructureExists {
for i := 0; i < 256; i++ {
@ -132,7 +134,7 @@ func NewBlobStore(path string) (bs *BlobStore, err error) {
if err != nil {
return nil, err
}
if !fi.IsDirectory() {
if !fi.IsDir() {
return nil, ErrBadFile
}
} else if e.Err == os.ENOTDIR {
@ -152,7 +154,7 @@ func NewBlobStore(path string) (bs *BlobStore, err error) {
if err != nil {
return nil, err
}
if !fi.IsDirectory() {
if !fi.IsDir() {
return nil, ErrBadFile
}
} else if e.Err == os.ENOTDIR {
@ -174,8 +176,8 @@ func NewBlobStore(path string) (bs *BlobStore, err error) {
}
bs = &BlobStore{
dir: path,
lockfn: lockfn,
dir: path,
lockfn: lockfn,
}
return bs, nil
}
@ -256,7 +258,7 @@ func (bs *BlobStore) Put(buf []byte) (key string, err error) {
// disk.
h := sha1.New()
h.Write(buf)
key = hex.EncodeToString(h.Sum())
key = hex.EncodeToString(h.Sum(nil))
// Get the components that make up the on-disk
// 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
// and Errno code 183 (ERROR_ALREADY_EXISTS)
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
}
if err.Err == os.EEXIST {

View file

@ -37,7 +37,7 @@ func TestMakeAllCreateAll(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if !fi.IsDirectory() {
if !fi.IsDir() {
t.Errorf("Not a directory")
}
}
@ -145,7 +145,7 @@ func TestReadNonExistantKey(t *testing.T) {
h := sha1.New()
h.Write([]byte{0x42})
key := hex.EncodeToString(h.Sum())
key := hex.EncodeToString(h.Sum(nil))
buf, err := bs.Get(key)
if err != ErrNoSuchKey {
t.Error("Expected no such key %v, found it anyway. (buf=%v, err=%v)", key, buf, err)

View file

@ -1,6 +1,6 @@
// 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.
// 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 blobstore
@ -12,7 +12,7 @@ import (
"syscall"
)
// Acquire lockfile at path.
// Acquire lockfile at path.
func AcquireLockFile(path string) error {
dir, fn := filepath.Split(path)
lockfn := filepath.Join(dir, fn)
@ -26,7 +26,8 @@ func AcquireLockFile(path string) error {
pid, err := strconv.Atoi(string(content))
if err == nil {
if syscall.Kill(pid, 0) == 0 {
err = syscall.Kill(pid, 0)
if err != nil {
return ErrLocked
}
}
@ -67,7 +68,7 @@ func AcquireLockFile(path string) error {
return nil
}
// Release lockfile at path.
// Release lockfile at path.
func ReleaseLockFile(path string) error {
return os.Remove(path)
}

View file

@ -208,7 +208,7 @@ func (cs *CryptState) Decrypt(dst, src []byte) (err error) {
cs.Lost = uint32(-lost)
}
cs.LastGoodTime = time.Seconds()
cs.LastGoodTime = time.Now().Unix()
return
}

View file

@ -6,8 +6,8 @@ package freezer
import (
"bytes"
"code.google.com/p/goprotobuf/proto"
"encoding/binary"
"goprotobuf.googlecode.com/hg/proto"
"hash/crc32"
"io"
"math"

View file

@ -14,4 +14,4 @@ const (
UserRemoveType
ChannelType
ChannelRemoveType
)
)

129
pkg/freezer/types.pb.go Normal file
View 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() {
}

View file

@ -6,7 +6,7 @@ package freezer
import (
"encoding/binary"
"goprotobuf.googlecode.com/hg/proto"
"code.google.com/p/goprotobuf/proto"
"hash"
"hash/crc32"
"io"

View file

@ -17,8 +17,8 @@ package freezer
import (
"bytes"
"code.google.com/p/goprotobuf/proto"
"encoding/binary"
"goprotobuf.googlecode.com/hg/proto"
"hash"
"hash/crc32"
"io"

View file

@ -59,7 +59,7 @@ func Filter(text string, options *Options) (filtered string, err error) {
// Strip away all HTML
out := bytes.NewBuffer(nil)
buf := bytes.NewBufferString(text)
parser := xml.NewParser(buf)
parser := xml.NewDecoder(buf)
parser.Strict = false
parser.AutoClose = xml.HTMLAutoClose
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
out := bytes.NewBuffer(nil)
buf := bytes.NewBufferString(text)
parser := xml.NewParser(buf)
parser := xml.NewDecoder(buf)
parser.Strict = false
parser.AutoClose = xml.HTMLAutoClose
parser.Entity = xml.HTMLEntity

View file

@ -16,10 +16,10 @@ import (
// LogTarget multiplexes its incoming writes to multiple optional
// output writers, and one main output writer (the log file).
type LogTarget struct {
mu sync.Mutex
logfn string
file *os.File
memLog *bytes.Buffer
mu sync.Mutex
logfn string
file *os.File
memLog *bytes.Buffer
}
var Target LogTarget
@ -35,7 +35,7 @@ func (target *LogTarget) Write(in []byte) (int, error) {
n, err := os.Stderr.Write(in)
if err != nil {
return n, err
return n, err
}
n, err = target.file.Write(in)

View 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)
}

View file

@ -93,6 +93,6 @@ func MessageType(msg interface{}) uint16 {
return MessageRequestBlob
case *ServerConfig:
return MessageServerConfig
}
}
panic("unknown type")
}

View file

@ -90,13 +90,13 @@ func (cfg *Config) IntValue(key string) (intval int) {
// Get the value of a specific config key as a uint32
func (cfg *Config) Uint32Value(key string) (uint32val uint32) {
str := cfg.StringValue(key)
uintval, _ := strconv.Atoui(str)
uintval, _ := strconv.ParseUint(str, 10, 0)
return uint32(uintval)
}
// Get the value fo a sepcific config key as a bool
func (cfg *Config) BoolValue(key string) (boolval bool) {
str := cfg.StringValue(key)
boolval, _ = strconv.Atob(str)
boolval, _ = strconv.ParseBool(str)
return
}

View file

@ -256,7 +256,7 @@ func (c *Conn) Prepare(cmd string) (*Stmt, error) {
if rv != 0 {
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 {
@ -356,13 +356,13 @@ func (s *Stmt) Scan(args ...interface{}) error {
}
*v = x
case *int64:
x, err := strconv.Atoi64(string(data))
x, err := strconv.ParseInt(string(data), 10, 64)
if err != nil {
return errors.New("arg " + strconv.Itoa(i) + " as int64: " + err.Error())
}
*v = x
case *float64:
x, err := strconv.Atof64(string(data))
x, err := strconv.ParseFloat(string(data), 64)
if err != nil {
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 {
return time.Nanoseconds() - s.t0
return time.Now().Sub(s.t0)
}
func (s *Stmt) Finalize() error {