mirror of https://github.com/fluffle/goirc
Initial commit of vague hackery for a go IRCd.
This commit is contained in:
parent
83e1f9ca74
commit
b2539c0063
|
@ -1,4 +1,5 @@
|
|||
/gobot
|
||||
/ircd-test
|
||||
*.[568]
|
||||
_obj/
|
||||
_test/
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=ircd-test
|
||||
GOFILES=\
|
||||
server.go\
|
||||
|
||||
include $(GOROOT)/src/Make.cmd
|
||||
|
|
@ -0,0 +1,612 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="800"
|
||||
height="600"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.47 r22583"
|
||||
sodipodi:docname="server-plan.svg">
|
||||
<defs
|
||||
id="defs4">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 526.18109 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||
id="perspective10" />
|
||||
<inkscape:perspective
|
||||
id="perspective3628"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-3"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-1"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-9"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-19"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-7"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-4"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-0"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-10"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-2"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-6"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3650-5"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.07"
|
||||
inkscape:cx="455.53801"
|
||||
inkscape:cy="350.84912"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
showguides="false"
|
||||
objecttolerance="5"
|
||||
inkscape:window-width="1366"
|
||||
inkscape:window-height="768"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
gridtolerance="5">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid2816"
|
||||
empspacing="5"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-452.36218)">
|
||||
<g
|
||||
id="g3613"
|
||||
transform="translate(75,20)">
|
||||
<text
|
||||
id="text3592"
|
||||
y="531.83582"
|
||||
x="110.68066"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="531.83582"
|
||||
x="110.68066"
|
||||
id="tspan3594"
|
||||
sodipodi:role="line">daemon</tspan></text>
|
||||
<path
|
||||
transform="translate(0,452.36218)"
|
||||
d="m 180,75 a 45,15 0 1 1 -90,0 45,15 0 1 1 90,0 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="75"
|
||||
sodipodi:cx="135"
|
||||
id="path2839"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc" />
|
||||
</g>
|
||||
<g
|
||||
id="g3746"
|
||||
transform="translate(100,30)">
|
||||
<text
|
||||
id="text3630"
|
||||
y="541.83582"
|
||||
x="453.32715"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="541.83582"
|
||||
x="453.32715"
|
||||
id="tspan3632"
|
||||
sodipodi:role="line">client</tspan></text>
|
||||
<path
|
||||
transform="translate(335,422.36218)"
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc" />
|
||||
</g>
|
||||
<g
|
||||
id="g3787"
|
||||
transform="translate(80,-10)">
|
||||
<text
|
||||
id="text3618"
|
||||
y="740.67273"
|
||||
x="223.75"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="740.67273"
|
||||
x="223.75"
|
||||
id="tspan3620"
|
||||
sodipodi:role="line">chanpriv</tspan></text>
|
||||
<path
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(115,622.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3782"
|
||||
transform="translate(10,-30)">
|
||||
<text
|
||||
id="text3614"
|
||||
y="711.83582"
|
||||
x="277.2207"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="711.83582"
|
||||
x="277.2207"
|
||||
id="tspan3616"
|
||||
sodipodi:role="line">nick</tspan></text>
|
||||
<path
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-7"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(155,592.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3777"
|
||||
transform="translate(10,10)">
|
||||
<text
|
||||
id="text3610"
|
||||
y="701.83582"
|
||||
x="185.58301"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="701.83582"
|
||||
x="185.58301"
|
||||
id="tspan3612"
|
||||
sodipodi:role="line">chan</tspan></text>
|
||||
<path
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-6"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(65,582.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3772"
|
||||
transform="translate(-10,-20)">
|
||||
<text
|
||||
id="text3606"
|
||||
y="701.83582"
|
||||
x="114.79785"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="701.83582"
|
||||
x="114.79785"
|
||||
id="tspan3608"
|
||||
sodipodi:role="line">node</tspan></text>
|
||||
<path
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-2"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(-5,582.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3767"
|
||||
transform="translate(30,-40)">
|
||||
<text
|
||||
id="text3602"
|
||||
y="671.83582"
|
||||
x="155.0918"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="671.83582"
|
||||
x="155.0918"
|
||||
id="tspan3604"
|
||||
sodipodi:role="line">network</tspan></text>
|
||||
<path
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-3"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(45,552.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3761"
|
||||
transform="translate(5,-75)">
|
||||
<text
|
||||
id="text3596"
|
||||
y="589.33582"
|
||||
x="54.987305"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="589.33582"
|
||||
x="54.987305"
|
||||
id="tspan3598"
|
||||
sodipodi:role="line">config</tspan><tspan
|
||||
id="tspan3600"
|
||||
y="604.33582"
|
||||
x="54.987305"
|
||||
sodipodi:role="line">reader</tspan></text>
|
||||
<path
|
||||
d="m 180,115 a 45,15 0 1 1 -90,0 45,15 0 1 1 90,0 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-4"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(-60,477.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3756"
|
||||
transform="translate(-5,-35)">
|
||||
<text
|
||||
id="text3634"
|
||||
y="634.47449"
|
||||
x="311.44727"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="634.47449"
|
||||
x="311.44727"
|
||||
id="tspan3636"
|
||||
sodipodi:role="line">map</tspan></text>
|
||||
<path
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-8"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(190,517.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3741"
|
||||
transform="translate(25,5)">
|
||||
<text
|
||||
id="text3622"
|
||||
y="545.63757"
|
||||
x="331.44434"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="545.63757"
|
||||
x="331.44434"
|
||||
id="tspan3624"
|
||||
sodipodi:role="line">mux</tspan></text>
|
||||
<path
|
||||
d="m 180,115 a 45,15 0 1 1 -90,0 45,15 0 1 1 90,0 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-5"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(210,427.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3751"
|
||||
transform="translate(85,35)">
|
||||
<text
|
||||
id="text3626"
|
||||
y="495.63757"
|
||||
x="465.67285"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="495.63757"
|
||||
x="465.67285"
|
||||
id="tspan3628"
|
||||
sodipodi:role="line">server</tspan></text>
|
||||
<path
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-36"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(350,377.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3736"
|
||||
transform="translate(-155,95)">
|
||||
<text
|
||||
id="text3638"
|
||||
y="486.83582"
|
||||
x="208.68848"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="486.83582"
|
||||
x="208.68848"
|
||||
id="tspan3640"
|
||||
sodipodi:role="line">handlers</tspan></text>
|
||||
<path
|
||||
d="m 180,115 a 45,15 0 1 1 -90,0 45,15 0 1 1 90,0 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-63"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(100,367.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3809"
|
||||
transform="translate(-110,0)"
|
||||
inkscape:transform-center-x="-10"
|
||||
inkscape:transform-center-y="5">
|
||||
<text
|
||||
id="text3792"
|
||||
y="549.47449"
|
||||
x="560.20703"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
id="tspan3796"
|
||||
y="549.47449"
|
||||
x="560.20703"
|
||||
sodipodi:role="line">parser</tspan></text>
|
||||
<path
|
||||
d="m 180,115 c 0,8.28427 -20.14719,15 -45,15 -24.85281,0 -45,-6.71573 -45,-15 0,-8.28427 20.14719,-15 45,-15 24.85281,0 45,6.71573 45,15 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-0"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(445,432.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3845"
|
||||
transform="translate(-5,-10)">
|
||||
<text
|
||||
id="text3818"
|
||||
y="600.67273"
|
||||
x="445.94043"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="600.67273"
|
||||
x="445.94043"
|
||||
id="tspan3820"
|
||||
sodipodi:role="line">clientmsg</tspan></text>
|
||||
<path
|
||||
d="m 180,115 a 45,15 0 1 1 -90,0 45,15 0 1 1 90,0 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-1"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(340,482.36218)" />
|
||||
</g>
|
||||
<g
|
||||
id="g3840">
|
||||
<text
|
||||
id="text3814"
|
||||
y="509.47449"
|
||||
x="438.53223"
|
||||
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
||||
xml:space="preserve"><tspan
|
||||
y="509.47449"
|
||||
x="438.53223"
|
||||
id="tspan3816"
|
||||
sodipodi:role="line">servermsg</tspan></text>
|
||||
<path
|
||||
d="m 180,115 a 45,15 0 1 1 -90,0 45,15 0 1 1 90,0 z"
|
||||
sodipodi:ry="15"
|
||||
sodipodi:rx="45"
|
||||
sodipodi:cy="115"
|
||||
sodipodi:cx="135"
|
||||
id="path3618-9-54"
|
||||
style="fill:none;stroke:#000000;stroke-opacity:1"
|
||||
sodipodi:type="arc"
|
||||
transform="translate(335,392.36218)" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 125.74257,64.356436 190,80"
|
||||
id="path3852"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 126.73267,125.74257 190,110"
|
||||
id="path3854"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 209.90099,111.88119 210,160"
|
||||
id="path3856"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 179.20792,185.14851 140,210"
|
||||
id="path3858"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 243.56436,186.13861 280,210"
|
||||
id="path3862"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 210,190 0,50"
|
||||
id="path3864"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 298.0198,240.59406 310,260"
|
||||
id="path3868"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 283.16832,276.23762 230,270"
|
||||
id="path3870"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 245,557.36218 40,30"
|
||||
id="path3874"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 280.19802,152.47525 250,170"
|
||||
id="path3876"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 255,547.36218 70,0"
|
||||
id="path3882" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 415,547.36218 10,0"
|
||||
id="path3884" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 527.72277,82.178218 510,90"
|
||||
id="path3886"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 530,110 510,100"
|
||||
id="path3888"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 367.32673,109.90099 340,130"
|
||||
id="path3896"
|
||||
transform="translate(0,452.36218)" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 470,562.36218 0,10"
|
||||
id="path3900" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 470,522.36218 0,10"
|
||||
id="path3902" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 22 KiB |
|
@ -0,0 +1,16 @@
|
|||
port 6667
|
||||
port 7009 {
|
||||
class = "server"
|
||||
}
|
||||
port 6697 { ssl = true }
|
||||
port 7011 {
|
||||
ssl = true
|
||||
class = "server"
|
||||
}
|
||||
|
||||
oper fluffle {
|
||||
pass = "foobar"
|
||||
hostmask = "*camelid@*"
|
||||
link = true
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"irc/server/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cfg := config.LoadConfig("server.cfg")
|
||||
for e, v := range(cfg.Errors) {
|
||||
fmt.Println(e, v)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=irc/server
|
||||
GOFILES=\
|
||||
config.go\
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
include $(GOROOT)/src/Make.inc
|
||||
|
||||
TARG=irc/server/config
|
||||
GOFILES=\
|
||||
config.go\
|
||||
port.go\
|
||||
oper.go\
|
||||
link.go\
|
||||
ban.go\
|
||||
info.go\
|
||||
settings.go\
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
|
@ -0,0 +1,33 @@
|
|||
package config
|
||||
|
||||
type cBan interface {
|
||||
Match(string) bool
|
||||
Reason() string
|
||||
}
|
||||
|
||||
// G-Line etc;
|
||||
type cBanNick struct {
|
||||
NickMask string // nick!ident@host
|
||||
Reason string
|
||||
}
|
||||
|
||||
// Z-Line
|
||||
type cBanIP struct {
|
||||
Address string // ip (or hostname), plus optional CIDR netmask
|
||||
Reason string
|
||||
ip string // parsed into these
|
||||
cidr int
|
||||
}
|
||||
|
||||
// CTCP version ban
|
||||
type cBanVersion struct {
|
||||
VersionRegex string // regex to match against version reply
|
||||
Reason string
|
||||
}
|
||||
|
||||
// Ban server from linking to network
|
||||
type cBanServer struct {
|
||||
ServerMask string // matched against name of linked server
|
||||
Reason string
|
||||
}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"scanner"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
fn string
|
||||
scan *scanner.Scanner
|
||||
|
||||
// Ports we listen on.
|
||||
Ports map[int]*cPort
|
||||
// People with teh p0wer.
|
||||
Opers map[string]*cOper
|
||||
// Servers we link to on the network.
|
||||
Links map[string]*cLink
|
||||
// Servers/nickmasks/IPs that are unwanted.
|
||||
Bans []*cBan
|
||||
|
||||
// Server info (name, admins, etc.)
|
||||
Info *cInfo
|
||||
|
||||
// Server settings
|
||||
Settings *cSettings
|
||||
|
||||
// Parse errors
|
||||
Errors []os.Error
|
||||
}
|
||||
|
||||
type configMap map[string]func(*Config)
|
||||
type keywordMap map[string]func(*Config, interface{})
|
||||
|
||||
var configKeywords = configMap{
|
||||
"port": (*Config).parsePort,
|
||||
// "oper": (*Config).parseOper,
|
||||
// "link": (*Config).parseLink,
|
||||
// "ban": (*Config).parseBan,
|
||||
// "info": (*Config).parseInfo,
|
||||
// "set": (*Config).parseSettings,
|
||||
}
|
||||
|
||||
func LoadConfig(filename string) *Config {
|
||||
conf := &Config{fn: filename}
|
||||
conf.initialise()
|
||||
if fh, err := os.Open(conf.fn, os.O_RDONLY, 0644); err == nil {
|
||||
conf.Parse(fh)
|
||||
fh.Close()
|
||||
} else {
|
||||
conf.Errors = append(conf.Errors, err)
|
||||
}
|
||||
return conf
|
||||
}
|
||||
|
||||
func (conf *Config) initialise() {
|
||||
conf.Ports = make(map[int]*cPort)
|
||||
conf.Opers = make(map[string]*cOper)
|
||||
conf.Links = make(map[string]*cLink)
|
||||
conf.Bans = make([]*cBan, 0)
|
||||
conf.Info = &cInfo{}
|
||||
conf.Settings = &cSettings{}
|
||||
conf.Errors = make([]os.Error, 0)
|
||||
}
|
||||
|
||||
func (conf *Config) Rehash() {
|
||||
neu := LoadConfig(conf.fn)
|
||||
if len(neu.Errors) > 0 {
|
||||
conf.Errors = neu.Errors
|
||||
} else {
|
||||
conf = neu
|
||||
}
|
||||
}
|
||||
|
||||
func (conf *Config) Parse(io io.Reader) {
|
||||
s := &scanner.Scanner{}
|
||||
s.Init(io)
|
||||
s.Filename = conf.fn
|
||||
conf.scan = s
|
||||
tok, text := conf.next()
|
||||
for tok != scanner.EOF {
|
||||
// This external loop should only parse Config things
|
||||
if f, ok := configKeywords[text]; ok {
|
||||
f(conf)
|
||||
} else {
|
||||
conf.parseError("Invalid top-level keyword '%s'", text)
|
||||
}
|
||||
fmt.Printf("Token: '%s', type %s\n", s.TokenText(), scanner.TokenString(tok))
|
||||
tok, text = conf.next()
|
||||
}
|
||||
}
|
||||
|
||||
func (conf *Config) parseKwBlock(dst interface{}, bt string, kw keywordMap) {
|
||||
if ok := conf.expect("{"); !ok {
|
||||
conf.parseError("Expected %s configuration block.", bt)
|
||||
return
|
||||
}
|
||||
tok, text := conf.next()
|
||||
for tok != scanner.EOF {
|
||||
if f, ok := kw[text]; ok {
|
||||
if ok = conf.expect("="); ok {
|
||||
f(conf, dst)
|
||||
}
|
||||
} else if text == "}" {
|
||||
break
|
||||
} else {
|
||||
conf.parseError("Invalid %s keyword '%s'", bt, text)
|
||||
}
|
||||
tok, text = conf.next()
|
||||
}
|
||||
}
|
||||
|
||||
var booleans = map[string]bool {
|
||||
"true": true,
|
||||
"yes": true,
|
||||
"on": true,
|
||||
"1": true,
|
||||
"false": false,
|
||||
"no": false,
|
||||
"off": false,
|
||||
"0": false,
|
||||
}
|
||||
|
||||
func (conf *Config) expectBool() (bool, bool) {
|
||||
tok, text := conf.next()
|
||||
if val, ok := booleans[text]; tok == scanner.Ident && ok {
|
||||
return val, ok
|
||||
}
|
||||
conf.parseError("Expected boolean, got '%s'", text)
|
||||
return false, false
|
||||
}
|
||||
|
||||
func (conf *Config) expectInt() (int, bool) {
|
||||
tok, text := conf.next()
|
||||
num, err := strconv.Atoi(text)
|
||||
if tok != scanner.Int || err != nil {
|
||||
conf.parseError("Expected integer, got '%s'", text)
|
||||
return 0, false
|
||||
}
|
||||
return num, true
|
||||
}
|
||||
|
||||
func (conf *Config) expect(str string) bool {
|
||||
_, text := conf.next()
|
||||
if text != str {
|
||||
conf.parseError("Expected '%s', got '%s'", str, text)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (conf *Config) next() (int, string) {
|
||||
tok := conf.scan.Scan()
|
||||
text := conf.scan.TokenText()
|
||||
if tok == scanner.String {
|
||||
// drop "quotes" -> quotes
|
||||
text = text[1:len(text)-1]
|
||||
}
|
||||
return tok, text
|
||||
}
|
||||
|
||||
func (conf *Config) parseError(err string, args ...interface{}) {
|
||||
err = conf.scan.Pos().String() + ": " + err
|
||||
conf.Errors = append(conf.Errors, os.NewError(fmt.Sprintf(err, args...)))
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package config
|
||||
|
||||
type cInfo struct {
|
||||
Name, Network, Info, MOTDFile string
|
||||
Admins []string
|
||||
Numeric int
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package config
|
||||
|
||||
type cLink struct {
|
||||
Server string // Server name for link
|
||||
Address string // {ip,ip6,host}:port
|
||||
ReceivePass string // Password when server connects to us
|
||||
ConnectPass string // Password when we connect to server
|
||||
|
||||
// Do we use tls.Dial? or compression (no)? Do we auto-connect on start?
|
||||
SSL, Zip, Auto bool
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package config
|
||||
|
||||
type cOper struct {
|
||||
Username, Password string
|
||||
HostMask []string
|
||||
|
||||
// Permissions for oper
|
||||
CanKill, CanBan, CanNick, CanLink bool
|
||||
}
|
||||
|
||||
var cOperDefaults = &cOper{
|
||||
HostMask: []string{"*@*"},
|
||||
CanKill: true, CanBan: true,
|
||||
CanNick: false, CanLink: false,
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"scanner"
|
||||
)
|
||||
|
||||
type cPort struct {
|
||||
Port int
|
||||
BindIP, Family, Class string
|
||||
|
||||
// Is port a tls.Listener? Does it support compression (no)?
|
||||
SSL, Zip bool
|
||||
|
||||
// address == "<BindIP>:<Port>"
|
||||
address string
|
||||
}
|
||||
|
||||
var portKeywords = keywordMap{
|
||||
// "bind_ip": (*Config).parsePortBindIP,
|
||||
// "family": (*Config).parsePortFamily,
|
||||
"class": (*Config).parsePortClass,
|
||||
"ssl": (*Config).parsePortSSL,
|
||||
// "zip": (*Config).parsePortZip,
|
||||
}
|
||||
|
||||
var cPortDefaults = cPort{
|
||||
BindIP: "", Family: "tcp", Class: "client",
|
||||
SSL: false, Zip: false,
|
||||
}
|
||||
|
||||
func defaultPort() *cPort {
|
||||
p := cPortDefaults
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p *cPort) String() string {
|
||||
str := []string{fmt.Sprintf("port %d {", p.Port)}
|
||||
if p.BindIP != "" {
|
||||
str = append(str, "\tbind_ip = " + p.BindIP)
|
||||
}
|
||||
str = append(str,
|
||||
fmt.Sprintf("\tfamily = \"%s\"",p.Family),
|
||||
fmt.Sprintf("\tclass = \"%s\"", p.Class),
|
||||
fmt.Sprintf("\tssl = %t", p.SSL),
|
||||
fmt.Sprintf("\tzip = %t", p.Zip),
|
||||
"}",
|
||||
)
|
||||
return strings.Join(str, "\n")
|
||||
}
|
||||
|
||||
func (conf *Config) parsePort() {
|
||||
port := defaultPort()
|
||||
portnum, ok := conf.expectInt()
|
||||
if !ok || portnum > 65535 || portnum < 1024 {
|
||||
conf.parseError("Invalid port '%s'", portnum)
|
||||
port = nil
|
||||
} else {
|
||||
port.Port = portnum
|
||||
conf.Ports[portnum] = port
|
||||
}
|
||||
if conf.scan.Peek() != '\n' {
|
||||
conf.parseKwBlock(port, "port", portKeywords)
|
||||
}
|
||||
fmt.Println(port.String())
|
||||
}
|
||||
|
||||
func (conf *Config) parsePortClass(pi interface{}) {
|
||||
port := pi.(*cPort)
|
||||
tok, text := conf.next()
|
||||
if tok == scanner.String && (text == "server" || text == "client") {
|
||||
port.Class = text
|
||||
} else {
|
||||
conf.parseError(
|
||||
"Port class must be \"server\" or \"client\", got '%s'", text)
|
||||
}
|
||||
}
|
||||
|
||||
func (conf *Config) parsePortSSL(pi interface{}) {
|
||||
port := pi.(*cPort)
|
||||
if ssl, ok := conf.expectBool(); ok {
|
||||
port.SSL = ssl
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package config
|
||||
|
||||
type cSettings struct {
|
||||
SSLKey, SSLCert, SSLCACert string
|
||||
MaxChans, MaxConnsPerIP int
|
||||
LogFile string
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"net"
|
||||
"crypto/tls"
|
||||
"compress/zlib"
|
||||
)
|
||||
|
||||
type Mux struct {
|
||||
// Sockets we've created
|
||||
listening []net.Listener
|
||||
serving []net.Conn
|
||||
|
||||
// send and recieve channels to sockets
|
||||
send map[*Node]chan string
|
||||
recv chan string
|
||||
|
||||
// input/output/error channels to daemon
|
||||
// Msg interface defined in parser.go
|
||||
In chan *Msg
|
||||
Out chan *Msg
|
||||
Err chan os.Error
|
||||
}
|
||||
|
||||
func (m *Mux) Serve(addr string, client bool, conf *tls.Config) os.Error {
|
||||
var l net.Listener, s net.Conn, e os.Error
|
||||
if conf == nil {
|
||||
if l, e = net.Listen("tcp", addr); e != nil {
|
||||
return e
|
||||
}
|
||||
} else {
|
||||
if l, e = tls.Listen("tcp", addr, conf); e != nil {
|
||||
return e
|
||||
}
|
||||
}
|
||||
append(m.listening, l)
|
||||
go func() {
|
||||
for {
|
||||
if s, e = l.Accept(); e != nil {
|
||||
m.Err <- e
|
||||
}
|
||||
append(m.serving, s)
|
||||
io := bufio.NewReadWriter(bufio.NewReader(s), bufio.NewWriter(s))
|
||||
if client {
|
||||
go m.clientSync(io)
|
||||
} else {
|
||||
// TODO(abramley): zlib support
|
||||
go m.serverSync(io)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Mux) clientSync(in bufio.ReadWriter) {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package server
|
|
@ -0,0 +1,15 @@
|
|||
package server
|
||||
|
||||
type NetMap struct {
|
||||
// To get to a specific Node, go via..
|
||||
via map[*Node]*Node
|
||||
|
||||
// Network links, from server's perspective
|
||||
links *Link
|
||||
}
|
||||
|
||||
type Link struct {
|
||||
node *Node
|
||||
hops int
|
||||
links []*Link
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package server
|
||||
|
||||
type Network struct {
|
||||
nodes map[string]*Node
|
||||
chans map[string]*Channel
|
||||
nicks map[string]*Nick
|
||||
tree *NetMap
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package server
|
|
@ -0,0 +1,6 @@
|
|||
package server
|
||||
|
||||
type Node struct {
|
||||
Name, Host string
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package server
|
|
@ -0,0 +1 @@
|
|||
package server
|
Loading…
Reference in New Issue