good morning!!!!

Skip to content
Snippets Groups Projects
Verified Commit ac353749 authored by a's avatar a
Browse files

noot

parent f20f858c
Branches
Tags
No related merge requests found
Pipeline #75654 failed
...@@ -2,6 +2,7 @@ package fed ...@@ -2,6 +2,7 @@ package fed
import ( import (
"crypto/tls" "crypto/tls"
"net"
"gfx.cafe/gfx/pggat/lib/util/decorator" "gfx.cafe/gfx/pggat/lib/util/decorator"
"gfx.cafe/gfx/pggat/lib/util/strutil" "gfx.cafe/gfx/pggat/lib/util/strutil"
...@@ -157,6 +158,11 @@ func (T *Conn) WriteByte(b byte) error { ...@@ -157,6 +158,11 @@ func (T *Conn) WriteByte(b byte) error {
return T.codec.WriteByte(b) return T.codec.WriteByte(b)
} }
func (T *Conn) LocalAddr() net.Addr {
return T.codec.LocalAddr()
}
func (T *Conn) ReadByte() (byte, error) { func (T *Conn) ReadByte() (byte, error) {
return T.codec.ReadByte() return T.codec.ReadByte()
} }
......
...@@ -14,6 +14,7 @@ import ( ...@@ -14,6 +14,7 @@ import (
"gfx.cafe/gfx/pggat/lib/bouncer" "gfx.cafe/gfx/pggat/lib/bouncer"
"gfx.cafe/gfx/pggat/lib/bouncer/backends/v0" "gfx.cafe/gfx/pggat/lib/bouncer/backends/v0"
"gfx.cafe/gfx/pggat/lib/fed" "gfx.cafe/gfx/pggat/lib/fed"
"gfx.cafe/gfx/pggat/lib/fed/codecs/netconncodec"
"gfx.cafe/gfx/pggat/lib/gat" "gfx.cafe/gfx/pggat/lib/gat"
"gfx.cafe/gfx/pggat/lib/util/strutil" "gfx.cafe/gfx/pggat/lib/util/strutil"
) )
...@@ -65,7 +66,7 @@ func (T *Dialer) Dial() (*fed.Conn, error) { ...@@ -65,7 +66,7 @@ func (T *Dialer) Dial() (*fed.Conn, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
conn := fed.NewConn(c) conn := fed.NewConn(netconncodec.NewCodec(c))
conn.User = T.Username conn.User = T.Username
conn.Database = T.Database conn.Database = T.Database
err = backends.Accept( err = backends.Accept(
...@@ -89,7 +90,7 @@ func (T *Dialer) Cancel(key fed.BackendKey) { ...@@ -89,7 +90,7 @@ func (T *Dialer) Cancel(key fed.BackendKey) {
if err != nil { if err != nil {
return return
} }
conn := fed.NewConn(c) conn := fed.NewConn(netconncodec.NewCodec(c))
defer func() { defer func() {
_ = conn.Close() _ = conn.Close()
}() }()
......
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"gfx.cafe/gfx/pggat/lib/fed" "gfx.cafe/gfx/pggat/lib/fed"
"gfx.cafe/gfx/pggat/lib/fed/codecs/netconncodec"
) )
type ListenerConfig struct { type ListenerConfig struct {
...@@ -40,7 +41,7 @@ func (T *Listener) accept() (*fed.Conn, error) { ...@@ -40,7 +41,7 @@ func (T *Listener) accept() (*fed.Conn, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return fed.NewConn(raw), nil return fed.NewConn(netconncodec.NewCodec(raw)), nil
} }
func (T *Listener) Provision(ctx caddy.Context) error { func (T *Listener) Provision(ctx caddy.Context) error {
......
...@@ -48,7 +48,7 @@ func (T *LocalAddress) Provision(ctx caddy.Context) error { ...@@ -48,7 +48,7 @@ func (T *LocalAddress) Provision(ctx caddy.Context) error {
} }
func (T *LocalAddress) Matches(conn *fed.Conn) bool { func (T *LocalAddress) Matches(conn *fed.Conn) bool {
switch addr := conn.NetConn.LocalAddr().(type) { switch addr := conn.LocalAddr().(type) {
case *net.TCPAddr: case *net.TCPAddr:
expected, ok := T.addr.(*net.TCPAddr) expected, ok := T.addr.(*net.TCPAddr)
if !ok { if !ok {
......
...@@ -2,14 +2,23 @@ package gsql ...@@ -2,14 +2,23 @@ package gsql
import ( import (
"gfx.cafe/gfx/pggat/lib/fed" "gfx.cafe/gfx/pggat/lib/fed"
"gfx.cafe/gfx/pggat/lib/fed/codecs/netconncodec"
"gfx.cafe/gfx/pggat/lib/util/mio" "gfx.cafe/gfx/pggat/lib/util/mio"
) )
func NewPair() (*fed.Conn, *fed.Conn) { func NewPair() (*fed.Conn, *fed.Conn) {
conn := new(mio.Conn) conn := new(mio.Conn)
inward := fed.NewConn(mio.InwardConn{Conn: conn}) inward := fed.NewConn(
netconncodec.NewCodec(
mio.InwardConn{Conn: conn},
),
)
inward.Ready = true inward.Ready = true
outward := fed.NewConn(mio.OutwardConn{Conn: conn}) outward := fed.NewConn(
netconncodec.NewCodec(
mio.OutwardConn{Conn: conn},
),
)
outward.Ready = true outward.Ready = true
return inward, outward return inward, outward
......
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"gfx.cafe/gfx/pggat/lib/bouncer/backends/v0" "gfx.cafe/gfx/pggat/lib/bouncer/backends/v0"
"gfx.cafe/gfx/pggat/lib/bouncer/bouncers/v2" "gfx.cafe/gfx/pggat/lib/bouncer/bouncers/v2"
"gfx.cafe/gfx/pggat/lib/fed" "gfx.cafe/gfx/pggat/lib/fed"
"gfx.cafe/gfx/pggat/lib/fed/codecs/netconncodec"
"gfx.cafe/gfx/pggat/lib/gsql" "gfx.cafe/gfx/pggat/lib/gsql"
"gfx.cafe/gfx/pggat/lib/util/flip" "gfx.cafe/gfx/pggat/lib/util/flip"
) )
...@@ -30,7 +31,7 @@ func TestQuery(t *testing.T) { ...@@ -30,7 +31,7 @@ func TestQuery(t *testing.T) {
t.Error(err) t.Error(err)
return return
} }
server := fed.NewConn(s) server := fed.NewConn(netconncodec.NewCodec(s))
err = backends.Accept( err = backends.Accept(
server, server,
"", "",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment