[update] move welcome to util module

This commit is contained in:
xvzc 2022-01-10 23:58:27 +09:00
parent b5d934e0a7
commit cb22573943
2 changed files with 15 additions and 13 deletions

View File

@ -1,12 +1,10 @@
package proxy package proxy
import ( import (
"fmt"
"log" "log"
"net" "net"
"os" "os"
"github.com/pterm/pterm"
"github.com/xvzc/SpoofDPI/doh" "github.com/xvzc/SpoofDPI/doh"
"github.com/xvzc/SpoofDPI/packet" "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() { func (p *Proxy) Start() {
listener, err := net.Listen("tcp", ":"+p.Port) listener, err := net.Listen("tcp", ":"+p.Port)
if err != nil { if err != nil {

View File

@ -2,6 +2,9 @@ package util
import ( import (
"flag" "flag"
"fmt"
"github.com/pterm/pterm"
) )
func ParseArgs() (string, string, bool) { func ParseArgs() (string, string, bool) {
@ -21,3 +24,15 @@ func BytesToChunks(buf []byte) [][]byte {
return [][]byte{buf[:1], buf[1:]} 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()
}