class NNTP::Connection

Included Modules

Defined in:

nntp/connection.cr:5
nntp/connection.cr:20

Constant Summary

Log = ::Log.for(self)

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module NNTP::Connection::Pool

release release

Instance methods inherited from module NNTP::Connection::Search

find_article_num(message_id : String, group : String | Nil = nil, batch_size = 100, offset : Int64 | Nil = nil) find_article_num, search_for_header(header : String, value : String, group : String | Nil = nil, batch_size = 100, offset : Int64 | Nil = nil, exact = false) search_for_header

Instance methods inherited from module NNTP::Connection::Groups

article_ids article_ids, group_article_ids(group) group_article_ids, group_info(group) : NNTP::Context::Group group_info, groups : Array(String) groups, list_active(*args, **options)
list_active(*args, **options, &)
list_active
, list_active_times(*args, **options)
list_active_times(*args, **options, &)
list_active_times
, list_distrib_pats(*args, **options)
list_distrib_pats(*args, **options, &)
list_distrib_pats
, list_distributions(*args, **options)
list_distributions(*args, **options, &)
list_distributions
, list_newsgroups(*args, **options)
list_newsgroups(*args, **options, &)
list_newsgroups
, list_overview_fmt(*args, **options)
list_overview_fmt(*args, **options, &)
list_overview_fmt
, list_subscriptions(*args, **options)
list_subscriptions(*args, **options, &)
list_subscriptions
, with_group(group, &) with_group

Instance methods inherited from module NNTP::Connection::Context

clear_context clear_context, context : NNTP::Context context, context? : Bool | Nil context?, context_start(group : String | Nil, article : Int32 | Int64 | Nil = nil) context_start, set_context(context : NNTP::Context) set_context

Instance methods inherited from module NNTP::Connection::Articles

body(num : Int32 | Int64) : Array(String)
body(message_id : String) : Array(String)
body
, headers(num : Int32 | Int64)
headers(message_id : String)
headers
, last last, next next, with_article(num : Int32 | Int64, &) with_article, xheader(header, message_id : String | Nil = nil)
xheader(header, num : Int64 | Int32, end_num : Int64 | Int32 | Nil = nil, all : Bool = false)
xheader
, xover(num : Int64 | Int32, end_num : Int64 | Int32 | Nil = nil, all : Bool = false) xover

Constructor Detail

def self.connect(host, port = 119, use_ssl = true, verify_mode : OpenSSL::SSL::VerifyMode = OpenSSL::SSL::VerifyMode::PEER, open_timeout : Int32 = 30, read_timeout : Int32 = 60, user : String | Nil = nil, secret : String | Nil = nil, method = :original) : Connection #

Will initialize a new Connection object, configure it, then establish a connection. The created Connection will then be returned.

client = NNTP::Connection.connect("localhost", user: "myuser", pass: "mypass")
client.connected? # => true

[View source]
def self.new(uri : URI) #

nntp://user:[email protected]:443/?ssl=true&verify_mode=none&method=original


[View source]
def self.new(host, port = 119, use_ssl = true, verify_mode : String = "peer", open_timeout : Int32 = 30, read_timeout : Int32 = 60) : Connection #

[View source]
def self.new #

[View source]

Class Method Detail

def self.connect(uri : URI) #

[View source]

Instance Method Detail

def close #

[View source]
def configure(&) #

Will yield self to provided block allow for variable setting. Then create a new NNTP::Socket instance (without connecting) Will return self.

client = NNTP::Connection.new
client.configure do |c|
  c.host = host
  c.port = port
  c.use_ssl = use_ssl
  c.open_timeout = open_timeout
  c.read_timeout = read_timeout
end

[View source]
def connect(user : String | Nil = nil, secret : String | Nil = nil, method = :original) #

Will establish a NNTP::Socket connection using client setting and any authentication params passed.

client = NNTP::Connection.new
client.connect("MyUSER", "SuperSecret")

[View source]
def connect(uri : URI) #

[View source]
def connected? #

Returns true if a connection has been established and false if not.

client = NNTP::Connection.new
client.connected? # => false
client.connect
client.connected? # => true

[View source]
def host : String #

[View source]
def host=(host : String) #

[View source]
def open_timeout : Int32 #

[View source]
def open_timeout=(open_timeout : Int32) #

[View source]
def port : Int32 #

[View source]
def port=(port : Int32) #

[View source]
def read_timeout : Int32 #

[View source]
def read_timeout=(read_timeout : Int32) #

[View source]
def use_ssl : Bool #

[View source]
def use_ssl=(use_ssl : Bool) #

[View source]
def verify_mode : OpenSSL::SSL::VerifyMode #

[View source]
def verify_mode=(verify_mode : OpenSSL::SSL::VerifyMode) #

[View source]
def with_socket(&) #

[View source]