Software Development with Go: Cloud-Native Programming using Golang with Linux and Docker 1st Edition Nanik Tolaram pdf download
Software Development with Go: Cloud-Native Programming using Golang with Linux and Docker 1st Edition Nanik Tolaram pdf download
https://ebookmass.com/product/software-development-with-go-cloud-
native-programming-using-golang-with-linux-and-docker-1st-
edition-nanik-tolaram/
https://ebookmass.com/product/beginning-cloud-native-development-with-
microprofile-jakarta-ee-and-kubernetes-1st-edition-tarun-telang/
https://ebookmass.com/product/go-crazy-a-fun-projects-based-approach-
to-golang-programming-1st-edition-nicolas-modrzyk/
Beginning Cloud Native Development with MicroProfile,
Jakarta EE, and Kubernetes: Java DevOps for Building and
Deploying Microservices-based Applications 1st Edition
Tarun Telang
https://ebookmass.com/product/beginning-cloud-native-development-with-
microprofile-jakarta-ee-and-kubernetes-java-devops-for-building-and-
deploying-microservices-based-applications-1st-edition-tarun-telang/
https://ebookmass.com/product/modern-enterprise-architecture-using-
devsecops-and-cloud-native-in-large-enterprises-1st-edition-jeroen-
mulder/
Nanik Tolaram
Software Development with Go: Cloud-Native Programming using Golang
with Linux and Docker
Nanik Tolaram
Sydney, NSW, Australia
Acknowledgments����������������������������������������������������������������������������xvii
Introduction���������������������������������������������������������������������������������������xix
v
Table of Contents
ELF Package�������������������������������������������������������������������������������������������������������22
High-Level ELF Format���������������������������������������������������������������������������������������������� 23
Dump Example���������������������������������������������������������������������������������������������������������� 24
/sys Filesystem���������������������������������������������������������������������������������������������������28
Reading AppArmor����������������������������������������������������������������������������������������������������� 29
Summary������������������������������������������������������������������������������������������������������������31
Summary������������������������������������������������������������������������������������������������������������48
vi
Table of Contents
Docker Proxy�������������������������������������������������������������������������������������������������������98
Container Attack Surface����������������������������������������������������������������������������������105
Summary����������������������������������������������������������������������������������������������������������106
gosec����������������������������������������������������������������������������������������������������������������122
Inside gosec������������������������������������������������������������������������������������������������������������ 123
Rules������������������������������������������������������������������������������������������������������������������������ 128
Summary����������������������������������������������������������������������������������������������������������130
vii
Table of Contents
Chapter 8: Scorecard������������������������������������������������������������������������131
Source Code������������������������������������������������������������������������������������������������������131
What Is Scorecard?�������������������������������������������������������������������������������������������131
Setting Up Scorecard����������������������������������������������������������������������������������������������� 133
Running Scorecard�������������������������������������������������������������������������������������������������� 137
High-Level Flow������������������������������������������������������������������������������������������������������� 139
GitHub���������������������������������������������������������������������������������������������������������������145
GitHub API���������������������������������������������������������������������������������������������������������������� 145
GitHub Explorer�������������������������������������������������������������������������������������������������������� 156
Summary����������������������������������������������������������������������������������������������������������159
UDP Networking������������������������������������������������������������������������������������������������168
UDP Client���������������������������������������������������������������������������������������������������������������� 169
UDP Server�������������������������������������������������������������������������������������������������������������� 172
Concurrent Servers�������������������������������������������������������������������������������������������������� 174
Load Testing������������������������������������������������������������������������������������������������������175
Summary����������������������������������������������������������������������������������������������������������179
viii
Table of Contents
DNS Server��������������������������������������������������������������������������������������������������������188
Running a DNS Server��������������������������������������������������������������������������������������������� 188
DNS Forwarder�������������������������������������������������������������������������������������������������������� 189
Pack and Unpack����������������������������������������������������������������������������������������������������� 193
Summary����������������������������������������������������������������������������������������������������������196
Using gopacket�������������������������������������������������������������������������������������������������205
pcap������������������������������������������������������������������������������������������������������������������������� 205
Networking Sniffer�������������������������������������������������������������������������������������������������� 206
Capturing With BPF�������������������������������������������������������������������������������������������������� 217
Summary����������������������������������������������������������������������������������������������������������222
Epoll Library������������������������������������������������������������������������������������������������������232
Summary����������������������������������������������������������������������������������������������������������235
ix
Table of Contents
Summary����������������������������������������������������������������������������������������������������������263
Summary����������������������������������������������������������������������������������������������������������290
x
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Table of Contents
Summary����������������������������������������������������������������������������������������������������������306
Bubbletea����������������������������������������������������������������������������������������������������������313
Init��������������������������������������������������������������������������������������������������������������������������� 315
Update��������������������������������������������������������������������������������������������������������������������� 318
View������������������������������������������������������������������������������������������������������������������������� 319
Summary����������������������������������������������������������������������������������������������������������321
xi
Table of Contents
Index�������������������������������������������������������������������������������������������������377
xii
About the Author
Nanik Tolaram is a big proponent of open source software with over 20
years of industry experience. He has dabbled in different programming
languages like Java, JavaScript, C, and C++. He has developed different
products from the ground up while working in start-up companies. He is
a software engineer at heart, but he loves to write technical articles and
share his knowledge with others. He learned to program with Go during
the COVID-19 pandemic and hasn’t looked back.
xiii
About the Technical Reviewer
Fabio Claudio Ferracchiati is a senior consultant and a senior
analyst/developer using Microsoft technologies. He works for BluArancio
(www.bluarancio.com). He is a Microsoft Certified Solution Developer for
.NET, a Microsoft Certified Application Developer for .NET, a Microsoft
Certified Professional, and a prolific author and technical reviewer.
Over the past ten years, he’s written articles for Italian and international
magazines and coauthored more than ten books on a variety of
computer topics.
xv
Acknowledgments
Thanks to everyone on the Apress team who helped and guided me so
much. Special thanks to James Robinson-Prior who guided me through
the writing process and to Nirmal Selvaraj who made sure everything was
done correctly and things were on track.
Thanks to the technical reviewers for taking time from their busy
schedules to review my book and provide great feedback.
Finally, thanks to you, the reader, for spending time reading this book
and spreading the love of Go.
xvii
Introduction
Go has been out for more than 10 years, and open source projects were
developed using Go. The aim of this book is to show you the way to use Go
to write a variety of applications that are useful in cloud-based systems.
Deploying applications into the cloud is a normal process that
developers do every day. There are many questions that developers ask
themselves about the cloud, like
xix
PART I
System Programming
CHAPTER 1
System Calls
Linux provides a lot of features and provides applications access to
everything that the operating system has access to. When discussing
system calls, most people will turn their attention to using C because
it is the most common language to use when interfacing with the
operating system.
In this chapter, you will explore what system calls are and how you can
program in Go to make system calls. By the end of this chapter, you will
have learned the following:
If you are using Go for the first time, refer to the online documentation
at https://go.dev/doc/install. The online documentation will walk you
through the steps to install Go on your local computer. Go through the Go
tutorial that the Go documentation provides at https://go.dev/doc/.
Source Code
The source code for this chapter is available from the https://github.
com/Apress/Software-Development-Go repository.
4
Chapter 1 System Calls
C System Call
In this section, you will briefly look at how system calls normally work
inside a C program. This will give you an idea of how system calls are done
in C compared to how they are done in Go.
You will see a simple example of using a socket to connect to a server
and read the response. The code can be found inside the chapter1/c
directory. The code creates a socket and uses it to connect to a public
website named httpbin.org and print the response it receives to the
screen. Listing 1-1 shows the sample code.
#include<stdio.h>
#include<string.h>
#include<sys/socket.h>
#include<arpa/inet.h>
5
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
The effusion of serum is often abundant, causing protrusion of the
mucous membrane, and narrowing of the canal; and when it is
limited to the upper part of the larynx, as frequently happens, the
disease is termed Œdema Glottidis. In this affection, the majority of
the symptoms, which have been already enumerated as attendant
on laryngitis, are all present, and in an aggravated form. Inspiration
is extremely difficult and sibilant, and occasionally the patient
experiences a sensation, as if a foreign body were lodged in the
passage, and had changed its position on the muscles of the part
being put in motion. The symptoms of œdema come on gradually in
some cases, in others with alarming rapidity. They often follow
ulcerations of the soft palate, and of the root of the tongue, as
shown in treating of diseases of that organ, occurring on the patient
being exposed to cold or moisture, or supervening rapidly when
discharge from the ulcerations is by any accident suddenly
suppressed. The difficult breathing, with cough and violent attempts
at expectoration, takes place in paroxysms, and often to so alarming
a degree as to threaten immediate suffocation, especially during the
night. The patient, if he has fallen asleep, often starts up suddenly,
and catches at the nearest object, having dreamed probably of
drowning or strangulation. Deglutition is seriously impeded, the
strength is exhausted, the body is emaciated, the features become
contracted, and evince great anxiety. As already stated, the serous
effusion is chiefly situated in the upper part of the larynx,
particularly on the lips of the glottis, and on the inferior surface of
the epiglottis; and on introducing the finger, a soft swelling can be
felt beneath this cartilage. Perhaps the following sketch exhibits the
most complete instance of œdematous swelling of the rima glottidis
to be found in collections of morbid anatomy. The patient was
brought to the Royal Infirmary labouring under all the symptoms of
the disease in a very aggravated form. Tracheotomy was performed
without delay, and with instant relief. The patient fell into a quiet and
profound sleep, which lasted for six or seven hours. He started up
suddenly and fell down dead; probably the end of the tube had
become obstructed by mucus. It is scarcely to be supposed that the
patient could have breathed at all with such a state of parts at the
top of the air-tube, as here represented.
Could any of the swelling have come on in
the interval betwixt the performance of the
operation and his sudden death? In some
instances, the disease rapidly proceeds to a
fatal termination, the glottis being speedily
and entirely shut by the swelling; in others,
the patient lingers for weeks, or even
months.
Depletion, local and general, especially the
former, if employed on the first appearance
of the inflammatory symptoms, will often
arrest their progress; but if practised at a
more advanced period, it can be productive of no benefit, and if any
advantage does follow, it is merely temporary. Sometimes
considerable benefit will be derived from the use of blisters, or from
the unguentum tartritis antimonii being rubbed on the sides of the
neck and over the larynx, so as to produce an eruption of numerous
pustules. When all hopes of procuring resolution have passed, and
when the urgent symptoms occasionally threatening suffocation
supervene, tracheotomy should be performed without delay; and it
ought to be borne in mind, that the more early this operation is
resorted to, the greater is the chance of success. It has been
repeatedly stated, that the disease is confined to the larynx, and, in
most instances, to the upper part of it; so that, by making an
opening in the windpipe below the thyroid gland, the disease is
situated above the incision, the patient breathes through a canal
which is in its healthy state, the affected parts are set at rest, and
from their remaining comparatively motionless the disease often
subsides spontaneously; if not, the various applications to the parts
can be employed much more successfully than before; for when the
parts remain subject to constant irritation from the movements
necessary for respiration and nutrition, all medicines and all topical
applications are generally productive of little or no benefit. But if the
incision be made into the crico-thyroid membrane, we shall, in most
instances, cut into the very middle of the disease; at any rate, the
affected parts can be at no great distance from the incision, and the
irritation of the tube will be a sufficient cause to excite inflammatory
action in parts contiguous to the original disease, and already
disposed to assume a similar action; thus the disease may be
extended. I have performed tracheotomy on a very considerable
number of patients afflicted with œdema glottidis, and I may say,
with almost uniform success. The disease was speedily subdued, and
in most of them there was no great difficulty in closing the artificial
aperture, and restoring natural respiration. The relief afforded by the
operation is almost instantaneous; the performance of it, if skilful, is
attended with no danger; and want of success will generally be
found to proceed from its having been too long delayed.
In consequence of laryngitis, or of long-continued irritation in the
neighbourhood, the mucous membrane becomes indurated, and
subsequently ulcerates; or ulceration may extend from the fauces. In
some cases, the ulcers of the larynx are few, and of slight extent; in
others, they are more numerous, and of considerable width and
depth; and in some there is extensive and uninterrupted destruction
of the surface, surrounded by thickened and elevated mucous
membrane. This disease is termed Phthisis Laryngea. It is
characterised by constant tickling cough with expectoration of
purulent matter; by pain in the region of the larynx increased on
pressure; by great prostration of strength, with general sinking of
the vital powers, and frequently by hectic fever. From extension of
the ulceration, the vocal chords, the ventricles of the larynx, and the
mucous folds forming the rima glottidis, are more or less injured,
and frequently altogether obliterated; partial or complete aphonia is
the consequence. In phthisis laryngea, especially when advanced,
swelling from serous effusion, to a greater or less degree, almost
certainly supervenes, the œdema is found in the upper surface of
the epiglottis, beneath the mucous membrane, upper and forepart of
the pharynx, and occasionally also in the lips of the glottis,—an
effect of the contiguous ulceration,—in the same way as œdema
glottidis supervenes on ulceration of the lining membrane of fauces
and pharynx; the usual train of symptoms denoting phthisis laryngea
may thus be interrupted by those of œdema of the glottis becoming
(each paroxysm) more and more urgent, terminating in suffocation
or relieved by tracheotomy.
From the reasons which have been already stated, inspiration is
performed with difficulty, and accompanied with a wheezing and
rattling sound, resembling the passage of air through a narrow
aperture lined with viscid fluid. Deglutition is difficult; and, from the
inactive state of the muscles which naturally close the glottis during
swallowing, and from the greater or less destruction of the epiglottis,
a portion of the fluid taken by the mouth escapes into the windpipe,
produces violent coughing, and is ejected by the mouth or nostrils.
As the disease advances, the lungs become affected, the patient is
incapacitated for ordinary exertion by the dyspnœa which ensues, he
grows weak and languid, and seems, in fact, to labour under phthisis
pulmonalis. Not unfrequently the two diseases are combined; but, in
the majority of cases, the affection of the lungs supervenes on that
of the larynx. Ulcers with tubercular bases are very frequent about
the ventricles of the larynx in subjects dead of pulmonary phthisis.
The chordæ vocales are thus often exposed. The affection of the
lungs is perhaps attributable to frequent and harassing cough,
occasioned by the state of the larynx and ejection of profuse vitiated
secretions.
When the ulceration extends deeply, portions of the cartilages
sometimes become diseased; the soft parts surrounding them are
destroyed, they become necrosed, and are expectorated along with
a quantity of highly fetid purulent fluid. In some instances, the
expectorated portions are osseous, of loose texture, irregular
margins, and dark colour, exhaling an odour intolerably fetid. It
sometimes happens that the ulcerations proceed still more deeply,
perforating the parietes of the canal, and establishing a
communication betwixt the windpipe and gullet; or, if the perforation
is anteriorly, the communication is with the cellular tissue on the
forepart of the neck, abscess forms which may attain a large size
and be productive of much inconvenience and danger.
The disease has been frequently produced by mercury, when the
abuse of that mineral was common; its abuse is still far from
uncommon.
The symptoms may be mitigated by counter-irritation. The parts
covering the trachea should not be subjected to counter-irritation; in
consequence of repeated blistering, the application of irritating
ointments, effusion and thickening of the cellular tissue is caused,
and this may prove a serious obstacle in the performance of
tracheotomy, should that afterwards, as is too likely, be required.
Setons may be inserted on the sides of the neck, and applications
made over the box of the larynx. But tracheotomy affords the only
hope of permanent relief; and if performed at an early period, if the
lungs are not the seat of tubercular disease, as they too frequently
are, there is every reason to expect that it will prove successful. It is
followed by the beneficial results mentioned when speaking of the
preceding disease, and the nitrate of silver can be applied to the
more external ulcers, along with the internal use of sarsaparilla, &c.
Ulcers, which there is every reason to suppose had been both
extensive and deep, have healed even after the discharge of
portions of dead, sometimes ossified, cartilage. The symptoms
abate; the patient recovers, though in general with imperfect voice,
as might be expected.
It may even be practicable to employ topical applications to the
ulcers within the cavity of the larynx, as in the following case, which,
though unsuccessful, shows the advantages to be expected from
similar procedure adopted at a more early period. T. C., aged 22,
had laboured under the symptoms of phthisis laryngea for five
months previous to his application. He was much emaciated, and
experienced great difficulty in swallowing, on account of the irritation
induced in the region of the glottis; he had occasional cough,
purulent sputa, and aphonia almost complete. The larynx was
painful when pressed, the epiglottis was seen to be œdematous, and
the general symptoms were of a hectic character. The œdema of the
epiglottis was reduced by scarification.
The symptoms increased, notwithstanding counter-irritation and
tonic remedies. The stethoscopic indications regarding the chest
were so far favourable.
Tracheotomy was performed, and the patient felt very much relieved
in consequence. On the tenth day after the operation, the inner
surface of the larynx was touched with a strong solution of the
nitrate of silver, applied by means of a bit of lint wrapped round the
end of a probe slightly bent, and introduced upwards from the
wound. The solution was applied every second or third day, and
under its use the patient was remarkably benefited. He swallowed,
spoke, slept, and looked better; the purulent sputa diminished, and
the cough abated. He complained of less pain in the larynx, and
seemed to be regaining strength, though slowly.
But after the lapse of several weeks, from imprudent exposure to
cold, evident symptoms of bronchitis supervened, under which his
constitution already shattered, speedily sank. The larynx was found
extensively ulcerated, but at a number of points there were distinct
marks of recent cicatrisation. The state of the lungs clearly showed
that phthisis pulmonalis had not only commenced, but made
considerable progress. The practice here detailed has been repeated
again and again with good success.
Dyspnœa is caused by other circumstances besides those already
mentioned; some rare cases are met with in which warty
excrescences have grown from the seat of the vocal chords: a
beautiful specimen from the collections of my friends, Messrs.
Grainger and Pilcher, is here delineated. Dyspnœa frequently arises
from paralysis of the muscles of the larynx, in consequence of
effusion at the base of the brain, from long-continued irritation, as
from an irritating cause seated in the mouth, and in old people from
a general decay of the animal powers. In the last case, it is generally
a symptom of approaching dissolution, as is the dysphagia which
often attends it.
Severe dyspnœa is sometimes caused by external violence. A fine
healthy child, aged eight, in running across the street, fell, and
struck the larynx with great force upon a
large stone. She was taken up quite lifeless,
and some time elapsed before respiration
was at all established. A gentleman finding
her face livid, opened the temporal artery,
and applied leeches to the throat, with some
relief. I saw her about three hours after the
accident. The breathing, inspiration more
particularly, was exceedingly difficult; and
this appeared to proceed not only from the
injury to the larynx, probably occasioning
loss of power in the muscles, but from the
collection of some fluid in the trachea and its
ramifications. The child was evidently in such
a state that, unless active measures were
resorted to, and that speedily, a fatal
termination would soon take place.
Tracheotomy was performed; a quantity of coagulated blood and
bloody mucus was evacuated from the opening; and when the
discharge and coughing had ceased, a tube was introduced. In eight
days the tube was withdrawn, the aperture closed; and no
unfavourable symptom recurred. In the museum at Chatham is a
larynx showing fracture of the thyroid cartilage from the kick of a
horse. The immediate consequence was great difficulty of breathing
and rapid general emphysema. The patient, a young soldier, died
soon after the injury.
Large or irregular foreign bodies, as coins, pebbles, portions of stone
or of coal, seeds of fruit, &c., put heedlessly into the mouth, are apt
to become impacted in the rima glottidis, and give rise to severe and
dangerous dyspnœa, or even cause sudden dissolution. Smaller and
smooth substances pass through into the trachea. Such accidents
happen most frequently to children. Peas, beans, small shells, &c.,
slip into the air-passage, are obstructed for a short time in the rima,
but are soon forced by the convulsive actions of the patient into the
trachea, and frequently lodge in the right bronchus, it being more
capacious, and more a continuation of the trachea than the left; or
they remain loose in the trachea, and are moved up and down by
the passage of the air. Immediately on their introduction, most
violent coughing takes place, respiration is convulsive and imperfect,
the patient writhes in agony, and is in dread of instant suffocation;
the countenance becomes inflated and livid, and most strenuous
efforts are made by nature to expel the foreign body. At length he is
exhausted, and an interval of perfect quiet ensues; but this is soon
interrupted by renewed attempts at expulsion. After a time, the
intervals of repose increase in duration, and in many cases are so
long continued, as to lull the patient and his friends into a belief that
the windpipe contains no extraneous substance. But still violent fits
of coughing supervene from time to time, and the dyspnœa is very
alarming; on attentive examination, the presence of this foreign
body may be ascertained beyond doubt by the peculiar noise
produced by its movements in the passage; at the same time, thin
mucus is copiously discharged from the lining membrane.
Occasionally the foreign body becomes so placed in the canal as to
form a complete valve, and then the labours of the patient to
dislodge it are most painfully severe; if they fail, he is suffocated.
During laborious breathing the neck sometimes becomes
emphysematous. The parts may at length get accustomed to the
presence of the foreign body, and all uneasiness subside. But
danger, though not immediate, still remains. Foreign bodies have
remained for years without causing much inconvenience; but in such
cases they have generally settled in some remote ramification of the
bronchial tubes; abscess commonly, sooner or later, takes place
around, purulent expectoration follows, all the symptoms of
pulmonary phthisis are established, the patient becomes hectic, and
dies.
The existence of the foreign body, when suspected, is to be
ascertained by accurate and attentive examination along the forepart
of the neck, and by listening carefully to the sounds which may be
present in the trachea; but the urgency and continuance of the
symptoms will seldom leave the surgeon to entertain a doubt. If he
attentively watch the patient, he can scarcely be mistaken. It has
been recommended to examine the œsophagus previously to
adopting active measures, a large foreign body impacted in that
passage being capable of materially obstructing respiration by
compression of the trachea; and it is safe and prudent to follow this
recommendation whenever the least uncertainty exists regarding the
real nature of the case.
When a foreign body has lodged in the windpipe, tracheotomy
should be had recourse to without delay. In general, the offending
substance presents itself immediately after the division of the
trachea, and is expelled by a strong current of air. But in some cases
it may be necessary to introduce instruments—probes, scoops, or
small forceps—upwards or downwards, to dislodge and extract the
body. A case in which a foreign body, which had lodged in the right
bronchus for about six months, was successfully extracted, is
detailed fully in the Lancet, and noticed shortly in the Practical
Surgery, p. 416. A little blood from the wound may cause coughing
for some minutes, but this soon ceases; the wound is closed after a
few hours, respiration is completely reëstablished, and all that the
surgeon has then to combat are the evil effects on the mucous
membrane which the contact of a foreign body may have
occasioned.
Tracheotomy is, in nearly all cases, preferable to laryngotomy. In
disease of the windpipe, as formerly stated, it is better to cut into a
sound part of the passage, or at least as far as possible from the
seat of the disease. When an adult, for example, labours under
acute laryngitis, the effused lymph is generally confined to the
larynx, as was already mentioned; an opening below the thyroid
gland is removed from the effusion, and by means of it the patient
breathes through the natural tube yet sound; whereas, if the
opening is made in the crico-thyroid membrane, the surgeon
frequently cuts into the middle of the diseased part; little or no
benefit follows, and, if the danger is not increased, equivocal good is
all that can be expected from such an operation. Tracheotomy is also
preferable for the removal of foreign bodies, unless it is certain that
the body is impacted in the rima, for in such circumstances
laryngotomy is much more suitable. In tracheotomy, the incision of
the tracheal rings can be extended with much less injury than can
division of the laryngeal cartilages, when the largeness of the foreign
body, its being firmly fixed, or other circumstances, require that the
wound be of considerable size. The risk or danger in the one
operation is not much greater than in the other. Division of the crico-
thyroid membrane and skin is effected by one incision; there is
nothing important in the way of the knife. In very young children,
when suffocation is threatened, as from the effects following upon
the attempt to swallow very hot fluids, and the inhalation of steam,
this operation may with great propriety be performed. Tracheotomy,
on the contrary, requires to be proceeded in more carefully,
particularly in children, in whom the neck is short, and the trachea
deep. The tube is moreover very small, and not easily steadied. I
had occasion, not long since, to open the passage in a child under
sixteen months old, who had tried to swallow the contents of a
teapot recently filled with boiling water. The difficulty experienced in
such cases is often very great. Obstacles may also be presented by
the thyroid and other veins being distended, and the soft parts are
perhaps tumid and infiltrated with serum.
The patient, if adult, should be seated with the trunk erect, and by
throwing back the head, space in the neck is gained. In a female on
whom I operated some years since, this advantage could not be
obtained on account of induration in the belly of the sterno-mastoid
muscle, with contraction. The incision of the integument is
commenced in the mesial line over the cricoid cartilage, and carried
downwards, an inch in the adult, but proportionally shorter in
children. The cellular tissue is divided by a few touches with the
point of the instrument (a small scalpel or bistoury); the finger is
then introduced to separate the sterno-hyoid muscles, and to feel for
any stray vessels which may be in the way; for the thyroid arteries
sometimes cross the line of incision, and it may happen that some of
the larger arteries of the neck, by following an unusual course,
become liable to injury, if the operation were rashly performed. The
plexus of veins on the forepart of the neck is pushed downwards,
and the isthmus of the thyroid gland, if it exist, is displaced slightly
upwards; thus the rings of the trachea are cleared. The patient is
desired to swallow his saliva, in order to elongate and stretch the
windpipe; and the surgeon, seizing the favourable opportunity,
pushes the point of the knife, with its back towards the top of the
sternum, into the tube at the lower part of the incision. The
instrument is carried steadily upwards, so as to divide three or four
rings. It is not at all necessary to cut out any part of the rings of the
trachea as recommended by some writers; contraction of the tube
may afterwards result; nor can any good purpose be served by
making the opening crucial.
If the operation has been undertaken for the removal of a foreign
body, its object is usually accomplished immediately on division of
the rings; if not, the substance must be dislodged by proper
instruments, as was previously remarked. The opening is allowed to
close after the oozing of blood has entirely ceased; but its edges
must be kept asunder till then, lest the blood be drawn into the
bronchial tubes, which occurrence, however slowly it take place, is
always dangerous. The union and cicatrisation of such longitudinal
wounds are soon accomplished; they close permanently in a few
days, even after having been open for many weeks with a foreign
substance interposed between their edges. The same obstacles do
not interfere as in transverse wounds; on the contrary, every
circumstance is in favour of rapid union.
When the object of the operation is to relieve respiration, impeded
by disease in the superior part of the canal, a silver tube, of
convenient curve, length, and calibre, is introduced into the wound
immediately on the knife being withdrawn, and secured by tapes
attached to the rings at the orifice of the tube, and tied round the
neck. Frequently a violent fit of coughing, alarming to the patient,
follows the introduction, in consequence of some blood having
entered the trachea. But on the ejection of some frothy mucus,
mixed with blood, the patient becomes quiet and tranquil, breathes
easily, and feels composed and relieved. The form of the tube—the
calibre gradually increasing from below towards the orifice—
completely prevents any farther ingress of blood, by the uniform
compression which it makes on the edges of the wound. The
secretion of mucus in the trachea is increased by the presence of the
foreign body, but the patient easily frees himself from its annoyance,
being instructed to place his finger on the orifice of the tube, so as
to narrow the aperture, when he wishes to cough and expectorate.
In those cases where the operation has been performed without
there being diminution of calibre of upper part by swelling or
otherwise, expectoration through the tube is more difficult. Mucus,
however, is apt to adhere to the inner surface of the tube, and
thereby obstruct breathing; to prevent this, it is necessary
occasionally to introduce a feather, or a probe wrapped round with
lint, for some hours after the operation; the attendance of an
assistant may be necessary for this purpose, but the patient readily
undertakes the duty himself, on being made aware of its necessity. A
double tube has been recommended, to facilitate the keeping of the
passage clear, the inner one being occasionally withdrawn, cleaned,
and replaced. But this is not in ordinary cases necessary. The
frequent introduction of a feather, or probe, is sufficient for some
hours after the operation, and in a very short time the patient finds
that he breathes freely, though the tube is removed for a few
minutes, in order to be cleaned. At first, a funnel-shaped tube is
used, to compress the edges of the wound and prevent oozing, as
already mentioned; afterwards, one of uniform calibre is more easily
coughed through. The patient should be kept in an atmosphere of
warm and equal temperature, and it is also prudent to place some
cloth of very loose texture over the tube, that the temperature of the
respired air may resemble as much as possible that passing through
the whole track of the windpipe; thus bronchitis may be averted.
In some cases, the necessity for continuing the tube speedily goes
off, the larynx, in consequence of rest, having recovered its healthy
state and action. After eight or ten days, on taking out the tube, and
closing the aperture in the trachea, the patient breathes and speaks
well, and continues to do so.
In other instances, the difficult breathing recurs soon after
withdrawal of the tube, the morbid state of the laryngeal mucous
membrane having not been wholly removed. In such circumstances,
the tube must be replaced and continued, but a smaller one suffices,
less mucus is secreted, and a considerable quantity of air passes
through the larynx; in short, the patient requires merely a small tube
to obviate the danger which might arise from complete closure of
the artificial opening, and to compensate for the narrowness of the
natural canal. He speaks tolerably well, on placing his finger over the
orifice of the tube. In course of time, the larynx may recover, and
the tube be no longer necessary.
In some cases, a tube of a certain size must be worn during the
remainder of life; and it does not generally cause much
inconvenience. Attempts to discontinue its use give rise to dreadful
suffering; the difficult breathing, threatened suffocation, and horrible
feelings during the night, all recur. The box of the larynx has fallen
in, as it were, in consequence of having been long disused, and is
unable to resume its functions to their full extent. Besides, great,
though gradual, change of structure has in all probability taken
place. In several such cases, I have attempted to restore the natural
dimensions of the passage, by the occasional introduction of
bougies, gradually increased in size; but in none have I completely
succeeded, except in the case of attempted suicide which has been
already detailed shortly. In all, my attempts were at first followed by
encouraging amelioration, but untoward symptoms occurring forced
me to abandon them, though repeatedly persevered in. In one man,
I succeeded in restoring natural respiration and closing the opening
in the neck, but this was not of long continuance; a fresh accession
of difficult breathing made renewal of the artificial opening
absolutely necessary within a few months. Still the results are not
such as to forbid further trials; and at any rate, it is now well
understood that much greater freedom may be safely used with the
air-tube than was formerly imagined; yet it must be acknowledged
that little benefit can be expected to follow such, or any treatment,
in many cases of contraction of the canal, from long-continued
disease. The larynx and trachea obtained from the patient whose
case is alluded to above are here represented. The poor fellow had
worn a small silver tube in an opening in his windpipe for many
years. It was originally introduced on account of
long-continued disease of the larynx, with dreadful
suffering and constant sense of impending
suffocation. He could not be made to dispense
with the tube entirely, as he felt immediately on
the wound closing a threatening of return of his
painful and dangerous symptoms. A small one was
substituted for that at first used. He led a very
irregular life, used a vast quantity of opium, and
no small amount of spirituous liquors. He used to
be out in the open air occasionally all night, and
suffered repeatedly under attacks of bronchitis. He
was under treatment again and again in the
hospital, on account of rheumatic affection and
deranged digestive organs. He used occasionally
to present himself, complaining of difficult
breathing, and stating that his silver tube was too
short. He could articulate tolerably well when he
stopped with his finger the orifice of the silver tube; at all times a
part of the respired air passing through the natural channel. Latterly,
he used to suffer from threatening of suffocation, and he used to
relieve himself of the cause of this, viz., the inspissated and ropy
mucus which got entangled in the trachea, then not suspected to be
in a diseased state, by pushing through the opening in his neck and
into the bronchi, long turkey’s feathers; of these he carried a good
store, and some are now in my possession. This feat he performed
without causing the slightest excitement or coughing. Ultimately, and
about twelve years after the operation had been performed, he died,
principally from diseased viscera. His liver was enormously enlarged
and altered in structure; the larynx is seen to be very much
contracted at two points. The tube is observed to be considerably
dilated below the contractions.
The introduction of tubes into the larynx has been supposed likely to
supersede bronchotomy in some cases; and it is said that their
presence does not produce so much irritation as has been stated.
But the practice must, in all cases, be most troublesome to the
surgeon, and painful to the patient; and, in my opinion, continuance
of it is in the great majority of cases impracticable. Besides, it is
difficult, and not unattended with danger. Bronchotomy is quite safe,
and not likely to be followed by such suffering to the patient, or by
any other unpleasant consequence, to which the other method is
liable.
Pharyngitis.—Inflammation of the pharynx is of rare occurrence. The
inflammation may extend from neighbouring parts, or be produced
by the direct application of an irritating or stimulating cause, as the
lodgement of foreign bodies, of pins, fish-bones, seeds, portions of
hard food; or by the application of acrid fluids to the membrane,
acids, hot water, &c. In one instance which I met with, it occurred in
a very violent form, in consequence of a large and sharp portion of
an earthenware plate having been swallowed so far by the patient
whilst eating his porridge, and becoming firmly impacted in the
lower part of the pharynx. I have seen a considerable number of
instances in which the disease was produced by the swallowing of
soap lees, a fluid, it would appear, highly acrid, occasioning a severe
degree of inflammation, and even destroying a portion of the
parietes.
A man employed by the police in fumigating houses during the
prevalence of cholera, had given to him as a practical joke a glass of
sulphuric acid instead of whiskey. He suffered at the time, as may be
supposed, most excruciating pain, violent inflammation supervened,
followed by a bad stricture of the gullet.
Deglutition is difficult and painful; an exquisite degree of pain is
occasioned by pressure on the sides of the neck, and the circulation
is more or less excited. Redness and swelling of a portion of the
mucous membrane can be observed on looking into the fauces. The
changes which occur in the membrane are similar to those produced
in the windpipe by inflammation.
Resolution will generally be effected by the application of leeches to
the neck, the exhibition of purgatives and diaphoretics, and strict
observance of the antiphlogistic regimen.
If the inflammation does not soon subside, it sometimes happens
that constriction of the passage occurs, either from thickening or
œdematous swelling of a portion of the mucous membrane, or from
effusion of lymph, and adhesion of the opposed surfaces. The
common seat of stricture, as in other mucous canals, is that portion
of the tube which is naturally the narrowest, the lower part of the
pharynx and commencement of the œsophagus, immediately behind
the cricoid cartilage: occasionally it takes place in other parts of the
canal. In general, the contraction is of small extent, and
unaccompanied with much thickening around. The tube immediately
above the constricted point is more or less dilated, and often to so
enormous a size as almost to resemble a first stomach. In the
majority of cases, the parietes of this pouch are attenuated; but
occasionally they are much thickened, and the seat of a purulent
collection, which subsequently opens into the general cavity. In
cases of long standing, ulceration often occurs, usually limited to the
neighbourhood of the stricture. When the parts immediately below
the stricture are ulcerated, the circumstances is often attributed to
the retching which generally attends the disease; but it appears to
be the result of morbid action, seated in the parts themselves,
similar to the ulcerative process in the larynx following inflammatory
affection. But ulceration occurs as frequently above the stricture as
below it; and, besides the natural cause to which it is referable, is
often produced, or at least aggravated, by injudicious or unskilful
attempts to remove the constriction. Though the ulcers seldom
enlarge to any great extent, yet, in some rare cases, a portion of the
parietes of the canal is perforated, and a communication thus
established with the trachea, or with the cellular substance amongst
the muscles of the neck. Or the ulcers, from either long continuance,
or inherent disposition, may assume a malignant action, extend
rapidly in both width and depth, throw out fungous and unhealthy
granulations, form sinuous false passages, and produce a most
horrible and intractable disease. But strictures are often of
temporary duration, and appear to depend on spasmodic contraction
of the circular muscular fibres of the tube. And dysphagia may also
arise from an opposite condition of the fibres—from paralysis, in
consequence of cerebral affection, a fatal symptom in any disease.
The prominent symptom of stricture of the œsophagus is difficult
deglutition. Some patients can swallow only liquids; and when an
attempt is made to get over any solid substance, this is stopped at
the contraction, and completely obstructs the passage. In such cases
patients will frequently apply for relief, in order that the portion of
food may be pushed through the narrow portion of the canal; with
the accomplishment of this many are quite satisfied, and are
unwilling to submit to farther treatment, obstruction to solid matter
being the only inconvenience experienced. But when contraction is
great, and the involved portion of the canal almost obliterated, little
food of any kind can pass into the stomach, the patient becomes
feeble and emaciated, and ultimately dies from inanition. The
subjects of this affection are generally far advanced in years, and in
them it often occurs without any evident cause.
If pharyngitis have subsided, either spontaneously or after
antiphlogistic treatment, and symptoms of stricture supervene, the
existence or non-existence of this latter disease must be ascertained
by gentle and cautious introduction of a gum-elastic bougie or ivory-
ball probe. If stricture exist, the descent of the instrument will be
resisted at the contracted point, and most frequently at the lower
part of the pharynx: this, in the adult, will be at a distance of about
nine inches from the incisor teeth. When the seat of the stricture is
ascertained, a bougie is to be introduced, sufficiently small to pass
through it; and when this has been pushed beyond, the disease, if
unattended with malignant disposition or action, is completely in the
power of the surgeon. After sufficient time has been allowed for the
irritation following the first introduction to subside, a larger bougie is
to be passed, and retained as long as its presence can be endured.
This practice must be continued, till, by gradual increase of the
bougie, the canal is dilated so as to admit readily an instrument
sufficient to distend the gullet in its healthy state. Thus the passage
will be gently and gradually dilated, till it regain its original calibre.
The process is partly mechanical, but also greatly dependent on vital
action; by the presence of the bougie the parts are stimulated, the
fluid, which may be effused beneath the mucous membrane or into
its substance, is absorbed, and the new solid matter is also gradually
removed by increased action of the absorbents. But if the bougie be
rudely and forcibly introduced, or too long retained, the absorbent
action from being salutary becomes morbid, and ulceration is
established, which may proceed to destroy the parietes of the canal,
so producing an additional and equally formidable disease; or if the
ulcerative action subside, the parts will cicatrise and consequently
contract, so giving rise to a new stricture,
and narrowing the canal to an equal or
greater extent than formerly. Before
introducing the bougie, the head must be
thrown as far back as possible, as here seen,
and brought to a horizontal position, that the
natural curve of the upper part of the canal
may be lessened, and the passage of the
instrument thus facilitated. It is of
consequence also to keep the point of the
bougie pushed back towards the vertebræ
(the patient being desired to make an effort
to swallow), and to grasp the larynx with the
left hand and pull it gently forwards, that
there may be no risk of the instrument passing into the windpipe,
instead of into the gullet; if such a mistake should happen, the
surgeon will soon be apprised of it by the violent and convulsive
coughing which is generally induced, though not always. Bougies
armed with caustic have been recommended, but are unnecessary,
the simple bougie being sufficient to remove the disease, if skilfully
employed; besides, their use is not unattended with danger,
ulceration being frequently produced. In very bad cases, in which
the stricture is long in yielding to the means already mentioned, and
the nutriment which the patient is able to swallow is necessarily
small,—when the canal is altogether obliterated either at one point
or to a considerable extent, as has sometimes happened, and when
there is consequently little hope of success from any treatment—the
strength of the patient may be supported, and life prolonged for
some time by the use of nutritive enemata.
Dysphagia may also be caused by tumours in the œsophagus; but as
these are generally of a medullary structure, and consequently
endowed with malignant action, the treatment can only be palliative
—there is no hope of a radical cure.
Dysphagia may arise from an aneurismal tumour of the arch of the
aorta, or of the large arterial trunks passing off from it, pressing on
the œsophagus, and so narrowing its calibre. In such cases, also, no
hope of success from any treatment can be entertained; often the
case terminates fatally in a very sudden manner, in consequence of
the aneurismal tumour giving way at the point which protrudes on
the gullet; the contents are discharged into the stomach, or ejected
by the mouth. If treatment by bougies be attempted in dysphagia
arising from such a cause, the practitioner not being aware of the
nature of the disease, the fatal issue will be fearfully hastened—a
very unpleasant consequence of any practice.
Foreign bodies lodged in the œsophagus produce difficult
deglutition, and, if large, may obstruct the passage completely;
much irritation is also caused to the parts with which they are in
contact, and inflammatory action kindled in them. A large substance
firmly impacted likewise creates difficulty of breathing, by
compressing the posterior part of the trachea. Indeed every
consequence is of such an annoying nature, as to render
dislodgement and removal of the offending substance necessary,
though there were no apprehension of danger from its long-
continued presence. The proceedings must be varied according to
the consistence, form, size, and situation of the foreign body. There
are a great many instruments for effecting dislodgement and
extraction, but the great majority of them are more curious and
ingenious than applicable to the purpose intended; few are of any
use. A probang, mounted with a bit of sponge, or with an ivory-ball
—a blunt flat hook attached to a whalebone probe—and long curved
forceps, constitute the whole useful apparatus. The feelings of the
patient are generally sufficient to mark the position which the body
occupies; he is made to throw the parts into action, by attempts to
swallow the saliva, and during the attempt to point to the seat of
pain. But by this both patient and surgeon may be deceived, for pain
and a feeling of foreign matter being lodged often remain at a fixed
point, after the body has passed down; similar deception occurs in
other situations, as in regard to extraneous substances in the eye,
urethra, &c.
Small and sharp substances seldom remain long in the œsophagus,
but readily descend into the stomach and intestines; they then either
escape along with the feces, or, as sometimes happens, penetrate
the parietes of the alimentary canal, generally near its termination.
On leaving the stomach or the intestines, by gradual perforation,
they frequently travel great distances in the trunk or limbs, without
causing much inconvenience,—effusion of lymph surrounding them,
and filling up their track. They will appear, long after their insertion,
at a far distant point, approach the surface, and gradually make their
way through the integument, or be readily extracted. When they
enter from the surface, also, they often come within reach long
afterwards, and far from their point of entrance. Needles, thus
travelling, become oxidised. They are easily removed, on coming
near the surface, by fixing them with the fingers, and making a small
incision over the more superficial extremity. A needle may
sometimes be taken out, by making pressure on both ends, and so
forcing the point through the integument.
Small pointed bodies, needles, pins, fish-bones, &c., often get
entangled in the root of the tongue or in the folds of the palate; on
opening the mouth they can be seen, and are easily brought away.
If lodged in the pharynx, they can be reached by the finger. The
patient is seated with the head thrown back, and the jaws extended;
the finger is introduced with determination, regardless of attempts
to vomit, and swiftly passed into all the sinuosities by the side of the
epiglottis, into the pouches betwixt the os hyoides and cornua of the
thyroid cartilage, so that no part is left unsearched. The substance,
when felt, may be extracted with the finger by entangling it in the
point of the nail; or curved forceps may be introduced, and applied
conveniently to the body by the guidance of the finger. Great care
and caution is required in dislodging the foreign body, when both
ends, as is often the case, have penetrated the parietes; if it be
rudely grasped and pulled, the parts are lacerated; or it breaks, and
the surgeon, after bringing out the portion held in the forceps, may
find great difficulty in detecting and disentangling the other. I have
often found it very troublesome to remove delicate needles entire.
When they are beyond the reach of the finger, it is of no use to
attempt their removal; the patient suffers great pain during the
endeavour, and there is no chance of successful issue; besides, the
surgeon is apt to bring discredit on himself.
Coins may be removed by the forceps, or by the hook, if lodged at
the narrow part of the passage behind the cricoid cartilage; if lower,
they generally defy attempts at extraction, and slip into the stomach
gradually. Halfpennies, halfcrowns, &c., pass readily along the
alimentary canal, and are voided in a short time.
Tendinous or cartilaginous portions of hard meat, when within reach
of the finger, can be laid hold of by the curved forceps, and pulled
up. Smaller and soft portions, if impeded in the passage, as when it
has been narrowed by previous disease, are dislodged and pushed
down by the cautious use of a small probang or œsophagus bougie.
In the introduction of any instrument, attention should always be
paid to the steps advised when treating of stricture of the gullet.
Œsophagotomy is an operation that may, under some peculiar
circumstances, be required. When a foreign body is of such a nature
that, when once lodged in the gullet, it cannot be removed either
upwards or downwards, without serious læsion of the parts, and,
when breathing is impeded by its projection, incision of the
œsophagus may be warrantable. The operation is easily
accomplished. An incision of about three inches is made in the
superior triangular space of the neck, on the left side,—the gullet
usually inclining to the left of the mesial line. It is commenced
opposite to the os hyoides, and carried downwards parallel with the
trachea; the use of the knife is continued till by cautious dissection
the wound is brought to the level of the common sheath of the large
vessels. Assistants separate the edges by thin and broad copper
spatulæ, and the cavity is frequently sponged. The larynx is pulled
aside, and turned a little over on its axis; the pharynx is thus
exposed. During the latter part of the dissection, the laryngeal
nerves and thyroid arteries must be looked for and avoided. The
foreign body is felt through the parietes, and these are laid open to
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
ebookmasss.com