From cb2257394351d1cc761662fc2ec03809648ec250 Mon Sep 17 00:00:00 2001 From: xvzc Date: Mon, 10 Jan 2022 23:58:27 +0900 Subject: [PATCH] [update] move welcome to util module --- proxy/proxy.go | 13 ------------- util/util.go | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/proxy/proxy.go b/proxy/proxy.go index 93ea199..bcd0c4c 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -1,12 +1,10 @@ package proxy import ( - "fmt" "log" "net" "os" - "github.com/pterm/pterm" "github.com/xvzc/SpoofDPI/doh" "github.com/xvzc/SpoofDPI/packet" ) @@ -25,17 +23,6 @@ func New(port string, os string, debug bool) *Proxy { } } -func (p *Proxy) PrintWelcome() { - cyan := pterm.NewLettersFromStringWithStyle("Spoof", pterm.NewStyle(pterm.FgCyan)) - purple := pterm.NewLettersFromStringWithStyle("DPI", pterm.NewStyle(pterm.FgLightMagenta)) - pterm.DefaultBigText.WithLetters(cyan, purple).Render() - - pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{ - {Level: 0, Text: "PORT : " + p.Port}, - {Level: 0, Text: "DEBUG : " + fmt.Sprint(p.Debug)}, - }).Render() -} - func (p *Proxy) Start() { listener, err := net.Listen("tcp", ":"+p.Port) if err != nil { diff --git a/util/util.go b/util/util.go index a0452d2..80c7ce1 100644 --- a/util/util.go +++ b/util/util.go @@ -2,6 +2,9 @@ package util import ( "flag" + "fmt" + + "github.com/pterm/pterm" ) func ParseArgs() (string, string, bool) { @@ -21,3 +24,15 @@ func BytesToChunks(buf []byte) [][]byte { return [][]byte{buf[:1], buf[1:]} } + +func PrintWelcome(port string, dns string, debug bool) { + cyan := pterm.NewLettersFromStringWithStyle("Spoof", pterm.NewStyle(pterm.FgCyan)) + purple := pterm.NewLettersFromStringWithStyle("DPI", pterm.NewStyle(pterm.FgLightMagenta)) + pterm.DefaultBigText.WithLetters(cyan, purple).Render() + + pterm.DefaultBulletList.WithItems([]pterm.BulletListItem{ + {Level: 0, Text: "PORT : " + port}, + {Level: 0, Text: "DNS : " + dns}, + {Level: 0, Text: "DEBUG : " + fmt.Sprint(debug)}, + }).Render() +}