don't log in GetJoinedWD for now because it is called prior to

This commit is contained in:
eyedeekay
2024-11-16 15:50:58 -05:00
parent 0d05b3c3f7
commit d7abd8af30
8 changed files with 48 additions and 38 deletions

View File

@ -4,12 +4,13 @@
package onramp package onramp
import ( import (
"github.com/sirupsen/logrus"
"net" "net"
"net/url" "net/url"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/sirupsen/logrus"
) )
//go:generate go run -tags gen ./gen.go //go:generate go run -tags gen ./gen.go
@ -18,23 +19,23 @@ import (
func GetJoinedWD(dir string) (string, error) { func GetJoinedWD(dir string) (string, error) {
wd, err := os.Getwd() wd, err := os.Getwd()
if err != nil { if err != nil {
log.WithError(err).Error("Failed to get working directory") //log.WithError(err).Error("Failed to get working directory")
return "", err return "", err
} }
jwd := filepath.Join(wd, dir) jwd := filepath.Join(wd, dir)
ajwd, err := filepath.Abs(jwd) ajwd, err := filepath.Abs(jwd)
if err != nil { if err != nil {
log.WithError(err).WithField("path", jwd).Error("Failed to get absolute path") //log.WithError(err).WithField("path", jwd).Error("Failed to get absolute path")
return "", err return "", err
} }
if _, err := os.Stat(ajwd); err != nil { if _, err := os.Stat(ajwd); err != nil {
log.WithField("path", ajwd).Debug("Directory does not exist, creating") //log.WithField("path", ajwd).Debug("Directory does not exist, creating")
if err := os.MkdirAll(ajwd, 0755); err != nil { if err := os.MkdirAll(ajwd, 0755); err != nil {
log.WithError(err).WithField("path", ajwd).Error("Failed to create directory") //log.WithError(err).WithField("path", ajwd).Error("Failed to create directory")
return "", err return "", err
} }
} }
log.WithField("path", ajwd).Debug("Successfully got joined working directory") //log.WithField("path", ajwd).Debug("Successfully got joined working directory")
return ajwd, nil return ajwd, nil
} }

View File

@ -7,12 +7,13 @@ import (
"context" "context"
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"github.com/sirupsen/logrus"
"net" "net"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/sirupsen/logrus"
"github.com/go-i2p/i2pkeys" "github.com/go-i2p/i2pkeys"
"github.com/go-i2p/sam3" "github.com/go-i2p/sam3"
) )

View File

@ -2,10 +2,14 @@ package onramp
import "github.com/go-i2p/sam3" import "github.com/go-i2p/sam3"
var OPT_DEFAULTS = sam3.Options_Default var (
var OPT_WIDE = sam3.Options_Wide OPT_DEFAULTS = sam3.Options_Default
OPT_WIDE = sam3.Options_Wide
)
var OPT_HUGE = sam3.Options_Humongous var (
var OPT_LARGE = sam3.Options_Large OPT_HUGE = sam3.Options_Humongous
var OPT_MEDIUM = sam3.Options_Medium OPT_LARGE = sam3.Options_Large
var OPT_SMALL = sam3.Options_Small OPT_MEDIUM = sam3.Options_Medium
OPT_SMALL = sam3.Options_Small
)

3
log.go
View File

@ -1,11 +1,12 @@
package onramp package onramp
import ( import (
"github.com/sirupsen/logrus"
"io" "io"
"os" "os"
"strings" "strings"
"sync" "sync"
"github.com/sirupsen/logrus"
) )
var ( var (

View File

@ -7,11 +7,12 @@ import (
"context" "context"
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"github.com/sirupsen/logrus"
"net" "net"
"os" "os"
"path/filepath" "path/filepath"
"github.com/sirupsen/logrus"
"github.com/cretz/bine/tor" "github.com/cretz/bine/tor"
"github.com/cretz/bine/torutil/ed25519" "github.com/cretz/bine/torutil/ed25519"
) )

View File

@ -1,10 +1,11 @@
package onramp package onramp
import ( import (
"github.com/sirupsen/logrus"
"io" "io"
"net" "net"
"strings" "strings"
"github.com/sirupsen/logrus"
) )
type OnrampProxy struct { type OnrampProxy struct {

3
tls.go
View File

@ -10,7 +10,6 @@ import (
"encoding/asn1" "encoding/asn1"
"encoding/pem" "encoding/pem"
"fmt" "fmt"
"github.com/sirupsen/logrus"
"math/big" "math/big"
"net" "net"
"os" "os"
@ -18,6 +17,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/sirupsen/logrus"
"github.com/cretz/bine/torutil" "github.com/cretz/bine/torutil"
) )