From a157ce8d9ee8735afa1eedac0d6a96878a3fd2df Mon Sep 17 00:00:00 2001
From: a <a@tuxpa.in>
Date: Mon, 14 Nov 2022 17:39:54 -0600
Subject: [PATCH] switch to new tuxpaint domain

---
 client.go         |  2 +-
 client_test.go    |  4 ++--
 go.mod            |  1 +
 go.sum            |  5 +++++
 handler.go        |  2 +-
 json.go           |  4 ----
 metrics.go        | 50 -----------------------------------------------
 middleware/log.go |  2 +-
 server.go         |  2 +-
 service.go        |  5 +++--
 websocket.go      |  2 +-
 11 files changed, 16 insertions(+), 63 deletions(-)
 delete mode 100644 metrics.go

diff --git a/client.go b/client.go
index efc7e1a..03edace 100644
--- a/client.go
+++ b/client.go
@@ -26,7 +26,7 @@ import (
 	"sync/atomic"
 	"time"
 
-	"git.tuxpa.in/a/zlog/log"
+	"tuxpa.in/a/zlog/log"
 )
 
 var (
diff --git a/client_test.go b/client_test.go
index 9a5e5f4..bd856b1 100644
--- a/client_test.go
+++ b/client_test.go
@@ -30,8 +30,8 @@ import (
 	"testing"
 	"time"
 
-	"git.tuxpa.in/a/zlog"
-	"git.tuxpa.in/a/zlog/log"
+	"tuxpa.in/a/zlog"
+	"tuxpa.in/a/zlog/log"
 	"github.com/davecgh/go-spew/spew"
 )
 
diff --git a/go.mod b/go.mod
index 3f40282..a15a023 100644
--- a/go.mod
+++ b/go.mod
@@ -50,4 +50,5 @@ require (
 	google.golang.org/protobuf v1.28.1 // indirect
 	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
+	tuxpa.in/a/zlog v1.50.0 // indirect
 )
diff --git a/go.sum b/go.sum
index d43c659..ee0f4dc 100644
--- a/go.sum
+++ b/go.sum
@@ -68,6 +68,7 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht
 github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
 github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
 github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
+github.com/coreos/go-systemd/v22 v22.4.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
 github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -288,6 +289,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
 github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
 github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
 github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
+github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
 github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
@@ -502,6 +504,7 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220915200043-7b5979e65e41/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc=
 golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -709,3 +712,5 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
 rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
 sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
 sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
+tuxpa.in/a/zlog v1.50.0 h1:4XVCBpOT/jtPoJ346Sp6jomLfcLWXI7MMazl+QjHPNw=
+tuxpa.in/a/zlog v1.50.0/go.mod h1:kwk2puLClsPPQhqtjG2OEV0Y4sjN0BuSRn7AYtACzjI=
diff --git a/handler.go b/handler.go
index 8536c36..9a30262 100644
--- a/handler.go
+++ b/handler.go
@@ -25,7 +25,7 @@ import (
 	"strings"
 	"sync"
 
-	"git.tuxpa.in/a/zlog"
+	"tuxpa.in/a/zlog"
 )
 
 // handler handles JSON-RPC messages. There is one handler per connection. Note that
diff --git a/json.go b/json.go
index fcf0a6b..062db5c 100644
--- a/json.go
+++ b/json.go
@@ -49,22 +49,18 @@ type JsonRpcMessage = jsonrpcMessage
 func (msg *jsonrpcMessage) isNotification() bool {
 	return msg.ID == nil && len(msg.Method) > 0
 }
-
 func (msg *jsonrpcMessage) isCall() bool {
 	return msg.hasValidID() && len(msg.Method) > 0
 }
-
 func (msg *jsonrpcMessage) isResponse() bool {
 	return msg.hasValidID() && len(msg.Method) == 0 && msg.Params == nil && (msg.Result != nil || msg.Error != nil)
 }
-
 func (msg *jsonrpcMessage) hasValidID() bool {
 	return msg.ID != nil && !msg.ID.null
 }
 func (msg *jsonrpcMessage) isSubscribe() bool {
 	return strings.HasSuffix(msg.Method, subscribeMethodSuffix)
 }
-
 func (msg *jsonrpcMessage) isUnsubscribe() bool {
 	return strings.HasSuffix(msg.Method, unsubscribeMethodSuffix)
 }
diff --git a/metrics.go b/metrics.go
deleted file mode 100644
index 4684388..0000000
--- a/metrics.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2020 The go-ethereum Authors
-// This file is part of the go-ethereum library.
-//
-// The go-ethereum library is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// The go-ethereum library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
-
-package jrpc
-
-import (
-	"fmt"
-	"time"
-
-	"github.com/ethereum/go-ethereum/metrics"
-)
-
-var (
-	rpcRequestGauge        = metrics.NewRegisteredGauge("rpc/requests", nil)
-	successfulRequestGauge = metrics.NewRegisteredGauge("rpc/success", nil)
-	failedRequestGauge     = metrics.NewRegisteredGauge("rpc/failure", nil)
-
-	// serveTimeHistName is the prefix of the per-request serving time histograms.
-	serveTimeHistName = "rpc/duration"
-
-	rpcServingTimer = metrics.NewRegisteredTimer("rpc/duration/all", nil)
-)
-
-// updateServeTimeHistogram tracks the serving time of a remote RPC call.
-func updateServeTimeHistogram(method string, success bool, elapsed time.Duration) {
-	note := "success"
-	if !success {
-		note = "failure"
-	}
-	h := fmt.Sprintf("%s/%s/%s", serveTimeHistName, method, note)
-	sampler := func() metrics.Sample {
-		return metrics.ResettingSample(
-			metrics.NewExpDecaySample(1028, 0.015),
-		)
-	}
-	metrics.GetOrRegisterHistogramLazy(h, nil, sampler).Update(elapsed.Microseconds())
-}
diff --git a/middleware/log.go b/middleware/log.go
index 586052d..eb564bd 100644
--- a/middleware/log.go
+++ b/middleware/log.go
@@ -7,7 +7,7 @@ import (
 	"time"
 
 	"gfx.cafe/open/jrpc"
-	"git.tuxpa.in/a/zlog/log"
+	"tuxpa.in/a/zlog/log"
 )
 
 func Logger(next jrpc.Handler) jrpc.Handler {
diff --git a/server.go b/server.go
index da3eeef..0079e55 100644
--- a/server.go
+++ b/server.go
@@ -6,7 +6,7 @@ import (
 	"net/http"
 	"sync/atomic"
 
-	"git.tuxpa.in/a/zlog/log"
+	"tuxpa.in/a/zlog/log"
 	mapset "github.com/deckarep/golang-set"
 )
 
diff --git a/service.go b/service.go
index 59efd0a..f9748f1 100644
--- a/service.go
+++ b/service.go
@@ -21,12 +21,13 @@ import (
 	"reflect"
 	"runtime"
 	"unicode"
+
+	"tuxpa.in/a/zlog/log"
 )
 
 var (
 	contextType = reflect.TypeOf((*context.Context)(nil)).Elem()
 	errorType   = reflect.TypeOf((*error)(nil)).Elem()
-	stringType  = reflect.TypeOf("")
 )
 
 // A helper function that mimics the behavior of the handlers in the go-ethereum rpc package
@@ -101,7 +102,7 @@ func (e *callback) ServeRPC(w ResponseWriter, r *Request) {
 			const size = 64 << 10
 			buf := make([]byte, size)
 			buf = buf[:runtime.Stack(buf, false)]
-			//log.Error().Str("method", r.msg.Method).Interface("err", err).Hex("buf", buf).Msg("crashed")
+			log.Error().Str("method", r.msg.Method).Interface("err", err).Hex("buf", buf).Msg("crashed")
 			//		errRes := errors.New("method handler crashed: " + fmt.Sprint(err))
 			w.Send(nil, nil)
 			return
diff --git a/websocket.go b/websocket.go
index 1ffe457..69c98db 100644
--- a/websocket.go
+++ b/websocket.go
@@ -24,7 +24,7 @@ import (
 	"time"
 
 	"gfx.cafe/open/jrpc/wsjson"
-	"git.tuxpa.in/a/zlog/log"
+	"tuxpa.in/a/zlog/log"
 	"nhooyr.io/websocket"
 )
 
-- 
GitLab