mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 14:26:31 +00:00
[update] move welcome to util module
This commit is contained in:
parent
b5d934e0a7
commit
cb22573943
@ -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 {
|
||||||
|
15
util/util.go
15
util/util.go
@ -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()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user