当前位置: 首页>>代码示例>>Golang>>正文


Golang client.Conn类代码示例

本文整理汇总了Golang中spool-mock/client.Conn的典型用法代码示例。如果您正苦于以下问题:Golang Conn类的具体用法?Golang Conn怎么用?Golang Conn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Conn类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Body

func Body(conn *client.Conn, tok []string) {
	if len(tok) != 2 {
		conn.Send("501 Invalid syntax.")
		return
	}
	read(conn, tok[1], "BODY")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:7,代码来源:nntp.go

示例2: Article

func Article(conn *client.Conn, tok []string) {
	if len(tok) != 2 {
		conn.Send("501 Invalid syntax.")
		return
	}
	read(conn, tok[1], "ARTICLE")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:7,代码来源:nntp.go

示例3: Stat

func Stat(conn *client.Conn, tok []string) {
	// 223 0 <[email protected]> status
	if len(tok) != 2 {
		conn.Send("501 Invalid syntax.")
		return
	}
	if tok[1] == "<[email protected]>" {
		conn.Send("223 0 <[email protected]> status")
		return
	} else if tok[1] == "500" {
		conn.Send("223 500 <[email protected]> status")
		return
	}
	conn.Send("501 No test")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:15,代码来源:nntp.go

示例4: Group

func Group(conn *client.Conn, tok []string) {
	if len(tok) != 2 {
		conn.Send("501 Invalid syntax.")
		return
	}
	if tok[1] == "nosuch.group" {
		conn.Send("411 No such group.")
		return
	} else if tok[1] == "standard.group" {
		conn.Send("211 300007627 8974530000 9274537627 standard.group")
		return
	}

	conn.Send("501 No test for given groupname")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:15,代码来源:nntp.go

示例5: List

func List(conn *client.Conn, tok []string) {
	if len(tok) == 1 {
		conn.Send("215 active file follows.")
		raw := `alt.pri 1 1 Y
alt.media.dvd.hack.samsung 1 1 y
macromedia.director.3d 1 1 Y
alt.tasteless.bottomfeeders 5 1 Y
.`
		raw = strings.Replace(raw, "\n", "\r\n", -1)
		conn.Send(raw)
		return
	}

	conn.Send("501 No test")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:15,代码来源:nntp.go

示例6: req

func req(conn *client.Conn) {
	conn.Send("200 StoreD")
	for {
		tok, e := conn.ReadLine()
		if e != nil {
			fmt.Println(fmt.Sprintf("WARN: C(%s): %s", conn.RemoteAddr(), e.Error()))
			break
		}

		cmd := strings.ToUpper(tok[0])
		if cmd == "QUIT" {
			Quit(conn, tok)
			break
		} else if cmd == "ARTICLE" {
			Article(conn, tok)
		} else if cmd == "HEAD" {
			Head(conn, tok)
		} else if cmd == "BODY" {
			Body(conn, tok)
		} else if cmd == "STAT" {
			Stat(conn, tok)
		} else if cmd == "AUTHINFO" {
			sub := strings.ToUpper(tok[1])
			if sub == "USER" {
				conn.User = tok[2]
				conn.Send("381 Need more.")
			} else if sub == "PASS" {
				if tok[2] == "test" {
					conn.Send("281 Authentication accepted.")
				}
			}
		} else if cmd == "GROUP" {
			Group(conn, tok)
		} else if cmd == "NOOP" {
			conn.Send("500 Unsupported.")
		} else if cmd == "IHAVE" {
			PostArticle(conn, tok)
		} else if cmd == "POST" {
			if e := conn.Send("340 Start posting."); e != nil {
				conn.Send("437 Start failed.")
			}
			br := bufio.NewReader(conn.GetReader())
			if _, e := io.Copy(ioutil.Discard, dotreader.New(br)); e != nil {
				conn.Send("437 Failed reading body")
				return
			}
			if e := conn.Send("240 Posted "); e != nil {
				conn.Send("437 Failed storing.")
			}
		} else if cmd == "XOVER" {
			Xover(conn, tok)
		} else if cmd == "XHDR" {
			Xhdr(conn, tok)
		} else if cmd == "LIST" {
			List(conn, tok)
		} else if cmd == "DATE" {
			Date(conn, tok)
		} else {
			Unsupported(conn, tok)
			break
		}
	}

	conn.Close()
	if config.Verbose {
		fmt.Println(fmt.Sprintf("C(%s) Closed", conn.RemoteAddr()))
	}
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:68,代码来源:nntp.go

示例7: read

func read(conn *client.Conn, msgid string, msgtype string) {
	var code, msgtop string
	head := true
	body := true

	if msgid == "<[email protected]>" && conn.User != "spool" {
		conn.Send("430 Article not found.")
		return
	}
	if msgid == "<[email protected]>" {
		conn.Send("430 Article not found.")
		return
	}

	if msgid[0] == '<' {
		msgtop = "0 " + msgid
	} else {
		msgtop = msgid + " " + "<[email protected]>"
	}

	if msgtype == "ARTICLE" {
		code = "220"
	} else if msgtype == "HEAD" {
		code = "221"
		body = false
	} else if msgtype == "BODY" {
		code = "222"
		head = false
	} else {
		panic("Should not get here")
	}

	if msgid == "<[email protected]>" || msgid == "123" {
		conn.Send("500 msgid means fivehundred err")
		return
	}

	// fake some timeouts here
	if msgid == "<[email protected]>" {
		time.Sleep(time.Second * 180)
	}
	if msgid == "<[email protected]>" {
		time.Sleep(time.Second * 20)
	}

	var raw string
	if head {
		raw += `Path: asg009!abp002.ams.xsnews.nl!abuse.newsxs.nl!not-for-mail
From: Zinitzio <x8F4zpNLByt8Vhh1hyFBTcarWqKeqTszySrxYJUNrGyj64VA761YahKczcyROsOv.N[email protected]47a00b01.16110764.10.1443172883.1.NL.v8r0DMvyrMxvrV9wjB9RklWe-p-p1ZChfS4lxGsMNtRWMbyLXZonEJ6Lp3usHDsLnG>
Subject: Mkv Tool Nix 8.4.0 NL | Zgp
Newsgroups: free.pt
Message-ID: <[email protected]>
X-Newsreader: Spotnet 2.0.0.114
X-XML: <Spotnet><Posting><Key>7</Key><Created>1443172883</Created><Poster>Zinitzio</Poster><Tag>Zgp</Tag><Title>Mkv Tool Nix 8.4.0 NL</Title><Description>Iedere Mkv (x264) film heeft meerdere sporen. Met dit programma kun je sporen verwijderen of toevoegen. Heb je een film zonder ondertitel dan kun je die makkelijk toevoegen.[br][br]In deze spot zitten de volgende onderdelen:[br][br]Mkv Tool Nix 8.4.0</Description><Image Width='350' Height='350'><Segment>[email protected]</Segment></Image><Size>16110764</Size><Category>04<Sub>04a00</Sub><Sub>04b01</Sub></Category><NZB><Segment>[email protected]</Segment></NZB></Posting></Spotnet>
X-XML-Signature: mMXtDVvEzuAz5soJzKcpsd042VQY2M306o418-pOYtLIxv7DN5lDzAO3rB3EakfZT
X-User-Key: <RSAKeyValue><Modulus>x8F4zpNLByt8Vhh1hyFBTcarWqKeqTszySrxYJUNrGyj64VA761YahKczcyROsOv</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>
X-User-Signature: N5UyksLragucHTY7hXbIf3OraQSwtjjJX6PcYubvlsh6oPDUGuY1j0b4Z7i6xnio
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Complaints-To: [email protected]
Organization: Newsxs
Date: Fri, 25 Sep 2015 11:21:23 +0200
Lines: 5
NNTP-Posting-Date: Fri, 25 Sep 2015 11:21:23 +0200`
	}
	if head && body {
		raw += "\n\n"
	}
	if body {
		raw += `Iedere Mkv (x264) film heeft meerdere sporen. Met dit programma kun je sporen verwijderen of toevoegen. Heb je een film zonder ondertitel dan kun je die makkelijk toevoegen.

In deze spot zitten de volgende onderdelen:

Mkv Tool Nix 8.4.0`
	}

	if msgid == "<r[email protected]>" {
		raw = strings.Replace(raw, "X-Newsreader: Spotnet 2.0.0.114", "Header-Key: REPLACEME", 1)
	}
	raw = strings.Replace(raw, "\n", "\r\n", -1)
	if msgid == "<[email protected]>" {
		raw = strings.Replace(
			raw,
			"Fri, 25 Sep 2015 11:21:23 +0200",
			time.Now().Format("Mon, 2 Jan 2006 15:04:05 -0700"),
			1,
		)
	}

	conn.Send(code + " " + msgtop)

	if msgid == "<[email protected]>" || msgid == "124" {
		// fake a broken
		conn.Send(raw[0:50])
		conn.Close()
	} else {
		conn.Send(raw)
	}
	conn.Send("\r\n.") // additional \r\n auto-added
	if msgid == "<[email protected]>" || msgid == "500" {
//.........这里部分代码省略.........
开发者ID:mpdroog,项目名称:spool-mock,代码行数:101,代码来源:nntp.go

示例8: Xhdr

func Xhdr(conn *client.Conn, tok []string) {
	// xhdr Date 7824860-7824865
	if len(tok) != 3 {
		conn.Send("501 Invalid syntax.")
		return
	}

	if tok[1] == "derp" {
		conn.Send("503 Header type unsupported.")
		return
	}

	if tok[1] == "Date" && tok[2] == "<[email protected]>" {
		conn.Send("501 Syntax error Unparsable input: [email protected]")
		return
	}

	if tok[1] == "Date" && tok[2] == "7824860-7824865" {
		conn.Send("221 Date headers follow.")
		raw := `7824860 Tue, 29 Sep 2015 13:39:23 +0200
7824861 Tue, 29 Sep 2015 13:40:33 +0200
7824862 Tue, 29 Sep 2015 13:42:44 +0200
7824863 Tue, 29 Sep 2015 11:43:36 GMT
7824864 Tue, 29 Sep 2015 13:53:39 +0200
7824865 Tue, 29 Sep 2015 11:49:51 GMT
.`
		raw = strings.Replace(raw, "\n", "\r\n", -1)
		conn.Send(raw)
		return
	}

	conn.Send("501 No test")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:33,代码来源:nntp.go

示例9: Unsupported

func Unsupported(conn *client.Conn, tok []string) {
	fmt.Println(fmt.Sprintf("WARN: C(%s): Unsupported cmd %s", conn.RemoteAddr(), tok[0]))
	conn.Send("500 Unsupported.")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:4,代码来源:nntp.go

示例10: Xover

func Xover(conn *client.Conn, tok []string) {
	// xover 7824800-7824865
	if len(tok) != 2 {
		conn.Send("501 Invalid syntax.")
		return
	}
	if tok[1] == "7824800-7824826" {
		conn.Send("224 Overview follows.")
		raw := `7824800	ABC 123 | Me	Name <qmumrmAB8Q8CxnO8j-smpGa1vPJ-sTcVrr6oHIfGkfcd7vF6o92vjRbUWz0fREIBxd.me[email protected]17a00d75b03c10d23d85z03.3400118167.10.1443520028.1.NL.Gx0rio4h-sMFXi6sHL3CgB4t-sRFz0-sCaaQ2-slCQ33Xny4Ervrh87mtiE7kVh9TmwF>	Tue, 29 Sep 2015 09:47:08 GMT	<[email protected]>		3017	11	Xref: artnum free.pt:7824800
7824801	A b's Z Abc - Person | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.oFSFmeMqBIP-s6I6JnNAXmhepNSDExw662pJG-pfiaubqB2ED5ZPkGafJXljSGmC2xOE8KrmkJQJU7ZLR8wp9f2TWnoCI63fJ8aQw2G-sXVnmsvlS	29 Sep 2015 09:50:42 GMT	<[email protected]>		3154	9	Xref: artnum free.pt:7824801
7824802	Text - Name LName - Derp derp | derp	Derp45 <vOD8F13AlBel-sUwaD1PMGBqs10-pSgwRn4e2-sqa3nTto9M1Go-sfBv4DPzy9ByTbBZ.fSP3[email protected]17a01d23d75b03c10z03.336868165.10.1443520400.1.NL.fMgLmXnHp5oQRTDLq2nLSZnaiGwjR1rxPMpOUPePBEjo6mzYjb-s0-smw32MEUCQAR>	Tue, 29 Sep 2015 11:53:47 +0200	<[email protected]>		1801	2	Xref: artnum free.pt:7824802
7824803	[Subj] My Sister's Text Text - Text Text | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.RL6EsiNtP5kxupOlUPV9eVf40G5Qe5QazLoj35wO6YRXf8jsqpRejBGjeiE5Y5d1hEDvtlG-shsIW8ukrnTKdYctQ9FWaUh2JV8CjLstLAQOTjt0T	29 Sep 2015 09:49:28 GMT	<[email protected]>		3086	9	Xref: artnum free.pt:7824803
7824804	Text - AB ABCDEFGG | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.jVMWwPY9TkbBFu8DOQeBmSrJU5F3RMrEe5qxzxhOqBEg9FUIQMVWaXBMndMAIMrSHXwLX7Vp0cL9yuoD7l1kJPsGM1l-sIoH4ajIixcCMOaVCsnwa	29 Sep 2015 09:47:56 GMT	<[email protected]>		3003	7	Xref: artnum free.pt:7824804
7824806	Real Text Stories - Person One & Person Two | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.RPErjYrF3WMgc3iQ1nFsAkuLbTutxtAKAydRSEOl6YJxc2DVxUeX3lDdhS4oPzcwI-pZzz7VERwqOAGm2zXGkuprWjqVBnBbYWvcx8vt8X5DePkX-	29 Sep 2015 09:52:56 GMT	<[email protected]>		3264	9	Xref: artnum free.pt:7824806
7824807	[Subj] Hard Text - Person Derp | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.a7wnSMEyBU-pXA1Esw45rd0stA4rd2FOD3w-sXb5O0NbMhrgoaaMpXbYjSTAAHBH0JXVlABT7KpgtmDr5c5NXyyMZRakDm6CAxW1eu-pLOEYkyZcE	29 Sep 2015 09:54:26 GMT	<[email protected]>		3263	9	Xref: artnum free.pt:7824807
7824808	Super cool derp S01E02 720p TestLip H264 | Bassie10	Bassie10 <3hKtBrWCqFv055OmdF25pEaWgNjp0yG7EwB-sm1ivvhGXJ8I0zP7AHMgTkrrv7lg3.Il[email protected]17a09b04d11c00c10d06z01.726336313.10.1443520698.1.NL.J2l0mXvqRhgIw1rbTNistDVg4tNdTagZrw3SC0VHb9Rp-sAdxAxO2Epi4wnDcyLZk>	29 Sep 2015 09:58:16 GMT	<[email protected]>		6311	3	Xref: artnum free.pt:7824808
7824809	[WOUW] MOUW Derp Herp. 13 | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.bMMK3byHT92HCeARYcOn9p23oyfi7JoPjmTvLqyAqkPZAsCdctgb3iyZQJ5xgXmXP2A0l6XN5cSQDVNFFqHe08Fpvw-s4AC-pi9b62G9CiAJGrSK3	29 Sep 2015 09:59:19 GMT	<[email protected]>		3163	9	Xref: artnum free.pt:7824809
7824810	Random subject here [Spoil HD] | hoil	La4444 <vOD8F13AlBel-sUwaD1PMGBqs10-pSgwRn4e2-sqa3nTto9M1Go-sfBv4DPzy9ByTbBZ.pq[email protected]17a01d23d75b03c10z03.427711992.10.1443521055.1.NL.BSz6C4oIqFXIXpgFBkgS-s5ND5SG9bsC8TAVZGZxVQUpGeVlx0Ol-sc8flUoAb-p6GD>Tue, 29 Sep 2015 12:04:42 +0200	<[email protected]>		1971	2	Xref: artnum free.pt:7824810
7824811	[Subj] It's A abc thing #200 | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.eKMfrw-pjhYj9GI4uFp6DlGlqX4U-s3X2iNA3Y1Ew8qSOdgkvPwMRkacSsgu3MYem35A2ef3EEKEGd8DPah1lrU5p4wOahShnsjUpxmDx9US66qJZ	29 Sep 2015 10:02:54 GMT	<[email protected]>		4117	14	Xref: artnum free.pt:7824811
7824812	[Hurts] The real text returns | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.Wi4g51cLUeh2PLIA9Fn-pt0KR4R-sr7ODCqXP-pvRrs-p9I5fnXuJ1WouHbYsaMty37lSJvcfIQq83nf89q6KXf45gFhqbR69-sExD-sua4DcRs8v	29 Sep 2015 10:01:05 GMT	<[email protected]>		4967	13	Xref: artnum free.pt:7824812
7824813	Pain Gain (Herp Derp Productions) | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.rZKeJCxvWgTBBAXtV4HdpjsO-p3i2jVjQPASuZMZvrezlPKfsAz4cxrbTIk8iGi3lO-p5TBVGLv2-pChAkT8HudmCEDMWkB4be4R9da5JXMJRsdwX	29 Sep 2015 10:06:40 GMT	<[email protected]>		4343	14	Xref: artnum free.pt:7824813
7824814	More random text | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.oyXA0Dmlc79hkshPH7SavGLLE74nuIcVJnge1OfqKeqtDUhkfpRGNFed-st6urYNglH3887E60A6QZ3-shSASHmhfU4BKw-s4Bzjg9qWoZ4uqj0M-	29 Sep 2015 10:07:27 GMT	<[email protected]>		3919	13	Xref: artnum free.pt:7824814
7824815	Text random (alive) | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.Tmg6LsfOzQV9ABQ-sMGpJjzv228lgr-pg-sdWPkK9jmNamZVOLLTOfRqFqSXrX1WmL6lMHNVsrwrLkuI4Sg74I-pt8NH-pPHP0tQajCfoLdWGt3BN	29 Sep 2015 10:07:53 GMT	<[email protected]>		4040	14	Xref: artnum free.pt:7824815
7824816	Blabla kleur text 1.2.3.4 Nederlands	Citp <qdbYG42osB9nKHQjfG7kB7tiAUR12G32Xde0YoX5HrvoK28GOkG9vKRqCQ-pyYgmB.D2MPI[email protected]47a00b09.8016910.10.1443521548.1.NL.RP1U2inwB5npih-sf5idprFU4Fn8ujZFbIsP1DTFpoDqO1tnHHDakdOI09-s0aAP7B>	Tue, 29 Sep 2015 10:12:28 GMT	<[email protected]>		5597	28	Xref: artnum free.pt:7824816
7824817	Rokende text (2015) | teens	KarinaAva <vOD8F13AlBel-sUwaD1PMGBqs10-pSgwRn4e2-sqa3nTto9M1Go-sfBv4DPzy9ByTbBZ.lE[email protected]17a01d23d75b03c10z03.815909751.10.1443521709.1.NL.XXSODRVY8EqYBXLcXK7cWL0PycsjZ23n9Xr13LUFWcfd0Wwd9jkEWBOl-pXssDsqp>	Tue, 29 Sep 2015 12:15:36 +0200	<[email protected]>		1656	2	Xref: artnum free.pt:7824817
7824818	RandText RandText-Januari 1980	Spiegel <wYKtGrS-phsIYo5r0vfJl0OgrhCnX83N6o5sil82HlZVlVLXJ7uhQ5nFTwo4NHX4X.J6xf6[email protected]17a05c04d44z02.35876240.10.1443525368.1.NL.oLoRAXNqhI0DsEo0TWWs8jbDRWASZ-p09GtVYiM5YCoby-psttmXeEq5gMqd75It17>	Tue, 29 Sep 2015 10:16:17 GMT	<[email protected]>		1921	7	Xref: artnum free.pt:7824818
7824819	RandText RandText RandText-RandText 2015	Spiegel <wYKtGrS-phsIYo5r0vfJl0OgrhCnX83N6o5sil82HlZVlVLXJ7uhQ5nFTwo4NHX4X.P[email protected]17a05c04d44z02.34697887.10.1443525229.1.NL.no69vuJNnGConbBGDeCkWavo5jjkBF55-sEZ9ohda6nRHfPgLVFQXti9R-pzxfGFiw>	Tue, 29 Sep 2015 10:13:58 GMT	<[email protected]>		2046	7	Xref: artnum free.pt:7824819
7824820	RandText - RandText RandText RandText RandText	Citp <qdbYG42osB9nKHQjfG7kB7tiAUR12G32Xde0YoX5HrvoK28GOkG9vKRqCQ-pyYgmB.GBkDC[email protected]47a00b26.449715654.10.1443521892.1.NL.LJbXIYUviRJ8HKwvjJjb2d2aCIisdot9rWrOB0KhQY1E7TMWsxH-sOQwFDObAH-s8T>	Tue, 29 Sep 2015 10:18:11 GMT	<[email protected]>		3417	7	Xref: artnum free.pt:7824820
7824821	RandText RandText RandText 11 Derp 99	Jaaprond <udOJLzYJY4T2EPdzAgV9bfao7PNXUU3pZzEVTPylFNgNPcLTe2u666ZfwxaNwlJ-s.j[email protected]17a00b04d11b03c02c10d05d50z01.997732875.10.1443522033.1.NL.mTyg6aWIFkVPxJtSDvk2-sgyOB-pfz5Z2zmlBgszszqx0Gl4CX4ZVBoJdKtmi8W3LW>	Tue, 29 Sep 2015 10:20:33 GMT	<[email protected]>		2484	3	Xref: artnum free.pt:7824821
7824822	RandText RandText RandText RandText II | sanook	sanook <sBhTrAj4CZLAhpiecI3B7jtR5708ko-pwWuVKa9-srPHxepNMPG0chq0rRNMV5yC3r.OY[email protected]27a00b00c07d03d33z00.199394624.10.1443522149.1.NL.m7-sWQhOqQQQrW5XHa15JwEmrQ2PHA4gMRhEjJUsMHr163b1Yd-s3yEXJIHUMNSizu>	Tue, 29 Sep 2015 10:22:29 GMT	<[email protected]>		2423	7	Xref: artnum free.pt:7824822
7824823	RandText RandText RandText RandText 2019	Spiegel <wYKtGrS-phsIYo5r0vfJl0OgrhCnX83N6o5sil82HlZVlVLXJ7uhQ5nFTwo4NHX4X.lgz[email protected]17a05c04d44z02.24441869.10.1443525673.1.NL.Jl-pc8xO01Oge1lMUe0I1PJWXqkZrWgl5i6-svSJ-pnY6Px-p5Nnwm6Sa8C7KSoHbfms>	Tue, 29 Sep 2015 10:21:28 GMT	<[email protected]>		2279	10	Xref: artnum free.pt:7824823
7824824	RandText RandText RandText RandText | fetish	FuMyAs <vOD8F13AlBel-sUwaD1PMGBqs10-pSgwRn4e2-sqa3nTto9M1Go-sfBv4DPzy9ByTbBZ.inm[email protected]17a01d23d75b03c10z03.132048357.10.1443522363.1.NL.fRYxBB2eChEvd3HVLj26h1iNTPBT9f4ccSfoAyaBP-s3CgZLpgIzatPdRPbYS4ED-p>	Tue, 29 Sep 2015 12:26:30 +0200	<[email protected]>		2163	2	Xref: artnum free.pt:7824824
7824826	RandText RandText RandText RandText RandText 2015	Spiegel <wYKtGrS-phsIYo5r0vfJl0OgrhCnX83N6o5sil82HlZVlVLXJ7uhQ5nFTwo4NHX4X.F[email protected]17a05c04d44z02.22635304.10.1443526055.1.NL.W5-sZ72AX0ZTetdgqa4a1vQZHc32sfCCoRLGbgdz1v4J7CmJNY3TWKNGGWJdtwLXx>	Tue, 29 Sep 2015 10:27:44 GMT	<[email protected]>		2358	11	Xref: artnum free.pt:7824826
.`
		raw = strings.Replace(raw, "\n", "\r\n", -1)
		conn.Send(raw)
		return
	}
	if tok[1] == "7824700-7824826" {
		conn.Send("224 Overview follows.")
		conn.Send(".")
		return
	}
	if tok[1] == "7624890-7824890" {
		// Create a BIG stream of 200.000 headers to fake >10MB streams
		conn.Send("224 Overview follows.")
		for i := 0; i < 200000; i++ {
			id := 7624890 + i
			conn.Send(fmt.Sprintf("%d	A b's Z Abc - Person | hotmama	hotmama <rbsHeWOltXSPohqOb5cK1bo7e0aKcDewG5MLp3LORmP2CCPuszZUvMNSrKoQYlkuXbqCfjlwvDobYaSfBhz-pdGI6IARjweEeXSJmjIpXQKkQ-pJF1hq-pbl6x85gQPuVp0MTSjS91emBCTCsgsFHXJAUA-p3gR-pgne42u94Dy421eM=.oFSFmeMqBIP-s6I6JnNAXmhepNSDExw662pJG-pfiaubqB2ED5ZPkGafJXljSGmC2xOE8KrmkJQJU7ZLR8wp9f2TWnoCI63fJ8aQw2G-sXVnmsvlS	29 Sep 2015 09:50:42 GMT	<[email protected]>		3154	9	Xref: artnum free.pt:7824801", id))
		}
		conn.Send(".")
		return
	}

	conn.Send("501 No test")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:56,代码来源:nntp.go

示例11: Date

func Date(conn *client.Conn, tok []string) {
	conn.Send("111 19990623135624")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:3,代码来源:nntp.go

示例12: Quit

func Quit(conn *client.Conn, tok []string) {
	conn.Send("205 Bye.")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:3,代码来源:nntp.go

示例13: PostArticle

func PostArticle(conn *client.Conn, tok []string) {
	if tok[1] == "<[email protected]>" {
		conn.Send("435 Already have article.")
		return
	}
	if tok[1] == "<[email protected]>" {
		conn.Send("436 Early failed.")
		return
	}
	conn.Send("335 Send article to be transferred.")

	b := new(bytes.Buffer)
	br := bufio.NewReader(conn.GetReader())
	r := textproto.NewReader(br)

	fmt.Println("PostArticle head.")
	m, e := r.ReadMIMEHeader()
	if e != nil {
		conn.Send("437 Failed reading header")
		return
	}

	fmt.Println("PostArticle body.")
	if _, e := io.Copy(b, dotreader.New(br)); e != nil {
		conn.Send("437 Failed reading body")
		return
	}

	if val := m.Get("X-Accept"); val == "DENY" {
		conn.Send("437 Deny test.")
		return
	}
	if val := m.Get("X-Accept"); val == "BROKEN" {
		conn.Send("500 Server is broken.")
		return
	}
	if val := m.Get("X-Accept"); val == "FAILED" {
		conn.Send("436 Transfer failed test.")
		return
	}

	if tok[1] == "<[email protected]>" {
		conn.Send("437 Duplicate")
		return
	}

	if conn.User == "refeed" {
		config.RequeMsgids = append(config.RequeMsgids, tok[1])
		conn.Send("235 Transferred.")
		return
	}

	if b.String() != "\r\nBody.\r\nBody1\r\nBody2 ohyeay?\r\n.\r\n" {
		conn.Send("500 Body does not match hardcoded compare value.")
		return
	}
	conn.Send("235 Transferred.")
}
开发者ID:mpdroog,项目名称:spool-mock,代码行数:58,代码来源:nntp.go


注:本文中的spool-mock/client.Conn类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。