sum7
/
yaja
Archived
1
0
Fork 0

move to dev.sum7.eu

This commit is contained in:
Martin/Geno 2018-02-07 15:34:18 +01:00
parent e474f460aa
commit 79459ff864
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
26 changed files with 92 additions and 89 deletions

View File

@ -1,6 +1,6 @@
workspace: workspace:
base: /go base: /go
path: src/github.com/genofire/yaja path: src/dev.sum7.eu/genofire/yaja
pipeline: pipeline:
build: build:

View File

@ -10,13 +10,13 @@ import (
"golang.org/x/crypto/acme/autocert" "golang.org/x/crypto/acme/autocert"
"github.com/genofire/yaja/database" "dev.sum7.eu/genofire/yaja/database"
"github.com/genofire/yaja/model/config" "dev.sum7.eu/genofire/yaja/model/config"
"github.com/genofire/yaja/server/extension" "dev.sum7.eu/genofire/yaja/server/extension"
"github.com/genofire/golang-lib/file" "dev.sum7.eu/genofire/golang-lib/file"
"github.com/genofire/golang-lib/worker" "dev.sum7.eu/genofire/golang-lib/worker"
"github.com/genofire/yaja/server" "dev.sum7.eu/genofire/yaja/server"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"sync" "sync"
"github.com/genofire/yaja/model" "dev.sum7.eu/genofire/yaja/model"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )

View File

@ -1,6 +1,6 @@
package main package main
import "github.com/genofire/yaja/cmd" import "dev.sum7.eu/genofire/yaja/cmd"
func main() { func main() {
cmd.Execute() cmd.Execute()

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQExtensions []IQExtension type IQExtensions []IQExtension

View File

@ -3,9 +3,9 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/database" "dev.sum7.eu/genofire/yaja/database"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQDisco struct { type IQDisco struct {

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQExtensionDiscovery struct { type IQExtensionDiscovery struct {

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
//TODO Draft //TODO Draft

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQPing struct { type IQPing struct {

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQPrivate struct { type IQPrivate struct {

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQPrivateBookmark struct { type IQPrivateBookmark struct {

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQPrivateMetacontact struct { type IQPrivateMetacontact struct {

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQPrivateRoster struct { type IQPrivateRoster struct {

View File

@ -3,9 +3,9 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/database" "dev.sum7.eu/genofire/yaja/database"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type IQRoster struct { type IQRoster struct {

View File

@ -3,7 +3,7 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type Extensions []Extension type Extensions []Extension

View File

@ -3,7 +3,7 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type Message struct { type Message struct {

View File

@ -3,8 +3,8 @@ package extension
import ( import (
"encoding/xml" "encoding/xml"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type Presence struct { type Presence struct {

View File

@ -4,12 +4,12 @@ import (
"crypto/tls" "crypto/tls"
"net" "net"
"github.com/genofire/yaja/database" "dev.sum7.eu/genofire/yaja/database"
"github.com/genofire/yaja/model" "dev.sum7.eu/genofire/yaja/model"
"github.com/genofire/yaja/server/extension" "dev.sum7.eu/genofire/yaja/server/extension"
"github.com/genofire/yaja/server/toclient" "dev.sum7.eu/genofire/yaja/server/toclient"
"github.com/genofire/yaja/server/toserver" "dev.sum7.eu/genofire/yaja/server/toserver"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"golang.org/x/crypto/acme/autocert" "golang.org/x/crypto/acme/autocert"
) )

View File

@ -4,9 +4,9 @@ import (
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/model" "dev.sum7.eu/genofire/yaja/model"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
"golang.org/x/crypto/acme/autocert" "golang.org/x/crypto/acme/autocert"
) )

View File

@ -1,8 +1,8 @@
package state package state
import ( import (
"github.com/genofire/yaja/server/extension" "dev.sum7.eu/genofire/yaja/server/extension"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
// SendingClient state // SendingClient state

View File

@ -1,6 +1,6 @@
package state package state
import "github.com/genofire/yaja/server/utils" import "dev.sum7.eu/genofire/yaja/server/utils"
// State processes the stream and moves to the next state // State processes the stream and moves to the next state
type State interface { type State interface {

View File

@ -7,11 +7,11 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/genofire/yaja/database" "dev.sum7.eu/genofire/yaja/database"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/extension" "dev.sum7.eu/genofire/yaja/server/extension"
"github.com/genofire/yaja/server/state" "dev.sum7.eu/genofire/yaja/server/state"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
"golang.org/x/crypto/acme/autocert" "golang.org/x/crypto/acme/autocert"
) )
@ -64,24 +64,26 @@ func (state *TLSStream) Process() state.State {
return state return state
} }
fmt.Fprintf(state.Client.Conn, `<?xml version='1.0'?>
<stream:stream id='%x' version='1.0' xmlns='%s' xmlns:stream='%s'>`,
utils.CreateCookie(), messages.NSClient, messages.NSStream)
if state.domainRegisterAllowed(state.Client.JID) { if state.domainRegisterAllowed(state.Client.JID) {
fmt.Fprintf(state.Client.Conn, `<stream:features> fmt.Fprintf(state.Client.Conn, `<?xml version='1.0'?>
<mechanisms xmlns='%s'> <stream:stream id='%x' version='1.0' xmlns='%s' xmlns:stream='%s'>
<mechanism>PLAIN</mechanism> <stream:features>
</mechanisms> <register xmlns='%s'/>
<register xmlns='%s'/> <mechanisms xmlns='%s'>
</stream:features>`, <mechanism>PLAIN</mechanism>
</mechanisms>
</stream:features>`,
utils.CreateCookie(), messages.NSClient, messages.NSStream,
messages.NSSASL, messages.NSFeaturesIQRegister) messages.NSSASL, messages.NSFeaturesIQRegister)
} else { } else {
fmt.Fprintf(state.Client.Conn, `<stream:features> fmt.Fprintf(state.Client.Conn, `<?xml version='1.0'?>
<mechanisms xmlns='%s'> <stream:stream id='%x' version='1.0' xmlns='%s' xmlns:stream='%s'>
<mechanism>PLAIN</mechanism> <stream:features>
</mechanisms> <mechanisms xmlns='%s'>
</stream:features>`, <mechanism>PLAIN</mechanism>
</mechanisms>
</stream:features>`,
utils.CreateCookie(), messages.NSClient, messages.NSStream,
messages.NSSASL) messages.NSSASL)
} }
@ -166,12 +168,13 @@ func (state *AuthedStart) Process() state.State {
return nil return nil
} }
fmt.Fprintf(state.Client.Conn, `<?xml version='1.0'?> fmt.Fprintf(state.Client.Conn, `<?xml version='1.0'?>
<stream:stream id='%x' version='1.0' xmlns='%s' xmlns:stream='%s'>`, <stream:stream xmlns:stream='%s' xml:lang='en' from='%s' id='%x' version='1.0' xmlns='%s'>
utils.CreateCookie(), messages.NSClient, messages.NSStream) <stream:features>
<bind xmlns='%s'>
fmt.Fprintf(state.Client.Conn, `<stream:features> <required/>
<bind xmlns='%s'/> </bind>
</stream:features>`, </stream:features>`,
messages.NSStream, state.Client.JID.Domain, utils.CreateCookie(), messages.NSClient,
messages.NSBind) messages.NSBind)
return state.Next return state.Next

View File

@ -4,11 +4,11 @@ import (
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"github.com/genofire/yaja/database" "dev.sum7.eu/genofire/yaja/database"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/model" "dev.sum7.eu/genofire/yaja/model"
"github.com/genofire/yaja/server/state" "dev.sum7.eu/genofire/yaja/server/state"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
) )
type RegisterFormRequest struct { type RegisterFormRequest struct {

View File

@ -6,11 +6,11 @@ import (
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"github.com/genofire/yaja/database" "dev.sum7.eu/genofire/yaja/database"
"github.com/genofire/yaja/messages" "dev.sum7.eu/genofire/yaja/messages"
"github.com/genofire/yaja/server/extension" "dev.sum7.eu/genofire/yaja/server/extension"
"github.com/genofire/yaja/server/state" "dev.sum7.eu/genofire/yaja/server/state"
"github.com/genofire/yaja/server/utils" "dev.sum7.eu/genofire/yaja/server/utils"
"golang.org/x/crypto/acme/autocert" "golang.org/x/crypto/acme/autocert"
) )
@ -90,14 +90,14 @@ func (state *TLSStream) Process() state.State {
} }
fmt.Fprintf(state.Client.Conn, `<?xml version='1.0'?> fmt.Fprintf(state.Client.Conn, `<?xml version='1.0'?>
<stream:stream id='%x' version='1.0' xmlns='%s' xmlns:stream='%s'>`, <stream:stream id='%x' version='1.0' xmlns='%s' xmlns:stream='%s'>
utils.CreateCookie(), messages.NSClient, messages.NSStream) <stream:features>
fmt.Fprintf(state.Client.Conn, `<stream:features>
<mechanisms xmlns='%s'> <mechanisms xmlns='%s'>
<mechanism>EXTERNAL</mechanism> <mechanism>EXTERNAL</mechanism>
</mechanisms> </mechanisms>
<bidi xmlns='urn:xmpp:features:bidi'/>
</stream:features>`, </stream:features>`,
utils.CreateCookie(), messages.NSClient, messages.NSStream,
messages.NSSASL) messages.NSSASL)
return state.Next return state.Next

View File

@ -4,7 +4,7 @@ import (
"encoding/xml" "encoding/xml"
"net" "net"
"github.com/genofire/yaja/model" "dev.sum7.eu/genofire/yaja/model"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )

View File

@ -5,7 +5,7 @@ import (
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"github.com/genofire/yaja/model" "dev.sum7.eu/genofire/yaja/model"
) )
// Cookie is used to give a unique identifier to each request. // Cookie is used to give a unique identifier to each request.