Skip to content

Commit

Permalink
chore(runner): implement logger & writer
Browse files Browse the repository at this point in the history
Signed-off-by: Dwi Siswanto <[email protected]>
  • Loading branch information
dwisiswant0 committed Oct 25, 2023
1 parent a674095 commit 75a17af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions internal/runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,17 @@ package runner
import (
"flag"
"os"
"time"

"github.com/charmbracelet/log"
"github.com/kitabisa/teler-proxy/common"
"github.com/mattn/go-colorable"
"github.com/kitabisa/teler-proxy/internal/logger"
)

func ParseOptions() *common.Options {
opt := &common.Options{}
cfg := &common.Config{}
tls := &common.TLS{}

opt.Logger = log.NewWithOptions(
colorable.NewColorableStderr(),
log.Options{
ReportTimestamp: true,
TimeFormat: time.Kitchen,
},
)
opt.Logger = logger.New()

flag.IntVar(&opt.Port, "p", 1337, "")
flag.IntVar(&opt.Port, "port", 1337, "")
Expand Down
4 changes: 2 additions & 2 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/fsnotify/fsnotify"
"github.com/kitabisa/teler-proxy/common"
"github.com/kitabisa/teler-proxy/internal/cron"
"github.com/kitabisa/teler-proxy/internal/writer"
"github.com/kitabisa/teler-proxy/pkg/tunnel"
"github.com/kitabisa/teler-waf"
"github.com/kitabisa/teler-waf/threat"
Expand Down Expand Up @@ -55,9 +56,8 @@ func New(opt *common.Options) error {
}

dest := buildDest(opt.Destination)
writer := run.NewWriter()

tun, err := tunnel.NewTunnel(opt.Port, dest, opt.Config.Path, opt.Config.Format, writer)
tun, err := tunnel.NewTunnel(opt.Port, dest, opt.Config.Path, opt.Config.Format, writer.New())
if err != nil {
return err
}
Expand Down

0 comments on commit 75a17af

Please sign in to comment.