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
import (
"github.com/sirupsen/logrus"
"net"
"net/url"
"os"
"path/filepath"
"strings"
"github.com/sirupsen/logrus"
)
//go:generate go run -tags gen ./gen.go
@ -18,23 +19,23 @@ import (
func GetJoinedWD(dir string) (string, error) {
wd, err := os.Getwd()
if err != nil {
log.WithError(err).Error("Failed to get working directory")
//log.WithError(err).Error("Failed to get working directory")
return "", err
}
jwd := filepath.Join(wd, dir)
ajwd, err := filepath.Abs(jwd)
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
}
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 {
log.WithError(err).WithField("path", ajwd).Error("Failed to create directory")
//log.WithError(err).WithField("path", ajwd).Error("Failed to create directory")
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
}

View File

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

View File

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

3
log.go
View File

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

View File

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

View File

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

3
tls.go
View File

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